How fMRI data is organized

Can somebody explain to me that how the final data after pre-processing fMRI scans look like.

For example if we have D=Number of Patients C= Number of Controls then obviously we have voxel data in time points then how a particular 3D or 4D fMRI data matrix is arranged?

My Understanding is following

D x V X T = Patients x Voxels x Timepoints

but my confusion is that voxel is 3D cube so it will have 6 values so where did that go and also in fMRI slices of brain are takn so how that 4D data as it is said that fMRI is 4D data where we have 3D brain volume in time dimension.
So I am totally messed up here and not getting how this 4D fMRI data is organized in a typical way?

Sorry for such a basic stupid question but I am confused read lot of stuffs…?

Hi Naseer,

Let me see if I can help. First, I’ll just note that what I’m going to describe is typical, but many details may not be mandatory in practice, and some may vary slightly over image type.

Source data

MRI data is organized in images, which are generally going to be 3D or 4D data files. A 3D image is said to contain a volume, and a 4D image is a series of concatenated volumes. If you’re looking at NIFTI files, these images contain a header of metadata about the image (such as orientation, dimensions and voxel size), followed by a 3- or 4D array, exactly as you would store a multi-dimensional array in memory. If you need to get a more concrete handle on what a volume looks like, check out the first section of this tutorial.

Each image will pertain to one subject, and generally you’ll get multiple images per subject (structural, functional, diffusion, field maps, etc.). While you could concatenate these into a single file, in practice it’s preferable to keep them separate, and initiatives like BIDS exist to establish standard ways of organizing these files in directories.

If we assume you have 2 patients and 2 controls, your data directory (organized according to BIDS) might look like:


Each of the *_T1w.nii.gz is a structural, T1-weighted image, stored as a 3D NIFTI image (i.e. one volume).
Each *_task-rest_bold.nii.gz file is a functional BOLD series, stored as a 4D NIFTI image (i.e. several concatenated volumes). You may have task data with multiple runs, or other modalities, but this should give a sense of how multiple subjects’ data can be stored coherently.

Combining data

I would guess the reason you’re interested in combining data from patients is that you would like to perform group-level statistics on them. This requires some manipulation of your data, first.

  1. Normalize BOLD data into a common space. As people’s brains are different shapes, and may be angled differently in the scanner, you can’t assume that a given voxel coordinate contains data about the same region of two subjects’ brains. This is the target of preprocessing (which also includes a number of other steps to improve the quality of data). If your data is organized in BIDS format, you can try using fMRIPrep. This will not only generate normalized BOLD series, but also reports that will help you understand the process, and see if anything went wrong.
  2. Perform first-level statistics within individual subjects. Generally speaking, you will want to take some measure from each subject, such as a BOLD contrast between conditions. The output of this is a single 3D volume per-subject, where each voxel contains the measure at that 3D location. Because these are all in the same space, they can now be concatenated into a 4D image. Instead of time points, your fourth dimension will now be subject. This can then be assessed for, e.g., differences in that measure between your patient and control group.

I hope this wasn’t too broad an overview and was able to answer your questions somewhat, or at least provide context to help you form more specific questions.


I am indeed very grateful and thankful to you for such a detailed reply. If you have time please also answer my relevant question

Voxel Based Morphometry