Loading data in Slicer from terminal

In fsleyes I can load data from the terminal:

fsleyes img1.nii.gz img2.nii.gz

Can I do a similar thing with Slicer? I am asking because it is a little difficult to navigate to my required directory from within the GUI.

3 posts were split to a new topic: Using native file dialog for selecting files and folders

A post was merged into an existing topic: Using native file dialog for selecting files and folders

Dear @tbillah

When you run your Slicer executable you can pass a python code to load the data during start time. something like the following

Slicer.exe --python-code "slicer.util.loadVolume('/full/path/to/img1.nii.gz')

or

Slicer.exe /full/path/to/img1.nii.gz

Also, you can do something similar from within the Slicer application using the python terminal

You might want to refer the Script repository for more information

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html

HTH
Andinet

2 Likes

I usually drag-and-drop data into the application window and hit Enter to open it. Do you have any suggestion how to make opening a file easier?

1 Like

Andient, this is amazing. I have been able to load multiple images from the terminal even with relative paths.

Thanks, I forgot the drag and drop feature. Andinet’s command line suggestion is the best for me. I don’t have anymore suggestion.