clearex.segmentation.pointsource

Functions

background_correction(image[, sigma])

Compute background using Gaussian blur while excluding zero-valued voxels.

detect_point_sources(input_chunk, ...[, ...])

Detect point sources in a 3D image.

clearex.segmentation.pointsource.detect_point_sources(input_chunk, axial_pixel_size, lateral_pixel_size, distance=10.0, plot_data=False)

Detect point sources in a 3D image.

Parameters:
  • input_chunk (np.ndarray) – The 3D image.

  • axial_pixel_size (float) – The axial pixel size.

  • lateral_pixel_size (float) – The lateral pixel size.

  • distance (float) – The minimum distance between point sources.

  • plot_data (bool) – Whether to plot the data.

Returns:

  • masked_data (np.ndarray) – A boolean mask indicating the location of point sources.

  • coordinates (np.ndarray) – Nx3 array of [z, y, x] coordinates for each point source.

Return type:

ndarray

Notes

For particles with FWHM ~6 pixels (XY) and ~10 pixels (Z): sigma ≈ FWHM / 2.355 After isotropic resizing, all dimensions should have similar sigma XY: 6 / 2.355 ≈ 2.5, Z: 10 / 2.355 ≈ 4.2 (but scaled to ~2.5 after resize)

clearex.segmentation.pointsource.background_correction(image, sigma=20)

Compute background using Gaussian blur while excluding zero-valued voxels.

Parameters:
  • image (np.ndarray) – The 3D image.

  • sigma (float) – The sigma for the Gaussian filter.

Returns:

The background-corrected image.

Return type:

np.ndarray