How to convert 4D fMRI images to a series of 3D images?

Hello,

I am working with the ADHD200 dataset. It consists of anatomical and resting state fMRI images in NIFTI (nii.gz) format.

The fMRI images are 4D images. These represent 3D image of the brain over a period of time (time is the fourth dimension). I want to convert these 4D images into a series of 3D images, where each 3D image would represent the brain at a particular time instant.

Is it possible to do this using SimpleITK? Please tell me the process.

Hello @debapriya,

Yes, this is easily done:

import SimpleITK as sitk

# image with 4 timepoints, each timepoint is a 3D image with size 2x2x2 and a constant value
image4d = sitk.JoinSeries([sitk.Image([2]*3, sitk.sitkUInt16)+i for i in range(4)])

#get the i'th 3D image
i=2
image3d = image4d[:,:,:,i]
1 Like