ITK  6.0.0
Insight Toolkit
itkImageSink.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkImageSink_h
19#define itkImageSink_h
20
22#include "itkImage.h"
26
27namespace itk
28{
29
52template <typename TInputImage>
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(ImageSink);
59
61 using Self = ImageSink;
65
67 itkOverrideGetNameOfClassMacro(ImageSink);
68
71
73 using InputImageType = TInputImage;
76 using InputImagePixelType = typename InputImageType::PixelType;
77
81
83
85 static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
86
87
90 virtual void
91 SetInput(const InputImageType * input);
92
93 virtual const InputImageType *
94 GetInput() const;
95
96 virtual const InputImageType *
97 GetInput(unsigned int idx) const;
98
99 virtual const InputImageType *
101
102 void
103 Update() override;
104
105 void
107
113 itkSetMacro(CoordinateTolerance, double);
114 itkGetConstMacro(CoordinateTolerance, double);
122 itkSetMacro(DirectionTolerance, double);
123 itkGetConstMacro(DirectionTolerance, double);
134
135
144
145protected:
147 ~ImageSink() override = default;
148
149 void
150 PrintSelf(std::ostream & os, Indent indent) const override;
151
152 unsigned int
154
155 void
156 GenerateNthInputRequestedRegion(unsigned int inputRequestedRegionNumber) override;
157
158 virtual void
160 {}
161
162 void
163 VerifyInputInformation() const override;
164
165 void
167 {
168 this->AllocateOutputs();
169 }
170
171 void
172 StreamedGenerateData(unsigned int inputRequestedRegionNumber) override;
173
174 virtual void
175 ThreadedStreamedGenerateData(const InputImageRegionType & inputRegionForChunk) = 0;
176
177
180 itkSetMacro(NumberOfStreamDivisions, unsigned int);
181
184 itkGetConstMacro(NumberOfStreamDivisions, unsigned int);
185
188 itkSetObjectMacro(RegionSplitter, SplitterType);
189 itkGetModifiableObjectMacro(RegionSplitter, SplitterType);
193private:
194 unsigned int m_NumberOfStreamDivisions{ 1 };
197
204};
207} // namespace itk
208
209#include "itkImageSink.hxx"
210
211#endif // itkImageSink_h
SmartPointer< Self > Pointer
Divide an image region into several pieces.
virtual const InputImageType * GetInput() const
virtual void AllocateOutputs()
Definition: itkImageSink.h:159
static double GetGlobalDefaultCoordinateTolerance()
virtual const InputImageType * GetInput(unsigned int idx) const
virtual void SetInput(const InputImageType *input)
static double GetGlobalDefaultDirectionTolerance()
void Update() override
Bring this filter up-to-date.
typename InputImageType::Pointer InputImagePointer
Definition: itkImageSink.h:74
unsigned int m_NumberOfStreamDivisions
Definition: itkImageSink.h:194
virtual const InputImageType * GetInput(const DataObjectIdentifierType &key) const
void StreamedGenerateData(unsigned int inputRequestedRegionNumber) override
InputImageRegionType m_CurrentInputRegion
Definition: itkImageSink.h:196
void PrintSelf(std::ostream &os, Indent indent) const override
void VerifyInputInformation() const override
Verifies that the inputs meta-data is consistent and valid for continued execution of the pipeline,...
void UpdateLargestPossibleRegion() override
Sets the output requested region to the largest possible region and updates.
typename SplitterType::Pointer RegionSplitterPointer
Definition: itkImageSink.h:80
unsigned int GetNumberOfInputRequestedRegions() override
Return the actual number of regions to request upstream.
~ImageSink() override=default
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageSink.h:75
double m_DirectionTolerance
Definition: itkImageSink.h:203
void GenerateNthInputRequestedRegion(unsigned int inputRequestedRegionNumber) override
For each streamed region, propagate request to all inputs.
TInputImage InputImageType
Definition: itkImageSink.h:73
static constexpr unsigned int InputImageDimension
Definition: itkImageSink.h:85
void BeforeStreamedGenerateData() override
Definition: itkImageSink.h:166
RegionSplitterPointer m_RegionSplitter
Definition: itkImageSink.h:195
virtual void ThreadedStreamedGenerateData(const InputImageRegionType &inputRegionForChunk)=0
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageSink.h:76
double m_CoordinateTolerance
Definition: itkImageSink.h:202
Secondary base class of ImageToImageFilter common between templates.
static double GetGlobalDefaultCoordinateTolerance()
static double GetGlobalDefaultDirectionTolerance()
static void SetGlobalDefaultDirectionTolerance(double)
static void SetGlobalDefaultCoordinateTolerance(double)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
virtual void SetInput(const DataObjectIdentifierType &key, DataObject *input)
Protected method for setting indexed and named inputs.
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Base class interface to process data on multiple requested input chunks.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....