Skip to content

Commit a0a283e

Browse files
committed
Add inpainting result vis method
1 parent fc73770 commit a0a283e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

BraTS/utils.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,22 @@ def visualize_segmentation(modality_file: str, segmentation_file: str):
6969
for ax in ax:
7070
ax.axis("off")
7171
plt.tight_layout()
72+
73+
74+
def visualize_inpainting(t1n_voided: str, prediction: str):
75+
"""Visualize the inpainting results
76+
77+
Args:
78+
t1n_voided (str): Voided T1 modality file
79+
prediction (str): Inpainting prediction file
80+
"""
81+
voided_np = nib.load(t1n_voided).get_fdata().transpose(2, 1, 0)
82+
inpainting_np = nib.load(prediction).get_fdata().transpose(2, 1, 0)
83+
_, ax = plt.subplots(1, 2, figsize=(8, 4))
84+
85+
slice_index = voided_np.shape[0] // 2 # You can choose any slice here
86+
ax[0].imshow(voided_np[slice_index, :, :], cmap="gray")
87+
ax[1].imshow(inpainting_np[slice_index, :, :], cmap="gray")
88+
for ax in ax:
89+
ax.axis("off")
90+
plt.tight_layout()

0 commit comments

Comments
 (0)