Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkVectorInterpolateImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorInterpolateImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006-02-06 22:01:58 $
00007   Version:   $Revision: 1.19 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00162   void operator=(const Self&); //purposely not implemented
00163 
00164 };
00165 
00166 } // end namespace itk
00167 
00168 #endif
00169 
00170 
00171 

Generated at Mon Apr 14 14:48:59 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000