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

ROI_number attribution #78

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

ROI_number attribution #78

wants to merge 7 commits into from

Conversation

FabienRech
Copy link

When trying to automatize addition of ROI in several RTstructure files, one problem is that ROI number in RTstructure might differ and are not successive (sometime going from 10 to 50).
Here is a proposition to check if the ROI number exists and give an original ROI number to prevent error in opening of the RT
structure in software.

Modify the ROI_number attribution
Modification of the ROI number attribution to prevent duplicated and error in opening.
@asim-shrestha
Copy link
Contributor

Hey thanks for tackling this! We should write some tests for this if possible :)

Scenarios:

  • Adding an roi with no existing ROIs
  • Adding an roi when there are existing ROI(s) but there is no number conflict
  • Adding an roi when there are existing ROI(s) but there are number conflicts

j = j+1
return j

"""choose a ROI number which has not been attributed to the ROI already existing the original RTstructure. This might prevent duplicate and error in opening"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment should be placed after the function declaration

def roi_number(self):
    """
    choose a ROI number which has not been attributed to the ROI already existing the original RTstructure. This might prevent duplicate and error in opening
    """

Comment on lines +30 to +33
ROI_list = self.ds.StructureSetROISequence
ROI_number = []
for i in range(len(ROI_list)):
ROI_number.append(ROI_list[i].ROINumber.numerator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use list comprehension here to simplify

Suggested change
ROI_list = self.ds.StructureSetROISequence
ROI_number = []
for i in range(len(ROI_list)):
ROI_number.append(ROI_list[i].ROINumber.numerator)
roi_numbers = [roi.ROINumber.numerator for roi in self.ds.StructureSetROISequence ]

note we have been using lowercase for ROI, we should remain consistent

@asim-shrestha
Copy link
Contributor

Side note, it looks like some existing unit tests are failing, will need to update those

Also, this looks like it has all of your previous commits that have been merged in, perhaps you need to sync your fork with the mainline repo

@FabienRech
Copy link
Author

Thank you for your answer.
I will check that in few days, I am not familiar with Github so I could have made a lot of mistakes.

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

Successfully merging this pull request may close these issues.

2 participants