[Insight-users] resampling problems

Luis Ibanez luis.ibanez@kitware.com
Mon, 18 Nov 2002 12:27:12 -0500


Hi Jorn,

Please follow Lydia's suggestion on using

               interp.GetPointer()

in the SetTransform() method.  The SetTransform()
method is expecting a pointer to the base class
of the interpolators hierarchy.  "interp" is a
SmartPointer to the linear interpolator belonging
to this hierarchy. Hoewever, SmartPointers cannot
perform polymorphism. That is, if class B derives
from class A, a SmartPointer to B cannot be a
substitute for a SmartPointer to A.  So you have to
get the raw pointer to the linear interpolator.
This is what the GetPointer() methods will return.

The compiler should accept a raw pointer to
LinearInterpolateImageFunction
http://www.itk.org/Doxygen/html/classitk_1_1LinearInterpolateImageFunction.html
wherever a raw pointer to InterpolateImageFunction
http://www.itk.org/Doxygen/html/classitk_1_1InterpolateImageFunction.html
is expected.

The same occurs with setting the Optimizers and Transforms,
since they are all members of a hierarchy and the registration
class expects to recieve a pointer to their base classes.

If you continue experiencing compiler problems with
this line, please note that just after the error message
that you posted, there should be another line starting
with:  "Candidates are...".  This will basically tell you
what is the type of the interpolator pointer expected by
the method.



   Luis


==========================================================
J. Van Dalen wrote:

...
> 
> 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?
> 


.....

> 
>   cout << transform.GetPointer() << "\n";
>   resample->SetTransform(transform.GetPointer());
> //  resample->SetInterpolator(interp); // gives an error

 >

....