ITK  5.2.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  * http://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 
27 namespace itk
28 {
29 
52 template <typename TInputImage>
53 class ImageSink
54  : public StreamingProcessObject
55  , private ImageToImageFilterCommon
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(ImageSink);
59 
61  using Self = ImageSink;
65 
67  itkTypeMacro(ImageSink, StreamingProcessObject);
68 
71 
73  using InputImageType = TInputImage;
74  using InputImagePointer = typename InputImageType::Pointer;
76  using InputImagePixelType = typename InputImageType::PixelType;
77 
81 
83 
85  itkStaticConstMacro(InputImageDimension, unsigned int, 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 *
100  GetInput(const DataObjectIdentifierType & key) const;
101 
102  void
103  Update() override;
104 
105  void
106  UpdateLargestPossibleRegion() override;
107 
113  itkSetMacro(CoordinateTolerance, double);
114  itkGetConstMacro(CoordinateTolerance, double);
116 
122  itkSetMacro(DirectionTolerance, double);
123  itkGetConstMacro(DirectionTolerance, double);
125 
134 
135 
144 
145 protected:
146  ImageSink();
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() ITKv5_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);
191 
192 
193 private:
194  unsigned int m_NumberOfStreamDivisions{ 1 };
197 
204 };
206 
207 } // namespace itk
208 
209 #include "itkImageSink.hxx"
210 
211 #endif // itkImageSink_h
itk::ImageSink::ImageSink
ImageSink()
itk::ImageSink< TImage >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageSink.h:76
itk::StreamingProcessObject::StreamingProcessObject
StreamingProcessObject()
itk::ImageSink::GenerateNthInputRequestedRegion
void GenerateNthInputRequestedRegion(unsigned int inputRequestedRegionNumber) override
itk::ImageSink::ThreadedStreamedGenerateData
virtual void ThreadedStreamedGenerateData(const InputImageRegionType &inputRegionForChunk)=0
itk::ImageSink::StreamedGenerateData
void StreamedGenerateData(unsigned int inputRequestedRegionNumber) override
itk::ImageSink::m_DirectionTolerance
double m_DirectionTolerance
Definition: itkImageSink.h:203
itk::ImageToImageFilterCommon::GetGlobalDefaultCoordinateTolerance
static double GetGlobalDefaultCoordinateTolerance()
itk::ProcessObject::DataObjectIdentifierType
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Definition: itkProcessObject.h:161
itk::ImageSink::GetInput
virtual const InputImageType * GetInput() const
itk::ImageToImageFilterCommon::SetGlobalDefaultDirectionTolerance
static void SetGlobalDefaultDirectionTolerance(double)
itk::StreamingProcessObject
Base class interface to process data on multiple requested input chunks.
Definition: itkStreamingProcessObject.h:40
itk::ImageSink< TImage >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageSink.h:74
itk::ImageSink::~ImageSink
~ImageSink() override=default
itkImage.h
itk::ImageSink::BeforeStreamedGenerateData
void BeforeStreamedGenerateData() override
Definition: itkImageSink.h:166
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkImageToImageFilterCommon.h
itk::ImageSink< TImage >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageSink.h:75
itk::ProcessObject::SetInput
virtual void SetInput(const DataObjectIdentifierType &key, DataObject *input)
Protected method for setting indexed and named inputs.
itk::ImageSink::VerifyInputInformation
void VerifyInputInformation() ITKv5_CONST override
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageRegionSplitterBase
Divide an image region into several pieces.
Definition: itkImageRegionSplitterBase.h:58
itkStreamingProcessObject.h
itk::ImageSink::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkImageRegionSplitterBase.h
itk::ImageSink::AllocateOutputs
virtual void AllocateOutputs()
Definition: itkImageSink.h:159
itk::ImageSink::SplitterType
ImageRegionSplitterBase SplitterType
Definition: itkImageSink.h:79
itkImageRegionSplitterSlowDimension.h
itk::ImageSink::GetNumberOfInputRequestedRegions
unsigned int GetNumberOfInputRequestedRegions() override
itk::ImageToImageFilterCommon
Secondary base class of ImageToImageFilter common between templates.
Definition: itkImageToImageFilterCommon.h:38
itk::ImageSink::InputImageDimension
static constexpr unsigned int InputImageDimension
Definition: itkImageSink.h:85
itk::ImageToImageFilterCommon::SetGlobalDefaultCoordinateTolerance
static void SetGlobalDefaultCoordinateTolerance(double)
itk::ImageToImageFilterCommon::GetGlobalDefaultDirectionTolerance
static double GetGlobalDefaultDirectionTolerance()
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageSink::m_NumberOfStreamDivisions
unsigned int m_NumberOfStreamDivisions
Definition: itkImageSink.h:194
itk::ImageSink< TImage >::RegionSplitterPointer
typename SplitterType::Pointer RegionSplitterPointer
Definition: itkImageSink.h:80
itk::ImageSink::UpdateLargestPossibleRegion
void UpdateLargestPossibleRegion() override
Sets the output requested region to the largest possible region and updates.
itk::ImageRegionSplitterBase::Pointer
SmartPointer< Self > Pointer
Definition: itkImageRegionSplitterBase.h:66
itk::ImageSink::SetInput
virtual void SetInput(const InputImageType *input)
itk::ImageSink::m_CurrentInputRegion
InputImageRegionType m_CurrentInputRegion
Definition: itkImageSink.h:196
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301
itk::ImageSink
Definition: itkImageSink.h:53
itk::ImageSink< TImage >::InputImageType
TImage InputImageType
Definition: itkImageSink.h:73
itk::ImageSink::m_CoordinateTolerance
double m_CoordinateTolerance
Definition: itkImageSink.h:202
itk::ImageSink::Update
void Update() override
Bring this filter up-to-date.
itk::ImageSink::m_RegionSplitter
RegionSplitterPointer m_RegionSplitter
Definition: itkImageSink.h:195