Commit
·
6dcc497
1
Parent(s):
0bee690
Added verbose option to save_nifti
Browse files
DeepDeformationMapRegistration/utils/nifty_utils.py
CHANGED
|
@@ -11,13 +11,14 @@ TEMP_UNZIP_PATH = '/mnt/EncryptedData1/Users/javier/ext_datasets/LITS17/temp'
|
|
| 11 |
NII_EXTENSION = '.nii'
|
| 12 |
|
| 13 |
|
| 14 |
-
def save_nifti(data, save_path):
|
| 15 |
data_nifti = nb.Nifti1Image(data, affine=np.eye(4))
|
| 16 |
|
| 17 |
data_nifti.header.get_xyzt_units()
|
| 18 |
try:
|
| 19 |
data_nifti.to_filename(save_path) # Save as NiBabel file
|
| 20 |
-
|
|
|
|
| 21 |
except ValueError:
|
| 22 |
print('Could not save {}'.format(save_path))
|
| 23 |
|
|
|
|
| 11 |
NII_EXTENSION = '.nii'
|
| 12 |
|
| 13 |
|
| 14 |
+
def save_nifti(data, save_path, verbose=True):
|
| 15 |
data_nifti = nb.Nifti1Image(data, affine=np.eye(4))
|
| 16 |
|
| 17 |
data_nifti.header.get_xyzt_units()
|
| 18 |
try:
|
| 19 |
data_nifti.to_filename(save_path) # Save as NiBabel file
|
| 20 |
+
if verbose:
|
| 21 |
+
print('Saved {}'.format(save_path))
|
| 22 |
except ValueError:
|
| 23 |
print('Could not save {}'.format(save_path))
|
| 24 |
|