upxo.pxtal.fm_steel_3d.slice_region_stats module
Region properties of PAGs and packets on 2-D slices of a structure.
A structure is cut by evenly spaced slices in one of the planes 'xy',
'yz' and 'xz'. On each slice the regions of the PAG label map (grains
merged into their PAG) and of the grain label map (the packets) are measured
and the values of all slices are collected per group and property.
- upxo.pxtal.fm_steel_3d.slice_region_stats.pag_label_grid(lgi: ndarray, clusters_dict: dict, dtype=<class 'numpy.int32'>) ndarray[source]
Grain label grid with every grain relabelled by the id of its PAG.
Grains in no cluster, and void, become 0. The result has type
dtype.
- upxo.pxtal.fm_steel_3d.slice_region_stats.periodic_neighbour_counts(label_img: ndarray) Dict[int, int][source]
Number of distinct regions edge-adjacent to each region of a 2-D label image. Edges wrap around, so regions on opposite edges of the image are adjacent. Void (label 0 or less) is not a neighbour.
- upxo.pxtal.fm_steel_3d.slice_region_stats.region_property_values(label_img: ndarray, voxel_size: float, properties: Iterable[str]) Dict[str, List[float]][source]
One value per region of a 2-D label image for each requested property.
Properties (
REGION_PROPERTIES): ‘area’ (voxel_size^2), ‘aspect_ratio’ (major / minor axis of the fitted ellipse, 1 when the minor axis is 0), ‘perimeter’ (voxel_size), ‘solidity’ and ‘n_neighbours’ (periodic_neighbour_counts). Regions are taken in order of label; an image without regions gives empty lists.
- upxo.pxtal.fm_steel_3d.slice_region_stats.pag_slice_distributions(lgi: ndarray, clusters_dict: dict, voxel_size: float, plane: str, n_slices: int, groups: Iterable[str], properties: Iterable[str], progress: Callable[[str, int, int, int], None] | None = None) Dict[str, Dict[str, List[float]]][source]
Property values of the regions on evenly spaced slices, per group.
- Parameters:
lgi (ndarray) – Grain label grid.
clusters_dict (dict) – PAG id -> grain ids.
voxel_size (float)
plane ({'xy', 'yz', 'xz'}) – Plane of the slices.
n_slices (int) – Number of slices, from the second to the last-but-one voxel layer.
groups (iterable of {'pag', 'packet'}) – ‘pag’ measures the regions of the PAG label map and ‘packet’ those of the grain label map.
properties (iterable of str) – From
REGION_PROPERTIES.progress (callable(plane, index, done, total), optional) – Called before each slice is measured.
- Returns:
{group: {property: [value, ...]}}over all slices.- Return type: