mymesh.register.ImageOverlay#

mymesh.register.ImageOverlay(img1, img2, threshold=None)[source]#

Generate an overlay image. The overlay image will have the same shape as img1 and img2 and will have the following values:

  • 0 : ~(img1 > threshold) & ~(img2 > threshold)

  • 1 : (img1 > threshold) & ~(img2 > threshold)

  • 2 : ~(img1 > threshold) & (img2 > threshold)

  • 3 : (img1 > threshold) & (img2 > threshold)

Parameters:
  • img1 (array_like) – Image array of the fixed image. Two or three dimensional numpy array of image data

  • img2 (array_like) – image array of the moving image. Two or three dimensional numpy array of image data

  • threshold (NoneType, float, or tuple, optional) – Threshold value(s) to binarize the images. Images are binarized by img > threshold. If given as a float or scalar value, this threshold value is applied to both images. If given as a two-element tuple (or array_like), the first value is applied to img1 and the second value is paplied to img2. If None, the image is assumed to already be binarized (or doesn’t require binarization, depending on which similarity metric is chosen). Images can be binarized arbitrarily, consisting of True/False, 1/0, 255/0, etc. If the image is not already binarized and no threshold is given, the threshold value will be the midpoint of the range of values for each image (which may not give the intended result). By default, None.

Returns:

overlay – Image array of the overlay

Return type:

np.ndarray