open-discussion > RE: How to discard first 10 volumes of 4D nii
Apr 25, 2013  09:04 AM | elvis dohmatb
RE: How to discard first 10 volumes of 4D nii
The previous responses (fslroi, etc.) certainly solve your problem. This is just another endeavor.

If you are a python user and have nibabel module installed (which is certainly the case if you use nipy for example), then something along the following lines should deliver the trick. Viz:

import nibabel as ni
fourD_img = ni.load("/home/edohmato/CODE/datasets/fsl-feeds-data/feeds/data/fmri.nii.gz")
fourD_img.shape
trimmed_img = ni.Nifti1Image(fourD_img.get_data()[:, :, :, 10:], fourD_img.get_affine())
trimmed_img.shape
ni.save(trimmed_img, "/tmp/trimmed_img.nii.gz")

Best Regards,
Elvis

Threaded View

TitleAuthorDate
Zhiyuan Wang Apr 24, 2013
Ged Ridgway Apr 24, 2013
Zhiyuan Wang Apr 26, 2013
RE: How to discard first 10 volumes of 4D nii
elvis dohmatb Apr 25, 2013
Justin Senseney Apr 24, 2013
Marcus heldmann Apr 24, 2013
Christopher Adamson Apr 24, 2013