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
00079 template <
00080 class TInputImage,
00081 class TOutputImage,
00082 class TDeformationField
00083 >
00084 class ITK_EXPORT WarpImageFilter :
00085 public ImageToImageFilter<TInputImage, TOutputImage>
00086 {
00087 public:
00089 typedef WarpImageFilter Self;
00090 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00091 typedef SmartPointer<Self> Pointer;
00092 typedef SmartPointer<const Self> ConstPointer;
00093
00095 itkNewMacro(Self);
00096
00098 itkTypeMacro( WarpImageFilter, ImageToImageFilter );
00099
00101 typedef typename TOutputImage::RegionType OutputImageRegionType;
00102
00104 typedef typename Superclass::InputImageType InputImageType;
00105 typedef typename Superclass::InputImagePointer InputImagePointer;
00106 typedef typename Superclass::OutputImageType OutputImageType;
00107 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00108 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00109 typedef typename OutputImageType::IndexType IndexType;
00110 typedef typename OutputImageType::SizeType SizeType;
00111 typedef typename OutputImageType::PixelType PixelType;
00112 typedef typename OutputImageType::SpacingType SpacingType;
00113
00115 itkStaticConstMacro(ImageDimension, unsigned int,
00116 TOutputImage::ImageDimension );
00117 itkStaticConstMacro(InputImageDimension, unsigned int,
00118 TInputImage::ImageDimension );
00119 itkStaticConstMacro(DeformationFieldDimension, unsigned int,
00120 TDeformationField::ImageDimension );
00122
00124 typedef TDeformationField DeformationFieldType;
00125 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00126 typedef typename DeformationFieldType::PixelType DisplacementType;
00127
00129 typedef double CoordRepType;
00130 typedef InterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00131 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00132 typedef LinearInterpolateImageFunction<InputImageType,CoordRepType>
00133 DefaultInterpolatorType;
00134
00136 typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00137
00139 void SetDeformationField( const DeformationFieldType * field );
00140
00142 DeformationFieldType * GetDeformationField(void);
00143
00145 itkSetObjectMacro( Interpolator, InterpolatorType );
00146
00148 itkGetObjectMacro( Interpolator, InterpolatorType );
00149
00151 itkSetMacro(OutputSpacing, SpacingType);
00152 virtual void SetOutputSpacing( const double* values);
00154
00156 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00157
00159 itkSetMacro(OutputOrigin, PointType);
00160 virtual void SetOutputOrigin( const double* values);
00162
00164 itkGetConstReferenceMacro(OutputOrigin, PointType);
00165
00167 itkSetMacro( EdgePaddingValue, PixelType );
00168
00170 itkGetMacro( EdgePaddingValue, PixelType );
00171
00177 virtual void GenerateOutputInformation();
00178
00185 virtual void GenerateInputRequestedRegion();
00186
00189 virtual void BeforeThreadedGenerateData();
00190
00193 virtual void AfterThreadedGenerateData();
00194
00195 #ifdef ITK_USE_CONCEPT_CHECKING
00196
00197 itkConceptMacro(SameDimensionCheck1,
00198 (Concept::SameDimension<ImageDimension, InputImageDimension>));
00199 itkConceptMacro(SameDimensionCheck2,
00200 (Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
00201 itkConceptMacro(InputHasNumericTraitsCheck,
00202 (Concept::HasNumericTraits<typename TInputImage::PixelType>));
00203 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
00204 (Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
00205
00207 #endif
00208
00209 protected:
00210 WarpImageFilter();
00211 ~WarpImageFilter() {};
00212 void PrintSelf(std::ostream& os, Indent indent) const;
00213
00217 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00218 int threadId );
00219
00220 private:
00221 WarpImageFilter(const Self&);
00222 void operator=(const Self&);
00223
00224 PixelType m_EdgePaddingValue;
00225 SpacingType m_OutputSpacing;
00226 PointType m_OutputOrigin;
00227
00228 InterpolatorPointer m_Interpolator;
00229
00230 };
00231
00232 }
00233
00234 #ifndef ITK_MANUAL_INSTANTIATION
00235 #include "itkWarpImageFilter.txx"
00236 #endif
00237
00238 #endif
00239