Slicer qt-loadable-modules as libraries to support other modules

Hello,

for Slicer-Liver, we are thinking about the modularity of the extension. We have a set of components already developed in C++, but would like to have a qt-scripted-module, featuring a single UI, be an entry point for our researchers to interact with and fast-prototype new ideas. We are currently thinking about two designs and would like to hear your opinion about their feasibility and your recommendation.

Single hybrid module

A single qt-scripted-module containing also C++ qtwidgets, logic, nodes, markups, etc., in the same module.

A set of qt-loadable-modules providing the core components + a qt-scripted-module providing the module UI and connecting the components

A set of qt-loadable-modules providing the core components (nodes, markups, qt-widgets, logics, etc.) and a qt-scripted-module that will feature a unified interface and connect the components. The qt-loadable-modules would be used as libraries for the qt-scripted-module, so they will be hidden and won’t have any module interface.

I thank you in advance for your feedback.

I’d say either of those could work fine. I might favor keeping all the C++ code in loadable modules and have only python code in a scriptable module, which I guess is your second option. I suppose it also depends on how many files you will end up with and whether a single module for all of it would get cluttered. Keeping them separate might encourage modularity and reusability.

2 Likes

Thanks @pieper. This is useful for us to decide.

I currently have the same requirement, where there are many core modules written in C++ that need to be associated with a UI written in Python.
Could you share your implementation ideas and some key issues you encountered?

This SlicerLiver code is here, so you can have a look: GitHub - ALive-research/Slicer-Liver: 3D Slicer extension for liver analysis and therapy planning

Thank you very much, I will try to read it. :grinning:

@herryliq Don’t hesitate to reach out if you have specific questions about how we implemented this in SlicerLiver :slight_smile: