[Insight-users] [ITK Community] Jacobian of an affine transform

francois rousseau rousseau at unistra.fr
Fri Jan 24 05:36:34 EST 2014


Hi Luis,

Here is the protocol I used :
1- a test image (a sphere) : https://dl.dropboxusercontent.com/u/38120688/debugJacobian/sphere30.nii.gz

2- an affine file : https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.txt
#Insight Transform File V1.0
#Transform 0
Transform: MatrixOffsetTransformBase_double_3_3
Parameters: 2 0 0 0 1 0 0 0 1 0 0 0 
FixedParameters: 22.6774 -12.4914 6.04305

3 - create a deformation field from this affine file using ANTS programs : 
ComposeMultiTransform 3 scale2.nii.gz -R sphere30.nii.gz scale2.txt
link to the file : https://dl.dropboxusercontent.com/u/38120688/debugJacobian/scale2.nii.gz 

4- code for jacobian computing : https://dl.dropboxusercontent.com/u/38120688/debugJacobian/debugJacobian.cxx 
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkDisplacementFieldTransform.h"
#include "itkDisplacementFieldJacobianDeterminantFilter.h"

int main(int argc, char * argv[])
{
  const unsigned int Dimension = 3;
  typedef itk::Image<float, Dimension>                    itkFloatImage;
  typedef itk::DisplacementFieldTransform< float,Dimension>::DisplacementFieldType itkDeformationField;
	
  //Read the deformation field
  typedef itk::ImageFileReader< itkDeformationField > itkDeformationFieldReader;
  itkDeformationFieldReader::Pointer reader   = itkDeformationFieldReader::New();
  reader->SetFileName( argv[1] ); 
  reader->Update();
  
  //Compute Jacobian
  typedef itk::DisplacementFieldJacobianDeterminantFilter< itkDeformationField, float, itkFloatImage>   itkFilterType;
  itkFilterType::Pointer filter = itkFilterType::New();
  filter->SetInput( reader->GetOutput() );
  filter->Update();	
  
  //Write the result
  typedef itk::ImageFileWriter< itkFloatImage > itkImageWriter;
  itkImageWriter::Pointer writer = itkImageWriter::New();
  writer->SetFileName( argv[2] );
  writer->SetInput( filter->GetOutput() );
  writer->Update();

  return EXIT_SUCCESS;
}


This code is compiled using ITK 4.3.1, gcc 4.7, under MacOS 10.9.1 (CMakeList : https://dl.dropboxusercontent.com/u/38120688/debugJacobian/CMakeLists.txt)

Merci d’avance,
François

On 23 Jan 2014, at 15:14, Luis Ibanez <luis.ibanez at kitware.com> wrote:

> Hi François
> 
> 
> On Wed, Jan 22, 2014 at 3:31 AM, francois rousseau <rousseau at unistra.fr> wrote:
> Hi there,
> 
> I’m trying to check itkDisplacementFieldJacobianDeterminantFilter for affine transform and I get weird results.
> 
> Basically, I’ve created a simple affine transform with a scale factor in x dimension :
> 
> #Insight Transform File V1.0
> #Transform 0
> Transform: MatrixOffsetTransformBase_double_3_3
> Parameters: 1.5 0 0 0 1 0 0 0 1 0 0 0 
> FixedParameters: 22.6774 -12.4914 6.04305
> 
> I’ve converted this affine file to a deformation field using ComposeMultiTransform (from ANTS). The field is correct so far.
> 
> Then, I computed the jacobian of the field using itkDisplacementFieldJacobianDeterminantFilter.
> Jacobian is constant and equal to 1.
> 
> I would have expected 1.5 or 2/3.
> 
> Am I doing something wrong?
> 
> 
> 
> 
> Your intuition seems to be correct here.
> It seems reasonable to expected the Jacobian to different from 1.0
> 
> Would you mind sharing your code ?
> 
> In that way we could give it a quick try at debugging,
> and getting a better sense of what is happening.
> 
>    Thanks
> 
>           Luis
> 
>  

--
François Rousseau
Chargé de recherche CNRS
--------------------------------------------------------------------------------------------------------------------------------
Laboratoire des sciences de l'Ingénieur, de l'Informatique et de l'Imagerie (ICube) UMR 7357
300 Bd Sébastien Brant - CS 10413 
F - 67412 ILLKIRCH cedex
tel : +33 3 68 85 44 89
email : rousseau at unistra.fr
http://icube-miv.unistra.fr/fr/index.php/François_Rousseau
--------------------------------------------------------------------------------------------------------------------------------







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140124/505384a3/attachment.html>


More information about the Insight-users mailing list