<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Hi all,<br><br>I would like to do 3D non-rigid registration in with the built in example which is DeformableRegistration16.<br><br>I have modify it a little bit to convert the program to work with 3D following the instruction from Luis.<br><br>However, I would like to further extend this program for my research purpose.<br><br>Let say we input two 3D image, A (target image), B (moving image), I would like to input one more moving image C, <br><br>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. <br><br>Therefore, my concept is only adding a few lines to the original program. It can be built and run probably. <br><br>However, the result I got was two independent registration between A-B and A-C.<br><br>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.<br><br>Thanks all of you in advanced!!<br><br>Please let me know if my question is too confused.<br><br>Thanks!<br>Edwin<br><br><br><br>(some lines are not type here, it is the same with the original one)<br>.......<br><br> // compute the output (warped) image<br> typedef itk::WarpImageFilter< ImageType, ImageType, DeformationFieldType > WarperType;<br> typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolatorType; <br><br> WarperType::Pointer warper = WarperType::New(); <br><br> InterpolatorType::Pointer interpolator = InterpolatorType::New(); <br><br> ImageType::Pointer targetImage = targetReader->GetOutput(); <br> warper->SetInput( sourceReader->GetOutput() ); <br> warper->SetInterpolator( interpolator ); <br>
warper->SetOutputSpacing( targetImage->GetSpacing() ); <br> warper->SetOutputOrigin( targetImage->GetOrigin() );<br> warper->SetOutputDirection( targetImage->GetDirection() );<br> warper->SetDeformationField( multires->GetOutput() );<br><br> typedef itk::ImageFileWriter< ImageType > WriterType;<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName( argv[3] );<br> writer->SetInput( warper->GetOutput() );<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><span style="background-color: rgb(255, 127, 0); font-weight: bold;"> // Read in the second source image</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><span style="background-color:
rgb(255, 127, 0);"> sourceReader->SetFileName( argv[5] );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"> sourceReader->Update();</span><br style="background-color: rgb(255, 127, 0);"><br style="background-color: rgb(255, 127, 0);"><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0); font-weight: bold;"> // cast second source to float</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"> sourceImageCaster->SetInput( sourceReader->GetOutput() );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0); font-weight:
bold;"> // compute the second output (warped) image</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"> warper->SetInput( sourceReader->GetOutput() ); </span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"> writer->SetFileName( argv[6] );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"> writer->SetInput( warper->GetOutput() );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127,
0);"></span>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br> try<br> {<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & excp )<br> {<br> std::cerr << excp << std::endl;<br> return EXIT_FAILURE;<br> }<br><br> // write the deformation field<br> typedef itk::ImageFileWriter< DeformationFieldType > DeformationWriterType;<br> DeformationWriterType::Pointer defwriter = DeformationWriterType::New();<br> defwriter->SetFileName( argv[4] );<br> defwriter->SetInput( multires->GetOutput() );<br><br><br></div></body></html>