00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkWarpVectorImageFilter_h
00018 #define __itkWarpVectorImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkVectorInterpolateImageFunction.h"
00022 #include "itkVectorLinearInterpolateImageFunction.h"
00023 #include "itkPoint.h"
00024 #include "itkFixedArray.h"
00025
00026 namespace itk
00027 {
00028
00084 template <
00085 class TInputImage,
00086 class TOutputImage,
00087 class TDeformationField
00088 >
00089 class ITK_EXPORT WarpVectorImageFilter :
00090 public ImageToImageFilter<TInputImage, TOutputImage>
00091 {
00092 public:
00094 typedef WarpVectorImageFilter Self;
00095 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00096 typedef SmartPointer<Self> Pointer;
00097 typedef SmartPointer<const Self> ConstPointer;
00098
00100 itkNewMacro(Self);
00101
00103 itkTypeMacro( WarpVectorImageFilter, ImageToImageFilter );
00104
00106 typedef typename TOutputImage::RegionType OutputImageRegionType;
00107
00109 typedef typename Superclass::InputImageType InputImageType;
00110 typedef typename Superclass::InputImagePointer InputImagePointer;
00111 typedef typename Superclass::OutputImageType OutputImageType;
00112 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00113 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00114 typedef typename OutputImageType::IndexType IndexType;
00115 typedef typename OutputImageType::SizeType SizeType;
00116 typedef typename OutputImageType::PixelType PixelType;
00117 typedef typename OutputImageType::SpacingType SpacingType;
00118 typedef typename OutputImageType::PixelType::ValueType ValueType;
00119
00121 itkStaticConstMacro(ImageDimension, unsigned int,
00122 TOutputImage::ImageDimension );
00123
00125 itkStaticConstMacro(PixelDimension, unsigned int,
00126 PixelType::Dimension );
00127
00129 typedef TDeformationField DeformationFieldType;
00130 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00131 typedef typename DeformationFieldType::PixelType DisplacementType;
00132
00134 typedef double CoordRepType;
00135 typedef VectorInterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00136 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00137 typedef VectorLinearInterpolateImageFunction<InputImageType,CoordRepType>
00138 DefaultInterpolatorType;
00139
00141 typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00142
00144 typedef typename TOutputImage::DirectionType DirectionType;
00145
00147 void SetDeformationField( DeformationFieldType * field );
00148
00150 DeformationFieldType * GetDeformationField(void);
00151
00153 itkSetObjectMacro( Interpolator, InterpolatorType );
00154
00156 itkGetObjectMacro( Interpolator, InterpolatorType );
00157
00159 itkSetMacro(OutputSpacing, SpacingType);
00160 virtual void SetOutputSpacing( const double* values);
00162
00164 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00165
00167 itkSetMacro(OutputOrigin, PointType);
00168 virtual void SetOutputOrigin( const double* values);
00170
00172 itkGetConstReferenceMacro(OutputOrigin, PointType);
00173
00175 itkSetMacro(OutputDirection, DirectionType );
00176 itkGetConstReferenceMacro(OutputDirection, DirectionType );
00178
00180 itkSetMacro( EdgePaddingValue, PixelType );
00181
00183 itkGetMacro( EdgePaddingValue, PixelType );
00184
00190 virtual void GenerateOutputInformation();
00191
00198 virtual void GenerateInputRequestedRegion();
00199
00202 virtual void BeforeThreadedGenerateData();
00203
00204 #ifdef ITK_USE_CONCEPT_CHECKING
00205
00206 itkConceptMacro(InputHasNumericTraitsCheck,
00207 (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00208 itkConceptMacro(OutputHasNumericTraitsCheck,
00209 (Concept::HasNumericTraits<ValueType>));
00210 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
00211 (Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
00212
00214 #endif
00215
00216 protected:
00217 WarpVectorImageFilter();
00218 ~WarpVectorImageFilter() {};
00219 void PrintSelf(std::ostream& os, Indent indent) const;
00220
00224 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00225 int threadId );
00226
00227 private:
00228 WarpVectorImageFilter(const Self&);
00229 void operator=(const Self&);
00230
00231 PixelType m_EdgePaddingValue;
00232 SpacingType m_OutputSpacing;
00233 PointType m_OutputOrigin;
00234 DirectionType m_OutputDirection;
00235
00236 InterpolatorPointer m_Interpolator;
00237
00238 };
00239
00240 }
00241
00242 #ifndef ITK_MANUAL_INSTANTIATION
00243 #include "itkWarpVectorImageFilter.txx"
00244 #endif
00245
00246 #endif
00247