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
00060 template <class TInputImage, class TOutputImage>
00061 class ITK_EXPORT ResampleImageFilter:
00062 public ImageToImageFilter<TInputImage, TOutputImage>
00063 {
00064 public:
00066 typedef ResampleImageFilter Self;
00067 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00068 typedef SmartPointer<Self> Pointer;
00069 typedef SmartPointer<const Self> ConstPointer;
00070 typedef TInputImage InputImageType;
00071 typedef TOutputImage OutputImageType;
00072 typedef typename InputImageType::Pointer InputImagePointer;
00073 typedef typename OutputImageType::Pointer OutputImagePointer;
00074 typedef typename InputImageType::RegionType InputImageRegionType;
00075
00077 itkNewMacro(Self);
00078
00080 itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00081
00083 itkStaticConstMacro(ImageDimension, unsigned int,
00084 TOutputImage::ImageDimension);
00085
00091 typedef Transform<double, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType;
00092 typedef typename TransformType::Pointer TransformPointerType;
00093
00095 typedef InterpolateImageFunction<InputImageType, double> InterpolatorType;
00096 typedef typename InterpolatorType::Pointer InterpolatorPointerType;
00097
00099 typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00100
00102 typedef typename TOutputImage::IndexType IndexType;
00103
00105 typedef typename InterpolatorType::PointType PointType;
00106
00108 typedef typename TOutputImage::PixelType PixelType;
00109
00111 typedef typename TOutputImage::RegionType OutputImageRegionType;
00112
00118 itkSetObjectMacro( Transform, TransformType );
00119
00121 itkGetObjectMacro( Transform, TransformType );
00122
00129 itkSetObjectMacro( Interpolator, InterpolatorType );
00130
00132 itkGetObjectMacro( Interpolator, InterpolatorType );
00133
00135 itkSetMacro( Size, SizeType );
00136
00138 itkGetConstReferenceMacro( Size, SizeType );
00139
00142 itkSetMacro(DefaultPixelValue,PixelType);
00143
00145 itkGetMacro(DefaultPixelValue,PixelType);
00146
00148 virtual void SetOutputSpacing( const double values[ImageDimension] );
00149
00151 const double * GetOutputSpacing()
00152 { return m_OutputSpacing; }
00153
00155 virtual void SetOutputOrigin( const double values[ImageDimension] );
00156
00158 const double * GetOutputOrigin()
00159 { return m_OutputSpacing; }
00160
00161
00167 virtual void GenerateOutputInformation();
00168
00174 virtual void GenerateInputRequestedRegion();
00175
00178 virtual void BeforeThreadedGenerateData();
00179
00181 unsigned long GetMTime( void ) const;
00182
00183 protected:
00184 ResampleImageFilter();
00185 ~ResampleImageFilter() {};
00186 void PrintSelf(std::ostream& os, Indent indent) const;
00187
00196 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00197 int threadId );
00198
00199 private:
00200 ResampleImageFilter(const Self&);
00201 void operator=(const Self&);
00202
00203 SizeType m_Size;
00204 TransformPointerType m_Transform;
00205 InterpolatorPointerType m_Interpolator;
00206
00207 PixelType m_DefaultPixelValue;
00208
00209
00210 double m_OutputSpacing[ImageDimension];
00211 double m_OutputOrigin[ImageDimension];
00212
00213 };
00214
00215
00216 }
00217
00218 #ifndef ITK_MANUAL_INSTANTIATION
00219 #include "itkResampleImageFilter.txx"
00220 #endif
00221
00222 #endif