Skip to content

Commit

Permalink
added list capabilities for the roi names dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
fishingguy456 committed Jun 16, 2022
1 parent 23b76e4 commit 2293242
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions imgtools/modules/structureset.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,16 @@ def to_segmentation(self, reference_image: sitk.Image,
labels = self._assign_labels(roi_names, force_missing) #only the ones that match the regex
elif isinstance(roi_names, dict):
for name, pattern in roi_names.items():
matching_names = list(self._assign_labels([pattern], force_missing).keys())
if matching_names:
labels[name] = matching_names #{"GTV": ["GTV1", "GTV2"]}
if isinstance(pattern, str):
matching_names = list(self._assign_labels([pattern], force_missing).keys())
if matching_names:
labels[name] = matching_names #{"GTV": ["GTV1", "GTV2"]}
elif isinstance(pattern, list):
labels[name] = []
for pat in pattern:
matching_names = list(self._assign_labels([pat], force_missing).keys())
if matching_names:
labels[name].extend(matching_names) #{"GTV": ["GTV1", "GTV2"]}
if isinstance(roi_names, str):
roi_names = [roi_names]
if isinstance(roi_names, list):
Expand Down

0 comments on commit 2293242

Please sign in to comment.