[Insight-users] problems running deformable registration

Alexandra Badea alex at orion.duhs.duke.edu
Thu May 10 13:53:42 EDT 2007


Hi Vijay!

The problems you are facing in running DeformableRegistration8 with  
analyze images are due to the limited support for analyze file  
orientations.
It so happens that the default orientation (RAI I believe, it is not  
supported) . You therefore have to specify in the analyze header a  
supported orientation (RPI for example). If you do not know how to  
changethe header of your files you need to use an orientation filter in  
your ITK program.

You need to use the orientation filter in three instances in  
DeformableRegistration8 since you will call a writer three times (one  
for the output image and twice for difference images).

The following modifications worked for me, I hope will work for you too!
  Best,
Alexandra


   A. writer 1

/////
WriterType::Pointer      writer =  WriterType::New();
   CastFilterType::Pointer  caster =  CastFilterType::New();


   writer->SetFileName( argv[3] );


   caster->SetInput( resample->GetOutput() );
   writer->SetInput( caster->GetOutput()   );
   std::cout << std::endl << "Writing output" << std::endl;


typedef itk::OrientImageFilter<OutputImageType,OutputImageType>
OrientImageFilterType;
	OrientImageFilterType::Pointer orienter3 =OrientImageFilterType::New();
	orienter3->SetInput( caster->GetOutput());
	orienter3->SetUseImageDirection(true);
	orienter3->SetDesiredCoordinateOrientation(itk::SpatialOrientation:: 
ITK_COORDINATE_ORIENTATION_RPI);
	orienter3->Update();
	writer->SetInput( orienter3->GetOutput() );
///

B. writer 2

///
std::cout << std::endl << "Writing difference between fixed and  
resampled moving
images" << std::endl;


typedef itk::OrientImageFilter<OutputImageType,OutputImageType>
OrientImageFilterType;
	OrientImageFilterType::Pointer orienter4 =OrientImageFilterType::New();
	orienter4->SetInput( difference->GetOutput());
	orienter4->SetUseImageDirection(true);
	orienter4->SetDesiredCoordinateOrientation(itk::SpatialOrientation:: 
ITK_COORDINATE_ORIENTATION_RPI);
	orienter4->Update();
	writer2->SetInput( orienter4->GetOutput() );





     try
       {
       writer2->Update();
       }
     catch( itk::ExceptionObject & err )
       {
       std::cerr << "ExceptionObject caught !" << std::endl;
       std::cerr << err << std::endl;
       return -1;
       }
     }
////
C. writer 3
///
// Compute the difference image between the
   // fixed and moving image before registration.
   if( argc >= 6 )
     {
     writer2->SetFileName( argv[5] );
     difference->SetInput1( fixedImageReader->GetOutput() );
     difference->SetInput2( movingImageReader->GetOutput() );


	typedef itk::OrientImageFilter<OutputImageType,OutputImageType>
OrientImageFilterType;
	OrientImageFilterType::Pointer orienter5 =OrientImageFilterType::New();
	orienter5->SetInput( difference->GetOutput());
	orienter5->SetUseImageDirection(true);
	orienter5->SetDesiredCoordinateOrientation(itk::SpatialOrientation:: 
ITK_COORDINATE_ORIENTATION_RPI);
	orienter5->Update();
	writer2->SetInput( orienter5->GetOutput() );






     try
       {
       writer2->Update();
       }
     catch( itk::ExceptionObject & err )
       {
       std::cerr << "ExceptionObject caught !" << std::endl;
       std::cerr << err << std::endl;
       return -1;
       }
     }
////



More information about the Insight-users mailing list