Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualization of the segmentation results codes #6

Closed
Eurus-Holmes opened this issue Jul 30, 2019 · 7 comments
Closed

Visualization of the segmentation results codes #6

Eurus-Holmes opened this issue Jul 30, 2019 · 7 comments

Comments

@Eurus-Holmes
Copy link

Would you release your visualization codes?

@cshwhale
Copy link
Collaborator

We visualized the segmentation results by ITK-SNAP software.

@Eurus-Holmes
Copy link
Author

oh, I see, but in your code test.py, it seems you don't save the predicted mask images?

@pervinh
Copy link

pervinh commented Aug 5, 2019

Hi, I have the same problem too. How can i save segmentation results as nifti files?

@cshwhale
Copy link
Collaborator

cshwhale commented Aug 5, 2019

@Eurus-Holmes
@pervinh
Hi, I save the predicted mask as nii format and then visualize it with ITK-SNAP software. The code is as follows:
import nibabel
vis_data = nibabel.Nifti1Image(np.array(mask).astype(np.float32), np.eye(4))
nibabel.save(vis_data, "mask_vis.nii.gz")

@pervinh
Copy link

pervinh commented Aug 6, 2019

@cshwhale
Thank you, this worked

@Eurus-Holmes
Copy link
Author

@cshwhale Thanks!

@ni-wei
Copy link

ni-wei commented Sep 2, 2019

@Eurus-Holmes
@pervinh
Hi, I save the predicted mask as nii format and then visualize it with ITK-SNAP software. The code is as follows:
import nibabel
vis_data = nibabel.Nifti1Image(np.array(mask).astype(np.float32), np.eye(4))
nibabel.save(vis_data, "mask_vis.nii.gz")

Hi,

in order to register the predicted mask with the data & label, does it make sense to obtain a "target_affine" from the data, and replace the "np.eye(4)" in SH's code with this "target_affine"?
I obtained the "target_affine" by inserting the following 2 lines next to https://github.com/Tencent/MedicalNet/blob/25ba32573f281646f8a3d15f096d017de615ee3a/test.py#L62
data = nib.load(os.path.join(sets.data_root, img_names[batch_id]))
target_affine = data.affine

Thanks,
Wei

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants