How to configure extension module paths for built Slicer?


I built a Slicer from source and some extension modules. I have the following:

[tb571@pnl-z840-2 Slicer]$ ls build/Slicer-build/Slicer

[tb571@pnl-z840-2 SlicerExtensionsBuild]$ ls *-build/SlicerWith*




Now how do I launch a Slicer knowledgeable of all the extension modules? In contrast, when I download a Slicer, it populated ~/.config/NA-MIC/Extension-28257.ini that had knowledge of all the downloaded modules.

Hi @tbillah -

I find it easiest to just make a shell script that combines the extension builds and scripted modules I need and then I just customize it to add or remove things based on what I’m working on at the moment.


# run this from within build tree


SDKROOT=/Applications/ ${SLICER_BUILD}/Slicer  $* \
  --additional-module-paths \
    ${LIB_PATH}/cli-modules ${LIB_PATH}/qt-loadable-modules ${LIB_PATH}/qt-scripted-modules \
    |& tee /tmp/log
1 Like

So do I get that the above has to be repeated for all extension builds I need? For what it’s worth, inner-build directory exists for SlicerDMRI only. The rest of the modules I attached above follow <name>-build/lib/Slicer-4.13 pattern.

Yes, if you go with the script approach you just set the appropriate lib dir as a variable and then duplicate the lines that add the three paths as needed.

Hi @pieper,

I am trying to load the following modules:


I am launching as you suggested:

[tb571@pnl-z840-2 SlicerExtensionsBuild]$ ~/Downloads/Slicer/build/Slicer-build/Slicer --additional-module-paths `ls -d *-build/lib/Slicer-4.13/cli-modules *-build/lib/Slicer-4.13/qt-loadable-modules *-build/lib/Slicer-4.13/qt-scripted-modules`

However, I find the following errors in one of the log files:

[DEBUG][Qt] 24.12.2020 16:20:35 [] (unknown:0) - Additional module paths ..: MarkupsToModel-build/lib/Slicer-4.13/qt-loadable-modules, SegmentEditorExtraEffects-build/lib/Slicer-4.13/qt-scripted-modules, SlicerFreeSurfer-build/lib/Slicer-4.13/qt-loadable-modules, UKFTractography-build/lib/Slicer-4.13/cli-modules, UKFTractography-build/lib/Slicer-4.13/qt-loadable-modules, UKFTractography-build/lib/Slicer-4.13/qt-scripted-modules
[CRITICAL][Qt] 24.12.2020 16:20:36 [] (unknown:0) -   Error(s):
    The shared library was not found.
[CRITICAL][Qt] 24.12.2020 16:20:36 [] (unknown:0) -   Error(s):
    The shared library was not found.
[CRITICAL][Qt] 24.12.2020 16:20:36 [] (unknown:0) -   Error(s):
    The shared library was not found.

I tried setting the following but didn’t help:

export LD_LIBRARY_PATH=/home/tb571/Qt/5.12.3/gcc_64/lib

I have been trying this for a while so any direction for rescue is appreciated. :innocent:

Extensions that provide additional shared libraries may need not just the module libraries but also additional folders in LibraryPath, Path, and PYTHONPATH. These are listed in the automatically generated AdditionalLauncherSettings.ini file in the extension’s build folder and can be used to launch Slicer with the extension (convenient for debugging and testing). However, if you add multiple extensions then you have other options:

  • Option A: combine content of AdditionalLauncherSettings.ini files of all the extensions that you use, and use that as additional launcher settings for starting Slicer
  • Option B: package each extension and install the extension from file using Slicer’s Extensions Manager.
  • Option C: Use the Slicer Custom Application template to build Slicer and bundle a list of extensions with it.

For development (when you often make small changes to the code and rebuild and run) option A typically works better, while for a custom Slicer setup options B and C may be better, as they robust and fully automatic (no need for manual merging of path lists).

1 Like

Yeah, I intuitively figured Option A from Steve’s idea. Will follow up with my progress.

The challenge I face is to make that Slicer available to everyone else in the lab. Otherwise, Option B would have been desired.

You can also just copy extension files into bin and module folders in the Slicer install tree. There will be an even cleaner solution (where you can copy the extension package contents into a single subfolder in the Slicer install tree and all settings in that subfolder, too), which requires merging of this PR (will happen soon).

You can also just copy extension files into bin and module folders in the Slicer install tree.

Hi Andras, this is a nicer idea. However, this is the download tree I have:

Downloaded slicer
β”œβ”€β”€ bin
β”œβ”€β”€ include
β”œβ”€β”€ lib
β”œβ”€β”€ libexec
β”œβ”€β”€ resources
β”œβ”€β”€ share
└── Slicer

where there is no module folder.

On the other hand, this is part of my build tree and there is neither bin nor module folder:

Built Slicer
[tb571@pnl-z840-2 Slicer]$ tree -L 1 build/
β”œβ”€β”€ BRAINSTools
β”œβ”€β”€ BRAINSTools-prefix
β”œβ”€β”€ bzip2
β”œβ”€β”€ bzip2-build
β”œβ”€β”€ bzip2-install
β”œβ”€β”€ bzip2-prefix
β”œβ”€β”€ CMakeCache.txt
β”œβ”€β”€ CMakeDoxygenDefaults.cmake
β”œβ”€β”€ CMakeFiles
β”œβ”€β”€ cmake_install.cmake
β”œβ”€β”€ CompareVolumes
β”œβ”€β”€ CompareVolumes-prefix
β”œβ”€β”€ CTestCustom.cmake
β”œβ”€β”€ CTestTestfile.cmake
β”œβ”€β”€ CTK
β”œβ”€β”€ CTKAppLauncher-0.1.27-linux-amd64.tar.gz

Could you be more specific about where I should copy these downloaded extension files?

[tb571@grx05 .config]$ tree -L 2 NA-MIC/
β”œβ”€β”€ Extensions-28257
β”‚   β”œβ”€β”€ DiffusionQC
β”‚   β”œβ”€β”€ DiffusionQC-icon.png
β”‚   β”œβ”€β”€ DiffusionQC.s4ext
β”‚   β”œβ”€β”€ MarkupsToModel
β”‚   β”œβ”€β”€ MarkupsToModel-icon.png
β”‚   β”œβ”€β”€ MarkupsToModel.s4ext
β”‚   β”œβ”€β”€ SegmentEditorExtraEffects
β”‚   β”œβ”€β”€ SegmentEditorExtraEffects-icon.png
β”‚   β”œβ”€β”€ SegmentEditorExtraEffects.s4ext
β”‚   β”œβ”€β”€ SlicerDMRI
β”‚   β”œβ”€β”€ SlicerDMRI-icon.png
β”‚   β”œβ”€β”€ SlicerDMRI.s4ext
β”‚   β”œβ”€β”€ UKFTractography
β”‚   β”œβ”€β”€ UKFTractography-icon.png
β”‚   └── UKFTractography.s4ext
β”œβ”€β”€ Slicer-28257.ini