[Insight-users] Transformation After Registration

Luis Ibanez luis.ibanez at kitware.com
Mon May 28 20:04:13 EDT 2012


Hi Abayiz,

Did you set the final parameters in the "finalTransform" ?

Please look at any of the examples:

ITK/Examples/Registration/
ImageRegistration2.cxx
ImageRegistration3.cxx
ImageRegistration4.cxx
ImageRegistration5.cxx
ImageRegistration6.cxx
ImageRegistration7.cxx
ImageRegistration8.cxx
ImageRegistration9.cxx


and the lines:

  ParametersType finalParameters =
registration->GetLastTransformParameters();

  TransformType::Pointer finalTransform = TransformType::New();

  finalTransform->SetParameters( finalParameters );
  finalTransform->SetFixedParameters( transform->GetFixedParameters() );

  ResampleFilterType::Pointer resample = ResampleFilterType::New();

  resample->SetTransform( finalTransform );


       Luis


-----------------------------------------
On Mon, May 21, 2012 at 8:44 AM, Abayiz <abayiz at yahoo.com> wrote:

> Hello,
>
> I am going to perform a transformation based on parameters from rigid
> registration, and my partial code for transformation is as follows:
>
> ****************************************************************
>   resampler->SetTransform( finalTransform );
>   resampler->SetInput( reader->GetOutput() );
>
>   resampler->SetSize(
> reader->GetOutput()->GetLargestPossibleRegion().GetSize() );
>   resampler->SetOutputOrigin(  reader->GetOutput()->GetOrigin() );
>   resampler->SetOutputSpacing( reader->GetOutput()->GetSpacing() );
>   resampler->SetOutputDirection( reader->GetOutput()->GetDirection() );
>
>   resampler->SetInterpolator ( linearInterpolator );
>   resampler->SetDefaultPixelValue( 30 );
>
>
>   CastFilterType::Pointer  caster =  CastFilterType::New();
>   WriterType::Pointer       writer =     WriterType::New();
>   caster->SetInput( resampler->GetOutput() );
>
>   writer->SetInput( resampler->GetOutput()   );
>   writer->SetFileName ( "transformedimage.mha" );
>   writer->Update();
>
> ****************************************************************
>
> 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?
>
> Thanks in advance.
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120528/da7d8962/attachment.htm>


More information about the Insight-users mailing list