Cellpose plugin
blockbuster.plugins.cellpose.cellpose_fn(model: str = 'cyto3', *, gpu: bool = False, diameter: float | None = None, do_3D: bool = False, channels: list[int] | None = None, channel_axis: int | None = None, **cellpose_kwargs: Any) -> Callable[[np.ndarray], np.ndarray]
Return a ready-to-use Cellpose function for tile_process.
One-liner convenience wrapper: combines model configuration and function creation into a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Cellpose model type: |
'cyto3'
|
gpu
|
bool
|
Use GPU for inference. |
False
|
diameter
|
float | None
|
Expected cell diameter in pixels. |
None
|
do_3D
|
bool
|
Run in 3-D mode. Each tile must contain the full z-stack — use
|
False
|
channels
|
list[int] | None
|
Cellpose 3 only. |
None
|
channel_axis
|
int | None
|
Cellpose 4 only. Index of the channel axis in the input array.
|
None
|
**cellpose_kwargs
|
Any
|
Extra kwargs forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
Callable[[ndarray], ndarray]
|
Picklable function ready for |
Examples:
Greyscale 2-D:
>>> fn = cellpose_fn("cyto3", gpu=True, diameter=30)
>>> result = tile_process("image.zarr", fn, tile_shape=(1, 2048, 2048), overlap=20)
Nuclear segmentation:
3-D with anisotropy:
>>> fn = cellpose_fn("cyto3", gpu=True, do_3D=True, anisotropy=3.0, diameter=20)
>>> from functools import partial
>>> from blockbuster import auto_tile_shape_cellpose, tile_process
>>> tile_fn = partial(auto_tile_shape_cellpose, do_3D=True, use_gpu=True, diameter=20)
>>> result = tile_process("image.zarr", fn, tile_shape=tile_fn, overlap=10)