ITK  5.2.0
Insight Toolkit
itkChangeInformationImageFilter.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 itkChangeInformationImageFilter_h
19 #define itkChangeInformationImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkFixedArray.h"
23 
24 namespace itk
25 {
48 template <typename TInputImage>
49 class ITK_TEMPLATE_EXPORT ChangeInformationImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(ChangeInformationImageFilter);
53 
59 
61  itkNewMacro(Self);
62 
63  using InputImageType = TInputImage;
64  using OutputImageType = TInputImage;
65 
69 
71  using InputImagePointer = typename InputImageType::Pointer;
72  using InputImageConstPointer = typename InputImageType::ConstPointer;
73 
75  using OutputImagePixelType = typename OutputImageType::PixelType;
76  using InputImagePixelType = typename InputImageType::PixelType;
77 
81  using OutputImageOffsetType = typename OutputImageType::OffsetType;
86  using InputImageOffsetType = typename InputImageType::OffsetType;
88 
90  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
91 
93  using SpacingType = typename InputImageType::SpacingType;
96 
99 
102  void
104  {
105  if (image != m_ReferenceImage)
106  {
107  m_ReferenceImage = image;
108  this->ProcessObject::SetNthInput(1, const_cast<InputImageType *>(image));
109  this->Modified();
110  }
111  }
113 
114  itkGetModifiableObjectMacro(ReferenceImage, TInputImage);
115 
116  itkSetMacro(UseReferenceImage, bool);
117  itkBooleanMacro(UseReferenceImage);
118  itkGetConstMacro(UseReferenceImage, bool);
119 
123  itkSetMacro(OutputSpacing, SpacingType);
124  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
126 
130  itkSetMacro(OutputOrigin, PointType);
131  itkGetConstReferenceMacro(OutputOrigin, PointType);
133 
137  itkSetMacro(OutputDirection, DirectionType);
138  itkGetConstReferenceMacro(OutputDirection, DirectionType);
140 
149  itkSetMacro(OutputOffset, OutputImageOffsetType);
150  itkGetConstReferenceMacro(OutputOffset, OutputImageOffsetType);
151  itkSetVectorMacro(OutputOffset, OutputImageOffsetValueType, ImageDimension);
153 
155  void
157  {
158  this->ChangeSpacingOn();
159  this->ChangeOriginOn();
160  this->ChangeDirectionOn();
161  this->ChangeRegionOn();
162  }
164 
167  void
169  {
170  this->ChangeSpacingOff();
171  this->ChangeOriginOff();
172  this->ChangeDirectionOff();
173  this->ChangeRegionOff();
174  }
176 
183  itkSetMacro(ChangeSpacing, bool);
184  itkBooleanMacro(ChangeSpacing);
185  itkGetConstMacro(ChangeSpacing, bool);
186 
193  itkSetMacro(ChangeOrigin, bool);
194  itkBooleanMacro(ChangeOrigin);
195  itkGetConstMacro(ChangeOrigin, bool);
196 
203  itkSetMacro(ChangeDirection, bool);
204  itkBooleanMacro(ChangeDirection);
205  itkGetConstMacro(ChangeDirection, bool);
206 
209  itkSetMacro(ChangeRegion, bool);
210  itkBooleanMacro(ChangeRegion);
211  itkGetConstMacro(ChangeRegion, bool);
212 
216  itkSetMacro(CenterImage, bool);
217  itkBooleanMacro(CenterImage);
218  itkGetConstMacro(CenterImage, bool);
220 
222  void
223  GenerateOutputInformation() override;
224 
226  void
227  GenerateInputRequestedRegion() override;
228 
230  void
231  GenerateData() override;
232 
233 protected:
235  ~ChangeInformationImageFilter() override = default;
236 
237  void
238  PrintSelf(std::ostream & os, Indent indent) const override;
239 
245  void
246  VerifyInputInformation() ITKv5_CONST override
247  {}
248 
249 private:
251 
258 
262 
265 };
266 } // end namespace itk
267 
268 #ifndef ITK_MANUAL_INSTANTIATION
269 # include "itkChangeInformationImageFilter.hxx"
270 #endif
271 
272 #endif
itk::ChangeInformationImageFilter::OutputImageOffsetType
typename OutputImageType::OffsetType OutputImageOffsetType
Definition: itkChangeInformationImageFilter.h:81
itk::ChangeInformationImageFilter::m_ChangeRegion
bool m_ChangeRegion
Definition: itkChangeInformationImageFilter.h:256
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::ChangeInformationImageFilter::OutputImageSizeType
typename OutputImageType::SizeType OutputImageSizeType
Definition: itkChangeInformationImageFilter.h:80
itk::ChangeInformationImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkChangeInformationImageFilter.h:75
itk::ChangeInformationImageFilter::m_UseReferenceImage
bool m_UseReferenceImage
Definition: itkChangeInformationImageFilter.h:257
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::ChangeInformationImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkChangeInformationImageFilter.h:68
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ChangeInformationImageFilter::DirectionType
typename InputImageType::DirectionType DirectionType
Definition: itkChangeInformationImageFilter.h:95
itk::ChangeInformationImageFilter::ChangeAll
void ChangeAll()
Definition: itkChangeInformationImageFilter.h:156
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ChangeInformationImageFilter
Change the origin, spacing and/or region of an Image.
Definition: itkChangeInformationImageFilter.h:49
itk::ChangeInformationImageFilter::InputImageOffsetType
typename InputImageType::OffsetType InputImageOffsetType
Definition: itkChangeInformationImageFilter.h:86
itk::ChangeInformationImageFilter::m_CenterImage
bool m_CenterImage
Definition: itkChangeInformationImageFilter.h:252
itk::ChangeInformationImageFilter::m_OutputDirection
DirectionType m_OutputDirection
Definition: itkChangeInformationImageFilter.h:261
itk::ChangeInformationImageFilter::ChangeNone
void ChangeNone()
Definition: itkChangeInformationImageFilter.h:168
itk::ChangeInformationImageFilter::m_ReferenceImage
InputImagePointer m_ReferenceImage
Definition: itkChangeInformationImageFilter.h:250
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ChangeInformationImageFilter::m_ChangeSpacing
bool m_ChangeSpacing
Definition: itkChangeInformationImageFilter.h:253
itk::ChangeInformationImageFilter::InputImageIndexType
typename InputImageType::IndexType InputImageIndexType
Definition: itkChangeInformationImageFilter.h:84
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ChangeInformationImageFilter::OutputImageIndexType
typename OutputImageType::IndexType OutputImageIndexType
Definition: itkChangeInformationImageFilter.h:79
itkFixedArray.h
itk::ChangeInformationImageFilter::OutputImageType
TInputImage OutputImageType
Definition: itkChangeInformationImageFilter.h:64
itk::ChangeInformationImageFilter::m_OutputSpacing
SpacingType m_OutputSpacing
Definition: itkChangeInformationImageFilter.h:259
itk::ChangeInformationImageFilter::m_ChangeDirection
bool m_ChangeDirection
Definition: itkChangeInformationImageFilter.h:255
itk::ChangeInformationImageFilter::OutputImageOffsetValueType
typename OutputImageType::OffsetValueType OutputImageOffsetValueType
Definition: itkChangeInformationImageFilter.h:83
itk::ChangeInformationImageFilter::SpacingType
typename InputImageType::SpacingType SpacingType
Definition: itkChangeInformationImageFilter.h:93
itk::ChangeInformationImageFilter::InputImageSizeType
typename InputImageType::SizeType InputImageSizeType
Definition: itkChangeInformationImageFilter.h:85
itkImageToImageFilter.h
itk::ChangeInformationImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkChangeInformationImageFilter.h:76
itk::ChangeInformationImageFilter::VerifyInputInformation
void VerifyInputInformation() ITKv5_CONST override
Definition: itkChangeInformationImageFilter.h:246
itk::ChangeInformationImageFilter::PointType
typename InputImageType::PointType PointType
Definition: itkChangeInformationImageFilter.h:94
itk::ChangeInformationImageFilter::m_Shift
OutputImageOffsetType m_Shift
Definition: itkChangeInformationImageFilter.h:264
itk::ChangeInformationImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkChangeInformationImageFilter.h:71
itk::ChangeInformationImageFilter::m_OutputOrigin
PointType m_OutputOrigin
Definition: itkChangeInformationImageFilter.h:260
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject::SetNthInput
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
itk::OffsetValueType
signed long OffsetValueType
Definition: itkIntTypes.h:94
itk::ChangeInformationImageFilter::InputImageDirectionType
typename InputImageType::DirectionType InputImageDirectionType
Definition: itkChangeInformationImageFilter.h:87
itk::ChangeInformationImageFilter::InputImageType
TInputImage InputImageType
Definition: itkChangeInformationImageFilter.h:63
itk::ChangeInformationImageFilter::m_ChangeOrigin
bool m_ChangeOrigin
Definition: itkChangeInformationImageFilter.h:254
itk::ChangeInformationImageFilter::OutputImageDirectionType
typename OutputImageType::DirectionType OutputImageDirectionType
Definition: itkChangeInformationImageFilter.h:82
itk::ChangeInformationImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkChangeInformationImageFilter.h:67
itk::ChangeInformationImageFilter::m_OutputOffset
OutputImageOffsetType m_OutputOffset
Definition: itkChangeInformationImageFilter.h:263
itk::ChangeInformationImageFilter::SetReferenceImage
void SetReferenceImage(InputImageType *image)
Definition: itkChangeInformationImageFilter.h:103
itk::ChangeInformationImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkChangeInformationImageFilter.h:72