dilate_labels
patchworks.dilate_labels(fn: Callable[[np.ndarray], np.ndarray], iterations: int = 1, *, use_gpu: bool = False) -> Callable[[np.ndarray], np.ndarray]
Wrap a segmentation callable to grow its labels after each tile.
Applies a single-pass grey dilation to whatever fn returns, before
tile_process/stage_tile trim the overlap halo and merge across
tile boundaries — so dilated labels still stitch correctly at tile
edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[ndarray], ndarray]
|
Any segmentation function with the |
required |
iterations
|
int
|
Pixels to grow each label by (grey-dilation footprint size
|
1
|
use_gpu
|
bool
|
Dilate via cupyx instead of scipy. Independent of whatever backend
|
False
|
Returns:
| Type | Description |
|---|---|
Callable[[ndarray], ndarray]
|
Picklable function ready for |