[Neuroimaging] Convert Nifti images
Matthew Brett
matthew.brett at gmail.com
Tue Sep 13 19:18:08 EDT 2016
Hi,
On Tue, Sep 13, 2016 at 4:09 PM, Kashi Vishwanath
<kashi.vishwa25 at gmail.com> wrote:
> Hello Users,
>
> We have concatenated dataset i.e 4D nifti data set. We are looking for
> options in python to convert 4d dataset into 3d dataset.
>
> is there a python package for this.?
> we tried nibable.four_to_three() but couldnt get exactly how it working..
> Not much documentation available.
The documentation is here:
http://nipy.org/nibabel/reference/nibabel.funcs.html#four-to-three
You'd use that from within a Python script or interactive session, as in:
In [4]: img = nib.load('a_4d_image.nii')
In [5]: images = nib.four_to_three(img)
In [6]: for i, img_3d in enumerate(images):
...: nib.save(img_3d, 'a_3d_image_{:03d}.nii'.format(i))
You could also use the program `nipy_4d_to_3d` from NiPy.
Best,
Matthew
More information about the Neuroimaging
mailing list