ITK  6.0.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
24namespace itk
25{
53template <typename TInputImage>
54class ITK_TEMPLATE_EXPORT ImageDuplicator : public Object
55{
56public:
57 ITK_DISALLOW_COPY_AND_MOVE(ImageDuplicator);
58
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
117
118protected:
119 ImageDuplicator() = default;
120 ~ImageDuplicator() override = default;
121 void
122 PrintSelf(std::ostream & os, Indent indent) const override;
123
124private:
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 */
A helper class which creates an image which is perfect copy of the input image.
typename TInputImage::Pointer ImagePointer
virtual const ImageType * GetOutput() const
typename TInputImage::PixelType PixelType
ImageDuplicator()=default
virtual ImageType * GetOutput()
typename TInputImage::ConstPointer ImageConstPointer
typename TInputImage::IndexType IndexType
~ImageDuplicator() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for most ITK classes.
Definition: itkObject.h:62
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105