AngioFlow / README.md
whding123's picture
Upload README.md with huggingface_hub
fd2e130 verified
|
Raw History Blame Contribute Delete
7.5 kB
metadata
pretty_name: AngioFlow GHD WSS Graphs
tags:
  - graph
  - mesh
  - cfd
  - wall-shear-stress
  - aneurysm
  - medical

AngioFlow GHD WSS Graphs

Per-case graphs of CFD wall shear stress (WSS) on GHD-parameterized cerebral aneurysm surfaces, for training a graph transformer (AngioWSSGraphGPS) to predict WSS time series from geometry alone. One graph per (source, case, frame); node count varies case to case (no shared/fixed topology, no common mesh).

This archive (ghd_graphs.zip) is a full unzip-in-place copy of the shared local dataset root angioflow_ghd_graphs/ — unzip it and the three subfolders below land next to each other exactly as shown.

Contents

subfolder internal tag cases geometry source CFD source real vs synthetic
AneuGv1/ v1 634 legacy canonical GHD reconstruction, ICP'd onto the CFD wall AngioFlow v1 transient CFD real patient
Angioflow/ v2 251 (152 AneuX + 99 ImperialNHS, see extraction_manifest.csv's dataset column) per-case GHD fit placed into the CFD frame merged v2 CFD real patient (both sub-cohorts)
AneuGv2/ aneugv2 141 AneuG-generated shapes (dome.obj), their own CFD runs whding123/AneuGv2 on the Hub synthetic

Every case currently has 80 WSS frames (one full cardiac-cycle time series) and aneurysm_type == 0 only (bifurcated/sidewall type-1 CFD data doesn't exist yet upstream — the extraction scripts skip and delete any type-1 output).

Total: 1,026 cases x 80 frames = 82,080 (source, case, frame) samples, ~18 GB uncompressed.

Per-case files

<subfolder>/static_<version>_<case>.pt        # one per case -- geometry + static fields
<subfolder>/wss_<version>_<case>_<t>.pt       # one per (case, frame) -- [N,3] WSS target, Pa
<subfolder>/extraction_manifest.csv           # per-case QC row, one file per subfolder
<subfolder>/sanity/*.png                      # pred/GT render samples (training-time renders, not part of the data itself)

static_<version>_<case>.pt is a dict:

field shape notes
pos [N,3] GHD-surface vertex coordinates, metres
faces [F,3] triangle connectivity
edge_index [2,E] not guaranteed symmetric as stored — symmetrize before use (see Loading, below)
normals [N,3] stored value is a QC artifact only — recompute at load time instead (see Loading)
geo_dist [N,3] geodesic distance to each of the 3 openings (type 0), normalized to [0,1] per column
cot_eigval [k] (k=16) cotangent-Laplacian eigenvalues, ascending by value, not frequency — for a connected mesh the smoothest mode is near the END of this array
cot_eigvec [N,k] matching eigenvectors (positional encoding)
ghd_eigvec [N,n_ghd] (n_ghd=8) canonical GHD basis carried onto this mesh, unit-norm per column
flow_split [2] outlet flow ratios
aneurysm_type scalar 0 for every case currently present
node_type [N] convention differs by source: AneuGv1/Angioflow use 0=wall,1=focused,2=inlet,3=outlet_0,4=outlet_1; AneuGv2 uses 0=wall, then 1..n by that case's own wall_zones order (no "focused" class)
knn_dist_mm [N] distance (mm) from each node to the nearest native CFD wall node — QC signal for extraction fidelity
meta dict the same row as this case's line in extraction_manifest.csv

wss_<version>_<case>_<t>.pt is a bare [N,3] tensor, Pa, one file per frame t (0-79).

Loading

The reference loader is ood_fix/dataset.py::AngioWSSGraphDataset in the AneuG-Net repo (not included in this archive). Key behavior to replicate if loading independently:

from ood_fix.dataset import AngioWSSGraphDataset

ds = AngioWSSGraphDataset(root="<path to this unzipped folder>",
                           versions=None,           # None = all three sources
                           frames="all",            # or e.g. [0] for frame-0 only
                           aneurysm_types=(0,))
data = ds[0]   # torch_geometric.data.Data: pos, normals, geo_dist, cot_eigvec,
               # cot_eigval, ghd_eigvec, edge_index, y (WSS), t (frame idx),
               # aneurysm_type, version, case
  • Normals are recomputed at load time (pytorch3d.structures.Meshes.verts_normals_packed()), not read from the stored normals field — the stored value came from whichever renderer wrote it (pyvista for v1/v2, plain numpy for aneugv2) and is not uniform across sources.
  • edge_index must be symmetrized before use (SymmetrizeEdges in the reference pipeline) — the raw stored value is directed/one-sided.
  • Apply any positional/value normalization exactly once — a transform chain applied both inside a custom Dataset.get() and again by PyG's own __getitem__ will double-apply (this bit the reference pipeline once; its dataset.py fix is to let get() return the raw Data and apply transforms only through PyG's wrapper).

Train/test split (as used by the reference training script, ood_fix/train_wss.py)

  • Test = n_test_aneux (30 by default) cases drawn from Angioflow's own dataset == "AneuX" cases — real-patient shapes, held out so evaluation never leaks onto a shape family the model trained on.
  • Train = everything else: all of AneuGv1, all of AneuGv2 (synthetic, never eligible for test), all ImperialNHS cases in Angioflow, and whatever AneuX cases weren't drawn for test.
  • The eventual target metric is generalization to the held-out AneuX cases specifically (real patients) — AneuGv1 is the most abundant source but the least representative of that target distribution; Angioflow/AneuGv2 are more directly relevant. A --balance_domains flag in the reference trainer equalizes per-epoch sampling across the three source folders above (not just real-vs-synthetic) so AneuGv1's raw volume (634 cases x 80 frames) doesn't dominate gradient updates.

Known caveats

  • Patient independence across sources is unverified. Splitting by (source, case) keeps one case's frames together, but does not establish that different sources/cases are distinct patients — exact-geometry checks won't catch refits, re-cuts, or generated descendants of the same base shape. Worth auditing upstream patient IDs / synthetic-generation provenance before assuming no leakage across AneuGv1/Angioflow/AneuGv2.
  • Type-1 (two-opening) aneurysms are not represented in this archive at all — every case is aneurysm_type == 0. A model trained on this data assumes 3 geodesic channels (geo_dist's last dim) and would need a schema change to admit type-1.
  • A separate waveform file (waveform_yiying.txt, the inlet flow waveform used to condition the time embedding) is not included in this archive — it lives outside this dataset root in the source repo (angioflowv2_merged/_meta/waveform_yiying.txt) and is a required input to the reference model's forward pass, not optional.

Provenance

Produced by ood_fix/cfd_data_factory/extract_wss_dataset.py (AneuGv1, Angioflow) and ood_fix/cfd_data_factory/extract_ghd_graphs_aneugv2.py (AneuGv2) in the AneuG-Net repo (private). See that repo's ood_fix/PIPELINE.md for the full upstream pipeline (CFD registration, GHD fitting/placement, subdivision) if you have access to it.