00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkResampleImageFilter_h
00018 #define __itkResampleImageFilter_h
00019
00020 #include "itkTransform.h"
00021 #include "itkImageFunction.h"
00022 #include "itkImageRegionIterator.h"
00023 #include "itkImageToImageFilter.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkSize.h"
00026
00027 namespace itk
00028 {
00029
00051 template <class TInputImage, class TOutputImage>
00052 class ITK_EXPORT ResampleImageFilter:
00053 public ImageToImageFilter<TInputImage, TOutputImage>
00054 {
00055 public:
00057 typedef ResampleImageFilter Self;
00058 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00059 typedef SmartPointer<Self> Pointer;
00060 typedef SmartPointer<const Self> ConstPointer;
00061 typedef TInputImage InputImageType;
00062 typedef TOutputImage OutputImageType;
00063 typedef typename InputImageType::Pointer InputImagePointer;
00064 typedef typename OutputImageType::Pointer OutputImagePointer;
00065 typedef typename InputImageType::RegionType InputImageRegionType;
00066
00068 itkNewMacro(Self);
00069
00071 itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00072
00074 itkStaticConstMacro(ImageDimension, unsigned int,
00075 TOutputImage::ImageDimension);
00076
00082 typedef Transform<double, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType;
00083 typedef typename TransformType::Pointer TransformPointerType;
00084
00086 typedef InterpolateImageFunction<InputImageType, double> InterpolatorType;
00087 typedef typename InterpolatorType::Pointer InterpolatorPointerType;
00088
00090 typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00091
00093 typedef typename TOutputImage::IndexType IndexType;
00094
00096 typedef typename InterpolatorType::PointType PointType;
00097
00099 typedef typename TOutputImage::PixelType PixelType;
00100
00102 typedef typename TOutputImage::RegionType OutputImageRegionType;
00103
00108 itkSetObjectMacro( Transform, TransformType );
00109
00111 itkGetObjectMacro( Transform, TransformType );
00112
00114 itkSetObjectMacro( Interpolator, InterpolatorType );
00115
00117 itkGetObjectMacro( Interpolator, InterpolatorType );
00118
00120 itkSetMacro( Size, SizeType );
00121
00123 itkGetConstReferenceMacro( Size, SizeType );
00124
00126 itkSetMacro(DefaultPixelValue,PixelType);
00127
00129 itkGetMacro(DefaultPixelValue,PixelType);
00130
00132 virtual void SetOutputSpacing( const double values[ImageDimension] );
00133
00135 const double * GetOutputSpacing()
00136 { return m_OutputSpacing; }
00137
00139 virtual void SetOutputOrigin( const double values[ImageDimension] );
00140
00142 const double * GetOutputOrigin()
00143 { return m_OutputSpacing; }
00144
00145
00151 virtual void GenerateOutputInformation();
00152
00158 virtual void GenerateInputRequestedRegion();
00159
00162 virtual void BeforeThreadedGenerateData();
00163
00165 unsigned long GetMTime( void ) const;
00166
00167 protected:
00168 ResampleImageFilter();
00169 ~ResampleImageFilter() {};
00170 void PrintSelf(std::ostream& os, Indent indent) const;
00171
00180 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00181 int threadId );
00182
00183 private:
00184 ResampleImageFilter(const Self&);
00185 void operator=(const Self&);
00186
00187 SizeType m_Size;
00188 TransformPointerType m_Transform;
00189 InterpolatorPointerType m_Interpolator;
00190
00191 PixelType m_DefaultPixelValue;
00192
00193
00194 double m_OutputSpacing[ImageDimension];
00195 double m_OutputOrigin[ImageDimension];
00196
00197 };
00198
00199
00200 }
00201
00202 #ifndef ITK_MANUAL_INSTANTIATION
00203 #include "itkResampleImageFilter.txx"
00204 #endif
00205
00206 #endif