Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

nibabel expand dimension

import nibabel as nib
import numpy as np
im = nib.load(im_path)
new_im = np.expand_dims(im.get_fdata().astype(np.float32),-1)
nib.save(nib.Nifti1Image(new_im, affine=im.affine), im_path)
 
PREVIOUS NEXT
Tagged: #nibabel #expand #dimension
ADD COMMENT
Topic
Name
6+7 =