00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkWarpImageFilter_h
00018 #define __itkWarpImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkInterpolateImageFunction.h"
00022 #include "itkLinearInterpolateImageFunction.h"
00023 #include "itkPoint.h"
00024
00025 namespace itk
00026 {
00027
00078 template <
00079 class TInputImage,
00080 class TOutputImage,
00081 class TDeformationField
00082 >
00083 class ITK_EXPORT WarpImageFilter :
00084 public ImageToImageFilter<TInputImage, TOutputImage>
00085 {
00086 public:
00088 typedef WarpImageFilter Self;
00089 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00090 typedef SmartPointer<Self> Pointer;
00091 typedef SmartPointer<const Self> ConstPointer;
00092
00094 itkNewMacro(Self);
00095
00097 itkTypeMacro( WarpImageFilter, ImageToImageFilter );
00098
00100 typedef typename TOutputImage::RegionType OutputImageRegionType;
00101
00103 typedef typename Superclass::InputImageType InputImageType;
00104 typedef typename Superclass::InputImagePointer InputImagePointer;
00105 typedef typename Superclass::OutputImageType OutputImageType;
00106 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00107 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00108 typedef typename OutputImageType::IndexType IndexType;
00109 typedef typename OutputImageType::SizeType SizeType;
00110 typedef typename OutputImageType::PixelType PixelType;
00111
00113 itkStaticConstMacro(ImageDimension, unsigned int,
00114 TOutputImage::ImageDimension );
00115
00117 typedef TDeformationField DeformationFieldType;
00118 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00119 typedef typename DeformationFieldType::PixelType DisplacementType;
00120
00122 typedef double CoordRepType;
00123 typedef InterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00124 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00125 typedef LinearInterpolateImageFunction<InputImageType,CoordRepType>
00126 DefaultInterpolatorType;
00127
00129 typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00130
00132 void SetDeformationField( DeformationFieldType * field );
00133
00135 DeformationFieldType * GetDeformationField(void);
00136
00138 itkSetObjectMacro( Interpolator, InterpolatorType );
00139
00141 itkGetObjectMacro( Interpolator, InterpolatorType );
00142
00144 virtual void SetOutputSpacing( const double values[ImageDimension] );
00145
00147 const double * GetOutputSpacing()
00148 { return m_OutputSpacing; }
00149
00151 virtual void SetOutputOrigin( const double values[ImageDimension] );
00152
00154 const double * GetOutputOrigin()
00155 { return m_OutputSpacing; }
00156
00158 itkSetMacro( EdgePaddingValue, PixelType );
00159
00161 itkGetMacro( EdgePaddingValue, PixelType );
00162
00168 virtual void GenerateOutputInformation();
00169
00176 virtual void GenerateInputRequestedRegion();
00177
00180 virtual void BeforeThreadedGenerateData();
00181
00182 protected:
00183 WarpImageFilter();
00184 ~WarpImageFilter() {};
00185 void PrintSelf(std::ostream& os, Indent indent) const;
00186
00190 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00191 int threadId );
00192
00193 private:
00194 WarpImageFilter(const Self&);
00195 void operator=(const Self&);
00196
00197 PixelType m_EdgePaddingValue;
00198 double m_OutputSpacing[ImageDimension];
00199 double m_OutputOrigin[ImageDimension];
00200
00201 InterpolatorPointer m_Interpolator;
00202
00203 };
00204
00205 }
00206
00207 #ifndef ITK_MANUAL_INSTANTIATION
00208 #include "itkWarpImageFilter.txx"
00209 #endif
00210
00211 #endif