Skip to content

Blob detection returns scikit-image sigma as if it were a blob radius #51

Description

@PierreRaybaut

Summary

sigima/tools/image/detection.py::__blobs_to_coords returns scikit-image's sigma as if it were a blob radius:

def __blobs_to_coords(blobs: np.ndarray) -> np.ndarray:
    cy, cx, radii = blobs.T
    coords = np.vstack([cx, cy, radii]).T
    return coords

The third column produced by skimage.feature.blob_log, blob_dog and blob_doh is the scale σ at which the blob was detected, not its radius:

  • for blob_log and blob_dog, the blob radius is approximately √2 · σ;
  • for blob_doh, the blob radius is approximately σ.

The conversion factor therefore differs per method, and none is currently applied. The docstrings of find_blobs_log / find_blobs_dog / find_blobs_doh add to the confusion by describing the min_sigma / max_sigma parameters as "the minimum/maximum blob radius in pixels".

Why this is tracked separately

Applying the correct conversion changes user-visible results: the radius of the circles drawn over detected blobs, and the size of the ROIs auto-generated around them via create_image_roi_around_points. It is therefore a behaviour change, not a documentation fix.

The documentation-only part is handled in the "assorted minor issues" issue.

Scope

  • Decide on the convention: return a true radius (per-method conversion) or keep sigma and rename the column accordingly
  • Apply the per-method conversion factor in __blobs_to_coords or in each find_blobs_* wrapper
  • Re-baseline sigima/tests/image/blobs*_unit_test.py and any ROI-size assertions
  • Check downstream consumers in DataLab and DataLab-Web (blob overlays, generated ROIs)
  • Release note announcing the behaviour change

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions