<br>Hi Motes,<br><br>Depending on the optimizer that you are using,<br>the expression<br><br> resampler->SetTransform( registration->GetTransform());<br><br>is incorrect, since not all optimizers set the Transform<br>
to be the one holding the last registration parameters.<br><br>Please follow what the Examples do in <br><br> Insight/Examples/Registration/<br><br><br> transform->SetFixedParameters( <br> registration->GetTransform()->GetFixedParameters() );<br>
<br> OptimizerType::ParametersType finalParameters = <br> registration->GetLastTransformParameters();<br><br> transform->SetParameters( finalParameters );<br><br> resampler->SetTransform( transform );<br>
<br><br>BTW: looking at the differences between <br><br>
<a href="http://img718.imageshack.us/img718/5899/correct.jpg" target="_blank">http://img718.imageshack.us/img718/5899/correct.jpg</a><br>
<a href="http://img203.imageshack.us/img203/8120/wrongd.jpg" target="_blank">http://img203.imageshack.us/img203/8120/wrongd.jpg</a><br><br>It looks like both are oriented the same way, and that the<br>only difference is the intensity level that you are setting<br>
in the Default value:<br><br> resampler->SetDefaultPixelValue( 0 );<br><br>Is that black background what you consider to be incorrect ?<br><br><br><br> Regards,<br><br><br> Luis<br><br><br>-----------------------------------------------------<br>
<div class="gmail_quote">On Wed, Apr 21, 2010 at 8:00 AM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Arg problem is still the same. I was previewing the moving image and<br>
not the registered image so any suggestions are still most welcome!<br>
<div class="im"><br>
<br>
<br>
On Wed, Apr 21, 2010 at 1:24 PM, motes motes <<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> After running an AffineTransform registration process I am trying to<br>
> compute the registered image using the following:<br>
><br>
> // ....<br>
> try {<br>
> registration->Update();<br>
> }<br>
> catch( itk::ExceptionObject & err ) {<br>
> std::cerr << "ExceptionObject caught !" << std::endl;<br>
> std::cerr << err << std::endl;<br>
> return;<br>
> }<br>
><br>
> resampler->SetInput(imageM);<br>
> resampler->SetInterpolator( registration->GetInterpolator() );<br>
> resampler->SetTransform( registration->GetTransform());<br>
> resampler->SetSize( imageF->GetLargestPossibleRegion().GetSize() );<br>
> resampler->SetOutputSpacing( imageF->GetSpacing() );<br>
> resampler->SetOutputOrigin( imageF->GetOrigin() );<br>
> resampler->SetDefaultPixelValue( 0 );<br>
> resampler->Update();<br>
><br>
> CopyImageToImage<typename FixedImageType::Pointer,<br>
> FixedImageType>(resampler->GetOutput(), imageR);<br>
> display_image<FixedImageType, Volume, short>(imageR);<br>
><br>
><br>
> When I print the parameters after the registration I get:<br>
><br>
> 25 = 1.06962 : [0.990631, 0.0905022, -0.0294116, -0.0802955, 1.00481,<br>
> -0.035022, 0.0491173, -0.00658597, 0.910021, -3.12388, 6.25156,<br>
> -21.9981]<br>
><br>
> these I know are the correct parameters and should produce this image:<br>
><br>
> <a href="http://img718.imageshack.us/img718/5899/correct.jpg" target="_blank">http://img718.imageshack.us/img718/5899/correct.jpg</a><br>
><br>
> after running the above resampler. But instead I get:<br>
><br>
> <a href="http://img203.imageshack.us/img203/8120/wrongd.jpg" target="_blank">http://img203.imageshack.us/img203/8120/wrongd.jpg</a><br>
><br>
><br>
> Any ideas on what might go wrong in the resampler, it looks like the<br>
> rotation is messed up for some reason?<br>
><br>
> I have checked that the fixed and moving images are correct just<br>
> before running the resampler.<br>
><br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br>