spacr.object
Module Contents
- spacr.object.generate_organelle_masks(src, settings, object_type)[source]
Generate organelle masks using multiple segmentation strategies.
- Supports four morphology modes:
‘spots’: punctate structures (lipid droplets, vesicles, peroxisomes)
‘network’: filamentous/reticular structures (mitochondria, microtubules, ER tubules)
‘irregular’: irregular-shaped organelles (Golgi, ER cisternae, lysosomes)
‘ring’: hollow / ring-shaped structures (endosomes, autophagosomes, late lysosomes)
- Each mode can use different backends:
‘cellpose’: deep-learning segmentation via Cellpose
‘stardist’: star-convex polygon instance segmentation (spots only)
‘otsu’: global Otsu thresholding with morphological cleanup
‘adaptive’: local adaptive thresholding
‘log’: Laplacian of Gaussian blob detection (spots, ring)
‘dog’: Difference of Gaussians blob detection (spots, ring)
‘ridge’: ridge/tubeness filter (network only)
‘hysteresis’: dual-threshold hysteresis (network only)
‘unet’: user-provided U-Net semantic segmentation (network only)
- Parameters:
src (str) – Path to the mask source directory containing .npz stacks.
settings (dict) – Configuration dictionary. Organelle-specific keys (all prefixed with ‘organelle_’) are documented in _set_organelle_defaults.
object_type (str) – Should be ‘organelle’ (or a custom name used for folder naming).
- Returns:
Masks are saved as .npy files in
{src}/{object_type}_mask_stack/.- Return type:
None