The add_roi function in the rt_struct.py has a fundamental problem with the ROI numbering.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 256
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
It took me some weeks to discover, but in the line of code where the roi_number is set, it calculates the length of the number of ROIs and adds 1 to it. But if a ROI is deleted via an external software, the list of the ROIs is not updated. For example if you have ROI 1 2 3 but 2 is deleted, the add_roi function will try to add a roi with the number 3, that already exists, and this does not go through and overwrite the ROI that was already there.
The solution I found was to change this line of code into this one:
old code: roi_number = len(self.ds.StructureSetROISequence) + 1
new code: roi_number = self.ds.ROINumberSequence[-1] + 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rt_struct.py at add_roi and inspect how roi_number is derived from StructureSetROISequence and ROINumberSequence. Reproduce the case where ROI 2 is deleted from ROIs 1, 2, and 3, then verify that adding a new ROI selects a number that does not overwrite an existing ROI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100