I have a prediction numpy array. How can I make a .nii or .nii.gz mask file from the array?
1 Answer
$\begingroup$
$\endgroup$
You can this using nibabel:
import nibabel as nb
ni_img = nib.Nifti1Image(numpy_array, affine=np.eye(4))
nib.save(ni_img, "dicom_volume_image.nii")
nibabel
python package might be able to help you with this. $\endgroup$