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: 2005/06/03 21:35:34 $
00007   Version:   $Revision: 1.18 $
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     }
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 = this->GetInputImage()->GetPixel( index );
00145     for( unsigned int k = 0; k < Dimension; 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&); //purposely not implemented
00160   void operator=(const Self&); //purposely not implemented
00161 
00162 };
00163 
00164 } // namespace itk
00165 
00166 #endif
00167 
00168 

Generated at Thu May 25 00:13:23 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000