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 <
00057 class TInputImage,
00058 class TCoordRep = float,
00059 class TPixelType = ITK_TYPENAME TInputImage::PixelType
00060 >
00061 class ITK_EXPORT VectorInterpolateImageFunction :
00062 public ImageFunction<
00063 TInputImage,
00064 FixedArray< ITK_TYPENAME NumericTraits<typename TPixelType::ValueType>::RealType,
00065 ::itk::GetDimension<TPixelType>::Dimension>,
00066 TCoordRep >
00067 {
00068 public:
00070 itkStaticConstMacro(Dimension, unsigned int,
00071 TPixelType::Dimension);
00072
00074 itkStaticConstMacro(ImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00076
00078 typedef VectorInterpolateImageFunction Self;
00079 typedef ImageFunction<TInputImage,
00080 FixedArray<double, itkGetStaticConstMacro(Dimension)>, 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->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00118 return ( this->EvaluateAtContinuousIndex( index ) );
00119 }
00121
00132 virtual OutputType EvaluateAtContinuousIndex(
00133 const ContinuousIndexType & index ) const = 0;
00134
00142 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00143 {
00144 OutputType output;
00145 PixelType input = this->GetInputImage()->GetPixel( index );
00146 for( unsigned int k = 0; k < Dimension; k++ )
00147 {
00148 output[k] = static_cast<double>( input[k] );
00149 }
00150 return ( output );
00151 }
00153
00154 protected:
00155 VectorInterpolateImageFunction() {}
00156 ~VectorInterpolateImageFunction() {}
00157 void PrintSelf(std::ostream& os, Indent indent) const
00158 { Superclass::PrintSelf( os, indent ); }
00159
00160 private:
00161 VectorInterpolateImageFunction(const Self&);
00162 void operator=(const Self&);
00163
00164 };
00165
00166 }
00167
00168 #endif
00169
00170
00171