GEM’s accuracy on the phantom¶
On the phantom (Synthetic reference data), the true field of every volume is known, so GEM’s estimates can be scored against it.
Data¶
The phantom is TRXScan’s adult brain under the Sherbrooke protocol: 128 × 128 × 60 voxels of 2 mm, and 64 gradient directions at each of b=1000, 2000 and 3500 s/mm². Its copies without head motion have eddy currents whose largest displacement in the brain is 2, 4 and 8 voxels: 4, 8 and 16 mm. TRXScan applies one strength to every volume, so each volume’s field follows its b-value, and the truth’s exponent is 1. The phantom’s fields are zero at a point of its own (#744), which GEM is given as its zero point.
The copies have no head motion, and the pass is given none, so GEM estimates the fields alone. Each copy is registered twice: noise-free, as simulated, and with the protocol’s noise. The noise is complex Gaussian, with a standard deviation of 3.0 in each channel, and the magnitude is kept, as in What limits registration to a perfect target. GEM is fitted to three targets:
- Noise-free originals
each volume as simulated without eddy currents, noise-free: what a perfect model would predict;
- gqi-krr predictions, gp-loo predictions
each volume’s prediction by that model (Model implementation), from the copy.
Each fit runs in three cascaded passes (Cascading passes). Three more fits to gqi-krr’s predictions hold the exponent (Fitting C at b=1000).
What is measured¶
Each fit is scored with two numbers:
the fitted exponent \(p\), against the truth’s 1;
the share of the true field that GEM recovers: the gain of the estimated slopes \(s\) on the true ones \(t\), \(\sum s \cdot t / \sum t \cdot t\) over the volumes. The share is 1 when GEM recovers the whole field, and 0 when it recovers none of it;
the median, over the volumes, of each volume’s field error: the mean, over the brain, of the distance between where the estimated and the true mappings move each voxel’s center.
What GEM recovers¶
Fig. 27 GEM’s fitted exponent (left) and the share of the true field it recovers (right), with each of the three targets, after one pass (top), two (middle) and three (bottom). Each line is one copy of the phantom, by the largest displacement of its eddy currents (4, 8 and 16 mm, light to dark blue). Solid lines and filled dots are the noise-free copies, and dashed lines and hollow dots the same copies with the protocol’s noise. The dotted line is the truth. Triangles are fits whose exponent stopped at the upper limit of the fit, 2.¶
Passes |
Targets |
Moving volumes |
p, 4 mm |
p, 8 mm |
p, 16 mm |
share, 4 mm |
share, 8 mm |
share, 16 mm |
|---|---|---|---|---|---|---|---|---|
1 |
noise-free originals |
noise-free |
1.01 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1 |
noise-free originals |
noisy |
1.02 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1 |
gqi-krr predictions |
noise-free |
1.00 |
0.84 |
0.76 |
0.71 |
0.62 |
0.54 |
1 |
gqi-krr predictions |
noisy |
0.98 |
0.84 |
0.75 |
0.74 |
0.65 |
0.55 |
1 |
gp-loo predictions |
noise-free |
2.00 |
2.00 |
2.00 |
0.13 |
0.14 |
0.20 |
1 |
gp-loo predictions |
noisy |
0.93 |
0.50 |
0.37 |
0.69 |
0.46 |
0.34 |
2 |
noise-free originals |
noise-free |
1.01 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
2 |
noise-free originals |
noisy |
1.02 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
2 |
gqi-krr predictions |
noise-free |
1.02 |
1.01 |
0.95 |
0.91 |
0.90 |
0.85 |
2 |
gqi-krr predictions |
noisy |
1.03 |
1.01 |
0.95 |
0.93 |
0.92 |
0.87 |
2 |
gp-loo predictions |
noise-free |
2.00 |
2.00 |
2.00 |
0.22 |
0.24 |
0.31 |
2 |
gp-loo predictions |
noisy |
1.03 |
0.90 |
0.64 |
0.92 |
0.83 |
0.63 |
3 |
noise-free originals |
noise-free |
1.01 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
3 |
noise-free originals |
noisy |
1.02 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
3 |
gqi-krr predictions |
noise-free |
1.01 |
1.00 |
1.00 |
0.96 |
0.97 |
0.96 |
3 |
gqi-krr predictions |
noisy |
1.02 |
1.00 |
1.00 |
0.97 |
0.98 |
0.97 |
3 |
gp-loo predictions |
noise-free |
2.00 |
2.00 |
2.00 |
0.29 |
0.31 |
0.37 |
3 |
gp-loo predictions |
noisy |
1.03 |
1.01 |
0.86 |
0.97 |
0.96 |
0.83 |
On the phantom, GEM’s accuracy is set by its targets:
From the noise-free originals, GEM recovers the whole field, and \(p\) is within 0.02 of the truth’s, with or without noise. The median field error is at most 0.003 mm without noise, and 0.012 mm with it. The originals never move, so later passes change nothing.
From predictions, one pass recovers less of the field, and less as the fields grow: with gqi-krr’s predictions of the noise-free copies, from 0.71 of it at 4 mm to 0.54 at 16 mm. Each prediction is made from the other volumes, whose fields resemble its volume’s where their gradients do, so it carries part of its volume’s distortion; registered to it, a volume is corrected for the rest.
The larger a volume’s field, the smaller the share that GEM recovers, so the estimated fields grow more slowly with the b-value than the true ones, and the fitted exponent falls below the truth’s. With gqi-krr’s predictions of the noise-free copy with 16 mm, for instance, one pass recovers 70% of the field at b=1000, 59% at b=2000 and 51% at b=3500, and \(p\) is 0.76.
Each later pass predicts each volume from the volumes that the pass before corrected, so its predictions carry part of what that pass left, not of the whole field. With gqi-krr, the first pass’s predictions carry 26% to 46% of the field, the second’s 23% to 32% of what the first left, and the third’s 25% to 41% of what the second left. Carried at the second pass’s rate, the third pass’s share would be within 0.01 of the one measured.
Two passes recover 0.85 to 0.93 of the field, and \(p\) is within 0.05 of the truth’s; three recover 0.96 to 0.98, and \(p\) is within 0.02. The median field error falls by a factor of 2.9 to 3.9 from one pass to two, and of 2.9 to 3.4 from two to three at 8 and 16 mm: at 16 mm, from 1.17 to 0.40 and 0.12 mm without noise, and from 1.14 to 0.34 and 0.10 mm with it. At 4 mm, the third pass halves it, to 0.03 mm.
Without noise, gp-loo’s predictions carry most of each volume’s distortion: GEM recovers 13% to 20% of the field in one pass, 22% to 31% in two, and 29% to 37% in three. The exponent then stops at the upper limit of the fit, and says nothing about the field. With noise, two passes recover 0.63 to 0.92 of it, and three 0.84 to 0.97.
Fitting C at b=1000¶
In one pass, from predictions, GEM recovers less of the larger fields, so a fit to every shell finds an exponent below the truth’s. Three more fits to gqi-krr’s predictions hold the exponent at the truth’s, 1, and differ in what they fit:
- One C for all the shells
GEM(exponent=1);- One C for each shell
GEM(edges=(1500, 2750), exponent=1);- C from b=1000
one \(C\), fitted on the b=1000 shell only, which gives every volume its field (Fitting on low b-values):
GEM(fit_range=(0, 1500), exponent=1).
Fig. 28 The share of the true field that GEM recovers from gqi-krr’s predictions (left), and the median field error (right), for each way of fitting it, after one pass (top), two (middle) and three (bottom). Lines and dots are as in the figure above.¶
Passes |
Fit |
Moving volumes |
share, 4 mm |
share, 8 mm |
share, 16 mm |
error (mm), 4 mm |
error (mm), 8 mm |
error (mm), 16 mm |
|---|---|---|---|---|---|---|---|---|
1 |
p fitted, all shells |
noise-free |
0.71 |
0.62 |
0.54 |
0.213 |
0.512 |
1.169 |
1 |
p fitted, all shells |
noisy |
0.74 |
0.65 |
0.55 |
0.181 |
0.468 |
1.143 |
1 |
p held at 1, all shells |
noise-free |
0.71 |
0.63 |
0.55 |
0.211 |
0.549 |
1.276 |
1 |
p held at 1, all shells |
noisy |
0.74 |
0.66 |
0.55 |
0.185 |
0.502 |
1.251 |
1 |
p held at 1, one C per shell |
noise-free |
0.71 |
0.62 |
0.54 |
0.223 |
0.520 |
1.381 |
1 |
p held at 1, one C per shell |
noisy |
0.74 |
0.65 |
0.54 |
0.204 |
0.506 |
1.435 |
1 |
p held at 1, C from b=1000 |
noise-free |
0.70 |
0.74 |
0.77 |
0.222 |
0.384 |
0.663 |
1 |
p held at 1, C from b=1000 |
noisy |
0.77 |
0.80 |
0.80 |
0.164 |
0.286 |
0.560 |
2 |
p fitted, all shells |
noise-free |
0.91 |
0.90 |
0.85 |
0.067 |
0.152 |
0.403 |
2 |
p fitted, all shells |
noisy |
0.93 |
0.92 |
0.87 |
0.055 |
0.121 |
0.343 |
2 |
p held at 1, all shells |
noise-free |
0.91 |
0.89 |
0.84 |
0.063 |
0.163 |
0.485 |
2 |
p held at 1, all shells |
noisy |
0.93 |
0.91 |
0.85 |
0.053 |
0.128 |
0.435 |
2 |
p held at 1, one C per shell |
noise-free |
0.91 |
0.90 |
0.84 |
0.068 |
0.159 |
0.418 |
2 |
p held at 1, one C per shell |
noisy |
0.93 |
0.92 |
0.85 |
0.062 |
0.129 |
0.406 |
2 |
p held at 1, C from b=1000 |
noise-free |
0.90 |
0.92 |
0.93 |
0.073 |
0.120 |
0.205 |
2 |
p held at 1, C from b=1000 |
noisy |
0.93 |
0.95 |
0.95 |
0.056 |
0.084 |
0.153 |
3 |
p fitted, all shells |
noise-free |
0.96 |
0.97 |
0.96 |
0.030 |
0.050 |
0.120 |
3 |
p fitted, all shells |
noisy |
0.97 |
0.98 |
0.97 |
0.028 |
0.042 |
0.102 |
3 |
p held at 1, all shells |
noise-free |
0.97 |
0.96 |
0.95 |
0.028 |
0.053 |
0.141 |
3 |
p held at 1, all shells |
noisy |
0.97 |
0.98 |
0.96 |
0.024 |
0.042 |
0.121 |
3 |
p held at 1, one C per shell |
noise-free |
0.96 |
0.97 |
0.96 |
0.025 |
0.049 |
0.131 |
3 |
p held at 1, one C per shell |
noisy |
0.97 |
0.98 |
0.96 |
0.032 |
0.047 |
0.113 |
3 |
p held at 1, C from b=1000 |
noise-free |
0.96 |
0.97 |
0.98 |
0.025 |
0.039 |
0.070 |
3 |
p held at 1, C from b=1000 |
noisy |
0.96 |
0.98 |
0.99 |
0.037 |
0.043 |
0.063 |
Passes |
Moving volumes |
Eddy currents |
b=1000 |
b=2000 |
b=3500 |
|---|---|---|---|---|---|
1 |
noise-free |
4 mm |
0.70 |
0.70 |
0.71 |
1 |
noise-free |
8 mm |
0.74 |
0.65 |
0.59 |
1 |
noise-free |
16 mm |
0.77 |
0.52 |
0.53 |
1 |
noisy |
4 mm |
0.77 |
0.72 |
0.75 |
1 |
noisy |
8 mm |
0.80 |
0.65 |
0.63 |
1 |
noisy |
16 mm |
0.80 |
0.49 |
0.54 |
2 |
noise-free |
4 mm |
0.90 |
0.90 |
0.92 |
2 |
noise-free |
8 mm |
0.89 |
0.89 |
0.90 |
2 |
noise-free |
16 mm |
0.90 |
0.86 |
0.83 |
2 |
noisy |
4 mm |
0.92 |
0.92 |
0.93 |
2 |
noisy |
8 mm |
0.92 |
0.91 |
0.92 |
2 |
noisy |
16 mm |
0.92 |
0.86 |
0.84 |
3 |
noise-free |
4 mm |
0.96 |
0.96 |
0.97 |
3 |
noise-free |
8 mm |
0.97 |
0.96 |
0.97 |
3 |
noise-free |
16 mm |
0.96 |
0.95 |
0.96 |
3 |
noisy |
4 mm |
0.96 |
0.97 |
0.97 |
3 |
noisy |
8 mm |
0.97 |
0.97 |
0.98 |
3 |
noisy |
16 mm |
0.97 |
0.96 |
0.96 |
Holding the exponent does not help by itself. With one \(C\) for all the shells, or one for each, the share stays within 0.02 of the default fit’s in every pass. The median field error is never more than 0.005 mm smaller, and is larger at 16 mm: by up to 0.29 mm in one pass, 0.09 mm in two and 0.02 mm in three.
Fitted at b=1000, \(C\) gives every shell 0.70 to 0.80 of its field in one pass. At 16 mm, the median field error is about half the default fit’s: 0.66 against 1.17 mm without noise, and 0.56 against 1.14 mm with it. At 4 mm, the four fits are alike.
After two passes, \(C\) from b=1000 recovers 0.90 to 0.95 of the field, and its error at 16 mm is still about half the default fit’s: 0.21 against 0.40 mm without noise, and 0.15 against 0.34 mm with it.
After three passes, it recovers 0.96 to 0.99 of the field. At 16 mm, its error is 0.07 against the default fit’s 0.12 mm without noise, and 0.06 against 0.10 mm with it; at 4 and 8 mm, it is within 0.011 mm of the default fit’s, either way.
Fitted on its own, in one pass, each shell recovers about the same share at 4 mm. At 8 and 16 mm, the b=1000 shell recovers the most, with or without noise: at 16 mm, 0.77 to 0.80 of its field, against 0.49 to 0.54 for the other shells. These runs do not say why. The gap closes over the passes: at 16 mm, 0.90 to 0.92 against 0.83 to 0.86 in two, and in three every shell recovers 0.95 to 0.98 of its field, at every size.
Here the exponent is held at the truth’s. On real data it must be given, and a wrong exponent goes straight to the high shells: held at 1/2 when the truth is 1, the b=3500 fields would come out at 0.53 of their size.
Whether real eddy currents follow GEM is the question of #752.
Reproducing the figures¶
The experiment runs GEM on the six copies (three sizes, without and with noise), with each of its six fits in three passes, in about 3 hours on 6 CPUs:
taskset -c 0-5 python tools/registration/eddy_model_accuracy.py \
--dataset <phantoms> --out <results>
python tools/registration/eddy_model_accuracy_figures.py \
--results <results> --out docs/_static/gem
The first command writes each run’s estimates and scores, and
<results>/accuracy.{tsv,json}; the second draws the figures and their tables from
them.