piscis#
Submodules#
Classes#
Class for running the Piscis algorithm. |
|
Class for running the PyTorch port of the legacy Piscis algorithm originally implemented in JAX. |
Package Contents#
- class piscis.Piscis(model_name: str = '20251212', batch_size: int = 1, input_size: Tuple[int, int] | None = None, device: str | torch.device | None = None)#
Bases:
_PiscisClass for running the Piscis algorithm.
- Attributes:
- model_namestr
Model name.
- batch_sizeint
Batch size for the CNN.
- adjustmentstr
Adjustment type applied to images during preprocessing.
- input_sizeTuple[int, int]
Input size for the CNN.
- dilation_iterationsint
Number of iterations used to dilate ground truth labels during training.
- channelsint
Number of channels in the input images.
- deviceOptional[Union[str, torch.device]]
Device to run the model on.
- poolingstr
Pooling type applied to labels.
- modelSpotsModel
Model.
- predict(x: numpy.ndarray | dask.array.Array, stack: bool = False, scale: float = 1.0, threshold: float = 0.5, min_distance: int = 1, intermediates: bool = False) Tuple[numpy.ndarray, xarray.DataArray] | numpy.ndarray#
Predict spots in an image or stack of images.
- Parameters:
- xnp.ndarray or da.Array
Image or stack of images.
- stackbool, optional
Whether x is a stack of images. Default is False.
- scalefloat, optional
Scale factor for rescaling x. Default is 1.
- thresholdfloat, optional
Spot detection threshold. Default is 0.5.
- min_distanceint, optional
Minimum distance between spots. Default is 1.
- intermediatesbool, optional
Whether to return intermediate feature maps. Default is False.
- Returns:
- coordsnp.ndarray
Predicted spot coordinates.
- ynp.ndarray, optional
Intermediate feature maps. Only returned if intermediates is True.
- class piscis.PiscisLegacy(model_name: str = '20230905', batch_size: int = 1, input_size: Tuple[int, int] | None = None, device: str | torch.device | None = None)#
Bases:
_PiscisClass for running the PyTorch port of the legacy Piscis algorithm originally implemented in JAX.
- Attributes:
- model_namestr
Model name.
- batch_sizeint
Batch size for the CNN.
- adjustmentstr
Adjustment type applied to images during preprocessing.
- input_sizeTuple[int, int]
Input size for the CNN.
- dilation_iterationsint
Number of iterations used to dilate ground truth labels during training.
- channelsint
Number of channels in the input images.
- deviceOptional[Union[str, torch.device]]
Device to run the model on.
- poolingstr
Pooling type applied to labels.
- modelSpotsModel
Model.
- predict(x: numpy.ndarray | dask.array.Array, stack: bool = False, scale: float = 1.0, threshold: float = 1.0, min_distance: int = 1, intermediates: bool = False) Tuple[numpy.ndarray, xarray.DataArray] | numpy.ndarray#
Predict spots in an image or stack of images.
- Parameters:
- xnp.ndarray or da.Array
Image or stack of images.
- stackbool, optional
Whether x is a stack of images. Default is False.
- scalefloat, optional
Scale factor for rescaling x. Default is 1.
- thresholdfloat, optional
Spot detection threshold. Can be interpreted as the minimum number of fully confident pixels necessary to identify a spot. Default is 1.0.
- min_distanceint, optional
Minimum distance between spots. Default is 1.
- intermediatesbool, optional
Whether to return intermediate feature maps. Default is False.
- Returns:
- coordsnp.ndarray
Predicted spot coordinates.
- ynp.ndarray, optional
Intermediate feature maps. Only returned if intermediates is True.