Skip to content

Commit

Permalink
Segmentation object now correctly handles indexing
Browse files Browse the repository at this point in the history
Former-commit-id: 5cee77d
  • Loading branch information
mkazmier committed Apr 16, 2020
1 parent 26328f7 commit 107c807
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imgtools/segmentation/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ def to_label_image(self):
label_arr = arr.argmax(-1)
label_img = array_to_image(label_arr, reference_image=self)
return label_img

def __getitem__(self, idx):
res = super().__getitem__(idx)
if isinstance(res, sitk.Image):
res = Segmentation(res, self.roi_names)
return res

0 comments on commit 107c807

Please sign in to comment.