Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbreak master #1148

Merged
merged 5 commits into from
Apr 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions starfish/spots/_detector/local_search_blob_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from starfish.intensity_table.intensity_table import IntensityTable
from starfish.intensity_table.intensity_table_coordinates import \
transfer_physical_coords_from_imagestack_to_intensity_table
from starfish.types import Axes, Features, Number
from starfish.types import Axes, Features, Number, SpotAttributes
from starfish.util import click
from ._base import SpotFinderAlgorithmBase

Expand All @@ -32,7 +32,6 @@


class LocalSearchBlobDetector(SpotFinderAlgorithmBase):

def __init__(
self,
min_sigma: Union[Number, Tuple[Number, ...]],
Expand Down Expand Up @@ -352,7 +351,13 @@ def _build_intensity_table(
return intensity_table

def run(
self, data: ImageStack, verbose: bool=False, n_processes: Optional[int]=None
self,
primary_image: ImageStack,
blobs_image: Optional[ImageStack] = None,
blobs_axes: Optional[Tuple[Axes, ...]] = None,
verbose: bool = False,
n_processes: Optional[int] = None,
*args,
) -> IntensityTable:
"""Find 1-hot coded spots in data.

Expand All @@ -366,13 +371,26 @@ def run(
Number of processes to devote to spot finding. If None, will use the number of available
cpus (Default None).

Notes
-----
blobs_image is an unused parameter that is included for testing purposes. It should not
be passed to this method. If it is passed, the method will trigger a ValueError.

Returns
-------
IntensityTable
Contains detected coded spots.

"""
per_tile_spot_results = self._find_spots(data, verbose=verbose, n_processes=n_processes)

if blobs_image is not None:
raise ValueError(
"blobs_image shouldn't be set for LocalSearchBlobDetector. This is likely a usage "
"error."
)

per_tile_spot_results = self._find_spots(
primary_image, verbose=verbose, n_processes=n_processes)

per_round_spot_results = self._merge_spots_by_round(per_tile_spot_results)

Expand All @@ -385,16 +403,23 @@ def run(

intensity_table = self._build_intensity_table(
per_round_spot_results, distances, indices,
rounds=data.xarray[Axes.ROUND.value].values, channels=data.xarray[Axes.CH.value].values,
search_radius=self.search_radius, anchor_round=self.anchor_round
rounds=primary_image.xarray[Axes.ROUND.value].values,
channels=primary_image.xarray[Axes.CH.value].values,
search_radius=self.search_radius,
anchor_round=self.anchor_round
)

transfer_physical_coords_from_imagestack_to_intensity_table(
image_stack=data, intensity_table=intensity_table
image_stack=primary_image, intensity_table=intensity_table
)

return intensity_table

def image_to_spots(self, data_image: Union[np.ndarray, xr.DataArray]) -> SpotAttributes:
# LocalSearchBlobDetector does not follow the same contract as the remaining spot detectors.
# TODO: (ambrosejcarr) Rationalize the spot detectors by contract and then remove this hack.
raise NotImplementedError()

@staticmethod
@click.command("LocalSearchBlobDetector")
@click.option(
Expand Down