upxo.pxtal.fm_steel_3d.voxel_interface_masks module

Voxel masks of grain boundaries, junction lines and junction points.

Each function takes a 3-D grid of integer grain labels and returns a boolean grid of the same shape that marks the voxels touching the feature.

Void voxels (label 0) and positions beyond the grid are both read as label 0. Together they count as one further label wherever labels are counted, so a boundary between two grains that lies on a face of the grid has three labels around it and is marked as a junction line.

upxo.pxtal.fm_steel_3d.voxel_interface_masks.shift_3d(arr, da, db, dc)[source]

Shift arr by (da, db, dc) voxels along its three axes.

res[i, j, k] == arr[i - da, j - db, k - dc]; positions that receive nothing are 0.

upxo.pxtal.fm_steel_3d.voxel_interface_masks.grain_boundary_voxels(labels)[source]

Voxels that share a face with a voxel of a different grain.

Only pairs of positive labels count; void (label 0 or negative) voxels are never part of a boundary.

upxo.pxtal.fm_steel_3d.voxel_interface_masks.junction_line_voxels(labels)[source]

Voxels around every grid edge where three or more labels meet.

An edge has four voxels around it, so each qualifying edge marks four voxels.

upxo.pxtal.fm_steel_3d.voxel_interface_masks.junction_point_voxels(labels)[source]

Voxels around every grid vertex where three or more labels meet.

A vertex has eight voxels around it, so each qualifying vertex marks eight voxels.