Launching Slicer with only Slicelet displayed on mac

Hi All,

I’m trying to launch Slicer with just a single module on Mac. Would the steps here work with Mac as well? Has anybody tried this? I tried a few things, but couldn’t get it to work.

My aim is to let my user click on ‘ModulName.app’ and show the module with ModuleName with only necessary GUI components of Slicer. I’ve been able to do this on Windows, but we would like to have a version for Mac as well.

Thank you!
HIna

I’ve never tried the settings approach, but it should work the same on mac as anywhere else. Another option is to remove the files related to modules you don’t want to load. There’s also the CustomSlicerGenerator although I haven’t used it in a while. Of course, building your own SlicerCAT is the most powerful approach.

Thanks Steve! I think SlicerCAT is too much work for the simple single module that I’m trying to create.

These are the steps that I followed for my scripted module

  • Copy the ModuleName.py and ModuelName.ui in Slicer.app/Contents/lib/Slicer-4.13/qt-scripted-modules and Slicer.app/Contents/lib/Slicer-4.13/qt-scripted-modules/Resources/UI respectively
  • Make a copy of bin/SlicerLauncherSettings.ini and rename it to ModuleNameLauncherSettings.ini
  • Make edits in ModuleNameLauncherSettings.ini as:

[General]
additionalSettingsFilePath=<APPLAUNCHER_SETTINGS_DIR>/SlicerLauncherSettings.ini
additionalSettingsExcludeGroups=General,Application,ExtraApplicationToLaunch
launcherNoSplashScreen=false
launcherSplashImagePath=<APPLAUNCHER_DIR>/bin/Slicer-SplashScreen.png
launcherSplashScreenHideDelayMs=3000
additionalLauncherHelpShortArgument=-h
additionalLauncherHelpLongArgument=–help
additionalLauncherNoSplashArguments=–no-splash,–help,–version,–home,–program-path,–no-main-window,–settings-path,–temporary-path

[Application]

path=<APPLAUNCHER_DIR>/bin/ModuleName
arguments=–python-code “slicer.util.selectModule(‘ModuleName’)”
name=ModuleName
revision=29738
organizationDomain=www.na-mic.org
organizationName=NA-MIC

[ExtraApplicationToLaunch]

  • Rename Contents/MacOS/Slicer to Contents/MacOS/ModuleName

I’m confused about the path in the [Application] section of the .ini file, since there’s no bin/Slicer (which is what the original SlicerLauncherSettings.ini file was pointing to), and hence no bin/ModuleName as well.
MacOS packaging works differently, and I’m afraid I need help understanding how things are connected to make this work.

Thank you!
Hina

Slicer accepts the option --modules-to-ignore, from the command line, specifying the list of modules to ignore as ModuleNameA,ModuleNameB,... should allow you to achieve this.

This command line parameter has its equivalent in the revision specific settings file shipped along side the application, on macOS it would be Slicer.app/Contents/www.na-mic.org/Slicer-NNNNN.ini here NNNNN is the slicer revision.

In this file, there is the following:

[Extensions]
....

[Modules]
AdditionalPaths=@Invalid()
IgnoreModules=@Invalid()

Setting IgnoreModules to the list of modules should allow to achieve the desired effect on all platforms.

Updating default settings (e.g home module)

  • Create an empty the file Slicer.app/Contents/www.na-mic.org/Slicer.ini (or equivalent on Linux and Windows)
  • Configure Module settings or any other settings of your choice

The setting found in the install tree will now be used and should allow you to create a zip file on all platform.

Notes about renaming

  • On macOS, you should be able to rename Slicer.app to AnyName.app

  • Since the main application name is hard-coded in the executable at build time, you should not rename the settings files bundled in the package.