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

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

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.

1 Like

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.

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. :slight_smile:

.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.

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