Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def threshold_scale(self):
'''The "scale" for the threshold = minor parameterizations'''
#
# Distinguish Otsu choices from each other
#
threshold_algorithm = self.threshold_algorithm
if threshold_algorithm == cpthresh.TM_OTSU:
if self.two_class_otsu == O_TWO_CLASS:
scale = "2"
else:
scale = "3"
if self.assign_middle_to_foreground == O_FOREGROUND:
scale += "F"
else:
scale += "B"
if self.use_weighted_variance == O_WEIGHTED_VARIANCE:
scale += "W"
else:
scale += "S"
return scale
elif threshold_algorithm == cpthresh.TM_MOG:
return str(int(self.object_fraction.value * 100))