Skip to content

Commit

Permalink
Add min_distance parameter to peak_local_max call (#2008)
Browse files Browse the repository at this point in the history
* Add min_distance parameter to peak_local_max call

otherwise multiple local maxima are returned even within the distance if
their values are identical. This lead to lots of over-segmentation. In
particular, multiple perfectly contigous nuclei were split in half.

Related #2006

* Fix iss test

adjust assumption on number of detected cells

* Fix docker build

the docker build was failing, because botocore needs urllib3 to be in a
certain version range. Pinning urllib3 to that range fixes the issue.
  • Loading branch information
iimog authored Dec 1, 2023
1 parent 853f56c commit a1cbb3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion REQUIREMENTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ scipy
showit >= 1.1.4
slicedimage==4.1.1
sympy ~= 1.5.0
urllib3 <1.27, >=1.25.4
tqdm
trackpy
validators
xarray >= 0.14.1
ipywidgets
ipywidgets
1 change: 1 addition & 0 deletions starfish/core/morphology/Filter/min_distance_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def run(
exclude_border=self._exclude_border,
footprint=footprint,
labels=np.asarray(mask),
min_distance=self._minimum_distance_xy,
)
local_maximum_mask = np.zeros_like(distance, dtype=bool)
local_maximum_mask[tuple(local_maximum.T)] = True
Expand Down
6 changes: 3 additions & 3 deletions starfish/test/full_pipelines/api/test_iss_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def test_iss_pipeline_cropped_data(tmpdir):

masks = iss.masks

# segmentation identifies only one cell
assert len(iss.watershed_markers) == 6
# segmentation identifies four cells
assert len(iss.watershed_markers) == 4

# assign targets
lab = AssignTargets.Label()
Expand Down Expand Up @@ -143,4 +143,4 @@ def test_iss_pipeline_cropped_data(tmpdir):
# test that nans were properly removed from the expression matrix
assert 'nan' not in expression_matrix.genes.data
# test the number of spots that did not decode per cell
assert np.array_equal(expression_matrix.number_of_undecoded_spots.data, [13, 1, 0, 36])
assert np.array_equal(expression_matrix.number_of_undecoded_spots.data, [13, 1, 36])

0 comments on commit a1cbb3b

Please sign in to comment.