qurit / rt-utils

A minimal Python library to facilitate the creation and manipulation of DICOM RTStructs.
MIT License
199 stars 57 forks source link

ROI_number #66

Open FabienRech opened 1 year ago

FabienRech commented 1 year ago

Hi, thank you for this tool.

I have some difficulties when adding a new ROI into an existing RTstructure.

In fact, I looked at the code and when adding a new ROI, the ROI_number is set to ds.StructureSetROISequence +1. However, in the RT file I have downloaded from my PACS, ROI_number are not consecutive. For example they are foing from 2 to 17, then 19 and 63. So I have for example 17 initial ROIs, and if I add 2 more ROIs, numbers 18 and 19 are automatically attributed, and this generates a error message when I reimport the RT structure in my PACS because there are two "numbers 19".

I will try to get around the problem but one of my suggestion would be to propose to the user to add (or not) the ROI_number when calling the add_ROI function and at least to specify this problem in your readme file as it was very difficult to understand where was the problem.

Best

Fabien

asim-shrestha commented 1 year ago

Hi Fabien,

Thanks for the suggestion. I agree that, that should be an option (and that we should update our documentation in that regard).

We should additionally test what existing roi_numbers are present and use one that isn't already taken, but that would be a separate initiative.

I can get a fix in for you sometime this week. If you'd like, feel free to try and tackle this in a PR :)

FabienRech commented 1 year ago

HI Asim,

thank you for your answer.

I managed to do it by modifying the rtstruct.py but my solution seems to be a little precarious as I removed the automatic roi_number affectation (which is not necessary for my ongoing study). Yes I would like to provide something "well done" by proposing the two options (automatic and manual). It will take some time (I am new in Python and even more in Github :) )

asim-shrestha commented 1 year ago

No worries! Please reach out if you have any questions :)