From c4c7bd9d0dde2d6bf10cd345d2e41bca58162dd7 Mon Sep 17 00:00:00 2001 From: David Young Date: Sun, 9 Jan 2022 11:17:30 +0800 Subject: [PATCH 1/4] Fix blob segmentation to use updated Scikit-image watershed function location Fixes #91. Change the location of `watershed` from the `morphology` to the `segmentation` package in Scikit-image now that the function was removed from the former in Scikit-image v0.19. Also, remove unused import. --- magmap/cv/segmenter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/magmap/cv/segmenter.py b/magmap/cv/segmenter.py index 1ca50a594..64b586154 100644 --- a/magmap/cv/segmenter.py +++ b/magmap/cv/segmenter.py @@ -3,7 +3,6 @@ """Segment regions based on blobs, labels, and underlying features. """ -from multiprocessing import sharedctypes from time import time from typing import Any, List, Optional, Tuple, Union @@ -626,7 +625,7 @@ def watershed_distance(foreground, markers=None, num_peaks=np.inf, local_max = feature.peak_local_max( distance, indices=False, num_peaks=num_peaks) markers = measure.label(local_max) - watershed = morphology.watershed( + watershed = segmentation.watershed( -distance, markers, compactness=compactness, mask=mask) return watershed From 6e7f2b7659ce87fa23f4c2ff136a3d8d4e7b124b Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 10 Jan 2022 10:58:04 +0800 Subject: [PATCH 2/4] Clarify ROI Editor options' tooltip Indicate which images the options change. --- magmap/gui/visualizer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/magmap/gui/visualizer.py b/magmap/gui/visualizer.py index 1653d4c45..14e8123ac 100644 --- a/magmap/gui/visualizer.py +++ b/magmap/gui/visualizer.py @@ -442,11 +442,11 @@ class Visualization(HasTraits): "Panes: show back and top panes\n" "Shadows: show blob shadows as circles") _check_list_2d = List( - tooltip="Filtered: show filtered image after detection\n" - "Border: margin around ROIs\n" - "Seg: segment blobs\n" - "Grid: overlay a grid\n" - "MIP: maximum intensity projection") + tooltip="Filtered: show filtered image after detection in ROI planes\n" + "Border: margin around ROI planes\n" + "Seg: segment blobs during detection in ROI planes\n" + "Grid: overlay a grid in ROI planes\n" + "MIP: maximum intensity projection in overview images") _DEFAULTS_2D = [ "Filtered", "Border", "Seg", "Grid", "MIP"] _planes_2d = List From f89292d04975945ed3776194d6022b1a3b10deda Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 10 Jan 2022 11:00:00 +0800 Subject: [PATCH 3/4] Clarify the scale detections control As indicated in #87, the "Scale detections" control label is confusing since it does not operate on the ROI Editor but only on the 3D viewer. Rename this control and add a tooltip to clarify this behavior. --- magmap/gui/visualizer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/magmap/gui/visualizer.py b/magmap/gui/visualizer.py index 14e8123ac..9bdde49ff 100644 --- a/magmap/gui/visualizer.py +++ b/magmap/gui/visualizer.py @@ -322,7 +322,9 @@ class Visualization(HasTraits): _segs_moved = [] # orig seg of moved blobs to track for deletion _scale_detections_low = 0.0 _scale_detections_high = Float # needs to be trait to dynamically update - scale_detections = Float + scale_detections = Float( + tooltip="Change the size of blobs in the 3D viewer" + ) segs_pts = None segs_selected = List # indices # multi-select to allow updating with a list, but segment updater keeps @@ -624,7 +626,7 @@ class Visualization(HasTraits): values=[e.value for e in BlobColorStyles], format_func=lambda x: x)), ), - Item("scale_detections", + Item("scale_detections", label="Scale 3D blobs", editor=RangeEditor( low_name="_scale_detections_low", high_name="_scale_detections_high", From 06e1d955d827d23a2cbd45b4c8d173d65960c72d Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 10 Jan 2022 11:12:25 +0800 Subject: [PATCH 4/4] Changelog entry for fixed blob segmentations --- docs/release/release_v1.6.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release/release_v1.6.md b/docs/release/release_v1.6.md index 68bf4fb80..4e6b4c0bb 100644 --- a/docs/release/release_v1.6.md +++ b/docs/release/release_v1.6.md @@ -23,6 +23,8 @@ #### Cell detection +- Fixed blob segmentation for newer versions of Scikit-image (#91) + #### Volumetric image processing #### I/O