upxo.meshing.gbconformant.d3v2p0.spike_cleaning module

Iterative removal of spike voxels from a label array before meshing.

A spike is a voxel with at most one face neighbour of its own label; the cleaner reassigns it to the neighbouring label. The passes repeat until a pass changes nothing, a label configuration repeats, or the pass limit is reached. Every grain ID must survive.

upxo.meshing.gbconformant.d3v2p0.spike_cleaning.clean_spikes(labels, max_passes=100, progress=None, track_history=True)[source]

Return (cleaned_labels, report); the input array is not modified.

report has stop_reason, history (voxels changed, and spike candidates remaining, per pass — empty when track_history is off), remaining_candidates (spike candidates left, including protected last voxels) and net_changed_voxels (voxels that differ from the input). progress(message, current, total) is called before every pass.