How to update Slicer's Python version from 3.6.7 to 3.7?

Hi, is there a way to upgrade my Slicer’s (v. 4.11) Python version from 3.6.7 to 3.7 (or newer) without updating the slicer itself? I would like to use skimage’s skimage.segmentation.expand_labels() function and it requires Python version 3.7 or higher. Thank you!

Updating the Python version is something we’ve been tracking for awhile now at Update Python version from 3.6.7 to 3.10 · Issue #5014 · Slicer/Slicer · GitHub. Since some python packages are already dropping support for Python 3.7, plans are to upgrade to one of the most recent versions Python.

@jcfr Do you or others at Kitware have this scheduled for work soon? I assume it will be completed as part of Update VTK9 to the latest master · Issue #5956 · Slicer/Slicer · GitHub.

1 Like

We’ll update Slicer’s Python, but if your main motivation is to use skimage then you don’t need to wait for that update. skimage is OK for really basic stuff, but you need much more if you work biomedical images.

For example, this skimage.segmentation.expand_labels function takes a single distance value in pixels. This is completely unusable for medical imaging, where images are most often 3D and have anisotropic spacing. If a label expansion filter only supports expansion by the same distance in all directions (which may make sense) then that distance must be specified in physical distance unit, not in pixels.

I would recommend to use SimpleITK for image processing, as it exposes most ITK features with a nice Pythonic interface. Latest version of SimpleITK is already bundled with Slicer. ITK-Python packages may work in Slicer, too (it is a different Python wrapping of ITK).

1 Like

Thank you @lassoan for your suggestions! I will definitely take a look at SimpleITK.