<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Steve,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">this function is not supposed to do bounds checking. Bounds checking can be done with IsInsideBuffer(). The commit which introduced the code:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">Revision: 6abbc7969a90786c4c73f5d191f634db536c2d1d</font></div><div class="gmail_default"><font face="monospace, monospace">Author: Hans Johnson <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>></font></div><div class="gmail_default"><font face="monospace, monospace">Date: 2010-08-05 22:35:42</font></div><div class="gmail_default"><font face="monospace, monospace">Message:</font></div><div class="gmail_default"><font face="monospace, monospace">Made USE_OPTIMIZED_REGISTRATION the default</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">The ITK_USE_OPTIMIZED_REGISTRATION is now the default</font></div><div class="gmail_default"><font face="monospace, monospace">behavior.  There is no longer another option.</font></div><div class="gmail_default"><br></div><div class="gmail_default">Maybe Hans can explain why the lower bounds are checked but not the upper. Otherwise you can try removing them and <a href="http://itk.org/Wiki/ITK/Git/Develop">submitting</a> a patch Steve.</div><div class="gmail_default"><br></div><div class="gmail_default">Regards,</div><div class="gmail_default">Dženan</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 19, 2016 at 5:38 PM, Steve M. Robbins <span dir="ltr"><<a href="mailto:steve@sumost.ca" target="_blank">steve@sumost.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
The doc for this function doesn't make it clear whether the user may<br>
call it with an index point that lies outside the image or not.  I can<br>
tell you that the code doesn't check the bounds, resulting in<br>
uninitialized memory reads [1].<br>
<br>
My question is: is that a user error or bug in the evaluation<br>
function?<br>
<br>
If I read the ITK 4.8.2 code correctly, it looks like it takes care of<br>
the lower index bound, but not the upper index bound -- so ITK bug?<br>
<br>
<br>
Thanks,<br>
-Steve<br>
<br>
<br>
[1] <a href="http://my.cdash.org/viewDynamicAnalysisFile.php?id=3780109" rel="noreferrer" target="_blank">http://my.cdash.org/<wbr>viewDynamicAnalysisFile.php?<wbr>id=3780109</a><br>
<br>
Elastix test suite creates a 2D image of size 10x10, then calls<br>
the interpolator with coordinates { 12.7, 15.3 }.  I believe<br>
that is the cause of this diagnostic:<br>
<br>
UMR ==26834== Invalid read of size 2<br>
==26834==    at 0x62AE77: itk::<wbr>LinearInterpolateImageFunction<wbr><itk::Image<short, 2u>, double>::EvaluateOptimized(<wbr>itk::<wbr>LinearInterpolateImageFunction<wbr><itk::Image<short, 2u>, double>::Dispatch<2u> const&, itk::ContinuousIndex<double, 2u> const&) const (<wbr>itkLinearInterpolateImageFunct<wbr>ion.h:172)<br>
==26834==    by 0x62228A: itk::<wbr>LinearInterpolateImageFunction<wbr><itk::Image<short, 2u>, double>::<wbr>EvaluateAtContinuousIndex(itk:<wbr>:ContinuousIndex<double, 2u> const&) const (<wbr>itkLinearInterpolateImageFunct<wbr>ion.h:99)<br>
==26834==    by 0x61C431: bool TestInterpolators<2u>() (<wbr>itkAdvancedLinearInterpolatorT<wbr>est.cxx:171)<br>
==26834==    by 0x616CD2: main (<wbr>itkAdvancedLinearInterpolatorT<wbr>est.cxx:279)<br>
<br>
(Later, the code does an out-of-image call in 3D as well)<br>
<br>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/<wbr>protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-<wbr>developers</a><br>
<br></blockquote></div><br></div>