ants.ops.threshold_image
- threshold_image(image, low_thresh=None, high_thresh=None, inval=1, outval=0, binary=True)[source]
Converts a scalar image into a binary image by thresholding operations
ANTsR function: thresholdImage
- Parameters:
image (
ants.core.ANTsImage) – Input image to operate onlow_thresh (
scalar (optional)) – Lower edge of threshold windowhight_thresh (
scalar (optional)) – Higher edge of threshold windowinval (
scalar) – Output value for image voxels in between lothresh and hithreshoutval (
scalar) – Output value for image voxels lower than lothresh or higher than hithreshbinary (
bool) – if true, returns binary thresholded image if false, return binary thresholded image multiplied by original image
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> image = ants.image_read( ants.get_ants_data('r16') ) >>> timage = ants.threshold_image(image, 0.5, 1e15)