Slicer can now be run from a portable drive (external drive, USB stick), along with all extensions, Python packages, settings, DICOM database, etc. - without installation. This can be used for easy distribution of Slicer to users, for example to be used as a free DICOM viewer for a folder full of DICOM files, or handing out preconfigured Slicer instance for a training course (see this related request). Since cache directory can be made local, too, the cache can be prepopulated with sample data sets, therefore the application does not need to access the internet for downloading them.
The feature is available in latest Slicer Preview Release. Updated documentation describes the exact rules how the application finds local and common settings. Implementation details are available here.
Example: How to set up Slicer as a portable viewer for a folder of DICOM files
By default, common settings (such as view settings, DICOM database folder location, various module preferences) are still taken from the user profile folder by default:
x:\myfolder\Slicer 4.13.0-2021-01-05>Slicer.exe --settings-path | more
c:/Users/andra/AppData/Roaming/NA-MIC/Slicer.ini
But if Slicer.ini file is copied to the Slicer home folder (including the organization subfolder NA-MIC) then Slicer will use this local settings file instead:
x:\myfolder\Slicer 4.13.0-2021-01-05>copy C:\Users\andra\AppData\Roaming\NA-MIC\Slicer.ini NA-MIC\Slicer.ini
1 file(s) copied.
x:\myfolder\Slicer 4.13.0-2021-01-05>Slicer.exe --settings-path | more
x:\myfolder\Slicer 4.13.0-2021-01-05/NA-MIC/Slicer.ini
After this local settings file is created, all changes in settings are recorded in this file. All paths that are specified relative to the application home folder will be kept as relative folders.
To change DICOM database to a local folder (that is portable along with the application), go to DICOM module, click “Database location”, a choose a folder that you created within the application home folder (for example, x:\myfolder\Slicer 4.13.0-2021-01-05/dicomdb
). This change will be stored in the local Slicer.ini file, with a relative path:
[General]
DatabaseDirectory_0.6.3=dicomdb
Similarly, other absolute paths in Slicer.ini and Slicer-NNN.ini can be changed to relative paths (they will be resolved using the current application home folder as a basis).
After this, add DICOM images to the local DICOM database using DICOM module -> “Import DICOM files” button. Make sure to set “Import Directory Mode” -> Copy.