binarize#

petpal.preproc.segmentation_tools.binarize(input_image_numpy: numpy.ndarray, out_val: float = 1)#

Convert a segmentation image array into a mask by setting nonzero values to a uniform output value, typically one.

Parameters:
  • input_image_numpy (np.ndarray) – Input image to be binarized to zero and another value.

  • out_val (float) – Uniform value output image is set to.

Returns:

bin_mask (np.ndarray)

Image array of same shape as input, with values

only zero and out_val.