KWStyle - itkNearestNeighborInterpolateImageFunction.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkNearestNeighborInterpolateImageFunction.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:42 $
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 _itkNearestNeighborInterpolateImageFunction_h
18 DEF #define _itkNearestNeighborInterpolateImageFunction_h
19
20 #include "itkInterpolateImageFunction.h"
21
22 namespace itk
23 {
24
25 /** \class NearestNeighborInterpolateImageFunction
26  * \brief Nearest neighbor interpolation of a scalar image.
27  *
28  * NearestNeighborInterpolateImageFunction interpolates image intensity at
29  * a non-integer pixel position by copying the intensity for the nearest
30  * neighbor. This class is templated
31  * over the input image type and the coordinate representation type 
32  * (e.g. float or double).
33  *
34  * \ingroup ImageFunctions ImageInterpolators
35  */
36 template <class TInputImage, class TCoordRep = float>
37 class ITK_EXPORT NearestNeighborInterpolateImageFunction : 
38 IND **public InterpolateImageFunction<TInputImage,TCoordRep> 
39 {
40 public:
41   /** Standard class typedefs. */
42   typedef NearestNeighborInterpolateImageFunction Self;
43 TDA   typedef InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
44 TDA   typedef SmartPointer<Self> Pointer;
45 TDA   typedef SmartPointer<const Self>  ConstPointer;
46   
47   /** Run-time type information (and related methods). */
48   itkTypeMacro(NearestNeighborInterpolateImageFunction, 
49     InterpolateImageFunction);
50
51   /** Method for creation through the object factory. */
52   itkNewMacro(Self);  
53
54   /** OutputType typedef support. */
55   typedef typename Superclass::OutputType OutputType;
56
57   /** InputImageType typedef support. */
58   typedef typename Superclass::InputImageType InputImageType;
59
60   /** Dimension underlying input image. */
61   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
62
63   /** Index typedef support. */
64   typedef typename Superclass::IndexType IndexType;
65
66   /** ContinuousIndex typedef support. */
67   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
68
69   /** Evaluate the function at a ContinuousIndex position
70    *
71    * Returns the interpolated image intensity at a 
72    * specified point position. No bounds checking is done.
73    * The point is assume to lie within the image buffer.
74    *
75    * ImageFunction::IsInsideBuffer() can be used to check bounds before
76    * calling the method. */
77   virtual OutputType EvaluateAtContinuousIndex( 
78     const ContinuousIndexType & index ) const
79 IND **{
80 IND ***IndexType nindex;
81 IND ***this->ConvertContinuousIndexToNearestIndex(index, nindex);
82 IND ***return static_cast<OutputType>( this->GetInputImage()->GetPixel( nindex ) );
83 IND **}
84
85 protected:
86   NearestNeighborInterpolateImageFunction(){};
87   ~NearestNeighborInterpolateImageFunction(){};
88   void PrintSelf(std::ostream& os, Indent indent) const
89 IND ***{ Superclass::PrintSelf( os, indent ); }
90
91 private:
92 LEN   NearestNeighborInterpolateImageFunction(const Self&); //purposely not implemented
93   void operator=(const Self&); //purposely not implemented
94
95 };
96
97 // namespace itk
98
99 #endif
100

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