--- license: cc-by-4.0 pretty_name: DiSCo replay phantom tags: - diffusion-mri - monte-carlo - replay-pack - tractography-phantom --- # DiSCo as a replay phantom The DiSCo substrate (Rafael-Patino, Girard, Truffet, Pizzolato, Caruyer, Thiran, *The diffusion-simulated connectivity (DiSCo) dataset*, Data in Brief 38 (2021) 107429, doi:10.1016/j.dib.2021.107429; data doi:10.17632/fgf86jdfg6.3, CC BY 4.0) walked once and stored as a replay pack, so that any acquisition a human scanner can play is a replay of the same walk, voxel by voxel on the dataset's own 40³ grid of 25 µm voxels, with a per-voxel Monte-Carlo certificate. DiSCo published one acquisition of this substrate; this dataset is the substrate itself in replayable form: the same 12,196 strands, two tubes per strand (the listed inner diameter and the outer tube at 1/0.7 of it), the dataset's diffusivity in both pools (0.6e-9 m²/s), intra water inside the inner tube and extra water outside the outer one, walked for 100 ms with every tier (positions, occupancy, wall contact, the strand field along the path). ## Use me **Install** dmipy-sim from its main branch (the reader lives there); the dataset is public, no login is needed: ``` pip install "git+https://github.com/dmrai-lab/dmipy-sim@main" "huggingface_hub>=0.25" ``` **1. You want images and no compute.** `disco/reference/` holds pre-replayed volumes on the 40³ grid as S/S0 NIfTI with their gradient tables: DiSCo's own 364-measurement protocol as bare diffusion (the dataset's own simulation) and with white matter at 3 T and 7 T (T2 per pool, surface relaxivity, the sheath's susceptibility), four other acquisitions (a clinical b = 1000 shell, a three-shell research scheme, a Connectome 2.0 b = 6000 shell, a 50 Hz OGSE), the per-voxel floor, the record of what each was read with, the comparison with the dataset's own images, and tractography scores. Read its `README.md` first. **2. You want to replay your own acquisition.** Open the pack by reference; nothing is downloaded whole, every byte read is one the replay uses (HTTP range reads of the columnar layout under `disco/`): ```python from dmipy_sim.replay import ReplayPack from dmipy_sim import sequences from dmipy_sim.spec.tissue import Tissue pack = ReplayPack.open("hf://SubstrateCommons/disco-replay/disco") # 150 M walkers, 31,802 voxels; ~0 bytes so far seq = sequences.pgse([[1, 0, 0], [0, 0, 1]], 0.0102, 0.0167, bvalues=[1e9, 1e9], TE=0.0535) # SI: s/m², s; any grid, any TE ≤ 100 ms print(pack.plan(seq)) # bands, tiers, bytes: decided before any transfer view = pack.view(K=32, voxels=[(20, 20, 20)]) # one voxel's rows at 32 bands (~1 MB): an ordinary ReplayPack S = view.replay(seq) # bare diffusion, the dataset's own physics wm = Tissue(T2={"intra": 0.05, "extra": 0.055, "myelin": 0.01}, rho=1.16e-6, chi_iso=-1e-7, chi_aniso=-1e-7) view = pack.view(K=32, modes=8, contact=True, voxels=[(20, 20, 20)]) # the tiers the physics needs S_3T = view.replay(seq, tissue=wm, scanner=3.0) # relaxation, wall contact, the sheath field at 3 T from dmipy_sim.replay.study import Acquisition, Protocol, Study study = Study(Protocol([Acquisition(seq)]), tissues=[None, wm], scanners=[None, 3.0, 7.0], pairs=[(0, 0), (1, 1), (1, 2)]) S, floor, plan = pack.image(study) # the whole grid: one pass over the rows, every pair from it ``` `S` is `(pairs, 40, 40, 40, measurements)`, NaN where the pack holds no walkers; `floor` the split-half floor of each volume, measured in the same pass. A study names a protocol (sequences, each in a pose), the tissues and the scanners; the bands are contracted once per acquisition and every tissue and scanner is arithmetic on the result. A replay returns the signal as measured (with the relaxation decay at TE when a tissue carries a T2); divide by a b = 0 measurement of the same setting for S/S0, as the reference volumes are. A pass over all rows streams 20 to 100 GB depending on the tiers (about 10 to 25 minutes at 50-75 MB/s) and needs a GPU for the sums; a voxel takes a second. The replay knobs are three objects, each stated once: `tissue` (a `Tissue`, or `pack.nominal` for the spec's values), `scanner` (a field in tesla or a catalogue scanner), `orientation`. Nothing is applied silently: the default is bare diffusion. The [replay guide](https://github.com/dmrai-lab/dmipy-sim/tree/main/docs/replay-guide) in dmipy-sim is the manual: one page per object, the table of what each knob touches and which channel it needs, images by reference, and a [DiSCo recipe](https://github.com/dmrai-lab/dmipy-sim/blob/main/docs/replay-guide/recipes/disco.md). **3. You want the walkers themselves.** `disco/` is the lossless form of the pack: every walker of the fill, in columns (`disco/columns/*.safetensors`), with nothing requantised; `pack.view(...)` returns any voxels' rows as an ordinary `ReplayPack`, and a top-up (a later pass) appends its rows to `disco/columns`. The embedded spec cites the strand file at `substrate/DiSCo_Strands_Trajectories.tck`: replay from the dataset's directory, or copy `substrate/` under `$DMIPY_SIM_SURFACE_DIR`. ## What is certified | | | |---|---| | state | pass 1 complete (0.16 of the plan, 1,399 shards, 1.5e8 walkers, certified floor median 0.033) + the repair of 332 voxels whose pool the plan had clipped (dmipy-sim#295; `columnar.repair` in `disco/manifest.json`); pass 2, the 0.84 top-up to the 0.008 floor, is held | | validation | DiSCo's own protocol replayed against the dataset's noise-free images: correlation 0.989 / 0.990 / 0.988 / 0.981 per shell, per-voxel r.m.s. 0.013 against the certified floor 0.035; a uniform +1 % of S0 because the dataset's tubes are triangle meshes (inner volume 0.953 of the pack's); the replay scores 0.91 on the dataset's connectome through a CSD + probabilistic tracking pipeline, where the dataset's own images score 0.905 | | walk | 100 ms gradient-on budget; K = 256 bands (1.28 kHz: every human scanner class at ε = 5e-3), the bands at 16 bits below mode 16 and 8 bits above, nanometre reconstruction; 3,349 saves set by the Connectome 2.0 envelope | | tiers | C0 positions, C1 occupancy (static, impermeable), C2 wall contact, C3 the strand field along the path (32 modes, refocusing depth 16); the sheath between the tubes holds no water and is the susceptibility source | | field | the exact field of every segment within 18 µm in closed form, the rest through a far grid on 2.5 µm nodes (read error 0.08 % of the field at walker positions); checked against an independent k-space route to 0.03-0.22 % (`substrate/far_field_check.txt`) | | outside | voxels farther than 46 µm from every strand hold free extra water and carry no walkers | | limits | no myelin water (a multi-echo replay sees two pools where white matter has three); refocusing depth 8 for the field channel; the band and envelope above | ## Layout ``` disco/ THE PACK, lossless, in columns (152.8 M rows, 187.7 GB in 237 parts): manifest.json (meta + every column's byte layout), index.json (row range per voxel and pool), columns/*.safetensors; a top-up appends to columns/ disco/moments/ the shape-moment layout contracted from disco/ (its manifest names disco/manifest.json's sha256) disco/reference/ pre-replayed volumes, their records, the comparison with DiSCo, tractography scores, a card manifest.json the fill's recipe: substrate, grid, walk, codec, plan, variants, code commit plan/ walkers per voxel per pool; the 1,399 voxel blocks and their seeds substrate/ DiSCo's strand files, unchanged (SOURCE.md: provenance and hashes); the far field grid certificate/ the fill's measured certificate (disco.json: a scaled block, the full battery; every block inherits it), with the certifying block's pack and the record of its walk STATUS.md, worker/ the fill's status page at the end of pass 1, and the worker ``` ## Contributing compute `worker/README.md`: one process fills blocks in a pipeline, claims by file, no scheduler; every shard records the code commit, the seed and the sha256 of what it uploaded, and carries the record of its run, and a finished pass is appended to `disco/columns`. Pass 1 was walked by five machines (a GH200, three L40S, a Kaggle T4) in 151 GPU-hours over two days. ## Attribution Substrate: Rafael-Patino et al. 2021 (CC BY 4.0). Replay packs: dmipy-sim (dmrai-lab), replay-pack-spec. Cite the dataset paper for the substrate and the replay paper for the packs.