<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Luis,<div><br></div><div>Here is the protocol I used :</div><div>1- a test image (a sphere) : <a href="https://dl.dropboxusercontent.com/u/38120688/debugJacobian/sphere30.nii.gz">https://dl.dropboxusercontent.com/u/38120688/debugJacobian/sphere30.nii.gz</a></div><div><br></div><div>2- an affine file : <a href="https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.txt">https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.txt</a></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(253, 255, 255);">#Insight Transform File V1.0</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(253, 255, 255);">#Transform 0</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(253, 255, 255);">Transform: MatrixOffsetTransformBase_double_3_3</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(253, 255, 255);">Parameters: 2 0 0 0 1 0 0 0 1 0 0 0 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(253, 255, 255);">FixedParameters: 22.6774 -12.4914 6.04305</div></div><div><br></div><div>3 - create a deformation field from this affine file using ANTS programs : </div><div><span style="background-color: rgb(253, 255, 255); font-family: Menlo; font-size: 11px;">ComposeMultiTransform 3 scale2.nii.gz -R sphere30.nii.gz scale2.txt</span></div><div>link to the file : <a href="https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.nii.gz">https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.nii.gz</a> <br><div><div><br></div><div>4- code for jacobian computing : <a href="https://dl.dropboxusercontent.com/u/38120688/debugJacobian/debugJacobian.cxx">https://dl.dropboxusercontent.com/u/38120688/debugJacobian/debugJacobian.cxx</a> </div><div><div>#include "itkImage.h"</div><div>#include "itkImageFileReader.h"</div><div>#include "itkImageFileWriter.h"</div><div>#include "itkDisplacementFieldTransform.h"</div><div>#include "itkDisplacementFieldJacobianDeterminantFilter.h"</div><div><br></div><div>int main(int argc, char * argv[])</div><div>{</div><div> const unsigned int Dimension = 3;</div><div> typedef itk::Image<float, Dimension> itkFloatImage;</div><div> typedef itk::DisplacementFieldTransform< float,Dimension>::DisplacementFieldType itkDeformationField;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div> //Read the deformation field</div><div> typedef itk::ImageFileReader< itkDeformationField > itkDeformationFieldReader;</div><div> itkDeformationFieldReader::Pointer reader = itkDeformationFieldReader::New();</div><div> reader->SetFileName( argv[1] ); </div><div> reader->Update();</div><div> </div><div> //Compute Jacobian</div><div> typedef itk::DisplacementFieldJacobianDeterminantFilter< itkDeformationField, float, itkFloatImage> itkFilterType;</div><div> itkFilterType::Pointer filter = itkFilterType::New();</div><div> filter->SetInput( reader->GetOutput() );</div><div> filter->Update();<span class="Apple-tab-span" style="white-space:pre"> </span></div><div> </div><div> //Write the result</div><div> typedef itk::ImageFileWriter< itkFloatImage > itkImageWriter;</div><div> itkImageWriter::Pointer writer = itkImageWriter::New();</div><div> writer->SetFileName( argv[2] );</div><div> writer->SetInput( filter->GetOutput() );</div><div> writer->Update();</div><div><br></div><div> return EXIT_SUCCESS;</div><div>}</div></div><div><br></div><div><br></div><div>This code is compiled using ITK 4.3.1, gcc 4.7, under MacOS 10.9.1 (CMakeList : <a href="https://dl.dropboxusercontent.com/u/38120688/debugJacobian/CMakeLists.txt">https://dl.dropboxusercontent.com/u/38120688/debugJacobian/CMakeLists.txt</a>)</div><div><br></div><div>Merci d’avance,</div><div>François</div><div><br></div><div>On 23 Jan 2014, at 15:14, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi François<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 22, 2014 at 3:31 AM, francois rousseau <span dir="ltr"><<a href="mailto:rousseau@unistra.fr" target="_blank">rousseau@unistra.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">Hi there,<div><br></div>
<div><div>I’m trying to check itkDisplacementFieldJacobianDeterminantFilter for affine transform and I get weird results.</div><div><br></div><div>Basically, I’ve created a simple affine transform with a scale factor in x dimension :</div>
<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">#Insight Transform File V1.0</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">
#Transform 0</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">Transform: MatrixOffsetTransformBase_double_3_3</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">
Parameters: 1.5 0 0 0 1 0 0 0 1 0 0 0 </div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">FixedParameters: 22.6774 -12.4914 6.04305</div></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">I’ve converted this affine file to a deformation field using ComposeMultiTransform (from ANTS). The field is correct so far.</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">Then, I computed the jacobian of the field using itkDisplacementFieldJacobianDeterminantFilter.</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">Jacobian is constant and equal to 1.</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">I would have expected 1.5 or 2/3.</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(253,255,255)">Am I doing something wrong?</div></div><div><br></div><div><br></div></div></blockquote><div><br></div><div><br></div><div>
Your intuition seems to be correct here.</div><div>It seems reasonable to expected the Jacobian to different from 1.0</div><div><br></div><div>Would you mind sharing your code ?</div><div><br></div><div>In that way we could give it a quick try at debugging,</div>
<div>and getting a better sense of what is happening.</div><div><br></div><div> Thanks</div><div><br></div><div> Luis</div><div><br></div><div> </div></div></div></div>
</blockquote></div><br><div apple-content-edited="true">
--<br>François Rousseau<br>Chargé de recherche CNRS<br>--------------------------------------------------------------------------------------------------------------------------------<br>Laboratoire des sciences de l'Ingénieur, de l'Informatique et de l'Imagerie (ICube) UMR 7357<br>300 Bd Sébastien Brant - CS 10413 <br>F - 67412 ILLKIRCH cedex<br>tel : +33 3 68 85 44 89<br>email : <a href="mailto:rousseau@unistra.fr">rousseau@unistra.fr</a><br><a href="http://icube-miv.unistra.fr/fr/index.php/François_Rousseau">http://icube-miv.unistra.fr/fr/index.php/François_Rousseau</a><br>--------------------------------------------------------------------------------------------------------------------------------<br><br><br><br><br><br><br>
</div>
<br></div></body></html>