[ITK-dev] itk::LinearInterpolateImageFunction::EvaluateAtContinuousIndex() -- what is intended behaviour outside of image?

Steve M. Robbins steve at sumost.ca
Mon Sep 19 17:38:58 EDT 2016


Hi,

The doc for this function doesn't make it clear whether the user may
call it with an index point that lies outside the image or not.  I can
tell you that the code doesn't check the bounds, resulting in
uninitialized memory reads [1].

My question is: is that a user error or bug in the evaluation
function?

If I read the ITK 4.8.2 code correctly, it looks like it takes care of
the lower index bound, but not the upper index bound -- so ITK bug?


Thanks,
-Steve


[1] http://my.cdash.org/viewDynamicAnalysisFile.php?id=3780109

Elastix test suite creates a 2D image of size 10x10, then calls
the interpolator with coordinates { 12.7, 15.3 }.  I believe
that is the cause of this diagnostic:

UMR ==26834== Invalid read of size 2
==26834==    at 0x62AE77: itk::LinearInterpolateImageFunction<itk::Image<short, 2u>, double>::EvaluateOptimized(itk::LinearInterpolateImageFunction<itk::Image<short, 2u>, double>::Dispatch<2u> const&, itk::ContinuousIndex<double, 2u> const&) const (itkLinearInterpolateImageFunction.h:172)
==26834==    by 0x62228A: itk::LinearInterpolateImageFunction<itk::Image<short, 2u>, double>::EvaluateAtContinuousIndex(itk::ContinuousIndex<double, 2u> const&) const (itkLinearInterpolateImageFunction.h:99)
==26834==    by 0x61C431: bool TestInterpolators<2u>() (itkAdvancedLinearInterpolatorTest.cxx:171)
==26834==    by 0x616CD2: main (itkAdvancedLinearInterpolatorTest.cxx:279)

(Later, the code does an out-of-image call in 3D as well)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20160919/ed2a4b74/attachment.sig>


More information about the Insight-developers mailing list