Skip to content

Python and MATLAB interface to STIR

Casper da Costa-Luis edited this page Nov 25, 2024 · 1 revision

Since STIR 3.0, we use SWIG to provide an interface to the underlying C++ library. This currently works best with Python, with work-in-progress for MATLAB (see also Installing the MATLAB interface to STIR).

Unfortunately there isn’t yet much documentation on what is available in the Python (or MATLAB) interface. You can use native help to find out about classes etc, but those are currently not documented. (There is some work in SWIG to be able to export the doxygen documentation from the C++ source files to Python, so hopefully this will change in the near feature). Currently you therefore need to look at the C++ class definition to see what each member those. That is of course easiest via the STIR doxygen-generated help, and of course at the examples provided in the examples folder. The STIR exercises use Python so would be useful as well.

You could also have a look at src/swig/stir.i. It’s very ugly currently, but it does tell you what classes are exported (just look at %include).

Also, it’s relatively easy to add something that is missing (which is why we use SWIG).