KWStyle - itkInterpolateImageFunction.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkInterpolateImageFunction.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:40 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 DEF #ifndef _itkInterpolateImageFunction_h
18 DEF #define _itkInterpolateImageFunction_h
19
20 #include "itkImageFunction.h"
21
22 namespace itk
23 {
24
25 /** \class InterpolateImageFunction
26  * \brief Base class for all image interpolaters.
27  *
28  * InterpolateImageFunction is the base for all ImageFunctions that
29  * interpolates image intensity at a non-integer pixel position. 
30  * This class is templated over the input image type and the 
31  * coordinate representation type (e.g. float or double ).
32  *
33  * \warning This heirarchy of functions work only for images 
34  * with scalar pixel types. For images of vector pixel types
35  * use VectorInterpolateImageFunctions. 
36  *
37  * \sa VectorInterpolateImageFunction
38  * \ingroup ImageFunctions ImageInterpolators
39  * 
40  * */
41 template <class TInputImage, class TCoordRep = float>
42 class ITK_EXPORT InterpolateImageFunction : 
43 IND **public ImageFunction< TInputImage, 
44 LEN     ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep > 
45 {
46 public:
47   /** Standard class typedefs. */
48   typedef InterpolateImageFunction Self;
49 LEN,TDA   typedef ImageFunction<TInputImage,typename NumericTraits<typename TInputImage::PixelType>::RealType,TCoordRep> Superclass;
50 TDA   typedef SmartPointer<Self> Pointer;
51 TDA   typedef SmartPointer<const Self>  ConstPointer;
52   
53   /** Run-time type information (and related methods). */
54   itkTypeMacro(InterpolateImageFunction, ImageFunction);
55
56   /** OutputType typedef support. */
57   typedef typename Superclass::OutputType OutputType;
58
59   /** InputImageType typedef support. */
60   typedef typename Superclass::InputImageType InputImageType;
61   
62   /** Dimension underlying input image. */
63   itkStaticConstMacro(ImageDimension, unsigned int,
64                       Superclass::ImageDimension);
65
66   /** Point typedef support. */
67   typedef typename Superclass::PointType PointType;
68
69   /** Index typedef support. */
70   typedef typename Superclass::IndexType IndexType;
71
72   /** ContinuousIndex typedef support. */
73   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
74
75   /** RealType typedef support. */
76 LEN   typedef typename NumericTraits<typename TInputImage::PixelType>::RealType RealType;
77
78   /** Interpolate the image at a point position
79    *
80    * Returns the interpolated image intensity at a 
81    * specified point position. No bounds checking is done.
82    * The point is assume to lie within the image buffer.
83    *
84    * ImageFunction::IsInsideBuffer() can be used to check bounds before
85    * calling the method. */
86   virtual OutputType Evaluate( const PointType& point ) const
87     {
88     ContinuousIndexType index;
89 LEN     this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
90     return ( this->EvaluateAtContinuousIndex( index ) );
91     }
92
93   /** Interpolate the image at a continuous index position
94    *
95    * Returns the interpolated image intensity at a 
96    * specified index position. No bounds checking is done.
97    * The point is assume to lie within the image buffer.
98    *
99    * Subclasses must override this method.
100    *
101    * ImageFunction::IsInsideBuffer() can be used to check bounds before
102    * calling the method. */
103   virtual OutputType EvaluateAtContinuousIndex( 
104     const ContinuousIndexType & index ) const = 0;
105
106   /** Interpolate the image at an index position.
107    *
108    * Simply returns the image value at the
109    * specified index position. No bounds checking is done.
110    * The point is assume to lie within the image buffer.
111    *
112    * ImageFunction::IsInsideBuffer() can be used to check bounds before
113    * calling the method. */
114   virtual OutputType EvaluateAtIndex( const IndexType & index ) const
115     {
116 LEN     return ( static_cast<RealType>( this->GetInputImage()->GetPixel( index ) ) );
117     }
118
119 protected:
120   InterpolateImageFunction(){};
121   ~InterpolateImageFunction(){};
122   void PrintSelf(std::ostream& os, Indent indent) const
123     { Superclass::PrintSelf( os, indent ); }
124
125 private:
126   InterpolateImageFunction( const Self& ); //purposely not implemented
127   void operator=( const Self& ); //purposely not implemented
128
129 };
130
131 // namespace itk
132
133 #endif
134

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:17PM
© Kitware Inc.