00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkChangeInformationImageFilter_h
00018 #define __itkChangeInformationImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkFixedArray.h"
00022
00023 namespace itk
00024 {
00025
00047 template <class TInputImage>
00048 class ITK_EXPORT ChangeInformationImageFilter:
00049 public ImageToImageFilter<TInputImage,TInputImage>
00050 {
00051 public:
00053 typedef ChangeInformationImageFilter Self;
00054 typedef ImageToImageFilter<TInputImage,TInputImage> Superclass;
00055 typedef SmartPointer<Self> Pointer;
00056 typedef SmartPointer<const Self> ConstPointer;
00057
00059 itkNewMacro(Self);
00060
00062 typedef typename TInputImage::RegionType OutputImageRegionType;
00063 typedef typename TInputImage::RegionType InputImageRegionType;
00064
00066 typedef typename TInputImage::Pointer InputImagePointer;
00067
00069 typedef typename TInputImage::PixelType OutputImagePixelType;
00070 typedef typename TInputImage::PixelType InputImagePixelType;
00071
00073 typedef typename TInputImage::IndexType OutputImageIndexType;
00074 typedef typename TInputImage::IndexType InputImageIndexType;
00075 typedef typename TInputImage::SizeType OutputImageSizeType;
00076 typedef typename TInputImage::SizeType InputImageSizeType;
00077 typedef typename TInputImage::OffsetType OutputImageOffsetType;
00078 typedef typename TInputImage::OffsetType InputImageOffsetType;
00079 typedef typename TInputImage::DirectionType OutputImageDirectionType;
00080 typedef typename TInputImage::DirectionType InputImageDirectionType;
00081
00083 itkStaticConstMacro(ImageDimension, unsigned int,
00084 TInputImage::ImageDimension);
00085
00087 typedef typename TInputImage::SpacingType SpacingType;
00088 typedef typename TInputImage::PointType PointType;
00089 typedef typename TInputImage::DirectionType DirectionType;
00090
00092 itkTypeMacro(ChangeInformationImageFilter, ImageToImageFilter);
00093
00096 void SetReferenceImage (TInputImage *image)
00097 {
00098 if (image != m_ReferenceImage)
00099 {
00100 m_ReferenceImage = image;
00101 this->ProcessObject::SetNthInput(1, image);
00102 this->Modified();
00103 }
00104 }
00105 itkGetObjectMacro(ReferenceImage, TInputImage);
00107
00108 itkSetMacro(UseReferenceImage, bool);
00109 itkBooleanMacro(UseReferenceImage);
00110 itkGetMacro(UseReferenceImage, bool);
00111
00115 itkSetMacro(OutputSpacing, SpacingType);
00116 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00118
00122 itkSetMacro(OutputOrigin, PointType);
00123 itkGetConstReferenceMacro(OutputOrigin, PointType);
00125
00129 itkSetMacro(OutputDirection, DirectionType);
00130 itkGetConstReferenceMacro(OutputDirection, DirectionType);
00132
00141 itkSetVectorMacro(OutputOffset, long, ImageDimension);
00142 itkGetVectorMacro(OutputOffset, const long, ImageDimension);
00144
00146 void ChangeAll()
00147 {
00148 this->ChangeSpacingOn();
00149 this->ChangeOriginOn();
00150 this->ChangeDirectionOn();
00151 this->ChangeRegionOn();
00152 }
00154
00157 void ChangeNone()
00158 {
00159 this->ChangeSpacingOff();
00160 this->ChangeOriginOff();
00161 this->ChangeDirectionOff();
00162 this->ChangeRegionOff();
00163 }
00165
00172 itkSetMacro(ChangeSpacing, bool);
00173 itkBooleanMacro(ChangeSpacing);
00174 itkGetMacro(ChangeSpacing, bool);
00175
00182 itkSetMacro(ChangeOrigin, bool);
00183 itkBooleanMacro(ChangeOrigin);
00184 itkGetMacro(ChangeOrigin, bool);
00185
00192 itkSetMacro(ChangeDirection, bool);
00193 itkBooleanMacro(ChangeDirection);
00194 itkGetMacro(ChangeDirection, bool);
00195
00198 itkSetMacro(ChangeRegion, bool);
00199 itkBooleanMacro(ChangeRegion);
00200 itkGetMacro(ChangeRegion, bool);
00201
00205 itkSetMacro(CenterImage, bool);
00206 itkBooleanMacro(CenterImage);
00207 itkGetMacro(CenterImage, bool);
00209
00211 virtual void GenerateOutputInformation();
00212
00214 virtual void GenerateInputRequestedRegion();
00215
00217 void GenerateData();
00218
00219 protected:
00220 ChangeInformationImageFilter();
00221 ~ChangeInformationImageFilter() {};
00222 void PrintSelf(std::ostream& os, Indent indent) const;
00223
00224 private:
00225 ChangeInformationImageFilter(const Self&);
00226 void operator=(const Self&);
00227
00228 InputImagePointer m_ReferenceImage;
00229
00230 bool m_CenterImage;
00231 bool m_ChangeSpacing;
00232 bool m_ChangeOrigin;
00233 bool m_ChangeDirection;
00234 bool m_ChangeRegion;
00235 bool m_UseReferenceImage;
00236
00237 SpacingType m_OutputSpacing;
00238 PointType m_OutputOrigin;
00239 DirectionType m_OutputDirection;
00240
00241 long m_OutputOffset[ImageDimension];
00242 OutputImageOffsetType m_Shift;
00243 };
00244
00245
00246 }
00247
00248 #ifndef ITK_MANUAL_INSTANTIATION
00249 #include "itkChangeInformationImageFilter.txx"
00250 #endif
00251
00252 #endif
00253