<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap:break-word; color:rgb(0,0,0); font-size:14px; font-family:Calibri,sans-serif">
<div>
<div>
<div>Marius,</div>
<div><br>
</div>
<div>GREAT CATCH. I'm working on incorporating your test into ITK right now in order to demonstrate both the bug and the solution.</div>
<div><br>
</div>
<div>Hans</div>
<div><br>
</div>
<div>
<div>
<div style="font-family:Consolas; font-size:medium">
<div style="font-family:Consolas,monospace; font-size:12px">=================================================================</div>
<div style="font-family:Consolas,monospace; font-size:12px">Hans J. Johnson, Ph.D.</div>
<div style="font-family:Consolas,monospace; font-size:12px">Assistant Professor, Department of Psychiatry</div>
<div style="font-family:Consolas,monospace; font-size:12px"><br>
</div>
<div style="font-family:Consolas,monospace; font-size:12px">Mailing Address:</div>
<div style="font-family:Consolas,monospace; font-size:12px">W274 GH Email: <a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a></div>
<div style="font-family:Consolas,monospace; font-size:12px">200 Hawkins Drive Phone: (319) 353 8587</div>
<div style="font-family:Consolas,monospace; font-size:12px">The University of Iowa</div>
<div style="font-family:Consolas,monospace; font-size:12px">Iowa City, IA 52242</div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">From: </span>"<a href="mailto:M.Staring@lumc.nl">M.Staring@lumc.nl</a>" <<a href="mailto:M.Staring@lumc.nl">M.Staring@lumc.nl</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, April 24, 2013 8:33 AM<br>
<span style="font-weight:bold">To: </span>ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>[Insight-developers] Bug in BSplineInterpolateImageFunction<br>
</div>
<div><br>
</div>
<div><style>
<!--
@font-face
        {font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:70.85pt 70.85pt 70.85pt 70.85pt}
div.WordSection1
        {}
-->
</style>
<div lang="EN-US">
<div class="WordSection1">
<p class="MsoNormal">Dear all,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">The BSplineInterpolateImageFunction class has two functions to compute<br>
the derivative:<br>
- EvaluateDerivativeAtContinuousIndex<br>
- EvaluateValueAndDerivativeAtContinuousIndex</p>
<p class="MsoNormal">The first one does take direction cosines into account, the other does<br>
not. When called while using an image with non-trivial direction<br>
cosines, the two derivatives are not equal.</p>
<p class="MsoNormal">I believe this bug was introduced a long time ago by commit 6abbc7969a90786c4c73f5d191f634db536c2d1d :</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><a href="http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13">http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13</a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">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:</p>
<p class="MsoNormal">(-0, 7.48376e-009, -1, 7.48376e-009, 1, 7.48376e-009, 1, -7.48376e-009, 0)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Current output:</p>
<p class="MsoNormal">EvaluateDerivative: [42.7697, -9.97885, 22.2913]</p>
<p class="MsoNormal">EvaluateValueAndDerivative: [-22.2913, -9.97885, 42.7697]</p>
<p class="MsoNormal">But that should really be the same. Note that the first and third entry are switched, and negated.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I filed a gerrit entry which proposes a fix:</p>
<p class="MsoNormal"><a href="http://review.source.kitware.com/#/c/11016/">http://review.source.kitware.com/#/c/11016/</a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">After that fix the output is as follows:</p>
<p class="MsoNormal">EvaluateDerivative: [42.7697, -9.97885, 22.2913]</p>
<p class="MsoNormal">EvaluateValueAndDerivative: [42.7697, -9.97885, 22.2913]</p>
<p class="MsoNormal">So, equal as it should be.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Looking forward to your feedback,</p>
<p class="MsoNormal">Regards, Marius</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-GB">Marius Staring, PhD</span></p>
<p class="MsoNormal"><span lang="EN-GB">Division of Image Processing (LKEB)</span></p>
<p class="MsoNormal"><span lang="EN-GB">Department of Radiology</span></p>
<p class="MsoNormal"><span lang="EN-GB">Leiden University Medical Center</span></p>
<p class="MsoNormal"><span lang="EN-GB">PO Box 9600, 2300 RC Leiden, The Netherlands</span></p>
<p class="MsoNormal"><span lang="EN-GB">phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256</span></p>
<p class="MsoNormal"><span lang="EN-GB"><a href="mailto:m.staring@lumc.nl">m.staring@lumc.nl</a></span></p>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</span><br>
<br>
<hr>
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any
retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
<hr>
</body>
</html>