peak_detection_map_overlap¶

peak_detection_map_overlap(block, min_distance, threshold_abs=None, threshold_rel=None, block_info=None, depth_h=0, depth_w=0, *, return_probability=False)[source]¶

Post-processing function for peak detection.

Builds a processed mask per input channel. Runs peak_local_max then writes 1.0 at peak pixels if return_probability is False, otherwise writes the confidence scores at peak locations.

Can be called from dask.da.map_overlap on a padded NumPy block (h_pad, w_pad, C) to process large prediction maps in chunks with overlap. Keeps only centroids whose (row, col) lie in the interior window: rows [depth_h : depth_h + core_h), cols [depth_w : depth_w + core_w)

Returns same spatial shape as the input block

Parameters:
  • block (ndarray) – NumPy array (H, W, C).

  • min_distance (int) – Minimum number of pixels separating peaks.

  • threshold_abs (float | None) – Minimum intensity of peaks. By default, None.

  • threshold_rel (float | None) – Minimum relative intensity of peaks. By default, None.

  • block_info (dict | None) – Dask block info dict. Only used when called from dask.array.map_overlap.

  • depth_h (int) – Halo size in pixels for height (rows). Only used when called from dask.array.map_overlap.

  • depth_w (int) – Halo size in pixels for width (cols). Only used when it’s called from dask.array.map_overlap.

  • return_probability (bool) – If True, returns the confidence scores at peak locations instead of binary peak map.

Returns:

NumPy array (H, W, C) with 1.0 at peaks, 0 elsewhere if return_probability is False, otherwise with confidence scores at peak locations.

Return type:

out