Skip to content

Commit

Permalink
Rework blob detection to accept a list of scaling factors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tibuch committed Jul 9, 2024
1 parent 6232e5f commit 86aa7bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/faim_ipa/detection/blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def detect_blobs(
axial_sigma: float,
lateral_sigma: float,
h: int,
n_scale_levels: int,
scale_factors: list[int],
overlap: float,
background_img: Optional[np.ndarray] = None,
) -> np.ndarray:
Expand All @@ -36,8 +36,8 @@ def detect_blobs(
YX extension of the spots.
h :
h-maxima threshold.
n_scale_levels :
Number of upscaling rounds.
scale_factors :
List of scaling factors to apply to the sigmas.
overlap :
A value between 0 and 1. If the fraction of area overlapping for 2
blobs is greater than `overlap` the smaller blob is eliminated.
Expand All @@ -59,8 +59,7 @@ def detect_blobs(
)

sigmas = [
(axial_sigma * 2**i, lateral_sigma * 2**i, lateral_sigma * 2**i)
for i in range(n_scale_levels)
(axial_sigma * f, lateral_sigma * f, lateral_sigma * f) for f in scale_factors
]

scale_cube = np.empty(image.shape + (len(sigmas),), dtype=np.uint8)
Expand Down
4 changes: 2 additions & 2 deletions tests/detection/test_blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_detect_blobs():
axial_sigma=2.07,
lateral_sigma=0.75,
h=200,
n_scale_levels=2,
scale_factors=[1, 2],
overlap=0.875,
background_img=None,
)
Expand All @@ -68,7 +68,7 @@ def test_detect_blobs():
axial_sigma=2.07,
lateral_sigma=0.75,
h=200,
n_scale_levels=2,
scale_factors=[1, 2],
overlap=0.875,
background_img=estimated_bg,
)
Expand Down

0 comments on commit 86aa7bb

Please sign in to comment.