[Insight-developers] Bug in BSplineInterpolateImageFunction

M.Staring at lumc.nl M.Staring at lumc.nl
Wed Apr 24 09:33:30 EDT 2013


Dear all,

The BSplineInterpolateImageFunction class has two functions to compute
the derivative:
- EvaluateDerivativeAtContinuousIndex
- EvaluateValueAndDerivativeAtContinuousIndex
The first one does take direction cosines into account, the other does
not. When called while using an image with non-trivial direction
cosines, the two derivatives are not equal.
I believe this bug was introduced a long time ago by commit 6abbc7969a90786c4c73f5d191f634db536c2d1d :

http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13

I attached a test program that simply calls the two functions. The input of the test program (set with interpolator->SetInputImage() ) is an image with direction cosines:
(-0, 7.48376e-009, -1, 7.48376e-009, 1, 7.48376e-009, 1, -7.48376e-009, 0)

Current output:
EvaluateDerivative:         [42.7697, -9.97885, 22.2913]
EvaluateValueAndDerivative: [-22.2913, -9.97885, 42.7697]
But that should really be the same. Note that the first and third entry are switched, and negated.

I filed a gerrit entry which proposes a fix:
http://review.source.kitware.com/#/c/11016/

After that fix the output is as follows:
EvaluateDerivative:         [42.7697, -9.97885, 22.2913]
EvaluateValueAndDerivative: [42.7697, -9.97885, 22.2913]
So, equal as it should be.

Looking forward to your feedback,
Regards, Marius

Marius Staring, PhD
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands
phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256
m.staring at lumc.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130424/fb98d705/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130424/fb98d705/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cxx
Type: application/octet-stream
Size: 1299 bytes
Desc: test.cxx
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130424/fb98d705/attachment.obj>


More information about the Insight-developers mailing list