ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkChangeInformationImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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:
50  public ImageToImageFilter< TInputImage, TInputImage >
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_ASSIGN(ChangeInformationImageFilter);
54 
60 
62  itkNewMacro(Self);
63 
64  using InputImageType = TInputImage;
65  using OutputImageType = TInputImage;
66 
70 
72  using InputImagePointer = typename InputImageType::Pointer;
73  using InputImageConstPointer = typename InputImageType::ConstPointer;
74 
76  using OutputImagePixelType = typename OutputImageType::PixelType;
77  using InputImagePixelType = typename InputImageType::PixelType;
78 
82  using OutputImageOffsetType = typename OutputImageType::OffsetType;
87  using InputImageOffsetType = typename InputImageType::OffsetType;
89 
91  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
92 
94  using SpacingType = typename InputImageType::SpacingType;
97 
100 
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 ChangeAll()
156  {
157  this->ChangeSpacingOn();
158  this->ChangeOriginOn();
159  this->ChangeDirectionOn();
160  this->ChangeRegionOn();
161  }
163 
166  void ChangeNone()
167  {
168  this->ChangeSpacingOff();
169  this->ChangeOriginOff();
170  this->ChangeDirectionOff();
171  this->ChangeRegionOff();
172  }
174 
181  itkSetMacro(ChangeSpacing, bool);
182  itkBooleanMacro(ChangeSpacing);
183  itkGetConstMacro(ChangeSpacing, bool);
184 
191  itkSetMacro(ChangeOrigin, bool);
192  itkBooleanMacro(ChangeOrigin);
193  itkGetConstMacro(ChangeOrigin, bool);
194 
201  itkSetMacro(ChangeDirection, bool);
202  itkBooleanMacro(ChangeDirection);
203  itkGetConstMacro(ChangeDirection, bool);
204 
207  itkSetMacro(ChangeRegion, bool);
208  itkBooleanMacro(ChangeRegion);
209  itkGetConstMacro(ChangeRegion, bool);
210 
214  itkSetMacro(CenterImage, bool);
215  itkBooleanMacro(CenterImage);
216  itkGetConstMacro(CenterImage, bool);
218 
220  void GenerateOutputInformation() override;
221 
223  void GenerateInputRequestedRegion() override;
224 
226  void GenerateData() override;
227 
228 protected:
230  ~ChangeInformationImageFilter() override = default;
231 
232  void PrintSelf(std::ostream & os, Indent indent) const override;
233 
239  void VerifyInputInformation() ITKv5_CONST override {}
240 
241 private:
243 
250 
254 
257 };
258 } // end namespace itk
259 
260 #ifndef ITK_MANUAL_INSTANTIATION
261 #include "itkChangeInformationImageFilter.hxx"
262 #endif
263 
264 #endif
typename InputImageType::IndexType InputImageIndexType
typename InputImageType::PixelType InputImagePixelType
Light weight base class for most itk classes.
typename InputImageType::SpacingType SpacingType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::OffsetValueType OutputImageOffsetValueType
typename InputImageType::ConstPointer InputImageConstPointer
typename OutputImageType::DirectionType OutputImageDirectionType
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::PointType PointType
typename OutputImageType::IndexType OutputImageIndexType
typename InputImageType::OffsetType InputImageOffsetType
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::DirectionType InputImageDirectionType
typename OutputImageType::SizeType OutputImageSizeType
typename OutputImageType::OffsetType OutputImageOffsetType
Base class for filters that take an image as input and produce an image as output.
Change the origin, spacing and/or region of an Image.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
typename InputImageType::DirectionType DirectionType
signed long OffsetValueType
Definition: itkIntTypes.h:94
typename InputImageType::RegionType InputImageRegionType
typename InputImageType::SizeType InputImageSizeType