morphogen.models.transparent

Transparent dead leaves (Jeulin 1997): a random function of falling transparent leaves, and its excursion above a threshold.

Each leaf (a sphere) carries a value v (a grey level, uniform on [0, 1] or Bernoulli); when it falls on a point, the value there becomes α v + (1 - α) Z: the leaf lets the fraction 1 - α of what it covers show through (α = 1: opaque leaves, the dead leaves). After infinitely many leaves, Z(x) = Σ_n α (1 - α)^{n - 1} v_n, v_1 the value of the last leaf fallen on x. Going back in time, as in the perfect simulation of the dead leaves (morphogen.models.deadleaves), the leaves are drawn one by one, each under the earlier ones, until the weight (1 - α)^n left to each centre of a check grid is below the tolerance, then a third more; what is left of the weight of a point takes the mean value of the leaves.

Theory. E[Z] = E[v] and Var Z = σ^2 α / (2 - α) (σ^2 = Var v). The leaves hitting x or x + h cover both with the probability r(h) = K(h) / (2K(0) - K(h)) (K: the mean geometric covariogram of the leaves), so that each of them multiplies E[(1 - α)^{a + b}], a and b the leaves fallen on each point above it, by m = r (1 - α)^2 + (1 - r)(1 - α); the shared leaves give

Cov(Z(x), Z(x + h)) = σ^2 α^2 r / (1 - m) = σ^2 α r / (1 + r (1 - α)),

the correlation r (2 - α) / (1 + r (1 - α)) (r for opaque leaves). Phase 1 is {Z > t}; its fraction P(Z > t) follows from the law of the series, here from 10^6 draws of its terms down to a weight of 10^-4 (the rest by its mean): the threshold of a volume fraction to about 10^-3.

morphogen.models.transparent.VALUES = ('uniform', 'bernoulli')

Laws of the values of the leaves.

class morphogen.models.transparent.TransparentDeadLeaves(domain: Domain, centers, radii, values, *, alpha: float, threshold: float, mean_value: float, **kwargs)[source]

Bases: Microstructure

Transparent leaves in their order of fall backwards (the first on top), the random function Z they make, and its excursion Z > threshold (phase 1).

property n_leaves: int
field(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

The random function Z at the voxel centres (float32).

voxelize(shape=None, *, voxel_size=None, grid: Grid | None = None, supersampling=1)[source]

Phase image (uint8), or partial volume fractions of phase 1 (float32) when supersampling > 1 (supersampling**3 sub-samples per voxel).

values_at(points) → ndarray[source]

The random function at points: the leaves covering each, in their order.

contains(points) → ndarray[source]

Whether points lie in phase 1.

level_set(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

The implicit function of the excursion Z > threshold (negative inside). The function Z is constant between the spheres of the leaves: the boundary of the excursion is made of the parts of these spheres across which Z passes the threshold. At a point, the leaf whose sphere is such a part nearby is one that, added to the leaves that cover the point or taken from them, changes its side: the function is the distance to the nearest of these spheres, with the sign of the side of the point (clipped to a band of four voxels). It vanishes exactly on the boundary; away from it, it is a distance to a sphere near that boundary.

summary() → dict[source]

Counts and sizes describing the realization.

class morphogen.models.transparent.TransparentDeadLeavesModel(radius: Distribution, transparency: float = 0.5, values: str = 'uniform', value_probability: float = 0.5, threshold: float | None = None, volume_fraction: float | None = None, tolerance: float = 0.001, *, anisotropy: Anisotropy | None = None)[source]

Bases: Model

Transparent dead leaves of spheres (Jeulin 1997): the excursion of the random function of leaves letting 1 - α of what they cover show through.

phases: ClassVar[dict[int, str]] = {0: 'below the threshold', 1: 'above the threshold'}

Meaning of the phase indices of the voxel images.

count_label: ClassVar[str] = 'leaves'

Objects counted by expected_count() (fibres, spheres, cells…).

property mean_value: float
property value_variance: float
field_threshold() → float[source]

The threshold of phase 1: given, or the quantile of the law of Z that leaves the volume fraction above it.

excursion_fraction() → float[source]

P(Z > threshold), from the law of Z.

same_leaf_probability(h) → ndarray[source]

r(h) = K(h) / (2 K(0) - K(h)) for spheres of the law of the radii.

field_covariance(h) → ndarray[source]

Cov(Z(x), Z(x + h)) = σ^2 α r / (1 + r (1 - α)).

generate(domain: Domain, seed: int | SeedSequence | Generator | None = None) → TransparentDeadLeaves[source]

One realization of the model in domain.

theory(domain: Domain | None = None) → dict[str, float][source]

Theoretical morphological characteristics known in closed form (may be empty).

Some values depend on the domain (e.g. the intensity implied by a number of cells).