Skip to content
Snippets Groups Projects
Commit d8cac787 authored by Andrey Aristov's avatar Andrey Aristov
Browse files

Merge branch 'main' of https://github.com/aaristov/napari-segment into main

parents f3c6e724 82313187
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,6 @@ def save_values(val): ...@@ -75,7 +75,6 @@ def save_values(val):
) )
def segment_organoid( def segment_organoid(
BF_layer: "napari.layers.Image", BF_layer: "napari.layers.Image",
fluo_layer: "napari.layers.Image",
thr: float = 0.3, thr: float = 0.3,
erode: int = 10, erode: int = 10,
min_diam=150, min_diam=150,
...@@ -84,8 +83,13 @@ def segment_organoid( ...@@ -84,8 +83,13 @@ def segment_organoid(
show_detections=True, show_detections=True,
) -> napari.types.LayerDataTuple: ) -> napari.types.LayerDataTuple:
# frame = napari.current_viewer().cursor.position[0] # frame = napari.current_viewer().cursor.position[0]
kwargs = {} kwargs = {"scale": BF_layer.scale}
print(kwargs)
ddata = BF_layer.data ddata = BF_layer.data
if isinstance(ddata, np.ndarray):
chunksize = np.ones(ddata.ndims)
chunksize[-2:] = ddata.shape[-2:] # xy full size
ddata = dask.array.from_array(ddata, chunksize=chunksize)
smooth_gradient = ddata.map_blocks( smooth_gradient = ddata.map_blocks(
partial(get_gradient), dtype=ddata.dtype partial(get_gradient), dtype=ddata.dtype
) )
...@@ -151,6 +155,7 @@ def get_gradient(bf_data: np.ndarray, smooth=10): ...@@ -151,6 +155,7 @@ def get_gradient(bf_data: np.ndarray, smooth=10):
applies gaussian filter applies gaussian filter
Returns SegmentedImage object Returns SegmentedImage object
""" """
print(bf_data.shape)
assert ( assert (
bf_data[0].ndim == 2 bf_data[0].ndim == 2
), f"expected 2D shape, got shape {bf_data[0].shape}" ), f"expected 2D shape, got shape {bf_data[0].shape}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment