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);
00106
00107 itkSetMacro(UseReferenceImage, bool);
00108 itkBooleanMacro(UseReferenceImage);
00109 itkGetMacro(UseReferenceImage, bool);
00110
00114 itkSetMacro(OutputSpacing, SpacingType);
00115 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00116
00120 itkSetMacro(OutputOrigin, PointType);
00121 itkGetConstReferenceMacro(OutputOrigin, PointType);
00122
00126 itkSetMacro(OutputDirection, DirectionType);
00127 itkGetConstReferenceMacro(OutputDirection, DirectionType);
00128
00137 itkSetVectorMacro(OutputOffset, long, ImageDimension);
00138 itkGetVectorMacro(OutputOffset, const long, ImageDimension);
00139
00141 void ChangeAll()
00142 {
00143 this->ChangeSpacingOn();
00144 this->ChangeOriginOn();
00145 this->ChangeDirectionOn();
00146 this->ChangeRegionOn();
00147 }
00148
00151 void ChangeNone()
00152 {
00153 this->ChangeSpacingOff();
00154 this->ChangeOriginOff();
00155 this->ChangeDirectionOff();
00156 this->ChangeRegionOff();
00157 }
00158
00165 itkSetMacro(ChangeSpacing, bool);
00166 itkBooleanMacro(ChangeSpacing);
00167 itkGetMacro(ChangeSpacing, bool);
00168
00175 itkSetMacro(ChangeOrigin, bool);
00176 itkBooleanMacro(ChangeOrigin);
00177 itkGetMacro(ChangeOrigin, bool);
00178
00185 itkSetMacro(ChangeDirection, bool);
00186 itkBooleanMacro(ChangeDirection);
00187 itkGetMacro(ChangeDirection, bool);
00188
00191 itkSetMacro(ChangeRegion, bool);
00192 itkBooleanMacro(ChangeRegion);
00193 itkGetMacro(ChangeRegion, bool);
00194
00198 itkSetMacro(CenterImage, bool);
00199 itkBooleanMacro(CenterImage);
00200 itkGetMacro(CenterImage, bool);
00201
00203 virtual void GenerateOutputInformation();
00204
00206 virtual void GenerateInputRequestedRegion();
00207
00209 void GenerateData();
00210
00211 protected:
00212 ChangeInformationImageFilter();
00213 ~ChangeInformationImageFilter() {};
00214 void PrintSelf(std::ostream& os, Indent indent) const;
00215
00216 private:
00217 ChangeInformationImageFilter(const Self&);
00218 void operator=(const Self&);
00219
00220 InputImagePointer m_ReferenceImage;
00221
00222 bool m_CenterImage;
00223 bool m_ChangeSpacing;
00224 bool m_ChangeOrigin;
00225 bool m_ChangeDirection;
00226 bool m_ChangeRegion;
00227 bool m_UseReferenceImage;
00228
00229 SpacingType m_OutputSpacing;
00230 PointType m_OutputOrigin;
00231 DirectionType m_OutputDirection;
00232
00233 long m_OutputOffset[ImageDimension];
00234 OutputImageOffsetType m_Shift;
00235 };
00236
00237
00238 }
00239
00240 #ifndef ITK_MANUAL_INSTANTIATION
00241 #include "itkChangeInformationImageFilter.txx"
00242 #endif
00243
00244 #endif