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
00115 typedef typename OutputImageType::IndexType IndexType;
00116 typedef typename OutputImageType::SizeType SizeType;
00117 typedef typename OutputImageType::PixelType PixelType;
00118 typedef typename OutputImageType::SpacingType SpacingType;
00119 typedef typename OutputImageType::PixelType::ValueType ValueType;
00120
00122 itkStaticConstMacro(ImageDimension, unsigned int,
00123 TOutputImage::ImageDimension );
00124
00126 itkStaticConstMacro(PixelDimension, unsigned int,
00127 PixelType::Dimension );
00128
00130 typedef TDeformationField DeformationFieldType;
00131 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00132 typedef typename DeformationFieldType::PixelType DisplacementType;
00133
00135 typedef double CoordRepType;
00136 typedef VectorInterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00137 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00138 typedef VectorLinearInterpolateImageFunction<InputImageType,CoordRepType>
00139 DefaultInterpolatorType;
00140
00142 typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00143
00145 typedef typename TOutputImage::DirectionType DirectionType;
00146
00148 void SetDeformationField( DeformationFieldType * field );
00149
00151 DeformationFieldType * GetDeformationField(void);
00152
00154 itkSetObjectMacro( Interpolator, InterpolatorType );
00155
00157 itkGetObjectMacro( Interpolator, InterpolatorType );
00158
00160 itkSetMacro(OutputSpacing, SpacingType);
00161 virtual void SetOutputSpacing( const double* values);
00163
00165 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00166
00168 itkSetMacro(OutputOrigin, PointType);
00169 virtual void SetOutputOrigin( const double* values);
00171
00173 itkGetConstReferenceMacro(OutputOrigin, PointType);
00174
00176 itkSetMacro(OutputDirection, DirectionType );
00177 itkGetConstReferenceMacro(OutputDirection, DirectionType );
00179
00181 itkSetMacro( EdgePaddingValue, PixelType );
00182
00184 itkGetMacro( EdgePaddingValue, PixelType );
00185
00191 virtual void GenerateOutputInformation();
00192
00199 virtual void GenerateInputRequestedRegion();
00200
00203 virtual void BeforeThreadedGenerateData();
00204
00205 #ifdef ITK_USE_CONCEPT_CHECKING
00206
00207 itkConceptMacro(InputHasNumericTraitsCheck,
00208 (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00209 itkConceptMacro(OutputHasNumericTraitsCheck,
00210 (Concept::HasNumericTraits<ValueType>));
00211 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
00212 (Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
00213
00215 #endif
00216
00217 protected:
00218 WarpVectorImageFilter();
00219 ~WarpVectorImageFilter() {};
00220 void PrintSelf(std::ostream& os, Indent indent) const;
00221
00225 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00226 int threadId );
00227
00228 private:
00229 WarpVectorImageFilter(const Self&);
00230 void operator=(const Self&);
00231
00232 PixelType m_EdgePaddingValue;
00233 SpacingType m_OutputSpacing;
00234 PointType m_OutputOrigin;
00235 DirectionType m_OutputDirection;
00236
00237 InterpolatorPointer m_Interpolator;
00238
00239 };
00240
00241 }
00242
00243 #ifndef ITK_MANUAL_INSTANTIATION
00244 #include "itkWarpVectorImageFilter.txx"
00245 #endif
00246
00247 #endif
00248