Skip to content

Commit

Permalink
initializing new "to_write" objects
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpati committed Apr 29, 2021
1 parent 5b589a7 commit 54886b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions BrainMaGe/tester/test_single_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ def infer_single_ma(input_path, output_path, weights, mask_path=None, device="cp

if mask_path is not None:
print("You chose to save the brain. We are now saving it with the masks.")
image_data[to_save == 0] = 0
to_save_brain = nib.Nifti1Image(image_data, patient_nib.affine)
patient_nib_write = nib.load(input_path)
image_data_write = patient_nib_write.get_fdata()
image_data_write[to_save == 0] = 0
to_save_brain = nib.Nifti1Image(image_data_write, patient_nib_write.affine)
nib.save(to_save_brain, os.path.join(mask_path))

print("Thank you for using BrainMaGe")
Expand Down

0 comments on commit 54886b6

Please sign in to comment.