morphogen.analysis.stereology¶
Stereology: the sections of a phase by the planes of the grid, and the recovery of the size distribution of its particles from them (Wicksell 1925; Saltykov 1967), for spheres and for aligned ellipsoids of a common shape and orientation, as Degdeg & Dirrenberger for the pores of a copper foam.
A plane normal to the unit vector n at the distance d from the centre of the
ellipsoid x . M x = 1, M^-1 = R diag(a^2, b^2, c^2) R^T, cuts it in an ellipse of
area pi abc (s - d^2) / s^(3/2), s = n . M^-1 n. Uniformly placed particles have
u = d / sqrt(s) uniform over [-1, 1]: the equivalent radius of their sections is
r = r_max sqrt(1 - u^2), the law of a sphere, F(v) = 1 - sqrt(1 - v^2) for
v = r / r_max, with r_max = kappa a, kappa = sqrt(l1 l2) / s_hat^(1/4) for the
shape factors l1 = b/a, l2 = c/a and s_hat = n . R diag(1, l1^2, l2^2) R^T n;
the planes of a family cut the particles in proportion to their height H = 2 a
sqrt(s_hat). On classes of radii of width delta, a particle of the 3D class I
(r_max = I delta) gives a section of the 2D class J <= I with the probability
P_IJ = (sqrt(I^2 - (J - 1)^2) - sqrt(I^2 - J^2)) / I (the Scheil–Schwartz–Saltykov
matrix), so that the areal densities of the sections are N_A,J = sum_I P_IJ H_I N_V,I,
inverted class by class from the largest.
- class morphogen.analysis.stereology.Sections(axis: int, radii: ndarray, weights: ndarray, area: float)[source]¶
Bases:
objectThe sections of a phase by the planes normal to
axis: their equivalent radiisqrt(area / pi), their weights (1, or the Miles–Lantuéjoul factor of a section inside the frame of a non-periodic image) and the total area of the planes.
- morphogen.analysis.stereology.section_sizes(image, phase: int = 1, axis: int = 2, *, separate: bool = False, prominence: float | None = None, min_radius: float = 0.0, periodic=None) Sections[source]¶
The sections of
phaseby the planes of voxels normal toaxis(8-connected pixels).separate: touching sections are split by a watershed of their distance map from its maxima of prominence at leastprominence(physical units, default half a pixel), in the manner of the binary watershed of Fiji. Sections of equivalent radius belowmin_radiusare dropped. On periodic images each section counts once, whole across the faces; otherwise the sections cut by the frame are dropped and the others weighted byn1 n2 / ((n1 - 1 - w1)(n2 - 1 - w2))for their extentswin pixels (Miles–Lantuéjoul).
- morphogen.analysis.stereology.saltykov_matrix(n: int) ndarray[source]¶
P[I - 1, J - 1]: the probability that a particle of the 3D classI(largest section radiusI delta) is cut in a section of the 2D classJ(radii between(J - 1) deltaandJ delta), classes counted upward; its rows sum to 1.
- morphogen.analysis.stereology.section_scales(shape=(1.0, 1.0), rotation=None, axis: int = 2) tuple[float, float][source]¶
(kappa, h): an ellipsoid of short semi-axisa, shape factorsshape = (b/a, c/a)and axesrotation(columns: the directions of its axes a, b, c in the frame of the image; default x, y, z) is cut by the planes normal toaxisin sections of equivalent radius at mostkappa a, and spansh aacross them. From a fabric tensorf:shape = (f.ratios[1], f.ratios[0]),rotation = f.axes[:, ::-1].
- class morphogen.analysis.stereology.Unfolding(radii: ndarray, density: ndarray, directional: ndarray, scales: ndarray, measured: ndarray, refolded: ndarray, errors: ndarray, axes: tuple[int, ...])[source]¶
Bases:
objectA 3D size distribution recovered from sections: the short semi-axes of its classes (
radii, on the mean scale of the directions) and their numbers per unit volume (density, the mean of the directions); per direction (axes), the densities (directional), the largest short semi-axisa_max(scales), the measured and refolded areal densities of the 2D classes and the relative L1 error of the refolding.
- morphogen.analysis.stereology.unfold_sections(sections, *, shape=(1.0, 1.0), rotation=None, bins: int = 20, classes: int | None = None, percentile: float = 99.0) Unfolding[source]¶
The size distribution of particles of a common shape (
shape,rotation: seesection_scales()) from their sections normal to one or several axes (aSectionsor a list), as Degdeg & Dirrenberger: in each direction the sections up to thepercentileof their radii,r_max, fall inbinsclasses of widthr_max / bins, and theclasseslargest 3D classes (short semi-axesI / binsofa_max = r_max / kappa) come from Saltykov’s recursion; their densities are averaged over the directions class by class.classes=None: the number that minimizes the summed L1 error of refolding the mean through each direction (several directions: with one, the refolding of all the classes is exact).
- morphogen.analysis.stereology.shape_consistency(sections, shape=(1.0, 1.0), rotation=None) ndarray[source]¶
The mean section radius over
kappain each direction (the axes ofsections, a list ofSectionsor a mapping axis -> mean radius):(pi / 4) m2 / m1of the short semi-axes in every direction when the particles have the given shape.
- morphogen.analysis.stereology.consistent_shape(sections, rotation=None) tuple[float, float][source]¶
The shape factors
(b/a, c/a)for whichshape_consistency()is the same in the three directions:r_D^4 s_hat_Dcommon to them, a linear system in the squared shape factors (b/a = (r_x / r_y)^2,c/a = (r_x / r_z)^2for the default axes). It is ill-conditioned for axes far from the planes of the grid.