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
[email protected]

# This project is intended to be built outside the Insight source tree
PROJECT(test)

cmake_minimum_required(VERSION 2.6)

# Find ITK.
FIND_PACKAGE( ITK REQUIRED )
INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(test test.cxx)

TARGET_LINK_LIBRARIES(test ${ITK_LIBRARIES})

Attachment: test.cxx
Description: test.cxx

_______________________________________________
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://www.itk.org/mailman/listinfo/insight-developers

Reply via email to