neheller / kits21

The official repository of the 2021 Kidney and Kidney Tumor Segmentation Challenge
MIT License
174 stars 47 forks source link

Removal of Cyst Label from segmentation #54

Open dannyhow12 opened 2 years ago

dannyhow12 commented 2 years ago

Hi and a very good day,

Thank you for organising this challenge and in turn providing the annotated datasets.

I have a question here, if I would want to remove the cyst label from the segmentation mask, eg: the majority voting of aggregated_MAJ_seg.nii.gz, how can I perform such action?

I have tried manually removing the label 3 (assuming that cyst label is represented by label 3) with ITK snap's Label Editor, but however it does not seem to be able to remove it after I reopen the edited mask.

Would you please give some guidance on this

Best regards, Danny

neheller commented 2 years ago

I would suggest you use a quick python script to do this. If you extract the "pixel data" from each nifti segmentation file as a numpy array called segdat and simply use segdat[segdat==3] = 1, then re-save the file, that should do the trick.