[Insight-users] ContinuousIndex and IsInside

Karthik Krishnan karthik.krishnan at kitware.com
Sun Dec 24 01:53:01 EST 2006


On 12/22/06, Emmanuel Christophe <melaneum at gmail.com> wrote:
>
> Hello,
>
> What is the valid range for a continous index of a dataset of size 100
> starting at 0 ?
>
> Index (integer) will be going from 0 to 99 (included).
> I would expect the continuous index to be valid from [0,100[ (100
> excluded but 99.9 included for example)
>
> Apparently the IsInside function consider the continousIndex to be
> inside only if in the interval [0,99] (99.9 excluded
>

I perfectly agree with you here and IMHO its a bug in itk::Image. I agree
that a ContinuousIndex should be considered "Inside" if it lies in the
interval (-0.5, 99.5] for your example.

An itk::Index is the value at the center of a voxel, with normalized extents
(-0.5,.5]. I tried to fix a while ago at the level of the interpolator,
which, in ITK is the class that evaluates the value at a ContinuousIndex. [A
voxel is just a regular grid of sample points from a continuous function,
and the ideal interpolator is the one that best approximates the PSF.]

That fix was here :
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkLinearInterpolateImageFunction.h?root=Insight&r1=1.28&r2=1.29
logged as Bug 3647.

It overrided the IsInsideBuffer() methods from ImageFunction, so as to
extend the boundaries of the voxel by 0.5, atleast for the
LinearInterpolator.

I reverted the fix though, since a few developers raised concerns about the
performance penalty, it might cause due to an extra IsInsideBuffer() call
that was made as a result. [
http://www.itk.org/mailman/private/insight-developers/2006-August/008340.html
]

I was worried about putting the fix in itk::Image, as you suggest, since
that would mean supporting negative indices and I'm not sure what would
happen in ITK with negative indices. It might be just fine, but there may be
code fragments somewhere assuming its a postive real value...

--
Karthik Krishnan
R & D Engineer,
Kitware Inc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061224/ea45abb5/attachment.html


More information about the Insight-users mailing list