18 #ifndef __itkImageFunction_h
19 #define __itkImageFunction_h
56 class TCoordRep =
float
59 public FunctionBase< Point< TCoordRep, TInputImage::ImageDimension >, TOutput >
63 itkStaticConstMacro(ImageDimension,
unsigned int,
64 TInputImage::ImageDimension);
93 typedef typename InputImageType::IndexType
IndexType;
111 {
return m_Image.GetPointer(); }
115 virtual TOutput Evaluate(
const PointType & point)
const = 0;
119 virtual TOutput EvaluateAtIndex(
const IndexType & index)
const = 0;
123 virtual TOutput EvaluateAtContinuousIndex(
124 const ContinuousIndexType & index)
const = 0;
132 virtual bool IsInsideBuffer(
const IndexType & index)
const
134 for (
unsigned int j = 0; j < ImageDimension; j++ )
136 if ( index[j] < m_StartIndex[j] )
140 if ( index[j] > m_EndIndex[j] )
154 for (
unsigned int j = 0; j < ImageDimension; j++ )
157 if ( ! (index[j] >= m_StartContinuousIndex[j] &&
158 index[j] < m_EndContinuousIndex[j] ) )
170 virtual bool IsInsideBuffer(
const PointType & point)
const
173 m_Image->TransformPhysicalPointToContinuousIndex(point, index);
177 bool isInside = IsInsideBuffer( index );
183 void ConvertPointToNearestIndex(
const PointType & point,
188 m_Image->TransformPhysicalPointToContinuousIndex(point, cindex);
189 this->ConvertContinuousIndexToNearestIndex(cindex, index);
193 void ConvertPointToContinuousIndex(
const PointType & point,
196 m_Image->TransformPhysicalPointToContinuousIndex(point, cindex);
200 inline void ConvertContinuousIndexToNearestIndex(
204 index.CopyWithRound(cindex);
207 itkGetConstReferenceMacro(StartIndex, IndexType);
208 itkGetConstReferenceMacro(EndIndex, IndexType);
210 itkGetConstReferenceMacro(StartContinuousIndex, ContinuousIndexType);
211 itkGetConstReferenceMacro(EndContinuousIndex, ContinuousIndexType);
215 void PrintSelf(std::ostream & os,
Indent indent)
const;
228 void operator=(
const Self &);
233 #define ITK_TEMPLATE_ImageFunction(_, EXPORT, TypeX, TypeY) \
236 _( 3 ( class EXPORT ImageFunction< ITK_TEMPLATE_3 TypeX > ) ) \
237 namespace Templates \
239 typedef ImageFunction< ITK_TEMPLATE_3 TypeX > ImageFunction##TypeY; \
243 #if ITK_TEMPLATE_EXPLICIT
244 #include "Templates/itkImageFunction+-.h"
248 #include "itkImageFunction.hxx"