itkVectorInterpolateImageFunction.h
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
00096 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00097
00099 typedef typename Superclass::OutputType OutputType;
00100
00102 typedef TCoordRep CoordRepType;
00103
00109 virtual OutputType Evaluate( const PointType& point ) const
00110 {
00111 ContinuousIndexType index;
00112 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00113 return ( this->EvaluateAtContinuousIndex( index ) );
00114 }
00116
00127 virtual OutputType EvaluateAtContinuousIndex(
00128 const ContinuousIndexType & index ) const = 0;
00129
00137 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00138 {
00139 OutputType output;
00140 PixelType input = this->GetInputImage()->GetPixel( index );
00141 for( unsigned int k = 0; k < Dimension; k++ )
00142 {
00143 output[k] = static_cast<double>( input[k] );
00144 }
00145 return ( output );
00146 }
00148
00149 protected:
00150 VectorInterpolateImageFunction() {}
00151 ~VectorInterpolateImageFunction() {}
00152 void PrintSelf(std::ostream& os, Indent indent) const
00153 { Superclass::PrintSelf( os, indent ); }
00154
00155 private:
00156 VectorInterpolateImageFunction(const Self&);
00157 void operator=(const Self&);
00158
00159 };
00160
00161 }
00162
00163 #endif
00164