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 "itkFixedArray.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::Pointer 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 itkSetObjectMacro( Transform, TransformType );
00125
00127 itkGetObjectMacro( Transform, TransformType );
00128
00135 itkSetObjectMacro( Interpolator, InterpolatorType );
00136
00138 itkGetObjectMacro( 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
00193 unsigned long GetMTime( void ) const;
00194
00195 protected:
00196 ResampleImageFilter();
00197 ~ResampleImageFilter() {};
00198 void PrintSelf(std::ostream& os, Indent indent) const;
00199
00208 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00209 int threadId );
00210
00211 private:
00212 ResampleImageFilter(const Self&);
00213 void operator=(const Self&);
00214
00215 SizeType m_Size;
00216 TransformPointerType m_Transform;
00217 InterpolatorPointerType m_Interpolator;
00218
00219 PixelType m_DefaultPixelValue;
00220
00221
00222 SpacingType m_OutputSpacing;
00223 PointType m_OutputOrigin;
00224 IndexType m_OutputStartIndex;
00225
00226 };
00227
00228
00229 }
00230
00231 #ifndef ITK_MANUAL_INSTANTIATION
00232 #include "itkResampleImageFilter.txx"
00233 #endif
00234
00235 #endif