From d526680ccd023fa6662b82f030cbbadeb184f3f7 Mon Sep 17 00:00:00 2001 From: Deep Ganguli Date: Fri, 12 Oct 2018 16:42:53 -0700 Subject: [PATCH] let is_volume be configurable in detect spots methods (#686) --- starfish/spots/_detector/detect.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/starfish/spots/_detector/detect.py b/starfish/spots/_detector/detect.py index d9425ca99..bda98890d 100644 --- a/starfish/spots/_detector/detect.py +++ b/starfish/spots/_detector/detect.py @@ -164,6 +164,7 @@ def detect_spots( reference_image_from_max_projection: bool=False, measurement_function: Callable[[Sequence], Number]=np.max, radius_is_gyration: bool=False, + is_volume: bool=True ) -> IntensityTable: """Apply a spot_finding_method to a ImageStack @@ -189,6 +190,8 @@ def detect_spots( spot intensity, but typically is a smaller unit than the sigma generated by blob_log. In this case, the spot's bounding box is rounded up instead of down when measuring intensity. (default False) + is_volume: bool + (default True) If True, pass 3d volumes (x, y, z) to func, else pass 2d tiles (x, y) to func Notes ----- @@ -217,6 +220,11 @@ def detect_spots( if reference_image_from_max_projection: reference_image = data_stack.max_proj(Indices.CH, Indices.ROUND) + if is_volume: + split_by = {Indices.Z.value, Indices.Y.value, Indices.X.value} + else: + split_by = {Indices.Y.value, Indices.X.value} + if reference_image is not None: reference_spot_locations = spot_finding_method(reference_image, **spot_finding_kwargs) intensity_table = measure_spot_intensities( @@ -229,8 +237,7 @@ def detect_spots( spot_finding_method = partial(spot_finding_method, **spot_finding_kwargs) spot_attributes_list = data_stack.transform( func=spot_finding_method, - # always use volumetric or pseudo-3d (1, n, m) data - split_by={Indices.Z.value, Indices.Y.value, Indices.X.value} + split_by=split_by ) intensity_table = concatenate_spot_attributes_to_intensities(spot_attributes_list)