[Insight-users] problem in running ITK file : How to compute a Jacobian

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 8 09:21:11 EDT 2008


Hi Shoosh,


The ITK Image class does not have a GetJacobian() method.


What exactly do you define as the Jacobian of an image ?


Typically this is done for Vector images...
(e.g. for deformation fields).

If that is your case, you may find interesting the new class
that Tom Vercauteren contributed to ITK via a paper in the
Insight Journal:
http://insight-journal.org/midas/handle.php?handle=1926/510

The class is currently on the directory

     Insight/Code/Review
       itkWarpJacobianDeterminantFilter.h


Please let us know more about your expectation of a
GetJacobian().



     Thanks


        Luis




--------------------
shoosh moosh wrote:
> I'm trying to calculate the Jacobian of an image. Can someone tell me what is wrong with the attached code?
> 
> _________________________________________________________________
> Discover the new Windows Vista
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
> 
> 
> ------------------------------------------------------------------------
> 
> #include "itkImageFileWriter.h"
> #include "itkImageFileReader.h"
> #include "itkImage.h"
> #include "itkImageRegionIterator.h"
> #include "Euler3DTransorm.h"
> 
> // Typedefs
> typedef short		PixelType;
> const   unsigned int	Dimension = 3;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef ImageType::Pointer ImagePointer;
> typedef ImageType::PointType PointType;
> typedef itk::ImageRegionIterator< ImageType > IteratorType;
> typedef itk::ImageFileWriter< ImageType >  WriterType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
> typedef itk::Euler3DTransform< transform > TransformType;
> //typedef double itk::Array2D Jaco;
> 
> 
> 
> int main( int argc, char ** argv )
> {
> TransformType::Pointer      transform     = TransformType::New();
> 
> // Verify the number of parameters in the command line
>   if( argc < 4 )
>   {
>     std::cerr << "Usage: " << std::endl;
>     std::cerr << argv[0] << " fixedImage, movingImage, scale" << std::endl;
>     return EXIT_FAILURE;
>   }
> 
> 
> // Get the file names from the command line arguments
>   const char * fixedImageFileName = argv[1];
>   const char * movingImageFileName = argv[2];
>   const char * scale = argv[3];
> 
> 
> //Reading the fixed image, moving image, and scale
>   ReaderType::Pointer reader = ReaderType::New();
>   reader->SetFileName( fixedImageFileName );
>   reader->Update();
>   ImageType::Pointer fixedImage = reader->GetOutput();
> 
>   reader->SetFileName( movingImageFileName );
>   reader->Update();
>   ImageType::Pointer movingImage = reader->GetOutput();
> 
>   int s=atoi(scale);
> 
> //get Jacobian
>   double itk::Array2D Jaco;
>   Jaco=fixedImage->GetJacobian();
>   //Jaco = GetJacobian(fixedImage);
>   std::cerr << "Jacobian: " << Jaco << std::endl;
> 
> 
> 
>  return 0;
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> PROJECT(MyOptimizer)
> 
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
> 	INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
> 	MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITKDIR." )
> ENDIF(ITK_FOUND)
> 
> SET(Libraries
> 	ITKCommon
> 	ITKIO
>         ITKNumerics
> )
> 
> ADD_EXECUTABLE(MyOptimizer MyOptimizer.cxx )
> TARGET_LINK_LIBRARIES(MyOptimizer ${Libraries})
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list