[Insight-users] Re: [vtkusers] Porting Problem - Please Help!

Brad King brad.king at kitware.com
Fri, 26 Mar 2004 14:55:06 -0500


gcope at engin.umich.edu wrote:
> Brad,
> 
> Thanks a lot for your help. The exact error is as follows:
> 
> itkSparseFieldLevelSetImageFilter.txx(479) : error C2668: 'vcl_sqrt' : ambiguous
> call to overloaded function
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(61) :
> while compiling class-template member function 'void __thiscall
> itk::SparseFieldLevelSetImageFilter<class itk::Image<unsigned short,3>,class
> itk::Image<unsigned short,3> >::
> UpdateActiveLayerValues(double,class itk::SparseFieldLayer<class
> itk::SparseFieldLevelSetNode<class itk::Index<3> > > *,class
> itk::SparseFieldLayer<class itk::SparseFieldLevelSetNode<class itk::Index<3> >
> 
>>*)'
> 
> 
> Itk and Vtk both compiled fine. My program includes both Itk and Vtk functions,
> and the Vtk functions compile correctly on their own.
> 
> Let me know if any other info would be helpful.

It looks like you are instantiating the filter with unsigned short image 
data.  The line containing the error looks like this in the template 
instantiation:

unsigned short v1, v2;
...
vcl_sqrt(v1/v2);

This will not work very well for unsigned short data.  Given that the 
filter is doing these kinds of calculations, I suggest you convert the 
image to float or double for now.  I'll bring up this problem with the 
developers to see about fixing the implementation to convert to a 
floating point type for these calculations regardless of the pixel type.

-Brad