Answers for "nibabel expand dimension"

0

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)
Posted by: Guest on October-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language