[Insight-users] bug in BSplineInterpolationWeightFunction, BSplineFloor()
Stefan Klein
s.klein at erasmusmc.nl
Mon Sep 8 12:42:30 EDT 2008
Hi,
It seems there is a bug in the BSplineFloor() function defined in
itkBSplineInterpolationWeightFunction.txx.
It floors 97.999999 to 98...
The code in the attachment reproduces the problem and illustrates how it
may lead to severe crashes when using the BSplineDeformableTransform
(that's how I found it).
Can anybody reproduce the problem? I'm using Visual C++ 2008, Windows XP
32bit, ITK 3.8.
It can be easily fixed by changing in
itkBSplineInterpolationWeightFunction.txx the following lines:
union { unsigned int hilo[2]; double d; } u;
u.d = x + 103079215104.0;
return (int)((u.hilo[1]<<16)|(u.hilo[0]>>16));
into:
return static_cast<int>(vcl_floor(x));
But that might give a performance loss, as the comment explains:
// The 'floor' function on x86 and mips is many times slower than these
// and is used a lot in this code, optimize for different CPU architectures
Does anybody have a better solution?
Kind regards,
Stefan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bugtest.cxx
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080908/84d91031/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080908/84d91031/attachment.txt>
More information about the Insight-users
mailing list