I have a prediction numpy array. How can I make a .nii or .nii.gz mask file from the array?
Asked
Active
Viewed 5,948 times
1 Answers
3
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")
Stephen Rauch
- 1,831
- 11
- 23
- 34
Tallys Prado
- 31
- 2