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

itkImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/10/18 15:28:17 $
00007   Version:   $Revision: 1.31 $
00008 
00009   Copyright (c) 2002 Insight 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 _itkImageFunction_h
00018 #define _itkImageFunction_h
00019 
00020 #include "itkFunctionBase.h"
00021 #include "itkPoint.h"
00022 #include "itkIndex.h"
00023 #include "itkContinuousIndex.h"
00024 #include "itkImageBase.h"
00025 
00026 namespace itk
00027 {
00028 
00029 
00055 template <
00056 class TInputImage, 
00057 class TOutput,
00058 class TCoordRep = float 
00059 >
00060 class ITK_EXPORT ImageFunction : 
00061     public FunctionBase< Point<TCoordRep,
00062                                ::itk::GetImageDimension<TInputImage>::ImageDimension>, 
00063                        TOutput > 
00064 {
00065 public:
00067   itkStaticConstMacro(ImageDimension, unsigned int,
00068                       TInputImage::ImageDimension);
00069 
00071   typedef ImageFunction Self;
00072   typedef FunctionBase< Point<TCoordRep,
00073                               itkGetStaticConstMacro(ImageDimension)>,
00074                         TOutput > Superclass;
00075   typedef SmartPointer<Self>  Pointer;
00076   typedef SmartPointer<const Self>  ConstPointer;
00077   
00079   itkTypeMacro(ImageFunction, FunctionBase);
00080 
00082   typedef TInputImage InputImageType;
00083 
00085   typedef typename InputImageType::PixelType InputPixelType;
00086 
00088   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00089 
00091   typedef TOutput OutputType;
00092 
00094   typedef TCoordRep CoordRepType;
00095 
00097   typedef typename InputImageType::IndexType IndexType;
00098 
00100   typedef ContinuousIndex<TCoordRep,itkGetStaticConstMacro(ImageDimension)>
00101           ContinuousIndexType;
00102 
00104   typedef Point<TCoordRep,itkGetStaticConstMacro(ImageDimension)> PointType;
00105 
00110   virtual void SetInputImage( const InputImageType * ptr );
00111 
00113   const InputImageType * GetInputImage() const
00114     { return m_Image.GetPointer(); }
00115 
00118   virtual TOutput Evaluate( const PointType& point ) const = 0;
00119 
00122   virtual TOutput EvaluateAtIndex( const IndexType & index ) const = 0;
00123 
00126   virtual TOutput EvaluateAtContinuousIndex( 
00127     const ContinuousIndexType & index ) const = 0;
00128     
00132   inline bool IsInsideBuffer( const IndexType & index ) const;
00133             
00137   inline bool IsInsideBuffer( const ContinuousIndexType & index ) const;
00138 
00142   inline bool IsInsideBuffer( const PointType & point ) const;
00143 
00147   inline void ConvertPointToContinuousIndex(
00148     const PointType& point, ContinuousIndexType& index ) const;
00149 
00150   inline void ConvertContinuousIndexToPoint(
00151     const ContinuousIndexType& index, PointType& point ) const;
00152 
00153   inline void ConvertIndexToPoint(
00154     const IndexType& index, PointType& point ) const;
00155 
00156   inline void ConvertPointToNearestIndex(
00157     const PointType& point, IndexType& index ) const;
00158 
00159   inline void ConvertContinuousIndexToNearestIndex(
00160     const ContinuousIndexType &cindex, IndexType& index ) const;
00161   
00162 protected:
00163   ImageFunction();
00164   ~ImageFunction() {}
00165   void PrintSelf(std::ostream& os, Indent indent) const;
00166 
00168   InputImageConstPointer  m_Image;
00169 
00171   const double * m_Origin;
00172   const double * m_Spacing;
00173   PointType      m_GeometricStart;
00174   PointType      m_GeometricEnd;
00175   IndexType      m_BufferStart;
00176   IndexType      m_BufferEnd;
00177 
00178 private:
00179   ImageFunction(const Self&); //purposely not implemented
00180   void operator=(const Self&); //purposely not implemented
00181   
00182 };
00183 
00184 } // namespace itk
00185 
00186 #ifndef ITK_MANUAL_INSTANTIATION
00187 #include "itkImageFunction.txx"
00188 #endif
00189 
00190 #endif

Generated at Wed Mar 12 01:13:00 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000