# How to split 4D volumes to individual 3D volumes?

**URL:** <https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707>\
**Category:** Support\
**Created:** [April 24, 2018, 7:14am UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707 "2018-04-24T07:14:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuec](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xuec/32/77755_2.png) [@xuec](https://discourse.slicer.org/u/xuec)\
**Post date:** [April 24, 2018, 7:14am UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/1 "2018-04-24T07:14:14Z")

</div>

Thank you.In addition to that, do you perhaps know how to split 4D image data to several 3D? I found a way to do it manually by saving it in GUI, but I have too many files to handle it manually. Any hints please? Thank you

---

<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:** [April 24, 2018, 1:07pm UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/2 "2018-04-24T13:07:44Z")

</div>

You can write separate volumes to a zip file with this code snippet:

```
sequenceNode = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLSequenceNode')
storageNode = slicer.vtkMRMLSequenceStorageNode()
storageNode.SetFileName('c:/tmp/volumes.mrb')
storageNode.WriteData(sequenceNode)

```

The .mrb file is actually a .zip file. You may need to change the extension to .zip to open it using an archive manager.

---

<div class="post-metadata">

**Author:** ![xuec](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xuec/32/77755_2.png) [@xuec](https://discourse.slicer.org/u/xuec)\
**Post date:** [April 26, 2018, 2:47am UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/3 "2018-04-26T02:47:39Z")

</div>

Thank you again for your response. how can I open the volumes.mrb, I tried to rename it to .zip files but I cannot open it using standard winrar/winzip.  
In addition, to my understanding, this will save the files, but will it be able to split the 4D data to 3D data directly? Thank you.

---

<div class="post-metadata">

**Author:** ![xuec](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xuec/32/77755_2.png) [@xuec](https://discourse.slicer.org/u/xuec)\
**Post date:** [April 26, 2018, 2:50am UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/4 "2018-04-26T02:50:59Z")

</div>

by the way, I usually used MultiVolumeExplorer module to select the frame and then save it one by one manually, however, I think this is too time consuming, hence I am just wondering if there is another good way to just split the 4D data to some 3D data. Thank you. 🙂

---

<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:** [April 26, 2018, 1:49pm UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/5 "2018-04-26T13:49:11Z")

</div>

> [@is there any ways to save transformation matrix using command line?](https://discourse.slicer.org/t/is-there-any-ways-to-save-transformation-matrix-using-command-line/2647/6):
>
> I tried to rename it to .zip files but I cannot open it using standard winrar/winzip

.mrb file is zip file, so if you cannot open it then it may mean that you’ve tried to rename some other file (maybe a .nrrd file).

Have you installed Sequences module? Did you have your volume loaded as MultiVolume or as Sequence node? If you had it as MultiVolume, then load it as volume Sequence instead, as explained here: [Documentation/Nightly/Extensions/Sequences - Slicer Wiki](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/Sequences#Convert_MultiVolume_node_to_Sequence_node).

---

<div class="post-metadata">

**Author:** ![xuec](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xuec/32/77755_2.png) [@xuec](https://discourse.slicer.org/u/xuec)\
**Post date:** [April 27, 2018, 6:53am UTC](https://discourse.slicer.org/t/how-to-split-4d-volumes-to-individual-3d-volumes/2707/6 "2018-04-27T06:53:32Z")

</div>

Indeed, I load it as volume instead of volume sequence, now It works like charm. Thank you so much!
