[Insight-developers] (update) Overloading ambiguity error while compiling Slicer; Solaris, ITK 3-18

Attila Nagy nagy.attila at yahoo.com
Sun Aug 1 11:18:27 EDT 2010


Hi all,

in the end I jumped into it, (in order to try to go further with the compilation), so what I did is:

line 155 of Code/Review/itkLabelPerimeterEstimationCalculator.txx
int numberOfNeighbors = (int)vcl_pow( 2.0, ImageDimension );
becomes:
int numberOfNeighbors = (int)vcl_pow( 2.0, static_cast<double> (ImageDimension) );

It compiled, but then a similar error popped up in
/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx


"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx", line 563: Error: Overloading ambiguity between "std::pow(double, double)" and "std::pow(double, int)".
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx", line 572:     Where: While instantiating "static itk::ShapeLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 3>>, itk::Image<unsigned char, 3>>::HyperSphereVolume(double)".
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx", line 572:     Where: Instantiated from static itk::ShapeLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 3>>, itk::Image<unsigned char, 3>>::HyperSpherePerimeter(double).
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx", line 342:     Where: Instantiated from itk::ShapeLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 3>>, itk::Image<unsigned char, 3>>::ThreadedProcessLabelObject(itk::StatisticsLabelObject<unsigned char, 3>*).
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkStatisticsLabelMapFilter.txx", line 64:     Where: Instantiated from itk::StatisticsLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 3>>, itk::Image<unsigned char, 3>>::ThreadedProcessLabelObject(itk::StatisticsLabelObject<unsigned char, 3>*).
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Common/itkObjectFactory.h", line 52:     Where: Instantiated from itk::LabelImageToStatisticsLabelMapFilter<itk::Image<unsigned char, 3>, itk::Image<unsigned char, 3>, itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 3>>>::GenerateData().
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Common/itkObjectFactory.h", line 52:     Where: Instantiated from itk::DoCenteredInitialization<itk::Image<float, 3>, itk::Image<float, 3>, itk::VersorRigid3DTransform<double>, itk::CenteredVersorTransformInitializer<itk::Image<float, 3>, itk::Image<float, 3>>>(itk::SmartPointer<itk::Image<float, 3>>&, itk::SmartPointer<itk::Image<float, 3>>&, itk::SmartPointer<itk::SpatialObject<3>>&, itk::SmartPointer<itk::SpatialObject<3>>&, unsigned, unsigned, std::string &).
"/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3/Applications/CLI/BRAINSTools/BRAINSCommonLib/BRAINSFitHelper.cxx", line 706:     Where: Instantiated from non-template code.
1 Error(s) detected.

So line 563 of Insight/Code/Review/itkShapeLabelMapFilter.txx

  return vcl_pow( vnl_math::pi,ImageDimension / 2.0 ) * vcl_pow( radius, ImageDimension ) / GammaN2p1( ImageDimension );

becomes:

  return vcl_pow( vnl_math::pi, static_cast<double> (ImageDimension) / 2.0 ) * vcl_pow( radius, static_cast<double>(ImageDimension) ) / GammaN2p1( static_cast<double>(ImageDimension) );

With these modifications it compiles fine now, but not sure if it's semantically okay, and dunno if this cast may cause some undesired effects.

Have a nice weekend!

Attila

--- On Sun, 8/1/10, Attila Nagy <nagy.attila at yahoo.com> wrote:

