# sitkUtils.PullVolumeFromSlicer makes Slicer crash

**URL:** <https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781>\
**Category:** Development\
**Tags:** bug\
**Created:** [January 12, 2020, 1:11pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781 "2020-01-12T13:11:23Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 7, 2020, 10:34pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/41 "2020-02-07T22:34:25Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![blowekamp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/blowekamp/32/1386_2.png) [@blowekamp](https://discourse.slicer.org/u/blowekamp)\
**Post date:** [February 11, 2020, 3:05pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/42 "2020-02-11T15:05:49Z")

</div>

> [@pieper](#):
>
> I used the same build flags as before

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](https://github.com/blowekamp/Slicer/tree/SimpleITKUseDefaultVisibility) in Debug mode (with SimpleITK shared libraries the default options), initially I got an ITK compilation error:

```auto
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.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 11, 2020, 6:38pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/43 "2020-02-11T18:38:13Z")

</div>

> [@blowekamp](#):
>
> I am not sure what additional changes you had.

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

> [@blowekamp](#):
>
> I believe this is the solution, we just need to get ITK and SimpleITK in sync.

So that means this PR then: [modfying opacity in the listing of models does not work · Issue #1324 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/1324)

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?).

---

<div class="post-metadata">

**Author:** ![blowekamp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/blowekamp/32/1386_2.png) [@blowekamp](https://discourse.slicer.org/u/blowekamp)\
**Post date:** [February 11, 2020, 6:59pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/44 "2020-02-11T18:59:11Z")

</div>

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.

> **[blowekamp/SimpleITK](https://github.com/blowekamp/SimpleITK/tree/slicer-vv1.2.4-2020-02-07-777520bd)**
>
> Contribute to blowekamp/SimpleITK development by creating an account on GitHub.

The branch just needs to be in [Slicer’s SimpleITK fork](https://github.com/Slicer/SimpleITK). Then we will not need to change the current ITK in Slicer is using.

---

<div class="post-metadata">

**Author:** ![blowekamp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/blowekamp/32/1386_2.png) [@blowekamp](https://discourse.slicer.org/u/blowekamp)\
**Post date:** [February 13, 2020, 4:16pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/45 "2020-02-13T16:16:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 13, 2020, 4:31pm UTC](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781/46 "2020-02-13T16:31:58Z")

</div>

Confirmed SimpleFilters is also working now on my local build 👍 Thanks @blowekamp!

[Previous page](https://discourse.slicer.org/t/sitkutils-pullvolumefromslicer-makes-slicer-crash/9781.md?page=2)
