Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVectorInterpolateImageFunction_h
00018 #define __itkVectorInterpolateImageFunction_h
00019
00020 #include "itkImageFunction.h"
00021 #include "itkFixedArray.h"
00022
00023 namespace itk
00024 {
00025
00032 template <typename T>
00033 struct GetDimension
00034 {
00035 itkStaticConstMacro(Dimension, int, T::Dimension);
00036 };
00037
00038
00056 template <class TInputImage, class TCoordRep = double>
00057 class ITK_EXPORT VectorInterpolateImageFunction :
00058 public ImageFunction<
00059 TInputImage,
00060 ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00061 TCoordRep >
00062 {
00063 public:
00065 itkStaticConstMacro(Dimension, unsigned int,
00066 TInputImage::PixelType::Dimension);
00067
00069 itkStaticConstMacro(ImageDimension, unsigned int,
00070 TInputImage::ImageDimension);
00071
00073 typedef VectorInterpolateImageFunction Self;
00074 typedef ImageFunction<TInputImage,
00075 ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00076 TCoordRep > Superclass;
00077 typedef SmartPointer<Self> Pointer;
00078 typedef SmartPointer<const Self> ConstPointer;
00079
00081 itkTypeMacro(VectorInterpolateImageFunction, ImageFunction);
00082
00084 typedef typename Superclass::InputImageType InputImageType;
00085 typedef typename InputImageType::PixelType PixelType;
00086 typedef typename PixelType::ValueType ValueType;
00087 typedef typename NumericTraits<ValueType>::RealType RealType;
00088
00090 typedef typename Superclass::PointType PointType;
00091
00093 typedef typename Superclass::IndexType IndexType;
00094 typedef typename Superclass::IndexValueType IndexValueType;
00095
00097 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00098
00100 typedef typename Superclass::OutputType OutputType;
00101
00103 typedef TCoordRep CoordRepType;
00104
00110 virtual OutputType Evaluate( const PointType& point ) const
00111 {
00112 ContinuousIndexType index;
00113 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00114 return ( this->EvaluateAtContinuousIndex( index ) );
00115 }
00117
00128 virtual OutputType EvaluateAtContinuousIndex(
00129 const ContinuousIndexType & index ) const = 0;
00130
00138 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00139 {
00140 OutputType output;
00141 PixelType input = this->GetInputImage()->GetPixel( index );
00142 for( unsigned int k = 0; k < Dimension; k++ )
00143 {
00144 output[k] = static_cast<double>( input[k] );
00145 }
00146 return ( output );
00147 }
00149
00150 protected:
00151 VectorInterpolateImageFunction() {}
00152 ~VectorInterpolateImageFunction() {}
00153 void PrintSelf(std::ostream& os, Indent indent) const
00154 { Superclass::PrintSelf( os, indent ); }
00155
00156 private:
00157 VectorInterpolateImageFunction(const Self&);
00158 void operator=(const Self&);
00159
00160 };
00161
00162 }
00163
00164 #endif
00165