In this situation, how can I make Slicer recognize modules like SlicerIGSIO-D, SlicerIGT-D and ETC ?
*(following option A) I try to find ‘SlicerWithMyExtension’ following the Developer guide for extesion but I can’t
*(following option B) Moreover, I try to add the path to ‘Application setting’ but I could not find ‘qt-scripted-modules’ in ‘C:\D\SlicerIGSIO-D\lib\Slicer-5.5’ instruted in Developer guide
Should the extension module be included in the Slicer build process, or can it be separately built and then included?
The shell script below is and example of what I use when working with an extension that includes multiple c++ and python shared and loadable modules. This is for mac, but something similar should work on windows.
When I am debugging multiple extensions with third-party libraries, I combine the AdditionalLauncherSettings.ini files from each of the extensions into a single one, and launch Slicer/VisualStudio with that file (--launcher-additional-settings GeneratedAdditionalSettings.ini).
I created a python script to combine the files (copied here), but you can copy and paste to merge the ini together manually.
You also still need to include --additional-module-paths when launching Slicer, pointing to the qt-loadable-modules/Debug, qt-scripted-modules and cli-modules/Debug for each of the extensions.
Then I made a python code the to run Slicer with .ini setting
automatically consider additional path setting
import subprocess
import configparser
paths = []
config = configparser.ConfigParser()
config.read('C:/D3/S/GeneratedSuperAdditionalLauncherSettings.ini')
# Check if the 'Paths' section exists in the INI file
if 'Paths' in config:
paths_section = config['PYTHONPATH']
# Get all the keys in the 'Paths' section
path_keys = paths_section.keys()
# Iterate through the keys and print the corresponding values
for key in path_keys:
if key != 'size': # Exclude the 'size' key
path_value = paths_section[key]
paths.append(path_value)
command = [
"C:/D3/SR/Slicer-build/Slicer.exe",
"--launcher-additional-settings",
"C:/D3/S/GeneratedSuperAdditionalLauncherSettings.ini",
"--additional-module-paths",
]+paths
subprocess.run(command)