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
00046 template <class TInputImage>
00047 class ITK_EXPORT ChangeInformationImageFilter:
00048 public ImageToImageFilter<TInputImage,TInputImage>
00049 {
00050 public:
00052 typedef ChangeInformationImageFilter Self;
00053 typedef ImageToImageFilter<TInputImage,TInputImage> Superclass;
00054 typedef SmartPointer<Self> Pointer;
00055 typedef SmartPointer<const Self> ConstPointer;
00056
00058 itkNewMacro(Self);
00059
00061 typedef typename TInputImage::RegionType OutputImageRegionType;
00062 typedef typename TInputImage::RegionType InputImageRegionType;
00063
00065 typedef typename TInputImage::Pointer InputImagePointer;
00066
00068 typedef typename TInputImage::PixelType OutputImagePixelType;
00069 typedef typename TInputImage::PixelType InputImagePixelType;
00070
00072 typedef typename TInputImage::IndexType OutputImageIndexType;
00073 typedef typename TInputImage::IndexType InputImageIndexType;
00074 typedef typename TInputImage::SizeType OutputImageSizeType;
00075 typedef typename TInputImage::SizeType InputImageSizeType;
00076 typedef typename TInputImage::OffsetType OutputImageOffsetType;
00077 typedef typename TInputImage::OffsetType InputImageOffsetType;
00078
00080 itkStaticConstMacro(ImageDimension, unsigned int,
00081 TInputImage::ImageDimension);
00082
00084 typedef FixedArray<double, itkGetStaticConstMacro(ImageDimension)> ArrayType;
00085
00087 itkTypeMacro(ChangeInformationImageFilter, ImageToImageFilter);
00088
00091 void SetReferenceImage (TInputImage *image)
00092 {
00093 if (image != m_ReferenceImage)
00094 {
00095 m_ReferenceImage = image;
00096 this->ProcessObject::SetNthInput(1, image);
00097 this->Modified();
00098 }
00099 }
00100 itkGetObjectMacro(ReferenceImage, TInputImage);
00101
00102 itkSetMacro(UseReferenceImage, bool);
00103 itkBooleanMacro(UseReferenceImage);
00104 itkGetMacro(UseReferenceImage, bool);
00105
00109 itkSetMacro(OutputSpacing, ArrayType);
00110 itkGetMacro(OutputSpacing, const ArrayType);
00111
00115 itkSetMacro(OutputOrigin, ArrayType);
00116 itkGetMacro(OutputOrigin, const ArrayType);
00117
00126 itkSetVectorMacro(OutputOffset, long, ImageDimension);
00127 itkGetVectorMacro(OutputOffset, const long, ImageDimension);
00128
00130 void ChangeAll()
00131 {
00132 this->ChangeSpacingOn();
00133 this->ChangeOriginOn();
00134 this->ChangeRegionOn();
00135 }
00136
00139 void ChangeNone()
00140 {
00141 this->ChangeSpacingOff();
00142 this->ChangeOriginOff();
00143 this->ChangeRegionOff();
00144 }
00145
00152 itkSetMacro(ChangeSpacing, bool);
00153 itkBooleanMacro(ChangeSpacing);
00154 itkGetMacro(ChangeSpacing, bool);
00155
00162 itkSetMacro(ChangeOrigin, bool);
00163 itkBooleanMacro(ChangeOrigin);
00164 itkGetMacro(ChangeOrigin, bool);
00165
00168 itkSetMacro(ChangeRegion, bool);
00169 itkBooleanMacro(ChangeRegion);
00170 itkGetMacro(ChangeRegion, bool);
00171
00175 itkSetMacro(CenterImage, bool);
00176 itkBooleanMacro(CenterImage);
00177 itkGetMacro(CenterImage, bool);
00178
00180 virtual void GenerateOutputInformation();
00181
00183 virtual void GenerateInputRequestedRegion();
00184
00186 void GenerateData();
00187
00188 protected:
00189 ChangeInformationImageFilter();
00190 ~ChangeInformationImageFilter() {};
00191 void PrintSelf(std::ostream& os, Indent indent) const;
00192
00193 private:
00194 ChangeInformationImageFilter(const Self&);
00195 void operator=(const Self&);
00196
00197 InputImagePointer m_ReferenceImage;
00198
00199 bool m_CenterImage;
00200 bool m_ChangeSpacing;
00201 bool m_ChangeOrigin;
00202 bool m_ChangeRegion;
00203 bool m_UseReferenceImage;
00204
00205 ArrayType m_OutputSpacing;
00206 ArrayType m_OutputOrigin;
00207
00208 long m_OutputOffset[ImageDimension];
00209 OutputImageOffsetType m_Shift;
00210 };
00211
00212
00213 }
00214
00215 #ifndef ITK_MANUAL_INSTANTIATION
00216 #include "itkChangeInformationImageFilter.txx"
00217 #endif
00218
00219 #endif