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

fatal error: itkLabelImageGenericInterpolateImageFunction.h: No such file or directory #1353

Open
tillea opened this issue May 4, 2022 · 11 comments

Comments

@tillea
Copy link

tillea commented May 4, 2022

When did the error occur?
[ ] CMake configuration (cmake / ccmake)
[X] Compilation (make)
[ ] Installation (make install)

Build environment

  • OS: Debian (sid)

ANTs version
2.3.5

Build configuration and logs
A full build log can be found in the Debian CI

In file included from /builds/med-team/ants/debian/output/source_dir/Examples/antsRegistrationTemplateHeader.cxx:1:
/builds/med-team/ants/debian/output/source_dir/Examples/antsRegistrationTemplateHeader.h:21:10: fatal error: itkLabelImageGenericInterpolateImageFunction.h: No such file or         directory
   21 | #include "itkLabelImageGenericInterpolateImageFunction.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [Examples/CMakeFiles/antsUtilities.dir/build.make:93: Examples/CMakeFiles/antsUtilities.dir/antsRegistrationTemplateHeader.cxx.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /builds/med-team/ants/debian/output/source_dir/Examples/antsRegistration2DDouble.cxx:1:
/builds/med-team/ants/debian/output/source_dir/Examples/antsRegistrationTemplateHeader.h:21:10: fatal error: itkLabelImageGenericInterpolateImageFunction.h: No such file or         directory        
   21 | #include "itkLabelImageGenericInterpolateImageFunction.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [Examples/CMakeFiles/antsUtilities.dir/build.make:107: Examples/CMakeFiles/antsUtilities.dir/antsRegistration2DDouble.cxx.o] Error 1
@cookpa
Copy link
Member

cookpa commented May 4, 2022

I think you need some additional modules in your ITK build

-DModule_MGHIO:BOOL=ON
-DModule_ITKReview:BOOL=ON
-DModule_GenericLabelInterpolator:BOOL=ON
-DModule_AdaptiveDenoising:BOOL=ON

@tillea
Copy link
Author

tillea commented May 5, 2022

I've rebuild the Debian package of ITK by setting:

diff --git a/debian/rules b/debian/rules
index d7e186a6..25db386c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -56,7 +56,10 @@ CMAKE_FLAGS = \
        -DModule_ITKVideoBridgeOpenCV:BOOL=OFF \
        -DModule_ITKVideoBridgeVXL:BOOL=OFF \
        -DModule_ITKVtkGlue:BOOL=OFF \
+       -DModule_MGHIO:BOOL=ON \
        -DModule_ITKReview:BOOL=ON \
+       -DModule_GenericLabelInterpolator:BOOL=ON \
+       -DModule_AdaptiveDenoising:BOOL=ON \
        -DVCL_INCLUDE_CXX_0X:BOOL=ON \
        -DITK_USE_SYSTEM_SWIG:BOOL=ON \
        -DITK_USE_SYSTEM_CASTXML:BOOL=ON \

but the header file in question was not created. The ants build fails with the same issue. The ITK version that is packaged for Debian is 5.2.1.
Kind regards, Andreas.

@cookpa
Copy link
Member

cookpa commented May 5, 2022

I'm sorry this is proving difficult, many package developers have had similar problems because ANTs is quite tightly coupled to the ITK version indicated in the Superbuild.

Separately of versioning, ANTs definitely needs the generic label interpolator. I don't know why it's not working when the flag is set.

SuperSandro2000 pushed a commit to NixOS/nixpkgs that referenced this issue Aug 29, 2022
Enable MGHIO, GenericLabelInterpolator, and AdaptiveDenoising ITK modules,
which are required by current versions of ANTs (e.g. 2.3.5 and 2.4.0);
see, e.g., ANTsX/ANTs#1353 (comment),
the Gentoo ANTs package, or the ANTs SuperBuild itself.
Updating ANTs will, in particular, allow removal of itk4 and vtk_7 from Nixpkgs.
Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
current in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.
@zc08
Copy link

zc08 commented Sep 24, 2022

I encountered the same problem on Ubuntu 22.04.

For me, the problem seems to be related to the ITK_DIR environment variable, which is somehow not properly added to the env argument when calling CMake in setup.py. Thus CMake is unaware of the ITK library.

The problem was resolved by modifying setup.py a bit, adding the -DITK_DIR=<path to ITK installation> (where the ITKConfig.cmake is located) argument to cmake_args in build_extension function.

119     def build_extension(self, ext):
120         setup_py_dir = os.path.dirname(os.path.realpath(__file__))
121         extdir = os.path.join(setup_py_dir, "ants", "lib")
122 
123         cmake_args = [
124             "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
125             "-DPYTHON_EXECUTABLE=" + sys.executable,
126             "-DCMAKE_BUILD_TYPE=Release",
127             "-DITK_DIR={}".format(os.getenv("ITK_DIR")),
128         ]

@gdevenyi
Copy link
Contributor

@zc08 sounds like you're referring to ANTspy not ANTs

@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Mar 2, 2023

@tillea Same problem on other distributions:

