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 #include "itkFixedArray.h"
00025
00026 namespace itk
00027 {
00028
00081 template <
00082 class TInputImage,
00083 class TOutputImage,
00084 class TDeformationField
00085 >
00086 class ITK_EXPORT WarpImageFilter :
00087 public ImageToImageFilter<TInputImage, TOutputImage>
00088 {
00089 public:
00091 typedef WarpImageFilter Self;
00092 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00093 typedef SmartPointer<Self> Pointer;
00094 typedef SmartPointer<const Self> ConstPointer;
00095
00097 itkNewMacro(Self);
00098
00100 itkTypeMacro( WarpImageFilter, ImageToImageFilter );
00101
00103 typedef typename TOutputImage::RegionType OutputImageRegionType;
00104
00106 typedef typename Superclass::InputImageType InputImageType;
00107 typedef typename Superclass::InputImagePointer InputImagePointer;
00108 typedef typename Superclass::OutputImageType OutputImageType;
00109 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00110 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00111 typedef typename OutputImageType::IndexType IndexType;
00112 typedef typename OutputImageType::SizeType SizeType;
00113 typedef typename OutputImageType::PixelType PixelType;
00114 typedef typename OutputImageType::SpacingType SpacingType;
00115
00117 itkStaticConstMacro(ImageDimension, unsigned int,
00118 TOutputImage::ImageDimension );
00119 itkStaticConstMacro(InputImageDimension, unsigned int,
00120 TInputImage::ImageDimension );
00121 itkStaticConstMacro(DeformationFieldDimension, unsigned int,
00122 TDeformationField::ImageDimension );
00124
00126 typedef TDeformationField DeformationFieldType;
00127 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00128 typedef typename DeformationFieldType::PixelType DisplacementType;
00129
00131 typedef double CoordRepType;
00132 typedef InterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00133 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00134 typedef LinearInterpolateImageFunction<InputImageType,CoordRepType>
00135 DefaultInterpolatorType;
00136
00138 typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00139
00141 typedef typename TOutputImage::DirectionType DirectionType;
00142
00144 void SetDeformationField( const DeformationFieldType * field );
00145
00147 DeformationFieldType * GetDeformationField(void);
00148
00150 itkSetObjectMacro( Interpolator, InterpolatorType );
00151
00153 itkGetObjectMacro( Interpolator, InterpolatorType );
00154
00156 itkSetMacro(OutputSpacing, SpacingType);
00157 virtual void SetOutputSpacing( const double* values);
00159
00161 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00162
00164 itkSetMacro(OutputOrigin, PointType);
00165 virtual void SetOutputOrigin( const double* values);
00167
00169 itkGetConstReferenceMacro(OutputOrigin, PointType);
00170
00172 itkSetMacro(OutputDirection, DirectionType );
00173 itkGetConstReferenceMacro(OutputDirection, DirectionType );
00175
00177 itkSetMacro( EdgePaddingValue, PixelType );
00178
00180 itkGetMacro( EdgePaddingValue, PixelType );
00181
00187 virtual void GenerateOutputInformation();
00188
00195 virtual void GenerateInputRequestedRegion();
00196
00199 virtual void BeforeThreadedGenerateData();
00200
00203 virtual void AfterThreadedGenerateData();
00204
00205 #ifdef ITK_USE_CONCEPT_CHECKING
00206
00207 itkConceptMacro(SameDimensionCheck1,
00208 (Concept::SameDimension<ImageDimension, InputImageDimension>));
00209 itkConceptMacro(SameDimensionCheck2,
00210 (Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
00211 itkConceptMacro(InputHasNumericTraitsCheck,
00212 (Concept::HasNumericTraits<typename TInputImage::PixelType>));
00213 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
00214 (Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
00215
00217 #endif
00218
00219 protected:
00220 WarpImageFilter();
00221 ~WarpImageFilter() {};
00222 void PrintSelf(std::ostream& os, Indent indent) const;
00223
00227 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00228 int threadId );
00229
00230 private:
00231 WarpImageFilter(const Self&);
00232 void operator=(const Self&);
00233
00234 PixelType m_EdgePaddingValue;
00235 SpacingType m_OutputSpacing;
00236 PointType m_OutputOrigin;
00237 DirectionType m_OutputDirection;
00238
00239 InterpolatorPointer m_Interpolator;
00240
00241 };
00242
00243 }
00244
00245 #ifndef ITK_MANUAL_INSTANTIATION
00246 #include "itkWarpImageFilter.txx"
00247 #endif
00248
00249 #endif
00250