[Insight-developers] interpolaters/image functions and coord rep type

Lydia Ng lng@insightful.com
Tue, 19 Feb 2002 17:23:00 -0800


Hi,

At the meeting I think it was agreed that coordinate represenation type
for itk::Point and itk::ContinuousIndex was to remain and template
parameter.

Currently the interpolators/image functions hard-wires the=20
coord rep to double as follows:

template<class TInputImage, class TOutput>
class ImageFunction ::
  public FunctionBase<Point<double,TInputImage::ImageDimension>,double>
{

  // other stuff snipped

  typedef Point<double,ImageDimension> PointType;
  typedef ContinuousIndex<double,ImageDimension> ContinousIndexType;

  // There are 3 versions of Evaluate
  virtual double Evaluate( const PointType& point ) const;
  virtual double Evaluate( const ContinuousIndexType& cindex ) const;
  virtual double Evaluate( const IndexType & index ) const;

};


The image functions API need to be extended to handle cases
when coord rep is not double.

I think two options were discussed at the meeting:

[1] add an extra template parameter to ImageFunction
 e.g. template<class TInputImage, class TCoordRep =3D float>

or

[2] have 4 different version of Evaluate
virtual double Evaluate( const Point<double,ImageDimension>& ) const;
virtual double Evaluate( const Point<float,ImageDimension>& ) const;
virtual double Evaluate( const ContinuousIndex<double, ImageDimension>&
) const;
virtual double Evaluate( const ContinuousIndex<float,ImageDimension>& )
const;

----------------------
I have concerns about [2] because it was awkward enough that each
subclass has to decide how it was going to support 3 different versions
of Evaluate. With [2] the function needs to now support 5.

Also we would need utility functions that converts double Point to
float Point and indexes both double Point and float Points etc ...

At this stage I prefer [1].=20
Anybody has comments/suggestions on this?

- Lydia=20