What's interesting with NixOS is that they:

  • rely on ITK 5.2.1 for ANTs 2.3.5 and 2.4.0,
  • but fetch two ITK modules directly from GitHub:
    "-DITK_FORBID_DOWNLOADS=ON"
    
      itkGenericLabelInterpolatorSrc = fetchFromGitHub {
        owner = "InsightSoftwareConsortium";
        repo = "ITKGenericLabelInterpolator";
        rev = "2f3768110ffe160c00c533a1450a49a16f4452d9";
        hash = "sha256-Cm3jg14MMnbr/sP+gqR2Rh25xJjoRvpmY/jP/DKH978=";
      };
    
      itkAdaptiveDenoisingSrc = fetchFromGitHub {
        owner = "ntustison";
        repo = "ITKAdaptiveDenoising";
        rev = "24825c8d246e941334f47968553f0ae388851f0c";
        hash = "sha256-deJbza36c0Ohf9oKpO2T4po37pkyI+2wCSeGL4r17Go=";
      };
    
  • and have to make symlinks for them:
        ln -sr ${itkGenericLabelInterpolatorSrc} Modules/External/ITKGenericLabelInterpolator
        ln -sr ${itkAdaptiveDenoisingSrc} Modules/External/ITKAdaptiveDenoising
    

Also, from this NixOS comment:

Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
currently in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.

@tillea
Copy link
Author

tillea commented Mar 2, 2023

Regarding downloading anything in the build process in Debian: That's strictly forbidden. Everything needs to be packaged. If ITK is missing modules these need to be packaged separately (or included in the ITK package).

@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Mar 2, 2023

I know about these Debian rules, but as far as I can understand, ANTs relies on unstable versions of ITK. In the case of Gentoo, packagers ship ITK 5.2.1, but ANTs require specific versions of the ITKGenericLabelInterpolator and ITKAdaptiveDenoising modules, which they have to bundle with ANTs to avoid changing the system-wide ITK version.

If I am not mistaken, you would need a system-wide unstable version of ITK to support ANT's 2.3.5 or 2.4, that is a Git commit instead of a release tag. Currently, ANTs requires InsightSoftwareConsortium/ITK@490b5c6 as indicated in the Superbuild:

set(${proj}_GIT_TAG 490b5c6069a790c2bbc50ece3a578fe1c5cdd50b) # Initialize random seeds for sparse sampling in SyN

Is it OK to ship a specific commit system-wide, instead of a stable release, for the sake of a single package?

Note that ITK 5.3.0 was released on 24 November 2022, but commit InsightSoftwareConsortium/ITK@490b5c6 is even more recent, merged on 4 January 2023, so even upgrading ITK from 5.2.1 to 5.3.0 might not prove sufficient.

@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Mar 2, 2023

Ah, wait, ANTs 2.4.3 (caa60eb) requires ITK 5.3.0 (InsightSoftwareConsortium/ITK@1fc47c7), a stable version, so upgrading ITK to 5.3.0 might be enough for ANTs 2.4.3:

set(${proj}_GIT_TAG 1fc47c7bec4ee133318c1892b7b745763a17d411) # Release 5.3.0

ANTs 2.3.5 (6f13702) requires a specific commit of ITK, InsightSoftwareConsortium/ITK@e21a56d:

set(${proj}_GIT_TAG e21a56d1227c5433066237060368cb4532b8a9d2) # Adaptive denoising module 10/2/2020

Commit InsightSoftwareConsortium/ITK@e21a56d is part of ANTs 5.2.0, 5.2.1 and 5.3.0 as far as I can see, but subsequent commits may have broken compatibility with ANTs 2.3.5 since NixOS need ITK 5.2.1 + specific commits for two modules to build ANTs:

So for both ANTs 2.3.5 and 2.4.3, ITK 5.3.0 should be OK.

@tillea
Copy link
Author

tillea commented Mar 2, 2023 via email

@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Mar 2, 2023

I am still confused because the ITK commit InsightSoftwareConsortium/ITK@e21a56d that is theoretically required and sufficient for ANTs 2.4.3 does not include these two commits that seem to be required by the NixOS build:

Indeed, InsightSoftwareConsortium/ITK@e21a56d predates InsightSoftwareConsortium/ITK@1546a4c which pulled the latest ITK modules between 5.2.1 and 5.3.0:


1. Situation at commit InsightSoftwareConsortium/ITK@e21a56d (required by ANTs 2.3.5)

Modules/Remote/GenericLabelInterpolator.remote.cmake
Lines 47 to 48 in e21a56d

  GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator.git
  GIT_TAG a02cbeaf28cb3d28ac66b9ac651073530eb6ab78

Modules/Remote/AdaptiveDenoising.remote.cmake
Lines 58 to 59 in e21a56d

  GIT_REPOSITORY ${git_protocol}://github.com/ntustison/ITKAdaptiveDenoising.git
  GIT_TAG ef309a1f050a2f7b1102f5024cf4997cd284266b

2. Situation at commit InsightSoftwareConsortium/ITK@1546a4c (pulls the ITK modules required by NixOS on top of InsightSoftwareConsortium/ITK@e21a56d) and InsightSoftwareConsortium/ITK@1fc47c7 (ITK release tag 5.3.0 and required by ANTs 2.4.3)

Modules/Remote/GenericLabelInterpolator.remote.cmake
Lines 47 to 48 in 1546a4c and 1fc47c7 (release tag 5.3.0)

  GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator.git
  GIT_TAG 2f3768110ffe160c00c533a1450a49a16f4452d9

Modules/Remote/AdaptiveDenoising.remote.cmake
Lines 58 to 59 in in 1546a4c and 1fc47c7 (release tag 5.3.0)

  GIT_REPOSITORY ${git_protocol}://github.com/ntustison/ITKAdaptiveDenoising.git
  GIT_TAG 24825c8d246e941334f47968553f0ae388851f0c

Some investigation still needed...

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

5 participants