[Insight-users] Problem with resampling

motes motes mort.motes at gmail.com
Wed Apr 21 07:56:09 EDT 2010


Solved. The problem was that the nearest neighbor interpolator by
mistake was used. I did not expect such a great difference between
using nearest neighbor and linear interpolation though.




On Wed, Apr 21, 2010 at 1:24 PM, motes motes <mort.motes at gmail.com> wrote:
> After running an AffineTransform registration process I am trying to
> compute the registered image using the following:
>
> // ....
>    try {
>      registration->Update();
>    }
>    catch( itk::ExceptionObject & err ) {
>      std::cerr << "ExceptionObject caught !" << std::endl;
>      std::cerr << err << std::endl;
>      return;
>    }
>
>    resampler->SetInput(imageM);
>    resampler->SetInterpolator( registration->GetInterpolator() );
>    resampler->SetTransform( registration->GetTransform());
>    resampler->SetSize( imageF->GetLargestPossibleRegion().GetSize() );
>    resampler->SetOutputSpacing( imageF->GetSpacing() );
>    resampler->SetOutputOrigin( imageF->GetOrigin() );
>    resampler->SetDefaultPixelValue( 0 );
>    resampler->Update();
>
>    CopyImageToImage<typename FixedImageType::Pointer,
> FixedImageType>(resampler->GetOutput(), imageR);
>    display_image<FixedImageType, Volume, short>(imageR);
>
>
> When I print the parameters after the registration I get:
>
> 25 = 1.06962 : [0.990631, 0.0905022, -0.0294116, -0.0802955, 1.00481,
> -0.035022, 0.0491173, -0.00658597, 0.910021, -3.12388, 6.25156,
> -21.9981]
>
> these I know are the correct parameters and should produce this image:
>
> http://img718.imageshack.us/img718/5899/correct.jpg
>
> after running the above resampler. But instead I get:
>
> http://img203.imageshack.us/img203/8120/wrongd.jpg
>
>
> Any ideas on what might go wrong in the resampler, it looks like the
> rotation is messed up for some reason?
>
> I have checked that the fixed and moving images are correct just
> before running the resampler.
>


More information about the Insight-users mailing list