diff --git a/starfish/core/experiment/builder/inplace.py b/starfish/core/experiment/builder/inplace.py index 9edb9d4a7..b531f32c1 100644 --- a/starfish/core/experiment/builder/inplace.py +++ b/starfish/core/experiment/builder/inplace.py @@ -6,7 +6,6 @@ import abc -import warnings from pathlib import Path from typing import Mapping, Optional @@ -32,15 +31,6 @@ def write_tile( return tile.provider.sha256 -def enable_inplace_mode(): - """ - .. deprecated:: 0.1.4 - This method is no longer necessary. Call `write_experiment_json` with - `writer_contract=InplaceWriterContract()`. - """ - warnings.warn("`enable_inplace_mode()` is no longer necessary.", DeprecationWarning) - - class InplaceFetchedTile(FetchedTile): """Data formatters that operate in-place should return tiles that extend this class.""" @property diff --git a/starfish/core/experiment/experiment.py b/starfish/core/experiment/experiment.py index 0e83bd9ec..3a237e95f 100644 --- a/starfish/core/experiment/experiment.py +++ b/starfish/core/experiment/experiment.py @@ -52,8 +52,8 @@ class FieldOfView: The decoding of :py:class:`~slicedimage.TileSet` to :py:class:`~starfish.imagestack.imagestack.ImageStack` does not happen until the image is accessed. ImageStacks can only be initialized with - aligned tilesets, so if thereare multiple you may need to iterate through the groups - using :py:func:`~starfish.experiment.experiment.FieldOfView.iterate_image_type` + aligned tilesets, so if there are multiple you may need to iterate through the groups + using :py:func:`~starfish.experiment.experiment.FieldOfView.get_images` and process each one individually. Be prepared to handle errors when images are accessed. @@ -100,23 +100,6 @@ def name(self) -> str: def image_types(self) -> Set[str]: return set(self._images.keys()) - def show_aligned_image_groups(self) -> None: - """ - .. deprecated:: 0.1.4 - Use `FieldOfView.get_images()` to retrieve all the aligned image groups. - """ - raise DeprecationWarning("This method has been deprecated. Aligned groups are now parsed " - "as a part of, FieldOfView.get_images() and are determined by the " - "selected axes provided to the method.") - - def iterate_image_type(self, image_type: str) -> Iterator[ImageStack]: - """ - .. deprecated:: 0.1.4 - Use `FieldOfView.get_images()` to retrieve all the aligned image groups. - """ - raise DeprecationWarning("This method has been deprecated. Instead use " - "FieldOfView.get_images(image_type)") - def get_image(self, item: str, aligned_group: Any = _SINGLETON, rounds: Optional[Collection[int]] = None, diff --git a/starfish/core/image/Filter/__init__.py b/starfish/core/image/Filter/__init__.py index 36924c954..dc90c0ccf 100644 --- a/starfish/core/image/Filter/__init__.py +++ b/starfish/core/image/Filter/__init__.py @@ -10,7 +10,6 @@ from .linear_unmixing import LinearUnmixing from .map import Map from .match_histograms import MatchHistograms -from .max_proj import MaxProject from .mean_high_pass import MeanHighPass from .reduce import Reduce from .richardson_lucy_deconvolution import DeconvolvePSF diff --git a/starfish/core/image/Filter/max_proj.py b/starfish/core/image/Filter/max_proj.py deleted file mode 100644 index b63118754..000000000 --- a/starfish/core/image/Filter/max_proj.py +++ /dev/null @@ -1,78 +0,0 @@ -import warnings -from typing import Iterable, MutableMapping, Optional, Sequence, Union - -import numpy as np - -from starfish.core.imagestack.imagestack import ImageStack -from starfish.core.types import Axes, Coordinates, Number -from ._base import FilterAlgorithm - - -class MaxProject(FilterAlgorithm): - """ - Creates a maximum projection over one or more axis of the image tensor - - .. deprecated:: 0.1.2 - Use `Filter.Reduce(func='max')` instead. - - Parameters - ---------- - dims : Iterable[Union[Axes, str]] - one or more Axes to project over - - See Also - -------- - starfish.types.Axes - - """ - - def __init__(self, dims: Iterable[Union[Axes, str]]) -> None: - warnings.warn( - "Filter.MaxProject is being deprecated in favor of Filter.Reduce(func='max')", - DeprecationWarning, - ) - self.dims = set(Axes(dim) for dim in dims) - - _DEFAULT_TESTING_PARAMETERS = {"dims": 'r'} - - def run( - self, - stack: ImageStack, - verbose: bool = False, - *args, - ) -> Optional[ImageStack]: - """Perform filtering of an image stack - - Parameters - ---------- - stack : ImageStack - Stack to be filtered. - in_place : bool - if True, process ImageStack in-place, otherwise return a new stack - verbose : bool - if True, report on filtering progress (default = False) - n_processes : Optional[int] - Number of parallel processes to devote to calculating the filter - - Returns - ------- - ImageStack : - The max projection of an image across one or more axis. - - """ - max_projection = stack.xarray.max([dim.value for dim in self.dims]) - max_projection = max_projection.expand_dims(tuple(dim.value for dim in self.dims)) - max_projection = max_projection.transpose(*stack.xarray.dims) - physical_coords: MutableMapping[Coordinates, Sequence[Number]] = {} - for axis, coord in ( - (Axes.X, Coordinates.X), - (Axes.Y, Coordinates.Y), - (Axes.ZPLANE, Coordinates.Z)): - if axis in self.dims: - # this axis was projected out of existence. - assert coord.value not in max_projection.coords - physical_coords[coord] = [np.average(stack.xarray.coords[coord.value])] - else: - physical_coords[coord] = max_projection.coords[coord.value] - max_proj_stack = ImageStack.from_numpy(max_projection.values, coordinates=physical_coords) - return max_proj_stack diff --git a/starfish/core/image/Filter/test/test_api_contract.py b/starfish/core/image/Filter/test/test_api_contract.py index 91ba27c46..ce36372b1 100644 --- a/starfish/core/image/Filter/test/test_api_contract.py +++ b/starfish/core/image/Filter/test/test_api_contract.py @@ -22,7 +22,6 @@ from starfish import ImageStack from starfish.core.image import Filter -from starfish.core.image.Filter.max_proj import MaxProject from starfish.core.image.Filter.reduce import Reduce @@ -35,7 +34,6 @@ 'guassian_high_pass': Filter.GaussianHighPass, 'guassian_low_pass': Filter.GaussianLowPass, 'laplace': Filter.Laplace, - 'max_proj': Filter.MaxProject, 'mean_high_pass': Filter.MeanHighPass, 'reduce': Filter.Reduce, 'deconvolve': Filter.DeconvolvePSF, @@ -72,7 +70,7 @@ def test_all_methods_adhere_to_contract(filter_class): # Max Proj and Reduce don't have an in_place, n_processes, verbose option, # so we need to skip these tests - if filter_class not in [MaxProject, Reduce]: + if filter_class not in [Reduce]: # return None if in_place = True try: filtered = instance.run(data, in_place=True) diff --git a/starfish/core/imagestack/imagestack.py b/starfish/core/imagestack/imagestack.py index 8ce4d77dc..fd3e38720 100644 --- a/starfish/core/imagestack/imagestack.py +++ b/starfish/core/imagestack/imagestack.py @@ -1146,7 +1146,8 @@ def max_proj(self, *dims: Axes) -> "ImageStack": This method is deprecated. Please ``ImageStack.reduce(axes, func="max")`` to do max projection operations. """ - raise DeprecatedAPIError("Please Filter.MaxProject to do max projection operations.") + raise DeprecatedAPIError( + """Please ImageStack.reduce(axes, func="max") to do max projection operations.""") def _squeezed_numpy(self, *dims: Axes): """return this ImageStack's data as a squeezed numpy array"""