Detection Module

The detection module is responsible for 3D nuclei centroid detection, which is required for single-cell analysis.

scout.detection.curvature_probability(eigvals, steepness, offset)

Calculate the interest point probability based on 3D curvature eigenvalues

Parameters
  • eigvals (ndarray) – 4D array of curvature eigenvalues

  • steepness (float) – Slope of the logistic function. Larger gives sharper transition between nuclei and background

  • offset (float) – Translation of the logistic function. Larger biases towards more negative curvatures

Returns

prob – Curvature interest point probability

Return type

ndarray

scout.detection.detect_nuclei_parallel(z_arr, sigma, min_intensity, steepness, offset, I0, stdev, prob_thresh, min_dist, chunks, overlap, nb_workers=None, prob_output=None)

Detect nuclei centroids from a chunked Zarr array with parallel processing

Parameters
  • z_arr (Zarr Array) – Input chunked Zarr array

  • sigma (int, tuple) – Amount of blurring

  • min_intensity (float) – Minimum intensity allowed for centroid

  • steepness (float) – Sensitivity of the curvature-based probability map

  • offset (float) – Bias of the curvature-based probability map

  • I0 (float) – Reference intensity for image intensity prior. Can typically be set using Otsu’s method.

  • stdev (float) – Sensitivity for the image intensity prior. Can typically be set to the standard deviation of the image.

  • prob_thresh (float) – Minimum probability allowed for centroid

  • min_dist (int) – Minimum distance allowed between detected centroids

  • chunks (tuple) – Chunk size to process in parallel. This must match z_arr.chunks if using GPU curvature computations.

  • overlap (int) – Amount of overlap between adjacent chunks

  • nb_workers (int) – Number of parallel processes to use

  • prob_output (Zarr Array) – Output array for intermediate probability map used for centroid detection

Returns

centers

Return type

ndarray

scout.detection.intensity_probability(image, I0=None, stdev=None)

Calculate the foreground probability using exponential distribution

Parameters
  • image (ndarray) – Input image

  • I0 (float, optional) – Normalization value. Default, mean of image

  • stdev (float, optional) – Width of the transition to foreground. Default, stdev of normalized image

Returns

prob – Foreground probability map

Return type

ndarray

scout.detection.nuclei_centers_probability(prob, threshold, min_dist)

Find nuclei centroids with a minimum probability at least min_dist apart

Parameters
  • prob (ndarray) – Input probability image

  • threshold (float) – Minimum probability allowed for a centroid

  • min_dist (int) – Minimum pixel distance allowed between detected centroids

Returns

output – Coordinates of detected centroids

Return type

ndarray

scout.detection.nucleus_probability(image, sigma, steepness=500, offset=0.0005, I0=None, stdev=None)

Calculate the nucleus probability map using logistic regression over curvature eigenvalues

Parameters
  • image (ndarray) – 3D image volume of nuclei staining

  • sigma (int or tuple) – Amount to blur the image before processing

  • steepness (float) – Slope of the logistic function. Larger gives sharper transition between nuclei and background

  • offset (float) – Translation of the logistic function. Larger biases towards more negative curvatures

Returns

prob – Nuclei probability map

Return type

ndarray