sitkUtils.PullVolumeFromSlicer makes Slicer crash

Hmm, well I rebuilt with the referenced ITK and SimpleITK and didn’t get any build errors, but when I try to run it says I can’t import SimpleITK. I used the same build flags as before.

Switch to module:  "SimpleFilters"
Traceback (most recent call last):
  File "/s/python-install/lib/python3.6/site-packages/SimpleITK/SimpleITK.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/s/python-install/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'SimpleITK._SimpleITK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/s/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/SimpleFilters.py", line 83, in __init__
    import SimpleITK as sitk
  File "/s/python-install/lib/python3.6/site-packages/SimpleITK/__init__.py", line 1, in <module>
    from .SimpleITK import *
  File "/s/python-install/lib/python3.6/site-packages/SimpleITK/SimpleITK.py", line 17, in <module>
    _SimpleITK = swig_import_helper()
  File "/s/python-install/lib/python3.6/site-packages/SimpleITK/SimpleITK.py", line 16, in swig_import_helper
    return importlib.import_module('_SimpleITK')
  File "/s/python-install/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_SimpleITK'
qSlicerPythonCppAPI::instantiateClass  - [ "SimpleFiltersWidget" ] - Failed to instantiate scripted pythonqt class "SimpleFiltersWidget" 0x7fcc110eae68

I am not sure what additional changes you had.

I have done a clean build in Debug and Release, and SimpleITK with SimpleFilters, and the test pass for me.

When I cleanly built the branch in Debug mode (with SimpleITK shared libraries the default options), initially I got an ITK compilation error:

Undefined symbols for architecture x86_64:
  "itk::TransformBaseTemplate<double>::TransformBaseTemplate()", referenced from:
      itk::Transform<double, 4u, 4u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 3u, 3u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 2u, 2u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 3u, 2u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
  "itk::TransformBaseTemplate<double>::~TransformBaseTemplate()", referenced from:
      itk::Transform<double, 4u, 4u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 4u, 4u>::~Transform() in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 3u, 3u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 3u, 3u>::~Transform() in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 2u, 2u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 2u, 2u>::~Transform() in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      itk::Transform<double, 3u, 2u>::Transform(unsigned long) in itkTransformFactoryBaseRegisterDoubleParameters.cxx.o
      ...

But then I reverted to the current ITK branch ( and removed the MeanImageFilter from SimpleITK). And the build completed OK.

I believe this is the solution, we just need to get ITK and SimpleITK in sync.

I was referring to the instantiation and visibility flags we’d been discussing above.

So that means this PR then: modfying opacity in the listing of models does not work · Issue #1324 · Slicer/Slicer · GitHub

I agree with the comment from @lassoan that it would be cleaner and less confusing if the changes could be in a tagged ITK version. (Could it be ITK v5.1rc02?).

The ITK version does not need to be updated.

I have a dangling branch of SimpleITK which cherry picked the needed change in SimpleITK to get it working with Slicer.

The branch just needs to be in Slicer’s SimpleITK fork. Then we will not need to change the current ITK in Slicer is using.

This patch was merged, and the SimpleFilters module works in the current Slicer nightly build.

3 Likes

Confirmed SimpleFilters is also working now on my local build :+1: Thanks @blowekamp!

2 Likes