[Insight-developers] Issue with the pow() function when including the itkCenteredTrasnformInitializer header file...
Jean-Philippe Guyon
piloo at unc . edu
Mon, 30 Jun 2003 17:38:52 -0700
Hello everyone,
I have noticed, while I was trying to use the centered transform framework
for registration, that the inclusion of the
itkCenteredTransformInitializer.h file will cause the following errors to
appear at compile time:
============================================================================
===============
--------------------Configuration: Vetot - Win32
RelWithDebInfo--------------------
Compiling...
Vetot.cxx
Vetot_GUI.cxx
D:\itkUNCApplications\Vetot\Segmenter.txx(568) : error C2666: 'pow' : 13
overloads have similar conversions
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
itk::Segmenter<class itk::Image<unsigned short,3>,class itk::Image<unsigned
char,3> >::GenerateParameters(vo
id)'
D:\itkUNCApplications\Vetot\Segmenter.txx(569) : error C2666: 'pow' : 13
overloads have similar conversions
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
itk::Segmenter<class itk::Image<unsigned short,3>,class itk::Image<unsigned
char,3> >::GenerateParameters(vo
id)'
D:\itkUNCApplications\Vetot\Segmenter.txx(570) : error C2666: 'pow' : 13
overloads have similar conversions
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
itk::Segmenter<class itk::Image<unsigned short,3>,class itk::Image<unsigned
char,3> >::GenerateParameters(vo
id)'
D:\InsightApplications\Auxiliary\FltkImageViewer\fltkImageViewer.txx(177) :
error C2666: 'pow' : 13 overloads have similar conversions
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<float,unsigned char>::Synchronize(void)'
D:\InsightApplications\Auxiliary\FltkImageViewer\fltkImageViewer.txx(177) :
error C2666: 'pow' : 13 overloads have similar conversions
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<float,unsigned char>::Synchronize(void)'
D:\InsightApplications\Auxiliary\FltkImageViewer\fltkImageViewer.txx(178) :
error C2666: 'pow' : 13 overloads have similar conversions
============================================================================
===============
I use VC++ 6.00 to compile my code. I have spent time tracking down the
source of those error messages and it ended up that the implicit inclusion
of the vcl/vcl_complex.h file through the centered transform initializer was
causing that problem. Basically, when you include any file that will result
in the inclusion of vcl/vcl_complex.h, you will not be able to use the pow()
function with certain combinations of parameters type.
To illustrate that problem, I tried to compile my code using different
argument types for the pow() function, and I obtained the following results:
---------------------------------
DOES NOT COMPILE:
pow((int)value,(int)power)
pow((int)value,(float)power)
pow((float)value,(int)power)
pow((float)value,(double)power)
pow((float)value,(float)power)
pow((double)value,(int)power)
pow((double)value,(float)power)
---------------------------------
DOES COMPILE:
pow((int)value,(double)power)
pow((double)value,(double)power)
---------------------------------
I can easily fix my code, but some of the other entities that I use such as
itkFltkImageViewer, or the itkObjectMorphologyImageFilter will not compile
since they call the pow() function with a float argument as first parameter.
Has anyone already encountered that kind of problem? Is there any
satisfactory way to fix that issue?
Thanks,
Jean-Philippe