OAI_analysis_2 icon indicating copy to clipboard operation
OAI_analysis_2 copied to clipboard

Update to ITK 5.4.x

Open dzenanz opened this issue 1 year ago • 1 comments

The current ITK from PyPI is missing libtbb on Linux, see ITK#4713. We want to switch to the newer version of ITK/Cuberille as soon as this is fixed, in order to clean up the CI.

dzenanz avatar Dec 19 '24 17:12 dzenanz

Current failure message:

(.venv) dzenan@corista:~/OAI/OAI_analysis_2$ pytest
===================================================================== test session starts ======================================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/dzenan/OAI/OAI_analysis_2
configfile: pyproject.toml
collected 8 items                                                                                                                                              

test/test_all.py F....                                                                                                                                   [ 62%]
test/test_mesh_processing.py F..                                                                                                                         [100%]

=========================================================================== FAILURES ===========================================================================
____________________________________________________________ TestOAIAnalysis.test_MeshThicknessCPU _____________________________________________________________

self = <test.test_all.TestOAIAnalysis testMethod=test_MeshThicknessCPU>

    def test_MeshThicknessCPU(self):
        input_image = itk.imread(self.data / "colab_case" / "image_preprocessed.nii.gz", itk.D)
        atlas_image = self.analysis_object.atlas_image
    
        correct_FC_segmentation = itk.imread(self.data / "colab_case" / "FC_probmap.nii.gz", itk.D)
        correct_TC_segmentation = itk.imread(self.data / "colab_case" / "TC_probmap.nii.gz", itk.D)
    
        inner_mesh_fc_atlas = mp.read_vtk_mesh(
            atlases_dir() / "atlas_60_LEFT_baseline_NMI/atlas_FC_inner_mesh_LPS.ply")
        inner_mesh_tc_atlas = mp.read_vtk_mesh(
            atlases_dir() / "atlas_60_LEFT_baseline_NMI/atlas_TC_inner_mesh_LPS.ply")
    
        def deform_probmap(phi_AB, image_A, image_B, prob_map):
            interpolator = itk.LinearInterpolateImageFunction.New(image_A)
            warped_image = itk.resample_image_filter(prob_map,
                transform=phi_AB,
                interpolator=interpolator,
                size=itk.size(image_B),
                output_spacing=itk.spacing(image_B),
                output_direction=image_B.GetDirection(),
                output_origin=image_B.GetOrigin()
            )
            return warped_image
    
        phi_AB = self.analysis_object.register(input_image)
    
        warped_image_FC = deform_probmap(phi_AB, input_image, atlas_image, correct_FC_segmentation)
        warped_image_TC = deform_probmap(phi_AB, input_image, atlas_image, correct_TC_segmentation)
    
>       fc_mesh_itk = mp.get_mesh_from_probability_map(warped_image_FC)

test/test_all.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
oai_analysis/mesh_processing.py:379: in get_mesh_from_probability_map
    mesh = itk.cuberille_image_to_mesh_filter(image,
../.venv/lib/python3.10/site-packages/itk/support/lazy.py:138: in __getattribute__
    base.itk_load_swig_module(module, namespace)
../.venv/lib/python3.10/site-packages/itk/support/base.py:130: in itk_load_swig_module
    l_module = loader.load(swig_module_name)
../.venv/lib/python3.10/site-packages/itk/support/base.py:289: in load
    l_spec.loader.exec_module(l_module)  # pytype: disable=attribute-error
<frozen importlib._bootstrap_external>:883: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    # This file was automatically generated by SWIG (https://www.swig.org).
    # Version 4.3.0
    #
    # Do not make changes to this file unless you know what you are doing - modify
    # the SWIG interface file instead.
    
    from sys import version_info as _swig_python_version_info
    # Import the low-level C/C++ module
    if __package__ or "." in __name__:
>       from . import _CuberillePython
E       ImportError: libtbb.so.12: cannot open shared object file: No such file or directory

../.venv/lib/python3.10/site-packages/itk/CuberillePython.py:10: ImportError
--------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------
WARNING: CUDA NOT AVAILABLE, FALLING BACK TO CPU
fixed range 0.0 1.0
moving range -0.021886727 0.86295754
________________________________________________________________________ test_get_mesh _________________________________________________________________________

    def test_get_mesh():
        test_prob_filepath = data_dir() / "colab_case" / "TC_probmap.nii.gz"
        image = itk.imread(test_prob_filepath)
>       mesh = mp.get_mesh_from_probability_map(image)

test/test_mesh_processing.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
oai_analysis/mesh_processing.py:379: in get_mesh_from_probability_map
    mesh = itk.cuberille_image_to_mesh_filter(image,
../.venv/lib/python3.10/site-packages/itk/support/lazy.py:138: in __getattribute__
    base.itk_load_swig_module(module, namespace)
../.venv/lib/python3.10/site-packages/itk/support/base.py:130: in itk_load_swig_module
    l_module = loader.load(swig_module_name)
../.venv/lib/python3.10/site-packages/itk/support/base.py:289: in load
    l_spec.loader.exec_module(l_module)  # pytype: disable=attribute-error
<frozen importlib._bootstrap_external>:883: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    # This file was automatically generated by SWIG (https://www.swig.org).
    # Version 4.3.0
    #
    # Do not make changes to this file unless you know what you are doing - modify
    # the SWIG interface file instead.
    
    from sys import version_info as _swig_python_version_info
    # Import the low-level C/C++ module
    if __package__ or "." in __name__:
>       from . import _CuberillePython
E       ImportError: libtbb.so.12: cannot open shared object file: No such file or directory

../.venv/lib/python3.10/site-packages/itk/CuberillePython.py:10: ImportError
======================================================================= warnings summary =======================================================================
test/test_all.py::TestOAIAnalysis::test_MeshThicknessCPU
test/test_all.py::TestOAIAnalysis::test_RegistrationCPU
test/test_all.py::TestOAIAnalysis::test_SegmentationCPU
test/test_all.py::TestOAIAnalysis::test_SegmentationCPU
test/test_all.py::TestImports::test_ImportsCPU
test/test_all.py::TestICONRegistration::test_RegistrationCPU
  You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.

test/test_all.py::TestOAIAnalysis::test_MeshThicknessCPU
test/test_all.py::TestOAIAnalysis::test_MeshThicknessCPU
test/test_all.py::TestOAIAnalysis::test_RegistrationCPU
test/test_all.py::TestOAIAnalysis::test_RegistrationCPU
test/test_all.py::TestICONRegistration::test_RegistrationCPU
test/test_all.py::TestICONRegistration::test_RegistrationCPU
  __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments. To learn more, see the migration guide https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================== short test summary info ====================================================================
FAILED test/test_all.py::TestOAIAnalysis::test_MeshThicknessCPU - ImportError: libtbb.so.12: cannot open shared object file: No such file or directory
FAILED test/test_mesh_processing.py::test_get_mesh - ImportError: libtbb.so.12: cannot open shared object file: No such file or directory
===================================================== 2 failed, 6 passed, 12 warnings in 857.25s (0:14:17) =====================================================
(.venv) dzenan@corista:~/OAI/OAI_analysis_2$

dzenanz avatar Dec 19 '24 17:12 dzenanz