Automatic centerline

You can have a look at the source code of this module, it is a pure Python script. You can either cop-paste just the parts that you need into your current script or use the code as is.

If you want to use the entire module as is, then you need to use Slicer’s virtual Python environment, but you need to use some Python environment anyway, so why not use Slicer’s? You can pip install any Python packages into it the same way as into any other. The Python environment is available without showing any GUI, so you can run your Python script with Slicer --no-main-window --python-script path/to/myscript.py as you would do it with python path/to/myscript.py in another Python environment.

There are Slicer docker images that you can use (you may need to add a step to install SlicerVMTK, but probably that’s all), so it all becomes a single command on the command-line. You can also run Slicer as a web service, so that you can use any of its features remotely, from a web or mobile application via a REST API. If you are developing a desktop application then probably you could save enormous amount of software development, maintenance, and support time by building your application based on Slicer (replacing the top-level GUI with your custom UI layer - this is how most companies develop their Slicer-based medical imaging products).

Also note that automated processing workflows can never guarantee 100% success rate. In medical applications, the typical target for automated processing success rate is 95% because there are always variability between patients, in imaging, etc. In some cases, maybe you can achieve 99%. But you cannot afford to errors slip through for a few percent of your patients. Therefore, you always need a GUI (for approval/quality assurance) and a way to manually correct those 5% of cases where automation does not provide perfect results.

1 Like