ITK  4.9.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 >
50  public ImageToImageFilter< TInputImage, TInputImage >
51 {
52 public:
58 
60  itkNewMacro(Self);
61 
62  typedef TInputImage InputImageType;
63  typedef TInputImage OutputImageType;
64 
66  typedef typename OutputImageType::RegionType OutputImageRegionType;
67  typedef typename InputImageType::RegionType InputImageRegionType;
68 
70  typedef typename InputImageType::Pointer InputImagePointer;
71  typedef typename InputImageType::ConstPointer InputImageConstPointer;
72 
74  typedef typename OutputImageType::PixelType OutputImagePixelType;
75  typedef typename InputImageType::PixelType InputImagePixelType;
76 
78  typedef typename OutputImageType::IndexType OutputImageIndexType;
79  typedef typename OutputImageType::SizeType OutputImageSizeType;
80  typedef typename OutputImageType::OffsetType OutputImageOffsetType;
81  typedef typename OutputImageType::DirectionType OutputImageDirectionType;
83  typedef typename InputImageType::IndexType InputImageIndexType;
84  typedef typename InputImageType::SizeType InputImageSizeType;
85  typedef typename InputImageType::OffsetType InputImageOffsetType;
86  typedef typename InputImageType::DirectionType InputImageDirectionType;
87 
89  itkStaticConstMacro(ImageDimension, unsigned int,
90  InputImageType::ImageDimension);
91 
93  typedef typename InputImageType::SpacingType SpacingType;
94  typedef typename InputImageType::PointType PointType;
95  typedef typename InputImageType::DirectionType DirectionType;
96 
99 
103  {
104  if ( image != m_ReferenceImage )
105  {
106  m_ReferenceImage = image;
107  this->ProcessObject::SetNthInput(1, const_cast< InputImageType *>( image ) );
108  this->Modified();
109  }
110  }
112 
113  itkGetModifiableObjectMacro(ReferenceImage, TInputImage);
114 
115  itkSetMacro(UseReferenceImage, bool);
116  itkBooleanMacro(UseReferenceImage);
117  itkGetConstMacro(UseReferenceImage, bool);
118 
122  itkSetMacro(OutputSpacing, SpacingType);
123  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
125 
129  itkSetMacro(OutputOrigin, PointType);
130  itkGetConstReferenceMacro(OutputOrigin, PointType);
132 
136  itkSetMacro(OutputDirection, DirectionType);
137  itkGetConstReferenceMacro(OutputDirection, DirectionType);
139 
148  itkSetMacro(OutputOffset, OutputImageOffsetType);
149  itkGetConstReferenceMacro(OutputOffset, OutputImageOffsetType);
150  itkSetVectorMacro(OutputOffset, OutputImageOffsetValueType, ImageDimension);
152 
154  void ChangeAll()
155  {
156  this->ChangeSpacingOn();
157  this->ChangeOriginOn();
158  this->ChangeDirectionOn();
159  this->ChangeRegionOn();
160  }
162 
165  void ChangeNone()
166  {
167  this->ChangeSpacingOff();
168  this->ChangeOriginOff();
169  this->ChangeDirectionOff();
170  this->ChangeRegionOff();
171  }
173 
180  itkSetMacro(ChangeSpacing, bool);
181  itkBooleanMacro(ChangeSpacing);
182  itkGetConstMacro(ChangeSpacing, bool);
183 
190  itkSetMacro(ChangeOrigin, bool);
191  itkBooleanMacro(ChangeOrigin);
192  itkGetConstMacro(ChangeOrigin, bool);
193 
200  itkSetMacro(ChangeDirection, bool);
201  itkBooleanMacro(ChangeDirection);
202  itkGetConstMacro(ChangeDirection, bool);
203 
206  itkSetMacro(ChangeRegion, bool);
207  itkBooleanMacro(ChangeRegion);
208  itkGetConstMacro(ChangeRegion, bool);
209 
213  itkSetMacro(CenterImage, bool);
214  itkBooleanMacro(CenterImage);
215  itkGetConstMacro(CenterImage, bool);
217 
219  virtual void GenerateOutputInformation() ITK_OVERRIDE;
220 
222  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
223 
225  void GenerateData() ITK_OVERRIDE;
226 
227 protected:
229  //~ChangeInformationImageFilter() {} default implementation ok
230 
231  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
232 
238  virtual void VerifyInputInformation() ITK_OVERRIDE {}
239 
240 private:
241  ChangeInformationImageFilter(const Self &) ITK_DELETE_FUNCTION;
242  void operator=(const Self &) ITK_DELETE_FUNCTION;
243 
245 
252 
256 
259 };
260 } // end namespace itk
261 
262 #ifndef ITK_MANUAL_INSTANTIATION
263 #include "itkChangeInformationImageFilter.hxx"
264 #endif
265 
266 #endif
Light weight base class for most itk classes.
signed long OffsetValueType
Definition: itkIntTypes.h:154
ImageToImageFilter< TInputImage, TInputImage > Superclass
virtual void GenerateOutputInformation() override
InputImageType::ConstPointer InputImageConstPointer
OutputImageType::DirectionType OutputImageDirectionType
virtual void Modified() const
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)
OutputImageType::OffsetValueType OutputImageOffsetValueType
virtual void GenerateInputRequestedRegion() override
InputImageType::DirectionType InputImageDirectionType
void PrintSelf(std::ostream &os, Indent indent) const override