InsightSoftwareConsortium / ITKThickness3D

An ITK module to compute 3D thickness
Apache License 2.0
39 stars 18 forks source link

No module named 'itkHelpers' #39

Closed mbrei closed 3 years ago

mbrei commented 3 years ago

Description

With the latest release of itk (version 5.2.0) the BinaryThinningImageFilter3D does not work anymore and fails with a ModuleNotFoundError.

Steps to reproduce

Package versions:

itk==5.2.0
itk-core==5.2.0
itk-filtering==5.2.0
itk-io==5.2.0
itk-numerics==5.2.0
itk-registration==5.2.0
itk-segmentation==5.2.0
itk-thickness3d==5.1.1 

Minimal example:

import itk 

image = itk.imread(<PATH TO A NIFTI FILE>)
skeleton = itk.BinaryThinningImageFilter3D.New(image)

fails with the following error message:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-78328829eebf> in <module>
----> 1 skeleton = itk.BinaryThinningImageFilter3D.New(image)

~/opt/anaconda3/envs/yuri/lib/python3.6/site-packages/itk/support/lazy.py in __getattribute__(self, attr)
     74                     module = self.__belong_lazy_attributes[attr]
     75                     namespace = {}
---> 76                     base.itk_load_swig_module(module, namespace)
     77                     self.loaded_lazy_modules.add(module)
     78                     for k, v in namespace.items():

~/opt/anaconda3/envs/yuri/lib/python3.6/site-packages/itk/support/base.py in itk_load_swig_module(name, namespace)
    108     # if we haven't already.
    109     loader = LibraryLoader()
--> 110     l_module = loader.load(swig_module_name)
    111 
    112     # OK, now the modules on which this one depends are loaded and

~/opt/anaconda3/envs/yuri/lib/python3.6/site-packages/itk/support/base.py in load(self, name)
    257             # since version 3.4: Use importlib.util.find_spec() instead.
    258             l_spec = importlib.util.find_spec(name)
--> 259             l_spec.loader.exec_module(l_module)  # pytype: disable=attribute-error
    260             return l_module
    261         finally:

~/opt/anaconda3/envs/yuri/lib/python3.6/importlib/_bootstrap_external.py in exec_module(self, module)

~/opt/anaconda3/envs/yuri/lib/python3.6/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~/opt/anaconda3/envs/yuri/lib/python3.6/site-packages/itk/support/../Thickness3DPython.py in <module>
     73 import itk.ITKDistanceMapPython
     74 import itk.ITKCommonPython
---> 75 from itk.itkThickness3DPython import *
     76 
     77 

~/opt/anaconda3/envs/yuri/lib/python3.6/site-packages/itk/itkThickness3DPython.py in <module>
    913 
    914 
--> 915 import itkHelpers
    916 @itkHelpers.accept_numpy_array_like_xarray
    917 def binary_thinning_image_filter3_d(*args, **kwargs):

ModuleNotFoundError: No module named 'itkHelpers'

Environment

MacOS, Python 3.6

yliu7366 commented 3 years ago

Having the same problem. Cannot find itkHelpers.py in itk 5.2.0 installation anyway. Tested in the following two settings (Ubuntu and Mac OS). Please solve the problem.

Environment Ubuntu 18.04, Python 3.6 MacOS, Python 3.8

amberhappy commented 3 years ago

same problem too

dzenanz commented 3 years ago

The most likely reason is that this module is built against an older version of ITK which still had itkHelpers.py. That file is now called helpers.py, and it resides in a different directory.

dzenanz commented 3 years ago

New packages are up on PyPI, can you test them?

amberhappy commented 3 years ago

sure, I test the new version on macos, python3.8, it works well now. Thanks!