morphogen.analysis.particles

The particles of a phase in a volume: its connected parts, those that touch split by the watershed of their distance map, with their volumes, their centres and their number per unit volume — measured in three dimensions, where the stereology of morphogen.analysis.stereology recovers them from sections.

The distance of each voxel of the phase to the other phase is highest at the heart of the particles and low in the necks where two of them touch or overlap. Its maxima of a prominence at least prominence (the descent from a maximum to the saddle towards a higher one: a neck, not the roughness of a surface) are the markers of the particles, and the watershed of the opposite of the distance (morphogen.kernels.watershed: the voxels conquered from the markers in decreasing order of their distance) shares the phase between them: two overlapping balls are cut by the plane of their neck. Voxels are 26-connected, through the faces of a periodic image.

In an image that is not periodic, the particles cut by its frame are known in part only: they are left out, and each of the others counts for Π n_i / Π (n_i - 1 - w_i) over the axes (n_i voxels of the image, w_i voxels of the particle: the inverse of the fraction of its positions that keep it whole in the frame, Miles 1974 and Lantuéjoul 1980), so that the number per unit volume and the distribution of sizes are not biased towards the small particles.

class morphogen.analysis.particles.Particles(labels: ndarray, volumes: ndarray, centroids: ndarray, weights: ndarray, volume: float)[source]

Bases: object

The particles of a phase: labels (0 outside the phase, else the number of the particle from 1), their volumes and centroids (n x 3, in the box), their weights (1; in an image that is not periodic, 0 for a particle cut by the frame and the factor of Miles and Lantuéjoul for the others) and the volume of the image.

property count: int

The number of particles (those cut by the frame included).

property radii: ndarray

The radii of the balls of the volumes of the particles.

density(edges=None)[source]

The number of particles per unit volume; in the classes of radii between edges, an array.

mean_radius() → float[source]

Number mean of the radii of the particles.

radius_cv() → float[source]

Coefficient of variation of the radii of the particles.

morphogen.analysis.particles.particle_sizes(image, phase: int = 1, *, separate: bool = True, prominence: float | None = None, min_radius: float = 0.0, periodic=None) → Particles[source]

The particles of phase in the volume of an image (see the module): its 26-connected parts and, with separate, those that touch split by the watershed of their distance map from its maxima of prominence at least prominence (physical units; default half a voxel). The particles of equivalent radius below min_radius are left out. On periodic images each particle counts once, whole across the faces; otherwise those cut by the frame have a zero weight and the others the factor of Miles and Lantuéjoul.