morphogen.models.boolean

Boolean models: unions of random grains implanted on Poisson points.

class morphogen.models.boolean.BooleanSpheres(radius: Distribution = Constant(value=1.0), volume_fraction: float | None = None, intensity: float | None = None, *, anisotropy: Anisotropy | None = None)[source]

Bases: Model

Boolean model of spheres: union of balls centred on a Poisson point process.

Give either the volume fraction of the union or the intensity of the germs; the other follows from p = 1 - exp(-theta * E[4/3 pi R^3]).

phases: ClassVar[dict[int, str]] = {0: 'matrix', 1: 'spheres'}

Meaning of the phase indices of the voxel images.

count_label: ClassVar[str] = 'spheres'

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

property mean_grain_volume: float
property theta: float

Intensity of the Poisson germs.

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

One realization of the model in domain.

expected_count(domain: Domain) → float[source]

Mean number of germs (grain centres) in the 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).

choquet_capacity(element: str, size) → ndarray[source]

T(K) = 1 - exp(-theta E[|A' (+) K'|]): balls of radius size (dilated spheres of radius R + r), segments of length size (the sphere swept along the segment: (4/3) pi R^3 + pi R^2 l), pairs of points at distance size (2 p - C(h)).

covariance(h) → ndarray[source]

C(h) = P(x in A, x + h in A) for the union A of the spheres.

integral_range() → float[source]

A3 = int (C(h) - p^2) dh / (p (1 - p)) of the indicator of the union.

class morphogen.models.boolean.BooleanCylinders(radius: Distribution = Constant(value=1.0), length: Distribution = Constant(value=10.0), orientation: OrientationDistribution = Isotropic(), caps: str = 'flat', volume_fraction: float | None = None, intensity: float | None = None)[source]

Bases: Model

Boolean model of finite fibres: cylinders (flat caps) or spherocylinders.

Fibre centres form a Poisson point process; radius, length (of the cylindrical part) and axis orientation are independent random variables. The covariance (covariance()) is in closed form along any direction, for any law of the axes (Peyrega et al. 2009).

phases: ClassVar[dict[int, str]] = {0: 'matrix', 1: 'fibres'}

Meaning of the phase indices of the voxel images.

count_label: ClassVar[str] = 'fibres'

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

property mean_grain_volume: float
property mean_grain_surface: float
property theta: float
generate(domain: Domain, seed: int | SeedSequence | Generator | None = None) → PrimitiveUnion[source]

One realization of the model in domain.

expected_count(domain: Domain) → float[source]

Mean number of germs (grain centres) in the 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).

mean_covariogram(h, direction=None) → ndarray[source]

E[K(h)] = E|K ∩ (K + h)|, the mean geometric covariogram of the fibres over their radii, lengths and axes, for h of the lengths h along direction (averaged over the directions without one): K = (l - |h·u|)+ lens(|h × u|) for cylinders (Peyrega et al. 2009, eq. 15), the integral along the axis of the lens of the sections for spherocylinders (morphogen.theory.spherocylinder_covariogram()); E[K(0)] = E[V] and int E[K(h)] dh = E[V^2].

covariance(h, direction=None) → ndarray[source]

C(h) = P(x in A, x + h in A) = 1 - 2q + q^2 exp(theta E[K(h)]) along direction (any for isotropic axes), or averaged over the directions of h without one (morphogen.theory.oriented_covariance()).

integral_range() → float[source]

A3 = int (C(h) - p^2) dh / (p q) over the space: 4 pi int h^2 (C̄(h) - p^2) dh / (p q), C̄ the covariance averaged over the directions (96 Gauss-Legendre distances up to the largest extent of a fibre); the mean volume of the fibres weighted by their volumes, E[V^2] / E[V], as p -> 0.