graintrace.rei_comparison#
Compare two rare-event-identification point clouds for spatial overlap.
- class graintrace.rei_comparison.REIComparison(rei_csv_1, rei_csv_2, output_dir, spacing_1=None, spacing_2=None, coord_cols=('x', 'y', 'z'), cluster_col='rare_cluster_id', origin=None, s_ref=None, supersample=1, split_merge_fraction=0.2)[source]#
Bases:
objectCompare two rare-event-identification (REI) point clouds.
Each input CSV is a voxelized point cloud of a rare region on a regular grid (columns
coord_colsplus an optional integercluster_col). The two grids may have different spacings but are assumed to share an origin (no rotation / translation is applied here).A rare point is treated as the center of its voxel cube, so each REI is a union of axis-aligned cubes and the overlap is a boolean volume intersection. Both regions are resampled onto a common finer lattice (
s_ref = min(spacing_1, spacing_2)per axis); membership is then an O(1) integer-index hash lookup. Carryingcluster_colthrough the same pass yields a per-cluster overlap matrix used for a 1-to-1 (Hungarian) cluster correspondence.- Outputs written to
output_dir: overlap_metrics.json: IoU/Dice/containment + counts/volumesoverlap_cloud.vtk: classified point cloud (membership 1=only-1, 2=only-2, 3=both)cluster_match.csv: 1-to-1 cluster pairing (ifcluster_col)
- Parameters:
- Outputs written to