# Multiple node export now supported

**URL:** <https://discourse.slicer.org/t/multiple-node-export-now-supported/21681>\
**Category:** Support\
**Tags:** feature\
**Created:** [January 28, 2022, 2:59pm UTC](https://discourse.slicer.org/t/multiple-node-export-now-supported/21681 "2022-01-28T14:59:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [January 28, 2022, 2:59pm UTC](https://discourse.slicer.org/t/multiple-node-export-now-supported/21681/1 "2022-01-28T14:59:21Z")

</div>

This is a follow up on [New export functionality](https://discourse.slicer.org/t/new-export-functionality/20950)

Exporting multiple nodes is now supported. Right click on a node in the data subject hierarchy, and you should see “Export as…” show up if the clicked node can be exported, _or_ if it has at least one descendant in the hierarchy that can be exported.

![export_multiple_feature](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/a/dadea59b12d2630c3445b49385a21ac687afc06e.png)

![export_multiple_feature2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/5/551b51d410f3c1f752530000921433b1c4b3284d.png)

A format and options selector will show up for each node _type_. So, for example, if all the nodes under a folder have the same type, then there would only be one format and options selector.

As is visible in the screenshot, filename entry is disabled when exporting more than one node. Node name is used automatically.

When it is relevant, a checkbox will show up to let you choose whether or not to include children of the selected item. Another checkbox can also show up to let you choose whether to include children _recursively_ (i.e. include all descendants in the subject hierarchy).

Thanks to @jcfr, @lassoan, and @pieper for their feedback and support throughout this work!

Comments and questions are welcome.

---

<div class="post-metadata">

**Author:** ![agporto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/agporto/32/8319_2.png) [@agporto](https://discourse.slicer.org/u/agporto)\
**Post date:** [July 6, 2023, 11:59pm UTC](https://discourse.slicer.org/t/multiple-node-export-now-supported/21681/2 "2023-07-06T23:59:30Z")

</div>

This is great. Is there a way to obtain similar functionality from the python interactor within Slicer?

---

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [July 7, 2023, 10:53am UTC](https://discourse.slicer.org/t/multiple-node-export-now-supported/21681/3 "2023-07-07T10:53:22Z")

</div>

Exporting a single node can be done with `slicer.util.exportNode`:  
[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#save-volume-to-file](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#save-volume-to-file)

Exporting multiple nodes is not exposed through the nice `slicer.util` module, but you could always see how `qSlicerCoreIOManager::exportNodes` is accessed internally in `slicer.util.exportNode` and follow that as a guide:

> <https://github.com/Slicer/Slicer/blob/f541fb5e068169cf3709873471c88764630059f4/Base/Python/slicer/util.py#L1128>

The script repository also shows a python implementation of a similar functionality using single node export:

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#save-files-to-directory-structure-matching-subject-hierarchy-folders](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#save-files-to-directory-structure-matching-subject-hierarchy-folders)

---

<div class="post-metadata">

**Author:** ![agporto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/agporto/32/8319_2.png) [@agporto](https://discourse.slicer.org/u/agporto)\
**Post date:** [July 7, 2023, 4:25pm UTC](https://discourse.slicer.org/t/multiple-node-export-now-supported/21681/4 "2023-07-07T16:25:25Z")

</div>

Perfect. Thanks @ebrahim
