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

itkNearestNeighborExtrapolateImageFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNearestNeighborExtrapolateImageFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:17 $ 00007 Version: $Revision: 1.2 $ 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 _itkNearestNeighborExtrapolateImageFunction_h 00018 #define _itkNearestNeighborExtrapolateImageFunction_h 00019 00020 #include "itkExtrapolateImageFunction.h" 00021 00022 namespace itk 00023 { 00024 00038 template <class TInputImage, class TCoordRep = float> 00039 class ITK_EXPORT NearestNeighborExtrapolateImageFunction : 00040 public ExtrapolateImageFunction<TInputImage,TCoordRep> 00041 { 00042 public: 00044 typedef NearestNeighborExtrapolateImageFunction Self; 00045 typedef ExtrapolateImageFunction<TInputImage,TCoordRep> Superclass; 00046 typedef SmartPointer<Self> Pointer; 00047 typedef SmartPointer<const Self> ConstPointer; 00048 00050 itkTypeMacro(NearestNeighborExtrapolateImageFunction, 00051 InterpolateImageFunction); 00052 00054 itkNewMacro(Self); 00055 00057 typedef typename Superclass::OutputType OutputType; 00058 00060 typedef typename Superclass::InputImageType InputImageType; 00061 00063 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00064 00066 typedef typename Superclass::IndexType IndexType; 00067 00069 typedef typename Superclass::ContinuousIndexType ContinuousIndexType; 00070 00078 virtual OutputType EvaluateAtContinuousIndex( 00079 const ContinuousIndexType & index ) const 00080 { 00081 typedef typename IndexType::IndexValueType ValueType; 00082 IndexType nindex; 00083 for ( unsigned int j = 0; j < ImageDimension; j++ ) 00084 { 00085 if ( index[j] < m_StartContinuousIndex[j] ) 00086 { 00087 nindex[j] = m_StartIndex[j]; 00088 } 00089 else if ( index[j] > m_EndContinuousIndex[j] ) 00090 { 00091 nindex[j] = m_EndIndex[j]; 00092 } 00093 else 00094 { 00095 nindex[j] = static_cast<ValueType>( vnl_math_rnd( index[j] ) ); 00096 } 00097 } 00098 return static_cast<OutputType>( m_Image->GetPixel( nindex ) ); 00099 } 00100 00101 00109 virtual OutputType EvaluateAtIndex( 00110 const IndexType & index ) const 00111 { 00112 IndexType nindex; 00113 for ( unsigned int j = 0; j < ImageDimension; j++ ) 00114 { 00115 if ( index[j] < m_StartIndex[j] ) 00116 { 00117 nindex[j] = m_StartIndex[j]; 00118 } 00119 else if ( index[j] > m_EndIndex[j] ) 00120 { 00121 nindex[j] = m_EndIndex[j]; 00122 } 00123 else 00124 { 00125 nindex[j] = index[j]; 00126 } 00127 } 00128 return static_cast<OutputType>( m_Image->GetPixel( nindex ) ); 00129 } 00130 00131 00132 protected: 00133 NearestNeighborExtrapolateImageFunction(){}; 00134 ~NearestNeighborExtrapolateImageFunction(){}; 00135 void PrintSelf(std::ostream& os, Indent indent) const 00136 { Superclass::PrintSelf( os, indent ); } 00137 00138 private: 00139 NearestNeighborExtrapolateImageFunction(const Self&); //purposely not implemented 00140 void operator=(const Self&); //purposely not implemented 00141 00142 }; 00143 00144 } // namespace itk 00145 00146 #endif

Generated at Sun Apr 1 02:38:56 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000