# 4D volume import-modification-export

**URL:** <https://discourse.slicer.org/t/4d-volume-import-modification-export/16909>\
**Category:** Support\
**Tags:** 4d\
**Created:** [April 1, 2021, 5:00pm UTC](https://discourse.slicer.org/t/4d-volume-import-modification-export/16909 "2021-04-01T17:00:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalman](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@Kalman](https://discourse.slicer.org/u/Kalman)\
**Post date:** [April 1, 2021, 5:00pm UTC](https://discourse.slicer.org/t/4d-volume-import-modification-export/16909/1 "2021-04-01T17:00:46Z")

</div>

Hi, I’m interested in whether there is a possibility to import and modify 4D fMRI nifti files in the Slicer?

A bit more explanation about the question: we are working with multivolume datasets, where one file contains several scans ([I attach a file as an example](https://www.dropbox.com/s/l87rq40crjbyxp9/fMRI_raw_4D.nii?dl=0)). I would like to make different rigid and non-linear transformations with the volume, modify scalar type etc. After having the result I would like to export it in a way that all the sub-volumes are modified accordingly (similar to that one image volume where I made the changes), and the saved single nifti file still have a multivolume property.

Thank you for you help!

Operating system: Windows 10, 64-bit  
Slicer version:4.11.20210226 (stable release)

---

<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 14, 2021, 5:44am UTC](https://discourse.slicer.org/t/4d-volume-import-modification-export/16909/2 "2021-04-14T05:44:31Z")

</div>

Using the GUI you can only save 4D volume sequences in nrrd format, but you can `pip_install('nibabel')` and concatenate the 3D volumes and write them as 4D using a few lines of Python script in Slicer’s Python console.

If you need to do this often then you can write a small IO plugin in Python that offers this option in the GUI (here is an [example](https://github.com/Slicer/Slicer/blob/master/Applications/SlicerApp/Testing/Python/SlicerScriptedFileReaderWriterTest.py)).

---

<div class="post-metadata">

**Author:** ![Kalman](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@Kalman](https://discourse.slicer.org/u/Kalman)\
**Post date:** [April 14, 2021, 6:43am UTC](https://discourse.slicer.org/t/4d-volume-import-modification-export/16909/3 "2021-04-14T06:43:09Z")

</div>

@lassoan: Thank you for your answer!
