whding123 commited on
Commit
fd2e130
·
verified ·
1 Parent(s): c45eeae

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +134 -0
README.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: AngioFlow GHD WSS Graphs
3
+ tags:
4
+ - graph
5
+ - mesh
6
+ - cfd
7
+ - wall-shear-stress
8
+ - aneurysm
9
+ - medical
10
+ ---
11
+
12
+ # AngioFlow GHD WSS Graphs
13
+
14
+ Per-case graphs of CFD wall shear stress (WSS) on GHD-parameterized cerebral aneurysm
15
+ surfaces, for training a graph transformer (`AngioWSSGraphGPS`) to predict WSS time
16
+ series from geometry alone. One graph per `(source, case, frame)`; node count varies
17
+ case to case (no shared/fixed topology, no common mesh).
18
+
19
+ This archive (`ghd_graphs.zip`) is a full unzip-in-place copy of the shared local
20
+ dataset root `angioflow_ghd_graphs/` — unzip it and the three subfolders below land
21
+ next to each other exactly as shown.
22
+
23
+ ## Contents
24
+
25
+ | subfolder | internal tag | cases | geometry source | CFD source | real vs synthetic |
26
+ |---|---|---|---|---|---|
27
+ | `AneuGv1/` | `v1` | 634 | legacy canonical GHD reconstruction, ICP'd onto the CFD wall | AngioFlow v1 transient CFD | real patient |
28
+ | `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) |
29
+ | `AneuGv2/` | `aneugv2` | 141 | AneuG-*generated* shapes (`dome.obj`), their own CFD runs | `whding123/AneuGv2` on the Hub | synthetic |
30
+
31
+ Every case currently has **80 WSS frames** (one full cardiac-cycle time series) and
32
+ **`aneurysm_type == 0`** only (bifurcated/sidewall type-1 CFD data doesn't exist yet
33
+ upstream — the extraction scripts skip and delete any type-1 output).
34
+
35
+ Total: 1,026 cases x 80 frames = 82,080 `(source, case, frame)` samples, ~18 GB
36
+ uncompressed.
37
+
38
+ ## Per-case files
39
+
40
+ ```
41
+ <subfolder>/static_<version>_<case>.pt # one per case -- geometry + static fields
42
+ <subfolder>/wss_<version>_<case>_<t>.pt # one per (case, frame) -- [N,3] WSS target, Pa
43
+ <subfolder>/extraction_manifest.csv # per-case QC row, one file per subfolder
44
+ <subfolder>/sanity/*.png # pred/GT render samples (training-time renders, not part of the data itself)
45
+ ```
46
+
47
+ `static_<version>_<case>.pt` is a dict:
48
+
49
+ | field | shape | notes |
50
+ |---|---|---|
51
+ | `pos` | `[N,3]` | GHD-surface vertex coordinates, metres |
52
+ | `faces` | `[F,3]` | triangle connectivity |
53
+ | `edge_index` | `[2,E]` | **not guaranteed symmetric as stored** — symmetrize before use (see Loading, below) |
54
+ | `normals` | `[N,3]` | stored value is a QC artifact only — recompute at load time instead (see Loading) |
55
+ | `geo_dist` | `[N,3]` | geodesic distance to each of the 3 openings (type 0), normalized to `[0,1]` per column |
56
+ | `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 |
57
+ | `cot_eigvec` | `[N,k]` | matching eigenvectors (positional encoding) |
58
+ | `ghd_eigvec` | `[N,n_ghd]` (n_ghd=8) | canonical GHD basis carried onto this mesh, unit-norm per column |
59
+ | `flow_split` | `[2]` | outlet flow ratios |
60
+ | `aneurysm_type` | scalar | `0` for every case currently present |
61
+ | `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) |
62
+ | `knn_dist_mm` | `[N]` | distance (mm) from each node to the nearest native CFD wall node — QC signal for extraction fidelity |
63
+ | `meta` | dict | the same row as this case's line in `extraction_manifest.csv` |
64
+
65
+ `wss_<version>_<case>_<t>.pt` is a bare `[N,3]` tensor, Pa, one file per frame `t` (0-79).
66
+
67
+ ## Loading
68
+
69
+ The reference loader is `ood_fix/dataset.py::AngioWSSGraphDataset` in the
70
+ `AneuG-Net` repo (not included in this archive). Key behavior to replicate if
71
+ loading independently:
72
+
73
+ ```python
74
+ from ood_fix.dataset import AngioWSSGraphDataset
75
+
76
+ ds = AngioWSSGraphDataset(root="<path to this unzipped folder>",
77
+ versions=None, # None = all three sources
78
+ frames="all", # or e.g. [0] for frame-0 only
79
+ aneurysm_types=(0,))
80
+ data = ds[0] # torch_geometric.data.Data: pos, normals, geo_dist, cot_eigvec,
81
+ # cot_eigval, ghd_eigvec, edge_index, y (WSS), t (frame idx),
82
+ # aneurysm_type, version, case
83
+ ```
84
+
85
+ - **Normals are recomputed at load time** (`pytorch3d.structures.Meshes.verts_normals_packed()`),
86
+ not read from the stored `normals` field — the stored value came from whichever
87
+ renderer wrote it (pyvista for v1/v2, plain numpy for aneugv2) and is not uniform
88
+ across sources.
89
+ - **`edge_index` must be symmetrized** before use (`SymmetrizeEdges` in the reference
90
+ pipeline) — the raw stored value is directed/one-sided.
91
+ - Apply any positional/value normalization exactly once — a transform chain applied
92
+ both inside a custom `Dataset.get()` and again by PyG's own `__getitem__` will
93
+ double-apply (this bit the reference pipeline once; its `dataset.py` fix is to let
94
+ `get()` return the raw `Data` and apply transforms only through PyG's wrapper).
95
+
96
+ ## Train/test split (as used by the reference training script, `ood_fix/train_wss.py`)
97
+
98
+ - **Test** = `n_test_aneux` (30 by default) cases drawn from `Angioflow`'s own
99
+ `dataset == "AneuX"` cases — real-patient shapes, held out so evaluation never
100
+ leaks onto a shape family the model trained on.
101
+ - **Train** = everything else: all of `AneuGv1`, all of `AneuGv2` (synthetic, never
102
+ eligible for test), all `ImperialNHS` cases in `Angioflow`, and whatever `AneuX`
103
+ cases weren't drawn for test.
104
+ - The eventual target metric is generalization to the held-out **AneuX** cases
105
+ specifically (real patients) — `AneuGv1` is the most abundant source but the least
106
+ representative of that target distribution; `Angioflow`/`AneuGv2` are more directly
107
+ relevant. A `--balance_domains` flag in the reference trainer equalizes per-epoch
108
+ sampling across the three source folders above (not just real-vs-synthetic) so
109
+ `AneuGv1`'s raw volume (634 cases x 80 frames) doesn't dominate gradient updates.
110
+
111
+ ## Known caveats
112
+
113
+ - **Patient independence across sources is unverified.** Splitting by
114
+ `(source, case)` keeps one case's frames together, but does not establish that
115
+ different sources/cases are distinct patients — exact-geometry checks won't catch
116
+ refits, re-cuts, or generated descendants of the same base shape. Worth auditing
117
+ upstream patient IDs / synthetic-generation provenance before assuming no leakage
118
+ across `AneuGv1`/`Angioflow`/`AneuGv2`.
119
+ - **Type-1 (two-opening) aneurysms are not represented** in this archive at all —
120
+ every case is `aneurysm_type == 0`. A model trained on this data assumes 3 geodesic
121
+ channels (`geo_dist`'s last dim) and would need a schema change to admit type-1.
122
+ - A separate **waveform file** (`waveform_yiying.txt`, the inlet flow waveform used
123
+ to condition the time embedding) is **not included** in this archive — it lives
124
+ outside this dataset root in the source repo
125
+ (`angioflowv2_merged/_meta/waveform_yiying.txt`) and is a required input to the
126
+ reference model's forward pass, not optional.
127
+
128
+ ## Provenance
129
+
130
+ Produced by `ood_fix/cfd_data_factory/extract_wss_dataset.py` (`AneuGv1`,
131
+ `Angioflow`) and `ood_fix/cfd_data_factory/extract_ghd_graphs_aneugv2.py`
132
+ (`AneuGv2`) in the `AneuG-Net` repo (private). See that repo's
133
+ `ood_fix/PIPELINE.md` for the full upstream pipeline (CFD registration, GHD
134
+ fitting/placement, subdivision) if you have access to it.