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

Dženan Zukić dzenanz at gmail.com
Tue Sep 20 09:00:24 EDT 2016


Hi Steve,

this function is not supposed to do bounds checking. Bounds checking can be
done with IsInsideBuffer(). The commit which introduced the code:

Revision: 6abbc7969a90786c4c73f5d191f634db536c2d1d
Author: Hans Johnson <hans-johnson at uiowa.edu>
Date: 2010-08-05 22:35:42
Message:
Made USE_OPTIMIZED_REGISTRATION the default


The ITK_USE_OPTIMIZED_REGISTRATION is now the default
behavior.  There is no longer another option.

Maybe Hans can explain why the lower bounds are checked but not the upper.
Otherwise you can try removing them and submitting
<http://itk.org/Wiki/ITK/Git/Develop> a patch Steve.

Regards,
Dženan

On Mon, Sep 19, 2016 at 5:38 PM, Steve M. Robbins <steve at sumost.ca> wrote:

> 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)
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20160920/87669e73/attachment.html>


More information about the Insight-developers mailing list