itasc.cellpose.divergence_maps¶
Divergence-based foreground & contour maps from Cellpose prob/dp outputs.
Replaces the (cellprob x z) mask sweep with a direct computation:
foreground = reduce_z(sigmoid(prob)) contours = reduce_z(clip(div(filter(dp)), 0, inf))
See notes/divergence_maps_spec.md for the rationale.
Functions
|
Compute and write |
|
Per (t, z): filter -> divergence -> clip(>=0); then reduce across z. |
|
Divergence of a |
|
|
|
Numerically stable sigmoid on float32 logits. |
Classes
|
Summary returned by |
- exception itasc.cellpose.divergence_maps.CancelledError[source]¶
Bases:
ExceptionRaised when a cooperative cancel signal is observed mid-computation.
- class itasc.cellpose.divergence_maps.DivergenceMapsReport(frames, foreground_z_reduction, contour_z_reduction, smoothing_sigma, median_radius, contours_path, foreground_path, foreground_smoothing_sigma=0.0, foreground_median_radius=0)[source]¶
Bases:
objectSummary returned by
build_divergence_maps().- Parameters:
- itasc.cellpose.divergence_maps.build_divergence_maps(prob_path, dp_path, contours_out, foreground_out, *, foreground_z_reduction, contour_z_reduction, smoothing_sigma, median_radius, foreground_smoothing_sigma=0.0, foreground_median_radius=0, progress_cb=None, cancel=None)[source]¶
Compute and write
contoursandforegroundfrom Cellpose prob/dp.Output stacks are
T x Y x Xfloat32.progress_cbis called for each foreground frame, contour z-slice, and output write.smoothing_sigma/median_radiusfilter the flow before divergence (contours); theforeground_*knobs filter the reduced foreground map independently.
- itasc.cellpose.divergence_maps.contour_from_dp(dp_tzcyx, *, smoothing_sigma, median_radius, reduction)[source]¶
Per (t, z): filter -> divergence -> clip(>=0); then reduce across z.
dp_tzcyx: shape(T, Z, 2, Y, X)with channels[dy, dx]. Returns(T, Y, X)float32.
- itasc.cellpose.divergence_maps.divergence_2d(flow_yx)[source]¶
Divergence of a
(2, Y, X)flow field with channels[dy, dx].
- itasc.cellpose.divergence_maps.foreground_from_prob(prob_tzyx, *, reduction, smoothing_sigma=0.0, median_radius=0)[source]¶
sigmoid(prob)reduced across z, optionally smoothed.Returns
(T, Y, X)float32 in [0, 1]. Whensmoothing_sigmaormedian_radiusis set, each reduced frame is median- then gaussian- filtered (defaults of0leave the foreground untouched).