Hi Abayiz,<br><br>Did you set the final parameters in the "finalTransform" ?<br><br>Please look at any of the examples:<br><br>ITK/Examples/Registration/<br>ImageRegistration2.cxx<br>ImageRegistration3.cxx<br>ImageRegistration4.cxx<br>
ImageRegistration5.cxx<br>ImageRegistration6.cxx<br>ImageRegistration7.cxx<br>ImageRegistration8.cxx<br>ImageRegistration9.cxx<br><br><br>and the lines:<br><br> ParametersType finalParameters = registration->GetLastTransformParameters();<br>
<br> TransformType::Pointer finalTransform = TransformType::New();<br><br> finalTransform->SetParameters( finalParameters );<br> finalTransform->SetFixedParameters( transform->GetFixedParameters() );<br><br> ResampleFilterType::Pointer resample = ResampleFilterType::New();<br>
<br> resample->SetTransform( finalTransform );<br><br><br> Luis<br><br><br>-----------------------------------------<br><div class="gmail_quote">On Mon, May 21, 2012 at 8:44 AM, Abayiz <span dir="ltr"><<a href="mailto:abayiz@yahoo.com" target="_blank">abayiz@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div>Hello,</div><div><br></div><div>
I am going to perform a transformation based on parameters from rigid registration, and my partial code for transformation is as follows: <br></div><div><br></div><div>****************************************************************</div>
<div> resampler->SetTransform( finalTransform );<br> resampler->SetInput( reader->GetOutput() );<br><br> resampler->SetSize( reader->GetOutput()->GetLargestPossibleRegion().GetSize() );<br> resampler->SetOutputOrigin( reader->GetOutput()->GetOrigin() );<br>
resampler->SetOutputSpacing( reader->GetOutput()->GetSpacing() );<br> resampler->SetOutputDirection( reader->GetOutput()->GetDirection() );<br><br> resampler->SetInterpolator (
linearInterpolator );<br> resampler->SetDefaultPixelValue( 30 );</div><div><br></div><div><br></div><div> CastFilterType::Pointer caster = CastFilterType::New();<br> WriterType::Pointer writer = WriterType::New();<br>
caster->SetInput( resampler->GetOutput() );<br><br> writer->SetInput( resampler->GetOutput() );<br> writer->SetFileName ( "transformedimage.mha" );<br> writer->Update();<br></div><div><br>
</div><div>****************************************************************</div><div><br></div><div>The code compiles without error, but from the result I can say it is not working correctly. Which part is wrong here?? Do you have any suggestion? <br>
</div><div><br></div><div>Thanks in advance. <br></div></div></div><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.php" target="_blank">http://www.kitware.com/products/protraining.php</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>
<br></blockquote></div><br>