morphogen.analysis.random_sets¶
Random sets and random functions probed by structuring elements (Matheron 1975; Serra 1982; Jeulin 2021).
A structuring element K placed at every point x probes a set A: the dilation
A (+) K' = {x : K_x hits A} and the erosion A (-) K' = {x : K_x inside A} (K'
the transposed element). A random closed set is characterized by its Choquet capacity
T(K) = P(K hits A) = 1 - Q(K), Q(K) = P(K inside A^c), which for an ergodic set is
the volume fraction of A (+) K' in one realization. Pairs of points give the
covariance (T({0, h}) = 2 p - C(h)), segments the lineal path of the complement,
balls the spherical contact distribution. A grey-level image Z (a random function) is
probed by its erosion by pairs of points: the morphological covariance
E[min(Z(x), Z(x + h))]; the Minkowski functionals of its excursion sets {Z > u}
are curves of the level u.
Periodic images are probed on the torus; other images by minus sampling: only the positions where the element lies inside the box are counted.
- class morphogen.analysis.random_sets.Capacity(element: str, sizes: ndarray, values: ndarray, volume_fraction: float)[source]¶
Bases:
objectChoquet capacity
T(K)of a phase for structuring elements of growing size: the radius of balls, the length of segments, the distance of pairs of points, the edge of cubes (sizes, in length units).- property complement: ndarray¶
Q(K) = P(K inside A^c) = 1 - T(K).
- class morphogen.analysis.random_sets.MorphologicalCovariance(lags: dict[str, ndarray], values: dict[str, ndarray], volume_fraction: float)[source]¶
Bases:
AxisFunctionMean of the erosion (or dilation) of a grey-level image by pairs of points along the x, y and z axes;
volume_fractionholds the mean of the image.
- morphogen.analysis.random_sets.choquet_capacity(image, element: str = 'ball', sizes=None, *, phase: int = 1, direction=(1, 0, 0), periodic=None) Capacity[source]¶
Choquet capacity
T(K) = P(K hits A)ofphase(the setA) for structuring elementsKof the givensizes(length units), estimated as the volume fraction of the dilation ofAbyK.element:"ball"(radius; digital balls of the voxel centres closer than the radius, through the Euclidean distance map),"segment"(length, along the griddirection, e.g.(1, 1, 0)),"pair"(two points distant of the size alongdirection:T = 2 p - C(h)) or"cube"(edge). Segments, pairs and cubes have points on the grid: their sizes are rounded to whole steps and the measured sizes are returned.sizesdefaults to one voxel steps up to a quarter of the box (half of it for segments and pairs).
- morphogen.analysis.random_sets.dilation(image, element: str, size: float, *, phase: int = 1, direction=(1, 0, 0), periodic=None)[source]¶
Indicator of
A (+) K': the voxelsxwhereK_xhits the phase (Kas inchoquet_capacity(), the element anchored at its first point or its centre).
- morphogen.analysis.random_sets.erosion(image, element: str, size: float, *, phase: int = 1, direction=(1, 0, 0), periodic=None)[source]¶
Indicator of
A (-) K': the voxelsxwhereK_xlies inside the phase (outside a non-periodic box counts as outside the phase).
- morphogen.analysis.random_sets.opening(image, element: str, size: float, *, phase: int = 1, direction=(1, 0, 0), periodic=None)[source]¶
(A (-) K') (+) K: the union of the translates ofKinside the phase.
- morphogen.analysis.random_sets.closing(image, element: str, size: float, *, phase: int = 1, direction=(1, 0, 0), periodic=None)[source]¶
(A (+) K') (-) K: the complement of the opening of the complement.
- morphogen.analysis.random_sets.morphological_covariance(image, *, max_lag: int | None = None, periodic=None, operation: str = 'erosion') MorphologicalCovariance[source]¶
E[min(Z(x), Z(x + h))](erosion by pairs of points;operation="dilation": the maximum) of a grey-level image along the three axes, lags 0..max_lag voxels (default half the box). For a binary image the erosion gives the covariance.
- morphogen.analysis.random_sets.minkowski_curves(image, thresholds, *, periodic=None) dict[str, ndarray][source]¶
Densities of the four Minkowski functionals of the excursion sets
{Z > u}of a grey-level image for the levelsthresholds: the volume fraction, the specific surface, the integral of mean curvature and the Euler characteristic per unit volume.