Module executable file

Hi everyone,

I developed a python scriped module using the Extension Wizard module in 3D Slicer (4.13.0) which takes as inputs the PatientID and a 3D volume. The module is running when the user clicks on the “Run” button.
Is it possible to convert the module into an executable file to run the module on another PC without sharing the source code?

Thank you in advance.

I believe for that you’d need to port your source code to C++, and if you want to move away from the open-source paradigm, then you won’t want the “download Slicer, install extension via extension manager” steps either, so maybe a Slicer custom app would be the best way to go.

Hello,

Thank you very much for your suggestion, it’s what I am looking for!

I looked into this tutorial SlicerCAT: Creating custom applications based on 3D Slicer - Kitware Blog and followed the build instructions available in 3D Slicer documentation Build Instructions — 3D Slicer documentation.

I’m having the same problem as Problem in building SlicerCustomAppTemplate - #5 by Pooja_Virkar : there is no file in the Slicer-build directory, so I couldn’t run /Slicer-build/Slicer.exe. I didn’t understand what was done to solve it, could you please explain it to me?

I managed to get the executable file but the DICOM module was not loaded although it was enabled at the cmakefile.txt

Enable Slicer built-in modules

set(Slicer_QTLOADABLEMODULES_ENABLED
)
set(Slicer_QTSCRIPTEDMODULES_ENABLED
DICOM
DICOMLib
DICOMPatcher
DICOMPlugins
)

And I’m getting the following error loading the scripted module:

for patient in slicer.dicomDatabase.patients():

AttributeError: module ‘slicer’ has no attribute ‘dicomDatabase’

Am I doing something wrong? I would appreciate some help. Thanks.

You need to go to the DICOM module at least once to ensure that a valid DICOM database is created.

But I can’t go to the DICOM module

Maybe there was any problem during the build? I didn’t get any error message…

Have you had any build errors? If not then you may have disabled DICOM support in your CMake files (CMakeLists.txt an *.cmake files) in your custom application source code.

Hi Andras, thank you for your response. Now I manage to get the DICOM module but I’m still getting the same error. I don’t understand why because from python interaction the application finds the DICOM database.

It is possible you are trying to access it too early. Maybe do some of the setup in the module widget’s setup function. Or connect a slot to the startupCompleted signal and do it there. To connect:

slicer.app.connect("startupCompleted()", self.onStartupCompleted)

Thank you very much! It solved my problem!

I have another question: I added to the ElastixParameterSetDatabase file a specific preset to be used in the registration. Should I re-build the project to compile the new preset?
Thanks

Can you please create a new topic for easier discoverability? If we discuss more, unrelated questions in the same thread people won’t have the chance to find it if they have the same issue…

1 Like