Commit 4f3ee81f authored by aknecht2's avatar aknecht2
Browse files

Fixed threshold validation.

parent 13c7850d
...@@ -745,6 +745,9 @@ valid = { ...@@ -745,6 +745,9 @@ valid = {
}, },
"--findSeed": { "--findSeed": {
"type": "exist" "type": "exist"
},
"--binary": {
"type": "exist"
} }
} }
}, },
...@@ -1202,7 +1205,9 @@ valid = { ...@@ -1202,7 +1205,9 @@ valid = {
"value": "" "value": ""
}, },
"--thresh": { "--thresh": {
"type": "numeric" "type": "string",
"validation": "list",
"value": ["binary", "inverse", "truncate", "tozero", "otsu"]
}, },
"--max": { "--max": {
"type": "numeric", "type": "numeric",
......
...@@ -555,7 +555,7 @@ class Image(object): ...@@ -555,7 +555,7 @@ class Image(object):
Thresholds the image based on the given type. The image must be Thresholds the image based on the given type. The image must be
grayscale to be thresholded. If the image is of type 'bgr' it is grayscale to be thresholded. If the image is of type 'bgr' it is
automatically converted to grayscale before thresholding. automatically converted to grayscale before thresholding.
Supported types are: binary, truncate, tozero, and otsu. Supported types are: binary, inverse, truncate, tozero, and otsu.
""" """
if self._isColor(): if self._isColor():
self.convertColor("bgr", "gray") self.convertColor("bgr", "gray")
......
...@@ -7,7 +7,7 @@ parser = argparse.ArgumentParser(description = "Converts an image between color ...@@ -7,7 +7,7 @@ parser = argparse.ArgumentParser(description = "Converts an image between color
parser.add_argument("--input", dest="input", help="Path to input image.", required = True) parser.add_argument("--input", dest="input", help="Path to input image.", required = True)
parser.add_argument("--thresh", dest="thresh", default=127, type=int, help="Threshold cutoff value.") parser.add_argument("--thresh", dest="thresh", default=127, type=int, help="Threshold cutoff value.")
parser.add_argument("--max", dest="max", default=255, type=int, help="Write value for binary threhsold") parser.add_argument("--max", dest="max", default=255, type=int, help="Write value for binary threhsold")
parser.add_argument("--type", dest="type", default="binary", help="Threshold type, one of: binary, trunc, tozero, otsu.") parser.add_argument("--type", dest="type", default="binary", help="Threshold type, one of: binary, inverse, trunc, tozero, otsu.")
parser.add_argument("--outputdir", dest="outputdir", default=".", help="Path to write output files, if not specified use current directory.") parser.add_argument("--outputdir", dest="outputdir", default=".", help="Path to write output files, if not specified use current directory.")
parser.add_argument("--output", dest="output", default=None, help="Name of output image to write, if not specified, use input image name.") parser.add_argument("--output", dest="output", default=None, help="Name of output image to write, if not specified, use input image name.")
parser.add_argument("--writeblank", default=False, action="store_true", help="If errors happen, write a blank file. Used to ensure dependent files exist for pegasus workflows.") parser.add_argument("--writeblank", default=False, action="store_true", help="If errors happen, write a blank file. Used to ensure dependent files exist for pegasus workflows.")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment