From 0ff1d8fde82448809d283bb8fc0c1900cdd260c8 Mon Sep 17 00:00:00 2001 From: Joost van Griethuysen Date: Wed, 14 Aug 2019 07:22:48 +0200 Subject: [PATCH] BUG: Fix formatting of missing label error --- radiomics/imageoperations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radiomics/imageoperations.py b/radiomics/imageoperations.py index 49754a05..f722c46b 100644 --- a/radiomics/imageoperations.py +++ b/radiomics/imageoperations.py @@ -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