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

MacOS brew ITK compilation error #654

Closed
robbietuk opened this issue Aug 10, 2020 · 4 comments · Fixed by #791
Closed

MacOS brew ITK compilation error #654

robbietuk opened this issue Aug 10, 2020 · 4 comments · Fixed by #791

Comments

@robbietuk
Copy link
Collaborator

robbietuk commented Aug 10, 2020

Related to #531, but possibly seperate

STIR ITK (via HomeBrew) install issue. Setting a clean directory to build in allows for cmake configeration and generation (work around for #531's issue). However, the make fails on:

[  8%] Building CXX object src/IO/CMakeFiles/IO.dir/ITKImageInputFileFormat.cxx.o
/Users/roberttwyman/bin/STIR/STIR/src/IO/ITKImageInputFileFormat.cxx:513:69: error: no member named 'VECTOR' in 'itk::ImageIOBase'
      if (reader->GetImageIO()->GetPixelType() != itk::ImageIOBase::VECTOR) {
                                                  ~~~~~~~~~~~~~~~~~~^
1 error generated.
make[2]: *** [src/IO/CMakeFiles/IO.dir/ITKImageInputFileFormat.cxx.o] Error 1
make[1]: *** [src/IO/CMakeFiles/IO.dir/all] Error 2
make: *** [all] Error 2
@rijobro
Copy link
Collaborator

rijobro commented Aug 10, 2020

Brew ITK is now v5 (see here), and I think STIR normally requires v4. I wonder if that could be causing you problems.

@robbietuk
Copy link
Collaborator Author

@rijobro Ahh thank you. I installed ITK v4.13 manually allowing for STIR with ITK installation. Brew does not seem to allow ITK v4 to be installed.

@KrisThielemans
Copy link
Collaborator

Actually, we should keep up with ITK. I'm sure it worked fine with ITK 5.0, so I guess it's something recently introduced.

Having a look at itk::ImageBaseIO, this seems to be caused by an update that made it in ITK 5.1
InsightSoftwareConsortium/ITK@0dd31a6. Code before that used an ordinary enum, while since then there's some strongly-typed enum stuff. However, from here I'd expected that the code should be backwards compatibly, unless ITK_LEGACY_REMOVE is defined. It's possible that the brew version was configured that way of course (although that would be quite naughty).

In any case, it seems we need to check ITK version and have preprocessor stuff to use the new behaviour from 5.1 onwards.

@KrisThielemans
Copy link
Collaborator

Looks like we should use ITK_VERSION_MAJOR and ITK_VERSION_MINOR
https://github.com/InsightSoftwareConsortium/ITK/blob/c2b399eef1248465a848a26231de66a8c9715132/Modules/Core/Common/src/itkConfigure.h.in#L164-L166

and probably itk::ImageIOBase::IOPixelEnum::VECTOR

KrisThielemans added a commit to KrisThielemans/STIR-1 that referenced this issue Jan 8, 2021
ITK 5.1 introduced a typed-enum IOPixelEnum

Fixes UCL#654
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

Successfully merging a pull request may close this issue.

3 participants