[Insight-users] resampling problems
J. Van Dalen
J.vanDalen" <J.vanDalen@rad.umcn.nl
Mon, 18 Nov 2002 17:46:46 +0100 (CET)
Dear ITK users,
Just recently I started to use ITK, mainly for the purpose of medical
image registration using mutual information. I am new in this field (ITK),
so logically I get into problems... Here are two questions, on which one
of you hopefully has some answer.
In my code, I use the information from the MIRegistration example. It
seems that I can perform a registration using MI, i.e., I get some numbers
associated with the transformation. However, when I try to resample, I run
into problems when I use SetTransform and when I use SetInterpolator. When
I use SetTransform in the ResampleImageFilter (see code below), it looks
as if the inverse transform is taken, instead of the "real" transform. Has
anybody an idea why this can be?
Furthermore, when I include the line "resample->SetInterpolator(interp);"
(see code below) the compilation of the program fails (the error message
is: "no matching function for call to `itk::ResampleImageFilter<main (int,
char **)::ImageType, main (int, char **)::ImageType>::SetInterpolator
(itk::SmartPointer<itk::LinearInterpolateImageFunction<main (int, char
**)::OutputType, double> > &)' ") Can anybody tell me something more about
the interpolator function and how it should be used in ITK?
Thanks,
Jorn.
// part of my code:
// Create a linear interpolation image function
typedef itk::LinearInterpolateImageFunction<ImageType, double> resIntType;
resIntType::Pointer interp = resIntType::New();
interp->SetInputImage(volInMove);
// Resample
itk::ResampleImageFilter< ImageType, ImageType >::Pointer resample;
resample = itk::ResampleImageFilter< ImageType, ImageType >::New();
resample->SetInput(volInMove);
cout << transform.GetPointer() << "\n";
resample->SetTransform(transform.GetPointer());
// resample->SetInterpolator(interp); // gives an error
resample->SetSize( volInFix->GetLargestPossibleRegion().GetSize() );
resample->SetOutputOrigin( volInFix->GetOrigin() );
resample->SetOutputSpacing( volInFix->GetSpacing() );
resample->SetDefaultPixelValue( 0 );
resample->Update();