I have a prediction numpy array. How can I make a .nii or .nii.gz mask file from the array?
Asked
Active
Viewed 4,055 times
3
-
2The [`nibabel` python package](https://nipy.org/nibabel/) might be able to help you with this. – Oxbowerce Mar 16 '21 at 15:53
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,783
- 11
- 21
- 34
Tallys Prado
- 31
- 2