ncempy.algo.local_max module

Module to find local maxima in an image.

ncempy.algo.local_max.local_max(img, r, thresh)[source]

Find local maxima from comparing dilated and eroded images.

Calculates images with maximum and minimum within given radius. If the difference is larger than the threshold, the original pixel position with max value is detected as local maximum.

Parameters:
  • img (np.ndarray) – Input image.
  • r (int) – Radius for locality.
  • thresh (int/float) – Intensity difference threshold.
Returns:

Array of points.

Return type:

(np.ndarray)

ncempy.algo.local_max.plot_points(img, points, vminmax=(0, 1), dims=None, invert=False, show=False)[source]

Plot the detected points on the input image for checking.

Parameters:
  • img (np.ndarray) – Image.
  • points (np.ndarray) – Array containing the points.
  • vminmax (tuple) – Tuple of two values for relative lower and upper cut off to display image.
  • dims (tuple) – Tuple of dims to plot in dimensions.
  • invert (bool) – Set to invert the image.
  • show (bool) – Set to directly show the plot interactively.
Returns:

Image of the plot.

Return type:

(np.ndarray)

ncempy.algo.local_max.points_todim(points, dims)[source]

Convert points from px coordinates to real dim.

Points are expected to be array indices for the first two dimensions in dims.

Parameters:
  • points (np.ndarray) – Points to convert.
  • dims (tuple) – Tuple of dimensions.
Returns:

Converted points.

Return type:

(np.ndarray)