# How to load 4D images in Slicer - fMRI or ASL datasets

**URL:** <https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157>\
**Category:** Support\
**Tags:** extensions-manager, volume\
**Created:** [October 2, 2017, 5:47pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157 "2017-10-02T17:47:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![acsenrafilho](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/acsenrafilho/32/6217_2.png) [@acsenrafilho](https://discourse.slicer.org/u/acsenrafilho)\
**Post date:** [October 2, 2017, 5:47pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/1 "2017-10-02T17:47:15Z")

</div>

Hello, slicers!

Firstly, I am sorry if this is a naive question, but I’ve tried to find something on the web and until now I could not fix my problem.

I have a small dataset with ASL and fMRI (both as 4D nii files) which I want to use Slicer to process it. However, I cannot load it simply by the Load volume module (apparently only the first volume is loaded).  
I’ve checked [DWIConverter](https://www.slicer.org/wiki/Documentation/Nightly/Modules/DWIConverter) module since this module has a flag (–fMRI) that may help me on this occasion. Nevertheless, I did not have success.

I wondering if there is a simple way to load 4D images in Slicer and then process it with a specific image processing module. Is there already a module to do that? If not, is it interesting to be implemented to the community? (I’m asking this because I can invest some time to figure it out to a simple CLI module if this is an interesting to several people)

Thank you again for the comprehension!

Best wishes

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [October 2, 2017, 6:04pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/2 "2017-10-02T18:04:14Z")

</div>

Please give an example of the files or look at the error log ( X in bottom right corner) and post any errors.

There is a Sequences module and a Multi-Volume module, but I don’t think either one has support for nifti specifically (for the latter: [https://issues.slicer.org/view.php?id=2972](https://issues.slicer.org/view.php?id=2972)). A CLI would be the simplest way to add support for your specific nifti flavor. Be aware that there is a difference in ITK between a vector image and a 4D image. This causes some complication in the i/o code, and may be a reason why Slicer’s readers don’t work for your data. Nifti 3d multivolume, 3d+t, and 3d+1 (no-op dimension) are all common, so any code may need user assistance to disambiguate.

---

<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:** [October 2, 2017, 6:54pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/3 "2017-10-02T18:54:34Z")

</div>

You can create a NIFTI importer for Sequences similarly how it is done for a different format (sequence metafile format) - see here [https://github.com/SlicerRt/Sequences/tree/master/MetafileImporter](https://github.com/SlicerRt/Sequences/tree/master/MetafileImporter). If you are not sure how to get started or stuck at any point then let me know.

---

<div class="post-metadata">

**Author:** ![acsenrafilho](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/acsenrafilho/32/6217_2.png) [@acsenrafilho](https://discourse.slicer.org/u/acsenrafilho)\
**Post date:** [October 3, 2017, 12:40pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/4 "2017-10-03T12:40:31Z")

</div>

Hi Norton,

In fact, the Slicer error log does not show any type of error when I tried  
to load my data, however, only the first volume is shown. My data is  
actually a series of 3D volumes concatenated through time (3D+t), as  
usually applied in fMRI datasets. A similar behaviour is found when I try  
to load a raw DTI data (1 b0 volume and N gradients in FSL format, i.e. one  
nifti file, one .bval and one .bvec text files). If I load only the nifti  
file from the 4D DWI, only the first volume appears in the scene and no  
errors are shown.

Fortunately, in DWI-DTI cases, there is the SlicerDMRI module that deal  
with the conversion from FSL data to Nrrd files. That’s fine. However, I  
have not seen anything similar to fMRI-like dataset conversion, i.e. only a  
series of 3D volumes through time.

I’ve also checked out the modules that you commented before, but it seems  
that is not exactly what I am looking for here. Maybe they only work on  
DICOM conversion. Am I right?

I hope that I am not creating more confusing with my question! 🙂

Thank you again for the quick response and suggestions!

Cheers  
Antonio

---

<div class="post-metadata">

**Author:** ![acsenrafilho](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/acsenrafilho/32/6217_2.png) [@acsenrafilho](https://discourse.slicer.org/u/acsenrafilho)\
**Post date:** [October 3, 2017, 12:42pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/5 "2017-10-03T12:42:18Z")

</div>

Sorry, Andras! I have not seen your message! I will try it and get back as  
soon as possible.  
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:** [October 3, 2017, 1:10pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/6 "2017-10-03T13:10:57Z")

</div>

Importing of 3D+t volumes are implemented by MultiVolumeImporter plugin. Once you loaded the image, you can browse between the frames using MultiVolumeExplorer module.

---

<div class="post-metadata">

**Author:** ![acsenrafilho](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/acsenrafilho/32/6217_2.png) [@acsenrafilho](https://discourse.slicer.org/u/acsenrafilho)\
**Post date:** [October 3, 2017, 1:44pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/7 "2017-10-03T13:44:19Z")

</div>

Great! MutliVolumeImporter solved the problem!

Thanks

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 14, 2018, 5:31pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/8 "2018-03-14T17:31:05Z")

</div>

I am interested in this topic. I have some Bruker cardiac data that I would like to look at in Slicer. I use a plugin in FIJI to convert the data from Bruker format to either Analyze or Nifti format. I looked at the MultiVolumeImporter and it seems to import nifti but the frames of the images are stacked in a single volume such that I cannot explore the multi-volumes. The advanced settings don’t make complete sense. Any pointers on this would be appreciated. Thanks  
Doug

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 14, 2018, 5:32pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/9 "2018-03-14T17:32:28Z")

</div>

And I am actually quite surprised that Slicer does not have a generalized multi-volume/frame importer. It would be great to have to import framed PET data as well. If you know of resources showing how to do this, it would be appreciated as well.

---

<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:** [March 14, 2018, 6:22pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/10 "2018-03-14T18:22:51Z")

</div>

There are not one but several ways of importing volume sequences.

If you have your volume as individual volume files in a folder then you have two main options:

**Option A:** If all volumes have the same geometry (origin, spacing, axis directions, extent)and they are all scalar volumes

Use MultiVolumeImporter module.

This module creates a Multivolume node. If you prefer volume sequence nodes (because you want to browse it along with other node types, have arbitrary number of time points extracted, etc.) then you can save the node as a nrrd file and when you load it into Slicer again, selecting `Volume sequence` in the `Description` column in `Add data` dialog.

**Option B:** In all other cases, for example volumes have different geometry or you want to import different data types (surface or volumetric meshes, point sets, tables, segmentations, etc)

- Install `Sequences` extension.
- Load your data set: drag-and-drop the folder to the Slicer application window, choose `Any data`, click OK, click OK.
- Go to `Sequences` module.
- Create a new Sequence node.
- In `Add/remove data nodes` section, click on your first node of the sequence, click the green `left arrow` button.
- Click the `left arrow` button until all nodes are added.

If you want to show the sequence playing in viewers:

- Go to Sequence browser module
- Select your sequence in the node selector at the top of `Synchronized nodes` section
- Click the green `+` icon
- You can click `Rename` checkbox to include index value in the proxy node name (that represents the selected sequence item in the scene)
- Select the proxy node to be shown in slice viewer or volume renderer to see the volume

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 14, 2018, 8:02pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/11 "2018-03-14T20:02:58Z")

</div>

> [@djrowland](#):
>
> Nifti format. I looked at the MultiVolumeImporter and it seems to import nifti but the frames of the images are stacked

The latest version of the MultiVolumeImporter (as of just the last few days) will try to load 4D nifti data (xyzt) if it finds it as the only file in the import directory. This is new and we don’t have a lot of example data but it works for 4D data from the [nifti site](https://nifti.nimh.nih.gov/nifti-1/data). The mac and linux nightly downloads are both broken today but it should work on windows or a local mac or linux build.

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 14, 2018, 9:53pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/12 "2018-03-14T21:53:23Z")

</div>

Thanks for the responses. I am still confused by this. The data I have are on the same grid as it was acquired with Intragate which retrospectively reconstructs phases of the heart cycle for a given acquisition. So technically, I should be using option A. The multivolumeImporter does identify the NIFTI format. But the image looks strange and it is such that I cannot cycle the heart phases. See attachment.

Thanks

Doug

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/7/971c9775b0c7143915d3e3d01a6f9cf8b62570aa.png)

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 14, 2018, 10:00pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/13 "2018-03-14T22:00:03Z")

</div>

I do have some additional suggestions, based on working in the preclinical area. Most datasets, dynamic framing or multivolume Cardiac data, comes in a single file. From a preclinical perspective, I like not having them as separate files for storage and retrieval. It would be cumbersome to have single files in individual directories. Most of the time a single directory has multiple nifti, raw or analyze files that are multi volume. Being able to select individual files would be a great thing to have.

Also having raw and analyze file imports would be great. Most image of the other image analysis software I use allows this flexibility and is intuitive (PMOD, Amira, FIJI, etc.). It is a bit surprising that this flexibility and intuitive import isn’t yet built into Slicer. This is what initially kept me from using Slicer.

Doug

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [March 15, 2018, 1:23pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/14 "2018-03-15T13:23:58Z")

</div>

> [@djrowland](#):
>
> The multivolumeImporter does identify the NIFTI format. But the image looks strange and it is such that I cannot cycle the heart phases.

Can you share the dataset to reproduce the problem?

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 15, 2018, 5:34pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/15 "2018-03-15T17:34:46Z")

</div>

I am willing to send a dataset. The first message bounced back as the attachment was to large. I am trying it through the forum website.The attachment is a screen shot of the .nii properties from FIJI.

![Capture](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/d/ad7e526f6fbe99cc85f4e25dfc8d09f97e92db90.jpeg)

The forum doesn’t allow upload of .nii files. Only jpg, jpeg, png and gif. How can I get you the data?

Doug

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [March 15, 2018, 6:07pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/16 "2018-03-15T18:07:45Z")

</div>

You can put it on Dropbox, Box, MS Drive, Google Drive, etc and share a link

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 15, 2018, 6:24pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/17 "2018-03-15T18:24:52Z")

</div>

Thanks.

> **[Dropbox - File Deleted](https://www.dropbox.com/s/qvjyx5mohti6tv5/MI1%20T2w.nii?dl=0)**
>
> Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

Hope this works.  
Doug

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 15, 2018, 8:35pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/18 "2018-03-15T20:35:38Z")

</div>

Hi Doug -

Yes, this loaded for me as a 10 frame multivolume using a build of the current slicer source code (current nightly build for mac or windows should work, linux built from source would also work). So you can at play the frames and plot the pixel values.

HTH,  
-Steve

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [March 15, 2018, 10:01pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/19 "2018-03-15T22:01:22Z")

</div>

@djrowland make sure you use the latest nightly

---

<div class="post-metadata">

**Author:** ![djrowland](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@djrowland](https://discourse.slicer.org/u/djrowland)\
**Post date:** [March 15, 2018, 10:20pm UTC](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157/20 "2018-03-15T22:20:12Z")

</div>

Thanks for checking it out. Does it work with the current stable release 4.8.1 for you? I have had issues with the nightly builds in the past and have kept to the stable release. It does not seem as though all the extensions are available in the nightly build, so it isn’t as useful to me.

I downloaded the nightly release and as you said it does work. Is there anyway to get the stable release to have this module working? The stable release in general is much more useful unless I am missing something with the extensions. But in general I don’t think I want to be using a nightly build or have to update on a daily or weekly basis by installing a nightly build.

Since the nightly build works, I tested having two nifti files in the same directory. It does not work well as it imports what looks to be the first frame of each multivolume and create it as a 2 frame multivolume. The project I am working on, we have already generated 40 separate images. I don’t want to have to create 40 separate directories for single nifti files. Will there be individual file support or will it remain as directory import?

[Next page](https://discourse.slicer.org/t/how-to-load-4d-images-in-slicer-fmri-or-asl-datasets/1157.md?page=2)
