cellcoloc.CellposeModelConfigο
- class cellcoloc.CellposeModelConfig(model_name_or_path, segmentation_method='cellpose', diameter=None, do_3d=None, z_axis=0, channel_axis=None, cellprob_threshold=0.0, flow_threshold=0.4, anisotropy=False, flow3d_smooth=0, prefilter=None, prefilter_sigma_xy=1.0, prefilter_sigma_z=None, prefilter_median_size_xy=3, prefilter_median_size_z=None, z_crop=None, z_projection=None, threshold_percentile=98.0, threshold_background_sigma=None, threshold_min_object_voxels=10, threshold_min_hole_voxels=10, threshold_apply_closing=True, postfilters=None, min_intensity_measure='mean', min_intensity_threshold=None, local_contrast_k=1.0, local_contrast_shell_inner_radius=1, local_contrast_shell_outer_radius=4, bright_pixel_measure='count', bright_pixel_threshold=None, bright_pixel_min_count=None, bright_pixel_min_fraction=None)[source]ο
Collect Cellpose settings for one segmentation target.
- diameterο
Diameter parameter passed to
cellpose.models.CellposeModel.eval(). For Cellpose 4 and newer this can be set toNoneto let Cellpose choose its default behavior without an explicit diameter.
- model_name_or_pathο
Either a built-in Cellpose model identifier such as
"cyto3"or"nuclei", or a filesystem path pointing to a custom trained model.
- segmentation_methodο
Segmentation backend used for this channel.
"cellpose"keeps the existing neural-network workflow."otsu","li", and"percentile"use intensity thresholding followed by connected component labeling.
- do_3dο
Whether Cellpose should run in 3D mode. If set to
None, the pipeline auto-detects 2D versus 3D from the loaded image z-size.
- z_axisο
Array axis representing the z dimension for Cellpose.
- channel_axisο
Channel axis passed to Cellpose. Keep this as
Nonefor single channel volumes.
- cellprob_thresholdο
Cellpose pixel probability threshold used during mask generation. This is only forwarded explicitly for Cellpose 4 and newer.
- flow_thresholdο
Cellpose flow error threshold used during mask generation. This is only forwarded explicitly for Cellpose 4 and newer.
- anisotropyο
Controls whether a 3D Cellpose run should use anisotropy correction. Set this to
Falseto disable anisotropy handling entirely, toTrueto let the pipeline derive an anisotropy factor from the configured voxel size, or to a numeric value to force a specific Cellpose anisotropy factor. The value is ignored for 2D runs.
- flow3d_smoothο
Optional Gaussian smoothing strength forwarded to Cellpose for 3D flow fields. This setting only has an effect for true 3D runs and is ignored for 2D data. Keep the default
0to disable smoothing.
- prefilterο
Optional image prefilter or ordered prefilter chain applied before segmentation. Supported values are
None, a single string such as"gaussian","laplacian_of_gaussian"(alias"log"), or"median", or a sequence combining these filters in the requested execution order.
- prefilter_sigma_xyο
Gaussian prefilter sigma in the in-plane directions. Used when
prefilter="gaussian".
- prefilter_sigma_zο
Gaussian prefilter sigma along z. If
None, the pipeline reusesprefilter_sigma_xy. Only relevant for 3D data.
- prefilter_median_size_xyο
Median prefilter kernel size in the in-plane directions. Used when
prefilter="median".
- prefilter_median_size_zο
Median prefilter kernel size along z. If
None, the pipeline reusesprefilter_median_size_xy. Only relevant for 3D data.
- z_cropο
Optional global z-range restriction in
(start, stop)form. When set on any participating channel config, the pipeline applies this crop consistently to all channels and all ROIs for the internal segmentation and quantification steps. The full stack is still shown in visualization outputs.
- z_projectionο
Optional global projection method applied along the z axis before any later ROI drawing, segmentation, quantification, or visualization. Supported values are
None(default),"max","mean","median","std", and"var". When used together withz_crop, only the cropped z interval is projected.
- threshold_percentileο
Percentile used when
segmentation_method="percentile".
- threshold_background_sigmaο
Optional Gaussian sigma used for background subtraction before threshold-based segmentation.
- threshold_min_object_voxelsο
Minimum object size kept after threshold-based segmentation.
- threshold_min_hole_voxelsο
Minimum hole size filled after threshold-based segmentation.
- threshold_apply_closingο
Whether a small binary closing step should be applied before threshold cleanup.
- postfiltersο
Optional post-segmentation filters applied to the resulting masks. Supported values are
None,"min_intensity","local_contrast","bright_pixel_support", or a list combining them in the requested execution order.
- min_intensity_measureο
Statistic used by the
"min_intensity"postfilter. Supported values are"mean","median", and"max".
- min_intensity_thresholdο
Intensity threshold used by the
"min_intensity"postfilter.
- local_contrast_kο
Contrast multiplier used by the
"local_contrast"postfilter in the criterionobject_median > background_median + k * background_mad.
- local_contrast_shell_inner_radiusο
Inner dilation radius, in pixels or voxels, used to construct the local shell for the
"local_contrast"postfilter.
- local_contrast_shell_outer_radiusο
Outer dilation radius, in pixels or voxels, used to construct the local shell for the
"local_contrast"postfilter.
- bright_pixel_measureο
Statistic used by the
"bright_pixel_support"postfilter."count"requires at least a minimum number of bright pixels within the mask, while"fraction"requires a minimum fraction of bright pixels relative to the object size.
- bright_pixel_thresholdο
Intensity threshold above which a pixel or voxel counts as bright for the
"bright_pixel_support"postfilter.
- bright_pixel_min_countο
Minimum number of bright pixels or voxels required when
bright_pixel_measure="count".
- bright_pixel_min_fractionο
Minimum fraction of bright pixels or voxels required when
bright_pixel_measure="fraction".
- __init__(model_name_or_path, segmentation_method='cellpose', diameter=None, do_3d=None, z_axis=0, channel_axis=None, cellprob_threshold=0.0, flow_threshold=0.4, anisotropy=False, flow3d_smooth=0, prefilter=None, prefilter_sigma_xy=1.0, prefilter_sigma_z=None, prefilter_median_size_xy=3, prefilter_median_size_z=None, z_crop=None, z_projection=None, threshold_percentile=98.0, threshold_background_sigma=None, threshold_min_object_voxels=10, threshold_min_hole_voxels=10, threshold_apply_closing=True, postfilters=None, min_intensity_measure='mean', min_intensity_threshold=None, local_contrast_k=1.0, local_contrast_shell_inner_radius=1, local_contrast_shell_outer_radius=4, bright_pixel_measure='count', bright_pixel_threshold=None, bright_pixel_min_count=None, bright_pixel_min_fraction=None)ο
Methods
__init__(model_name_or_path[,Β ...])Attributes