pyplati / platipy

Processing Library and Analysis Toolkit for Medical Imaging in Python
https://pyplati.github.io/platipy/
Apache License 2.0
103 stars 24 forks source link

Conversion of dicom structure to nii.gz doesn't retain holes in structure #244

Open nickhardcastle opened 7 months ago

nickhardcastle commented 7 months ago

Hi team,

When using convert_rtstruct, if there's a hole in the structure in the dicom, this isn't retained. The resultant nii.gz fills in the hole in the structure.

I noticed this while converting ring structures.

Cheers,

Nick

pchlap commented 7 months ago

Thanks for reporting this @nickhardcastle! We will look into it.

kirbyju commented 1 month ago

Hi, any update on this? We've got some new datasets in TCIA where this is an issue.

Btw, it's super cool that you built in support to pull data from us directly! I'm planning to advertise this in of our social media posts sometime soon :-)

pchlap commented 1 month ago

Hi @kirbyju, thanks for reaching out. To be honest both @rnfinnegan and I have been caught up with other things. But hopefully this is something that would be fairly straightforward to resolve.

@rnfinnegan when we catch up in a couple of weeks can we discuss how to do this? It would be good to have a sample RTSTRUCT to use for development? Perhaps you could generate something on a phantom? Once we have that I think it should be fairly easy to adapt our function to support this.

@kirbyju we'll keep you posted on how it goes :)

pchlap commented 2 weeks ago

Hi @kirbyju, @nickhardcastle,

Sorry for the delay in fixing this issue. @rnfinnegan and I had a chance to meet yesterday to debug this. Turns out the solution was pretty simple! (See #271).

Rob created a test dataset using Eclipse for us to test this. But it might be good to get some more test data to confirm this fixes the issue entirely. Do either of you have data you might be able to share? Alternatively would it be feasible to test out the fix before we build a release? I will aim to generate some test data using MIM and RF AutoContour this weekend.

Rob and I will address a few other minor issues and will prepare a new release of platipy including this fix in about 3-4 weeks.

kirbyju commented 2 weeks ago

Check out https://github.com/brianmanderson/Slicer_RT_Target_Issue/blob/main/Slicer_Target_Issue.ipynb, which I believe was put together to help test this same issue in SlicerRT. I will take a look at some of the tumor segmentation RTSTRUCT data we have in TCIA to see if I can find a few examples for you to test from there as well.

kirbyju commented 2 weeks ago

I think this one would be useful to try. You can download it here: https://nbia.cancerimagingarchive.net/nbia-search/?saved-cart=nbia-31061718290468281

Screenshot 2024-06-13 at 10 05 44 AM
pchlap commented 2 weeks ago

I think this one would be useful to try. You can download it here: https://nbia.cancerimagingarchive.net/nbia-search/?saved-cart=nbia-31061718290468281

Thanks @kirbyju, this TCIA example seems to convert fine. However there isn't a hole in this particular structure, just 2d islands which platipy is converting to a mask fine. Or have I missed something?

I also tested this today with an RTSTRUCT generated in MIM and RF AutoContour where I created a strucutre with a hole inside. These holes are now appearing in the masks generated.

kirbyju commented 2 weeks ago

My mistake, wasn't thinking straight. Glad it seems to be working in all circumstances though!