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 void SetTransform(TransformPointerType transform)
00109 { m_Transform = transform; }
00110
00112 itkGetObjectMacro( Transform, TransformType );
00113
00115 void SetInterpolator(InterpolatorPointerType interpolator)
00116 { m_Interpolator = interpolator; }
00117
00119 itkGetObjectMacro( Interpolator, InterpolatorType );
00120
00122 void SetSize(const SizeType &size)
00123 { m_Size = size; }
00124
00126 const SizeType& GetSize()
00127 { return m_Size; }
00128
00130 itkSetMacro(DefaultPixelValue,PixelType);
00131
00133 itkGetMacro(DefaultPixelValue,PixelType);
00134
00136 virtual void SetOutputSpacing( const double values[ImageDimension] );
00137
00139 const double * GetOutputSpacing()
00140 { return m_OutputSpacing; }
00141
00143 virtual void SetOutputOrigin( const double values[ImageDimension] );
00144
00146 const double * GetOutputOrigin()
00147 { return m_OutputSpacing; }
00148
00149
00155 virtual void GenerateOutputInformation();
00156
00162 virtual void GenerateInputRequestedRegion();
00163
00166 virtual void BeforeThreadedGenerateData();
00167
00168
00169 protected:
00170 ResampleImageFilter();
00171 ~ResampleImageFilter() {};
00172 void PrintSelf(std::ostream& os, Indent indent) const;
00173
00182 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00183 int threadId );
00184
00185 private:
00186 ResampleImageFilter(const Self&);
00187 void operator=(const Self&);
00188
00189 SizeType m_Size;
00190 TransformPointerType m_Transform;
00191 InterpolatorPointerType m_Interpolator;
00192
00193 PixelType m_DefaultPixelValue;
00194
00195
00196 double m_OutputSpacing[ImageDimension];
00197 double m_OutputOrigin[ImageDimension];
00198
00199 };
00200
00201
00202 }
00203
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkResampleImageFilter.txx"
00206 #endif
00207
00208 #endif