DGtal-team / DGtalTools

Tools associated with DGtal Library
http://dgtal.org
GNU Lesser General Public License v3.0
44 stars 38 forks source link

concept checking error in itk2vol #390

Closed phcerdan closed 3 years ago

phcerdan commented 4 years ago

The failing concept is from DGtal ITKWriter

Error:

[1/2] Building CXX object converters/CMakeFiles/itk2vol.dir/itk2vol.cpp.o
FAILED: converters/CMakeFiles/itk2vol.dir/itk2vol.cpp.o
In file included from DGtal/src/src/DGtal/base/CPredicate.h:45,
                 from DGtal/src/src/DGtal/kernel/BasicPointPredicates.h:50,
                 from DGtal/src/src/DGtal/kernel/domains/HyperRectDomain.h:49,
                 from DGtal/src/src/DGtal/helpers/StdDefs.h:47,
                 from DGtal/DGtalTools-src/converters/itk2vol.cpp:33:
DGtal/src/src/DGtal/base/CUnaryFunctor.h: In instantiation of ‘DGtal::concepts::CUnaryFunctor<X, A, R>::~CUnaryFunctor() [with X = DGtal::functors::Rescaling<double, unsigned char>; A = double; R = double]’:
/usr/include/boost/concept/detail/general.hpp:39:47:   required from ‘static void boost::concepts::requirement<boost::concepts::failed************ Model::************>::failed() [with Model = DGtal::concepts::CUnaryFunctor<DGtal::functors::Rescaling<double, unsigned char>, double, double>]’
DGtal/src/src/DGtal/io/writers/ITKWriter.h:71:5:   required from ‘struct DGtal::ITKWriter<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, double>, DGtal::functors::Rescaling<double, unsigned char> >’
DGtal/src/src/DGtal/io/writers/GenericWriter.ih:206:62:   required from ‘static bool DGtal::GenericWriter<TContainer, 3, unsigned char, TFunctor>::exportFile(const string&, const TContainer&, const string&, const TFunctor&) [with TContainer = DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, double>; TFunctor = DGtal::functors::Rescaling<double, unsigned char>; std::string = std::__cxx11::basic_string<char>]’
DGtal/DGtalTools-src/converters/itk2vol.cpp:143:69:   required from here
DGtal/src/src/DGtal/base/CUnaryFunctor.h:98:29: error: no matching function for call to ‘sameType(double&, unsigned char)’
   98 |       ConceptUtils::sameType( r, x.operator() ( a ) );
      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from DGtal/src/src/DGtal/base/Common.h:120,
                 from DGtal/DGtalTools-src/converters/itk2vol.cpp:32:
DGtal/src/src/DGtal/base/ConceptUtils.h:117:8: note: candidate: ‘template<class T> void DGtal::concepts::ConceptUtils::sameType(const T&, const T&)’
  117 |   void sameType( const T & /* t1 */, const T & /* t2 */ ) {}
      |        ^~~~~~~~
DGtal/src/src/DGtal/base/ConceptUtils.h:117:8: note:   template argument deduction/substitution failed:
In file included from DGtal/src/src/DGtal/base/CPredicate.h:45,
                 from DGtal/src/src/DGtal/kernel/BasicPointPredicates.h:50,
                 from DGtal/src/src/DGtal/kernel/domains/HyperRectDomain.h:49,
                 from DGtal/src/src/DGtal/helpers/StdDefs.h:47,
                 from DGtal/DGtalTools-src/converters/itk2vol.cpp:33:
DGtal/src/src/DGtal/base/CUnaryFunctor.h:98:29: note:   deduced conflicting types for parameter ‘const T’ (‘double’ and ‘unsigned char’)
   98 |       ConceptUtils::sameType( r, x.operator() ( a ) );
      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
DGtal/src/src/DGtal/base/CUnaryFunctor.h: In instantiation of ‘DGtal::concepts::CUnaryFunctor<X, A, R>::~CUnaryFunctor() [with X = DGtal::functors::Rescaling<int, unsigned char>; A = int; R = int]’:
/usr/include/boost/concept/detail/general.hpp:39:47:   required from ‘static void boost::concepts::requirement<boost::concepts::failed************ Model::************>::failed() [with Model = DGtal::concepts::CUnaryFunctor<DGtal::functors::Rescaling<int, unsigned char>, int, int>]’
DGtal/src/src/DGtal/io/writers/ITKWriter.h:71:5:   required from ‘struct DGtal::ITKWriter<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, int>, DGtal::functors::Rescaling<int, unsigned char> >’
DGtal/src/src/DGtal/io/writers/GenericWriter.ih:206:62:   required from ‘static bool DGtal::GenericWriter<TContainer, 3, unsigned char, TFunctor>::exportFile(const string&, const TContainer&, const string&, const TFunctor&) [with TContainer = DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, int>; TFunctor = DGtal::functors::Rescaling<int, unsigned char>; std::string = std::__cxx11::basic_string<char>]’
DGtal/DGtalTools-src/converters/itk2vol.cpp:160:69:   required from here
DGtal/src/src/DGtal/base/CUnaryFunctor.h:98:29: error: no matching function for call to ‘sameType(int&, unsigned char)’
In file included from DGtal/src/src/DGtal/base/Common.h:120,
                 from DGtal/DGtalTools-src/converters/itk2vol.cpp:32:
DGtal/src/src/DGtal/base/ConceptUtils.h:117:8: note: candidate: ‘template<class T> void DGtal::concepts::ConceptUtils::sameType(const T&, const T&)’
  117 |   void sameType( const T & /* t1 */, const T & /* t2 */ ) {}
      |        ^~~~~~~~
DGtal/src/src/DGtal/base/ConceptUtils.h:117:8: note:   template argument deduction/substitution failed:
In file included from DGtal/src/src/DGtal/base/CPredicate.h:45,
                 from DGtal/src/src/DGtal/kernel/BasicPointPredicates.h:50,
                 from DGtal/src/src/DGtal/kernel/domains/HyperRectDomain.h:49,
                 from DGtal/src/src/DGtal/helpers/StdDefs.h:47,
                 from DGtal/DGtalTools-src/converters/itk2vol.cpp:33:
DGtal/src/src/DGtal/base/CUnaryFunctor.h:98:29: note:   deduced conflicting types for parameter ‘const T’ (‘int’ and ‘unsigned char’)
   98 |       ConceptUtils::sameType( r, x.operator() ( a ) );
      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

It can be reproduced when DGtal option WITH_ITK is enabled.

kerautret commented 3 years ago

Thanks @phcerdan I will have look next week probably

kerautret commented 3 years ago

thanks @phcerdan I reproduce it and have a workaround (just a problem on reading int type from .nii)