[Insight-developers] Conceptual error in LinearInterpolateImageFunction?

Paul Hughett hughett@mercur.uphs.upenn.edu
Tue, 22 May 2001 14:34:03 -0400


There appears to be a conceptual error in the design of the Evaluate
method for the LinearInterpolateImageFunction class.  This method
requires the caller to test in advance whether or not the point at
which the image is to be interpolated is inside or outside the
boundary of the image; presumably the caller will provide a suitable
default value for points outside the image.  The problem arises for
pointsn outside the boundary but within one unit of it, for which it
is necessary to interpolate between the interior samples and the
default external value (typically zero).  Implementing the interior
case within the method and requiring the caller to implement the more
complex boundary case seems unreasonable to me.  Note that mosaicing
multiple images into a larger image without boundary artifacts
requires that the boundary interpolation be handled correctly.

I suggest that the Evaluate method should handle correctly any point,
whether it is inside, near, or outside the boundary.  The default
external value should be zero; I have no position as to whether it
should be possible to set another external value.

If performance is an issue, then we should implement a distinct,
unchecked method (or perhaps provide an optional argument that, if set
to non-zero, guarantees that the point is inside the boundary).


Paul Hughett