[Insight-users] Problems with editing DeformableRegistration16

志昕 區 charles_ao at yahoo.com.hk
Thu Apr 12 13:58:35 EDT 2012


Hi all,

I would like to do 3D non-rigid registration in with the built in example which is DeformableRegistration16.

I have modify it a little bit to convert the program to work with 3D following the instruction from Luis.

However, I would like to further extend this program for my research purpose.

Let say we input two 3D image, A (target image), B (moving image), I would like to input one more moving image C, 

this C image will not be considered during registration between A and B. C will only be deformed by the same deformation field which is used to deform B. 

Therefore, my concept is only adding a few lines to the original program. It can be built and run probably. 

However, the result I got was two independent registration between A-B and A-C.

Below is what I added to the original image. (the color one) Would any one please help me how to solve this problem? I am sticking with this problem for a while already.

Thanks all of you in advanced!!

Please let me know if my question is too confused.

Thanks!
Edwin



(some lines are not type here, it is the same with the original one)
.......

  // compute the output (warped) image
  typedef itk::WarpImageFilter< ImageType, ImageType, DeformationFieldType > WarperType;
  typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolatorType; 

 WarperType::Pointer warper = WarperType::New(); 

  InterpolatorType::Pointer interpolator = InterpolatorType::New(); 

  ImageType::Pointer targetImage = targetReader->GetOutput(); 
  warper->SetInput( sourceReader->GetOutput() ); 
  warper->SetInterpolator( interpolator ); 
  warper->SetOutputSpacing( targetImage->GetSpacing() ); 
  warper->SetOutputOrigin( targetImage->GetOrigin() );
  warper->SetOutputDirection( targetImage->GetDirection() );
  warper->SetDeformationField( multires->GetOutput() );

  typedef itk::ImageFileWriter< ImageType >  WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetFileName( argv[3] );
  writer->SetInput( warper->GetOutput() );
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  Read in the second source image
  sourceReader->SetFileName( argv[5] );
  sourceReader->Update();


  // cast second source to float

  sourceImageCaster->SetInput( sourceReader->GetOutput() );

    // compute the second output (warped) image

  warper->SetInput( sourceReader->GetOutput() ); 

  writer->SetFileName( argv[6] );
  writer->SetInput( warper->GetOutput() );
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  try
    {
    writer->Update();
    }
  catch( itk::ExceptionObject & excp )
    {
    std::cerr << excp << std::endl;
    return EXIT_FAILURE;
    }

  // write the deformation field
  typedef itk::ImageFileWriter< DeformationFieldType >  DeformationWriterType;
  DeformationWriterType::Pointer defwriter = DeformationWriterType::New();
  defwriter->SetFileName( argv[4] );
  defwriter->SetInput( multires->GetOutput() );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120413/5bc91933/attachment.htm>


More information about the Insight-users mailing list