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 "itkFixedArray.h"
00021 #include "itkTransform.h"
00022 #include "itkImageFunction.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkImageToImageFilter.h"
00025 #include "itkInterpolateImageFunction.h"
00026 #include "itkSize.h"
00027
00028 namespace itk
00029 {
00030
00061 template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType=double>
00062 class ITK_EXPORT ResampleImageFilter:
00063 public ImageToImageFilter<TInputImage, TOutputImage>
00064 {
00065 public:
00067 typedef ResampleImageFilter Self;
00068 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00069 typedef SmartPointer<Self> Pointer;
00070 typedef SmartPointer<const Self> ConstPointer;
00071 typedef TInputImage InputImageType;
00072 typedef TOutputImage OutputImageType;
00073 typedef typename InputImageType::Pointer InputImagePointer;
00074 typedef typename OutputImageType::Pointer OutputImagePointer;
00075 typedef typename InputImageType::RegionType InputImageRegionType;
00076
00078 itkNewMacro(Self);
00079
00081 itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00082
00084 itkStaticConstMacro(ImageDimension, unsigned int,
00085 TOutputImage::ImageDimension);
00086
00092 typedef Transform<TInterpolatorPrecisionType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType;
00093 typedef typename TransformType::ConstPointer TransformPointerType;
00094
00096 typedef InterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> InterpolatorType;
00097 typedef typename InterpolatorType::Pointer InterpolatorPointerType;
00098
00100 typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00101
00103 typedef typename TOutputImage::IndexType IndexType;
00104
00106 typedef typename InterpolatorType::PointType PointType;
00107
00108
00110 typedef typename TOutputImage::PixelType PixelType;
00111
00113 typedef typename TOutputImage::RegionType OutputImageRegionType;
00114
00116 typedef typename TOutputImage::SpacingType SpacingType;
00117 typedef typename TOutputImage::PointType OriginPointType;
00118
00124 itkSetConstObjectMacro( Transform, TransformType );
00125
00127 itkGetConstObjectMacro( Transform, TransformType );
00128
00135 itkSetObjectMacro( Interpolator, InterpolatorType );
00136
00138 itkGetConstObjectMacro( Interpolator, InterpolatorType );
00139
00141 itkSetMacro( Size, SizeType );
00142
00144 itkGetConstReferenceMacro( Size, SizeType );
00145
00148 itkSetMacro(DefaultPixelValue,PixelType);
00149
00151 itkGetMacro(DefaultPixelValue,PixelType);
00152
00154 itkSetMacro(OutputSpacing, SpacingType);
00155 virtual void SetOutputSpacing( const double values[ImageDimension] );
00156
00158 itkGetConstReferenceMacro( OutputSpacing, SpacingType );
00159
00161 itkSetMacro(OutputOrigin, PointType);
00162 virtual void SetOutputOrigin( const double values[ImageDimension] );
00163
00165 itkGetConstReferenceMacro( OutputOrigin, PointType );
00166
00169 itkSetMacro( OutputStartIndex, IndexType );
00170
00172 itkGetConstReferenceMacro( OutputStartIndex, IndexType );
00173
00179 virtual void GenerateOutputInformation();
00180
00186 virtual void GenerateInputRequestedRegion();
00187
00190 virtual void BeforeThreadedGenerateData();
00191
00194 virtual void AfterThreadedGenerateData();
00195
00197 unsigned long GetMTime( void ) const;
00198
00199 protected:
00200 ResampleImageFilter();
00201 ~ResampleImageFilter() {};
00202 void PrintSelf(std::ostream& os, Indent indent) const;
00203
00212 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00213 int threadId );
00214
00215 private:
00216 ResampleImageFilter(const Self&);
00217 void operator=(const Self&);
00218
00219 SizeType m_Size;
00220 TransformPointerType m_Transform;
00221 InterpolatorPointerType m_Interpolator;
00222 PixelType m_DefaultPixelValue;
00223
00224 SpacingType m_OutputSpacing;
00225 PointType m_OutputOrigin;
00226 IndexType m_OutputStartIndex;
00227
00228 };
00229
00230
00231 }
00232
00233 #ifndef ITK_MANUAL_INSTANTIATION
00234 #include "itkResampleImageFilter.txx"
00235 #endif
00236
00237 #endif