Skip to content

Commit

Permalink
let is_volume be configurable in detect spots methods (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
dganguli authored and ambrosejcarr committed Oct 12, 2018
1 parent 50b1d29 commit d526680
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions starfish/spots/_detector/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
-----
Expand Down Expand Up @@ -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(
Expand All @@ -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)

Expand Down

0 comments on commit d526680

Please sign in to comment.