ITK  4.2.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< class 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 
102  void SetReferenceImage(InputImageType *image)
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  itkGetObjectMacro(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();
220 
222  virtual void GenerateInputRequestedRegion();
223 
225  void GenerateData();
226 
227 protected:
229  //~ChangeInformationImageFilter() {} default implementation ok
230 
231  void PrintSelf(std::ostream & os, Indent indent) const;
232 
238  virtual void VerifyInputInformation() {}
239 
240 private:
241  ChangeInformationImageFilter(const Self &); //purposely not implemented
242  void operator=(const Self &); //purposely not implemented
243 
245 
252 
256 
259 };
260 } // end namespace itk
261 
262 #ifndef ITK_MANUAL_INSTANTIATION
263 #include "itkChangeInformationImageFilter.hxx"
264 #endif
265 
266 #endif
267