ITK  5.4.0
Insight Toolkit
itkImageDuplicator.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 itkImageDuplicator_h
19 #define itkImageDuplicator_h
20 
21 #include "itkObject.h"
22 #include "itkImage.h"
23 
24 namespace itk
25 {
53 template <typename TInputImage>
54 class ITK_TEMPLATE_EXPORT ImageDuplicator : public Object
55 {
56 public:
57  ITK_DISALLOW_COPY_AND_MOVE(ImageDuplicator);
58 
61  using Superclass = Object;
64 
66  itkNewMacro(Self);
67 
69  itkOverrideGetNameOfClassMacro(ImageDuplicator);
70 
72  using ImageType = TInputImage;
75  using PixelType = typename TInputImage::PixelType;
77 
78  static constexpr unsigned int ImageDimension = ImageType::ImageDimension;
79 
80  itkSetConstObjectMacro(InputImage, ImageType);
81 
89  // NOTE: The m_DuplicateImage is only
90  // exposed via the Source generation interface
91  // by the GetOutput() method that mimics
92  // a process object.
93  virtual const ImageType *
94  GetOutput() const
95  {
96  return this->m_DuplicateImage.GetPointer();
97  }
98  virtual ImageType *
100  {
101  return this->m_DuplicateImage.GetPointer();
102  }
105 #if !defined(ITK_LEGACY_REMOVE)
106  // This interface was exposed in ITKv4 when the itkGetModifiableObjectMacro was used
107  virtual ImageType *
108  GetModifiableOutput()
109  {
110  return this->m_DuplicateImage.GetPointer();
111  }
112 #endif
113 
115  void
116  Update();
117 
118 protected:
119  ImageDuplicator() = default;
120  ~ImageDuplicator() override = default;
121  void
122  PrintSelf(std::ostream & os, Indent indent) const override;
123 
124 private:
125  ImageConstPointer m_InputImage{};
126  ImagePointer m_DuplicateImage{};
127  ModifiedTimeType m_InternalImageTime{};
128 };
129 } // end namespace itk
130 
131 #ifndef ITK_MANUAL_INSTANTIATION
132 # include "itkImageDuplicator.hxx"
133 #endif
134 
135 #endif /* itkImageDuplicator_h */
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ImageDuplicator::ImageConstPointer
typename TInputImage::ConstPointer ImageConstPointer
Definition: itkImageDuplicator.h:74
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:102
itk::ImageDuplicator::GetOutput
virtual ImageType * GetOutput()
Definition: itkImageDuplicator.h:99
itk::ImageDuplicator::ImagePointer
typename TInputImage::Pointer ImagePointer
Definition: itkImageDuplicator.h:73
itk::ImageDuplicator
A helper class which creates an image which is perfect copy of the input image.
Definition: itkImageDuplicator.h:54
itk::ImageDuplicator::GetOutput
virtual const ImageType * GetOutput() const
Definition: itkImageDuplicator.h:94
itkImage.h
itk::SmartPointer< Self >
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageDuplicator::IndexType
typename TInputImage::IndexType IndexType
Definition: itkImageDuplicator.h:76
itk::ImageDuplicator::ImageType
TInputImage ImageType
Definition: itkImageDuplicator.h:72
itkObject.h
itk::ImageDuplicator::PixelType
typename TInputImage::PixelType PixelType
Definition: itkImageDuplicator.h:75
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61