# Loading data in Slicer from terminal

**URL:** <https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912>\
**Category:** Support\
**Created:** [June 1, 2021, 8:58pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912 "2021-06-01T20:58:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbillah](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tbillah/32/4139_2.png) [@tbillah](https://discourse.slicer.org/u/tbillah)\
**Post date:** [June 1, 2021, 8:58pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/1 "2021-06-01T20:58:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2021, 1:33pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/2 "2021-06-02T13:33:00Z")

</div>

3 posts were split to a new topic: [Using native file dialog for selecting files and folders](https://discourse.slicer.org/t/using-native-file-dialog-for-selecting-files-and-folders/17926)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2021, 1:36pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/4 "2021-06-02T13:36:50Z")

</div>

A post was merged into an existing topic: [Using native file dialog for selecting files and folders](https://discourse.slicer.org/t/using-native-file-dialog-for-selecting-files-and-folders/17926/3)

---

<div class="post-metadata">

**Author:** ![Andinet\_Enquobahrie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/andinet_enquobahrie/32/75_2.png) [@Andinet\_Enquobahrie](https://discourse.slicer.org/u/Andinet_Enquobahrie)\
**Post date:** [June 2, 2021, 10:18am UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/5 "2021-06-02T10:18:05Z")

</div>

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

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

```

or

```auto
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](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html)

HTH  
Andinet

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2021, 11:10am UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/6 "2021-06-02T11:10:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tbillah](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tbillah/32/4139_2.png) [@tbillah](https://discourse.slicer.org/u/tbillah)\
**Post date:** [June 2, 2021, 3:21pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/7 "2021-06-02T15:21:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tbillah](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tbillah/32/4139_2.png) [@tbillah](https://discourse.slicer.org/u/tbillah)\
**Post date:** [June 2, 2021, 3:22pm UTC](https://discourse.slicer.org/t/loading-data-in-slicer-from-terminal/17912/8 "2021-06-02T15:22:47Z")

</div>

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