> From: Attila Nagy <nagy.attila at yahoo.com>
> Subject: [Insight-developers] Overloading ambiguity error while compiling Slicer; Solaris, ITK 3-18
> To: gaetan.lehmann at jouy.inra.fr, "Steve Pieper" <pieper at bwh.harvard.edu>, "Slicer Devel List" <slicer-devel at bwh.harvard.edu>, "Itk list" <insight-developers at itk.org>
> Date: Sunday, August 1, 2010, 12:26 AM
> Hi folks,
> 
> while trying to compile Slicer for Solaris, I ran into this
> problem (see at the end of the mail).
> Some parameters: x86 64 bit mode, ITK-3.18, Studio express
> 10/06 (or 06/10, I never know... :)), Slicer 3-6
> I did not have this error with earlier compiler versions
> (S12, S12u1) (*).
> In fact I think I see what the problem might be: math_iso.h
> is included in math.h, and math_iso.h only contains one
> definition (double, double), not the other one. A cast would
> maybe do, but we're talking about a .txx file, and
> metaprogramming is waay beyond me :)
> According to Su..^W Oracle Studio's IDE the offending code
> is in 
> Code/Review/itkLabelPerimeterEstimationCalculator.txx
> 
> (http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Review/itkLabelPerimeterEstimationCalculator.txx?view=log&root=Insight&pathrev=ITK-3-18)
> 
> in line 155:
> int numberOfNeighbors = (int)vcl_pow( 2.0, ImageDimension
> );
> 
> Could maybe somebody take a look at it?
> 
> (*): this may simply indicate that this ambiguity was not
> caught by earlier compiler versions, for example:
> http://forums.sun.com/thread.jspa?threadID=5330068
> and
> http://forums.sun.com/thread.jspa?threadID=5330068
> 
> Thanks very much,
> Attila
> 
> ps: I could overcome the warning at least :D
> 
> ======== output ============
> 
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3/Applications/CLI/BRAINSTools/BRAINSCommonLib/BRAINSFitHelper.h",
> line 129: Warning: Identifier expected instead of "}".
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkLabelPerimeterEstimationCalculator.txx",
> line 155: Error: Overloading ambiguity between
> "std::pow(double, double)" and "std::pow(double, int)".
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx",
> line 68:     Where: While instantiating
> "itk::LabelPerimeterEstimationCalculator<itk::Image<unsigned
> char, 3>>::Compute()".
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkShapeLabelMapFilter.txx",
> line 68:     Where: Instantiated from
> itk::ShapeLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned
> char, 3>>, itk::Image<unsigned char,
> 3>>::BeforeThreadedGenerateData().
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Review/itkStatisticsLabelMapFilter.txx",
> line 44:     Where: Instantiated from
> itk::StatisticsLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned
> char, 3>>, itk::Image<unsigned char,
> 3>>::BeforeThreadedGenerateData().
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Common/itkObjectFactory.h",
> line 52:     Where: Instantiated from
> itk::LabelImageToStatisticsLabelMapFilter<itk::Image<unsigned
> char, 3>, itk::Image<unsigned char, 3>,
> itk::LabelMap<itk::StatisticsLabelObject<unsigned
> char, 3>>>::GenerateData().
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3-lib/Insight/Code/Common/itkObjectFactory.h",
> line 52:     Where: Instantiated from
> itk::DoCenteredInitialization<itk::Image<float, 3>,
> itk::Image<float, 3>,
> itk::VersorRigid3DTransform<double>,
> itk::CenteredVersorTransformInitializer<itk::Image<float,
> 3>, itk::Image<float,
> 3>>>(itk::SmartPointer<itk::Image<float,
> 3>>&, itk::SmartPointer<itk::Image<float,
> 3>>&,
> itk::SmartPointer<itk::SpatialObject<3>>&,
> itk::SmartPointer<itk::SpatialObject<3>>&,
> unsigned, unsigned, std::string &).
> "/ufsbckp/head-64-slicer/studio.ex-apache/Slicer3/Applications/CLI/BRAINSTools/BRAINSCommonLib/BRAINSFitHelper.cxx",
> line 706:     Where: Instantiated from
> non-template code.
> 1 Error(s) and 1 Warning(s) detected.
> gmake[6]: ***
> [Applications/CLI/BRAINSTools/BRAINSCommonLib/CMakeFiles/BRAINSCommonLib.dir/BRAINSFitHelper.cxx.o]
> Error 2
> 
> 
> 
>       
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information
> visit:
> http://kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
> 


      


More information about the Insight-developers mailing list