[Insight-users] Re: Error MRIBiasFieldCorrectionFilter.
Luis Ibanez
luis.ibanez@kitware.com
Sat, 26 Oct 2002 12:25:57 -0400
Hi Suresh,
The error indicates that you are attempting to
pass an image of type:
Image< float, 3 >
To a filter that was templated over an input
image of type:
Image< unsigned char, 3 >
Please make sure that the image you provide
to the SetInput() method has the same type
used as first template parameter of
MRIBiasFieldCorrectionFilter
Verify the type of the "imageMRI" object
used in your code
> filter->SetInput(imageMRI);
You can change the type of the filter producing
the imageMRI or you can change the first template
parameter of the CorrectionFilter.
If for some reason you don't want to modify any of
these types, you may want to consider the use of
the ImageCastFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1CastImageFilter.html
to convert imageMRI into a Image<float,3>
Please let us know if you find any problems,
Thanks
Luis
==============================================
suresh wrote:
>
> Hi Luis,
>
> I'm facing a compilation problem with MRIBiasFieldCorrectionFilter.
> this template accpets ImageTYpe as tempalte parameters. But when
> compile code like this the compiler throws a erroras following
>
> F:\itk\include\Algorithms\itkMRIBiasFieldCorrectionFilter.txx(233) :
> error C2664: 'SetImage' : cannot convert parameter 1 from 'class
> itk::SmartPointer<class itk::Image<float,3> >' to 'class
> itk::Image<unsigned char,3> *'
>
>
>
> typedef itk::Image<unsigned char, 3> ConverterType;
> typedef itk::MRIBiasFieldCorrectionFilter <ImageType, ImageType,
> ImageType> Corrector;
> filter->SetInput(imageMRI);
> filter->IsBiasFieldMultiplicative(true) ;
> filter->SetTissueClassStatistics(classMeans,classSigma) ;
> filter->SetUsingInterSliceIntensityCorrection(true);
> filter->SetSlicingDirection(2) ;
> ProgressUpdate(35, "Apply filter ", MRIVolumeName);
> filter->Update();
>
> please help me in fixing this error.
>
> regards,
> suresh
>