Use Julia with Slicer

You actually already have several options to run Julia scripts directly from Slicer as CLI modules.

You can implement CLI modules in any language. For now, you need to create an executable (sh, bat, py, exe,…) launcher the starts your script with Julia. But with a small change in Slicer core, you could implement direct Julia launching capability the same way as Python CLIs. See example here:

If Julia.exe startup time is too slow then you can do the same that we did for Matlab. We implemented a very simple TCP server in Matlab that receives commands from Slicer executes them, and sends back to result to Slicer. See details here:

Slicer also supports the Jupyter kernel protocol, so you can access Slicer features via this interface.

If you want to run Julia inside the Slicer process then it should be possible, too, but much more complicated. Python can be either extended (you load your libraries into Python and let Python execute it) or Python can be embedded (your application instantiates and manages a Python interpreter). We embed Python into Slicer so that we have better control over the application and to keep Python an optional component. Probably the simplest way to integrate Julia in the Slicer application is to embed Julia - if it has this option. You may be able to extend Julia with Slicer, this is how TCL integration worked years ago. For a few years, Slicer extended TCL and embedded Python. You can go back in the version history of Slicer and see how it was implemented.

1 Like