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 "itkVector.h"
00022
00023 namespace itk
00024 {
00025
00032 template <typename T>
00033 struct GetVectorDimension
00034 {
00035 itkStaticConstMacro(VectorDimension, int, T::VectorDimension);
00036 };
00037
00038
00056 template <
00057 class TInputImage,
00058 class TCoordRep = float,
00059 class TPixelType = typename TInputImage::PixelType
00060 >
00061 class ITK_EXPORT VectorInterpolateImageFunction :
00062 public ImageFunction<
00063 TInputImage,
00064 Vector< ITK_TYPENAME NumericTraits<typename TPixelType::ValueType>::RealType,
00065 ::itk::GetVectorDimension<TPixelType>::VectorDimension>,
00066 TCoordRep >
00067 {
00068 public:
00070 itkStaticConstMacro(VectorDimension, unsigned int,
00071 TPixelType::VectorDimension);
00072
00074 itkStaticConstMacro(ImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00076
00078 typedef VectorInterpolateImageFunction Self;
00079 typedef ImageFunction<TInputImage,
00080 Vector<double, itkGetStaticConstMacro(VectorDimension)>, TCoordRep > Superclass;
00081 typedef SmartPointer<Self> Pointer;
00082 typedef SmartPointer<const Self> ConstPointer;
00083
00085 itkTypeMacro(VectorInterpolateImageFunction, ImageFunction);
00086
00088 typedef typename Superclass::InputImageType InputImageType;
00089 typedef typename InputImageType::PixelType PixelType;
00090 typedef typename PixelType::ValueType ValueType;
00091 typedef typename NumericTraits<ValueType>::RealType RealType;
00092
00093
00095 typedef typename Superclass::PointType PointType;
00096
00098 typedef typename Superclass::IndexType IndexType;
00099
00101 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00102
00104 typedef typename Superclass::OutputType OutputType;
00105
00107 typedef TCoordRep CoordRepType;
00108
00114 virtual OutputType Evaluate( const PointType& point ) const
00115 {
00116 ContinuousIndexType index;
00117 this->ConvertPointToContinuousIndex( point, index );
00118 return ( this->EvaluateAtContinuousIndex( index ) );
00119 }
00120
00131 virtual OutputType EvaluateAtContinuousIndex(
00132 const ContinuousIndexType & index ) const = 0;
00133
00141 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00142 {
00143 OutputType output;
00144 PixelType input = m_Image->GetPixel( index );
00145 for( unsigned int k = 0; k < VectorDimension; k++ )
00146 {
00147 output[k] = static_cast<double>( input[k] );
00148 }
00149 return ( output );
00150 }
00151
00152 protected:
00153 VectorInterpolateImageFunction() {}
00154 ~VectorInterpolateImageFunction() {}
00155 void PrintSelf(std::ostream& os, Indent indent) const
00156 { Superclass::PrintSelf( os, indent ); }
00157
00158 private:
00159 VectorInterpolateImageFunction(const Self&);
00160 void operator=(const Self&);
00161
00162 };
00163
00164 }
00165
00166 #endif
00167
00168