Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to build with ITK 5 #277

Open
Morwenn opened this issue Apr 30, 2019 · 2 comments
Open

Failure to build with ITK 5 #277

Morwenn opened this issue Apr 30, 2019 · 2 comments

Comments

@Morwenn
Copy link

Morwenn commented Apr 30, 2019

I'm trying to use Statismo in a project and was in the process of writing Conan recipes to build all the dependencies smoothly. I tried to make Statismo build with ITK 5.0rc01, which is the latest version available so far, but building fails with the following error (I just replaced the directory names for clarity):

[STATISMO_ROOT]/modules/ITK/include/itkStandardImageRepresenter.hxx: In instantiation of ‘itk::StandardImageRepresenter<TPixel, ImageDimension>::StandardImageRepresenter() [with TPixel = itk::Vector<float, 2>; unsigned int ImageDimension = 2]’:
[STATISMO_ROOT]/modules/ITK/include/itkStandardImageRepresenter.h:74:5:   required from ‘static itk::StandardImageRepresenter<TPixel, ImageDimension>::Pointer itk::StandardImageRepresenter<TPixel, ImageDimension>::New() [with TPixel = itk::Vector<float, 2>; unsigned int ImageDimension = 2; itk::StandardImageRepresenter<TPixel, ImageDimension>::Pointer = itk::SmartPointer<itk::StandardImageRepresenter<itk::Vector<float, 2>, 2> >]’
[STATISMO_ROOT]/modules/ITK/examples/itkDeformationModelFitting.cxx:145:61:   required from here
[STATISMO_ROOT]/modules/ITK/include/itkStandardImageRepresenter.hxx:66:20: error: call of overloaded ‘SmartPointer(int)’ is ambiguous
     : m_reference(0) {
                    ^
[ITK_ROOT]/include/ITK-5.0/itkExceptionObject.h:28:0,
                 from [ITK_ROOT]/include/ITK-5.0/itkMacro.h:1347,
                 from [ITK_ROOT]/include/ITK-5.0/itkLightObject.h:21,
                 from [ITK_ROOT]/include/ITK-5.0/itkObject.h:31,
                 from [ITK_ROOT]/include/ITK-5.0/itkCommand.h:21,
                 from [STATISMO_ROOT]/modules/ITK/examples/itkDeformationModelFitting.cxx:42:
[ITK_ROOT]/include/ITK-5.0/itkSmartPointer.h:95:3: note: candidate: itk::SmartPointer<TObjectType>::SmartPointer(itk::SmartPointer<TObjectType>::ObjectType*) [with TObjectType = itk::Image<itk::Vector<float, 2>, 2>; itk::SmartPointer<TObjectType>::ObjectType = itk::Image<itk::Vector<float, 2>, 2>]
   SmartPointer (ObjectType *p) noexcept:
   ^~~~~~~~~~~~
[ITK_ROOT]/include/ITK-5.0/itkSmartPointer.h:83:3: note: candidate: itk::SmartPointer<TObjectType>::SmartPointer(itk::SmartPointer<TObjectType>&&) [with TObjectType = itk::Image<itk::Vector<float, 2>, 2>]
   SmartPointer (SmartPointer<ObjectType > &&p) noexcept :
   ^~~~~~~~~~~~
[ITK_ROOT]/include/ITK-5.0/itkSmartPointer.h:69:13: note: candidate: constexpr itk::SmartPointer<TObjectType>::SmartPointer(std::nullptr_t) [with TObjectType = itk::Image<itk::Vector<float, 2>, 2>; std::nullptr_t = std::nullptr_t]
   constexpr SmartPointer (std::nullptr_t p) noexcept:
             ^~~~~~~~~~~~
[ITK_ROOT]/include/ITK-5.0/itkSmartPointer.h:65:3: note: candidate: itk::SmartPointer<TObjectType>::SmartPointer(const itk::SmartPointer<TObjectType>&) [with TObjectType = itk::Image<itk::Vector<float, 2>, 2>]
   SmartPointer (const SmartPointer& p) noexcept:
   ^~~~~~~~~~~~

Apparently using 0 to initialize a SmartPtr causes an ambiguous overload resolution issue. Now, I'm not really surprised because ITK 5 uses C++11 and the proper way would now be to use nullptr instead of 0. I don't know whether Statismo plans to move to C++11, but it might be required at some point to move to the latest ITK versions. I tried to use an older ITK version to solve the problem, but I would also have to downgrade VXL in the process...

@marcelluethi
Copy link
Member

@Morwenn
Thanks for reporting this. Currently there is almost no activity in the Statismo development from the original authors, as none of us works in C++ projects at the moment. Consequently no effort has been done to make it compatible with newer ITK Versions.

There was, however, an attempt to bring statismo to c++11, which you can find in this PR
#268

I believe this PR would solve many problems. The reason it is not merged yet is because it has not yet been thoroughly tested. Could you give it a try?

@Morwenn
Copy link
Author

Morwenn commented May 3, 2019

I tried to build the experimental C++11 branch of Statismo on top of ITK 5.0rc02 which was released a few days ago, and the problem described above still exists. Additionally some files were probably removed from ITK since including itkTransformToDisplacementFieldSource.h now fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants