Skip to content

Commit

Permalink
BUG: Fix formatting of missing label error
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostJM committed Aug 14, 2019
1 parent 52c671f commit 0ff1d8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions radiomics/imageoperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def getMask(mask, **kwargs):
mask = sitk.Cast(mask, sitk.sitkUInt32)

labels = numpy.unique(sitk.GetArrayFromImage(mask))
if len(labels) == 0:
raise ValueError('No labels found in this mask (i.e. nothing is segmented)!', label, labels[labels != 0])
if len(labels) == 1:
raise ValueError('No labels found in this mask (i.e. nothing is segmented)!')
if label not in labels:
raise ValueError('Label (%g) not present in mask. Choose from %s', label, labels[labels != 0])
raise ValueError('Label (%g) not present in mask. Choose from %s' % (label, labels[labels != 0]))

return mask

Expand Down

0 comments on commit 0ff1d8f

Please sign in to comment.