mscard 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mscard-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cedric Conday
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mscard-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: mscard
3
+ Version: 0.1.0
4
+ Summary: Longitudinal multiple sclerosis MRI report that grades itself: new, enlarging, resolved and slowly expanding lesions, brain volume change, and a calibration of the same pipeline on the same scan with known injected truth.
5
+ Author: Cedric Conday
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/CedricConday/mscard
8
+ Keywords: multiple sclerosis,MRI,longitudinal,lesion,atrophy,calibration,report
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: numpy>=1.24
18
+ Requires-Dist: scipy>=1.10
19
+ Requires-Dist: nibabel>=5
20
+ Requires-Dist: pandas>=2
21
+ Requires-Dist: matplotlib>=3.7
22
+ Requires-Dist: lesiontrack>=0.2.0
23
+ Requires-Dist: bidsgate>=0.2.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7; extra == "dev"
26
+ Requires-Dist: ruff>=0.4; extra == "dev"
27
+ Requires-Dist: build; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # mscard
31
+
32
+ **The longitudinal multiple sclerosis MRI report that grades itself.**
33
+
34
+ Two (or more) MRI visits in, one page out: new, enlarging, shrinking and resolved
35
+ lesions, slowly expanding lesion (SEL) candidates, lesion volume change and brain
36
+ volume change. Next to every number, a grade: before the report is written, the
37
+ same pipeline is run on the subject's own baseline scan with **known changes
38
+ injected** (a known brain contraction, a known set of new lesions, a small
39
+ repositioning, gain drift and noise), and the page states how much of that truth
40
+ it recovered. A number the pipeline cannot recover on this scan is marked as such.
41
+
42
+ > **Nothing in this repository is evidence about multiple sclerosis.** It is
43
+ > research software. It is not a medical device, it has not been validated
44
+ > against clinical outcome, and it makes no diagnostic claim.
45
+
46
+ Status: first public build, 2026-09-29. Results on the public MSLesSeg cohort
47
+ (24 subjects) are in the Results section; the gallery of reports is at
48
+ https://cedricconday.github.io/mscard/.
49
+
50
+ ## Why
51
+
52
+ Every clinic that pays for longitudinal MS MRI analysis receives counts of new
53
+ and enlarging lesions and a brain volume change, and none of those reports says
54
+ how accurate the pipeline was on that scanner, that protocol, that head. The
55
+ open pieces exist: [LST-AI](https://github.com/CompImg/LST-AI) segments,
56
+ [lesiontrack](https://github.com/CedricConday/lesiontrack) registers, tracks and
57
+ finds SEL candidates, [bidsgate](https://github.com/CedricConday/bidsgate)
58
+ injects known lesions and atrophy and scores their recovery. mscard is the page
59
+ that joins them, and the rule that the calibration is not optional.
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ pip install mscard
65
+ ```
66
+
67
+ Python 3.10 or later. Registration comes with lesiontrack (greedy as a wheel,
68
+ x86-64 and arm64, CPU only). LST-AI is optional and runs in its container
69
+ (`docker` on PATH); without it, give your own lesion masks.
70
+
71
+ ## Use
72
+
73
+ A manifest, one row per scan, tab separated:
74
+
75
+ ```
76
+ subject session time_years t1 flair mask brainmask
77
+ P1 T1 28.09 P1/T1/T1.nii.gz P1/T1/FLAIR.nii.gz P1/T1/MASK.nii.gz P1/T1/brain.nii.gz
78
+ P1 T2 28.51 P1/T2/T1.nii.gz P1/T2/FLAIR.nii.gz P1/T2/MASK.nii.gz P1/T2/brain.nii.gz
79
+ ```
80
+
81
+ `time_years` is any monotone clock (age, or years since the first scan).
82
+ `mask` and `brainmask` are optional: with `--segmenter lst-ai` the masks come
83
+ from LST-AI, and a missing brain mask is estimated (skull-stripped input: the
84
+ nonzero support; whole head: bidsgate's morphological estimate). T1w, FLAIR and
85
+ masks of one scan must share a grid.
86
+
87
+ ```bash
88
+ mscard run manifest.tsv --out derivatives/mscard # measure, calibrate, report
89
+ mscard run manifest.tsv --out derivatives/mscard --segmenter lst-ai
90
+ mscard run manifest.tsv --out derivatives/mscard --no-calibrate # measure and report only
91
+ mscard calibrate manifest.tsv --out derivatives/mscard # calibration only
92
+ mscard report derivatives/mscard # re-render pages
93
+ ```
94
+
95
+ Output per subject: `report.html` (self-contained), `measure/mscard.json`
96
+ (every number), `measure/lesiontrack/` (masks, label maps, Jacobian, tables),
97
+ `calibration/synthetic/` (the synthetic follow-up and its truth),
98
+ `calibration/grade.json`. Over the tree: `index.html`, one row per subject.
99
+
100
+ ## What is measured
101
+
102
+ * **Registration, tracking, SEL candidates**: lesiontrack. Halfway space, greedy
103
+ stationary-velocity deformable registration on T1w and FLAIR jointly, Jacobian
104
+ determinant, lesion matching on the overlap graph; classes follow the
105
+ Vanden Bulcke et al. 2025 bands (enlarging or shrinking beyond ±9 %/yr, stable
106
+ within ±4 %/yr, trend between); SEL candidates by the Elliott et al. 2019 rule.
107
+ A *definite* SEL is a cohort-relative ranking and is not claimed for one subject.
108
+ * **Brain volume change**: the mean Jacobian determinant of the same deformation
109
+ field over the baseline brain mask, minus one. When a brain mask exists for
110
+ both visits the mask-volume ratio is shown as a second, ungraded number.
111
+
112
+ ## How the grade is made
113
+
114
+ For each subject, its baseline scan becomes a synthetic follow-up one modelled
115
+ year later (`mscard/calibrate.py`, parameters in `mscard/config.py`):
116
+
117
+ 1. the whole brain contracted by a known factor (default 0.98, i.e. −2 %) with
118
+ bidsgate `inject-atrophy`; every image and mask follows the same field;
119
+ 2. a known set of new lesions (default 12, 30 to 1500 mm³) with bidsgate
120
+ `inject-lesions`, placed at least 6 mm from every baseline lesion so each is
121
+ truly new;
122
+ 3. a rigid repositioning (up to 1 degree, 1 voxel), per-image gain (0.9 to 1.1)
123
+ and 2 % noise.
124
+
125
+ Every baseline lesion is otherwise unchanged. The same pipeline measures
126
+ baseline against this synthetic scan and each report line is compared with its
127
+ truth:
128
+
129
+ | Report line | Truth | Grade |
130
+ |---|---|---|
131
+ | new lesions | the injected set | sensitivity; false new |
132
+ | enlarging / shrinking | none | share of unchanged lesions called changed |
133
+ | resolved | none | share called resolved |
134
+ | SEL candidates | none | candidates per baseline lesion |
135
+ | brain volume change | the injected factor | recovery = measured / injected |
136
+ | segmentation (LST-AI mode only) | the injected lesions | sensitivity, false positives, Dice |
137
+
138
+ The traffic-light bands are mscard's own and are printed on every page so the
139
+ reader can disagree with them. Green: read the number at face value. Amber: read
140
+ it with the calibration table. Red: the pipeline could not recover that kind of
141
+ change on this scan; do not use the number.
142
+
143
+ What the calibration does **not** cover: real new lesions are not ellipsoids and
144
+ can sit next to old ones; real atrophy is not uniform; a synthetic year has no
145
+ scanner change. It is a floor, not a validation.
146
+
147
+ ## Results
148
+
149
+ **MSLesSeg cohort, 2026-09-29, this box (4 CPU threads, greedy engine), expert lesion masks supplied
150
+ (`--segmenter given`), calibration factor 0.98, 12 injected lesions per subject.** Every report is
151
+ in the gallery: https://cedricconday.github.io/mscard/ (one self-contained page per subject).
152
+
153
+ | Subject | Years | Baseline lesions | New | Enlarging | Shrinking | Resolved | SEL cand. | Lesion vol %/yr | Brain vol %/yr (eroded) | Boundary | Injected found | False new | Unchanged called changed | SEL/lesion on unchanged | Atrophy recovery |
154
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---|---:|---:|---:|---:|---:|
155
+ | P1 | 1.40 | 18 | 4 | 3 | 4 | 7 | 20 | -18.0 | 1.30 (0.01) | amber | 12/12 | 0 | 0/18 | 1.33 | 1.15 |
156
+ | P2 | 4.59 | 15 | 2 | 6 | 1 | 0 | 1 | 6.5 | -0.77 (-0.73) | green | 12/12 | 0 | 0/15 | 1.07 | 1.07 |
157
+ | P3 | 4.41 | 41 | 5 | 4 | 3 | 21 | 3 | -8.3 | -0.26 (-0.39) | green | 12/12 | 0 | 0/37 | 0.34 | 1.26 |
158
+ | P4 | 2.19 | 19 | 4 | 2 | 4 | 5 | 77 | 6.6 | -0.90 (-1.39) | green | 12/12 | 0 | 0/18 | 7.21 | 1.26 |
159
+ | P5 | 1.59 | 22 | 4 | 5 | 3 | 9 | 4 | -6.2 | -0.15 (-0.73) | amber | 12/12 | 0 | 0/18 | 0.73 | 1.20 |
160
+ | P6 | 2.01 | 33 | 18 | 9 | 6 | 13 | 40 | 14.8 | -2.38 (-2.33) | green | 12/12 | 0 | 0/32 | 1.85 | 1.17 |
161
+ | P7 | 0.97 | 21 | 11 | 4 | 3 | 8 | 40 | 30.5 | 0.08 (-0.21) | green | 12/12 | 0 | 0/20 | 3.67 | 1.23 |
162
+ | P8 | 1.02 | 17 | 7 | 4 | 7 | 4 | 15 | 10.9 | -3.47 (-2.53) | amber | 12/12 | 0 | 0/16 | 0.41 | 1.15 |
163
+ | P9 | 2.15 | 14 | 3 | 4 | 7 | 2 | 4 | 0.6 | -2.46 (-1.23) | amber | 12/12 | 0 | 0/12 | 1.21 | 1.23 |
164
+ | P10 | 1.00 | 34 | 11 | 9 | 7 | 12 | 20 | 13.9 | -3.33 (-1.90) | amber | 12/12 | 0 | 0/33 | 0.41 | 1.13 |
165
+ | P11 | 0.58 | 14 | 1 | 3 | 4 | 4 | 11 | -44.7 | -3.64 (-5.69) | red | 12/12 | 0 | 0/13 | 0.79 | 1.20 |
166
+ | P12 | 3.16 | 32 | 13 | 5 | 8 | 9 | 39 | 5.7 | -1.84 (-1.87) | green | 12/12 | 0 | 0/28 | 2.88 | 1.13 |
167
+ | P13 | 1.39 | 38 | 22 | 14 | 14 | 5 | 40 | 4.4 | -2.16 (-2.14) | green | 12/12 | 0 | 0/37 | 1.16 | 1.17 |
168
+ | P14 | 3.75 | 16 | 17 | 1 | 2 | 4 | 11 | -0.8 | 0.39 (-0.38) | amber | 12/12 | 0 | 0/16 | 1.31 | 1.10 |
169
+ | P19 | 6.03 | 58 | 8 | 3 | 0 | 36 | 19 | 2.5 | 0.54 (0.20) | green | 12/12 | 0 | 1/56 | 1.35 | 1.19 |
170
+ | P20 | 4.37 | 8 | 10 | 0 | 1 | 7 | 3 | 24.5 | 0.65 (1.19) | amber | 12/12 | 0 | 0/8 | 0.12 | 1.18 |
171
+ | P22 | 0.59 | 21 | 3 | 7 | 9 | 4 | 4 | -14.2 | 0.69 (-1.41) | red | 12/12 | 0 | 0/19 | 0.38 | 1.17 |
172
+ | P28 | 0.97 | 8 | 14 | 1 | 3 | 2 | 2 | 25.2 | -8.18 (-6.25) | red | 12/12 | 0 | 0/8 | 0.00 | 1.18 |
173
+ | P31 | 1.48 | 28 | 7 | 15 | 4 | 2 | 12 | 34.8 | -0.58 (0.36) | amber | 12/12 | 0 | 0/24 | 0.85 | 1.20 |
174
+ | P33 | 2.42 | 41 | 2 | 3 | 8 | 21 | 9 | -16.3 | -0.81 (-0.54) | green | 12/12 | 0 | 0/37 | 1.00 | 1.31 |
175
+ | P50 | 1.00 | 47 | 8 | 14 | 10 | 13 | 35 | 298.5 | -0.38 (0.39) | amber | –/– | – | –/– | – | – |
176
+ | P51 | 3.01 | 43 | 18 | 6 | 2 | 26 | 33 | 9.5 | -1.29 (-1.72) | green | 12/12 | 0 | 0/40 | 1.70 | 1.34 |
177
+ | P52 | 0.16 | 26 | 3 | 5 | 4 | 15 | 24 | -87.5 | 29.48 (16.12) | red | 12/12 | 0 | 0/25 | 1.00 | 1.25 |
178
+ | P53 | 1.17 | 22 | 21 | 0 | 1 | 21 | 21 | -7.6 | -0.97 (-1.41) | green | 12/12 | 0 | 0/21 | 1.14 | 1.13 |
179
+
180
+ Subjects: 24. Injected new lesions reported: 276 of 276; false new: 0. Unchanged lesions called enlarging or shrinking: 1 of 551; called resolved: 0. SEL candidates per unchanged lesion: median 1.07 (range 0.00 to 7.21). Atrophy recovery: median 1.18 (range 1.07 to 1.34). Boundary check on the real pairs: {'green': 11, 'amber': 9, 'red': 4}.
181
+
182
+ Two of 26 longitudinal subjects are not in the table: P49's released follow-up T1w is empty
183
+ (lesiontrack refuses it; reported upstream as MSLesSeg-2024 issue #1) and P50's baseline gives
184
+ bidsgate too little white matter to place lesions after the 6 mm exclusion around its existing ones.
185
+
186
+ What the numbers say, and what they do not:
187
+
188
+ * **New lesions, supplied masks: matching only.** With masks drawn by an annotator, the synthetic
189
+ follow-up mask contains the injected lesions by construction, so 276 of 276 says that
190
+ lesiontrack's tracking calls an injected lesion "new" rather than a fragment or a merge, and
191
+ nothing about detection. That is why the badge is grey. The LST-AI mode grades detection; its
192
+ numbers follow below as they land.
193
+ * **Enlarging, shrinking, resolved: 1 false call in 551 lesions, 0 false resolved.** Each baseline
194
+ lesion is judged against its own truth volume in the synthetic mask, with lesiontrack's ±9 %/yr
195
+ and ±4 %/yr bands. Registration and tracking do not invent change on a one-year synthetic
196
+ interval. The real pairs still show many resolved and shrinking lesions (P1: 7 resolved of 18);
197
+ the calibration cannot tell annotation drift between visits from biology, and the page says so.
198
+ * **Brain volume change: recovery 1.07 to 1.34, median 1.18.** The deformation field over-reads a
199
+ uniform 2 % contraction by about a fifth, consistently (lesiontrack's lesion-expansion backtest
200
+ gave 1.16). On the real pairs the boundary check is green for 11, amber for 9, red for 4: where it
201
+ is red, the full-mask and eroded-mask numbers disagree by more than 1.5 points per year and the
202
+ page calls the number rim-dominated.
203
+ * **SEL candidates: red for 17 of 23.** With no lesion expanding, the Elliott et al. 2019 candidate
204
+ rule still marks a median 1.07 candidates per baseline lesion. That is the noise floor of the
205
+ candidate stage at this registration; the definite/possible split is a cohort ranking on top of
206
+ it. This is the finding a reader of any SEL count should have next to it.
207
+
208
+ ## Citations
209
+
210
+ * Elliott C, et al. Slowly expanding/evolving lesions as a magnetic resonance imaging marker of chronic active multiple sclerosis lesions. *Mult Scler* 2019.
211
+ * Vanden Bulcke C, et al. 2025 (lesion volume change bands, see lesiontrack).
212
+ * Wiltgen T, et al. LST-AI: a deep learning ensemble for accurate MS lesion segmentation. *NeuroImage Clin* 2024.
213
+ * Guarnera C, et al. MSLesSeg: baseline and benchmarking of a new multiple sclerosis lesion segmentation dataset. 2024/2025.
214
+
215
+ ## Licence
216
+
217
+ MIT.
mscard-0.1.0/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # mscard
2
+
3
+ **The longitudinal multiple sclerosis MRI report that grades itself.**
4
+
5
+ Two (or more) MRI visits in, one page out: new, enlarging, shrinking and resolved
6
+ lesions, slowly expanding lesion (SEL) candidates, lesion volume change and brain
7
+ volume change. Next to every number, a grade: before the report is written, the
8
+ same pipeline is run on the subject's own baseline scan with **known changes
9
+ injected** (a known brain contraction, a known set of new lesions, a small
10
+ repositioning, gain drift and noise), and the page states how much of that truth
11
+ it recovered. A number the pipeline cannot recover on this scan is marked as such.
12
+
13
+ > **Nothing in this repository is evidence about multiple sclerosis.** It is
14
+ > research software. It is not a medical device, it has not been validated
15
+ > against clinical outcome, and it makes no diagnostic claim.
16
+
17
+ Status: first public build, 2026-09-29. Results on the public MSLesSeg cohort
18
+ (24 subjects) are in the Results section; the gallery of reports is at
19
+ https://cedricconday.github.io/mscard/.
20
+
21
+ ## Why
22
+
23
+ Every clinic that pays for longitudinal MS MRI analysis receives counts of new
24
+ and enlarging lesions and a brain volume change, and none of those reports says
25
+ how accurate the pipeline was on that scanner, that protocol, that head. The
26
+ open pieces exist: [LST-AI](https://github.com/CompImg/LST-AI) segments,
27
+ [lesiontrack](https://github.com/CedricConday/lesiontrack) registers, tracks and
28
+ finds SEL candidates, [bidsgate](https://github.com/CedricConday/bidsgate)
29
+ injects known lesions and atrophy and scores their recovery. mscard is the page
30
+ that joins them, and the rule that the calibration is not optional.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install mscard
36
+ ```
37
+
38
+ Python 3.10 or later. Registration comes with lesiontrack (greedy as a wheel,
39
+ x86-64 and arm64, CPU only). LST-AI is optional and runs in its container
40
+ (`docker` on PATH); without it, give your own lesion masks.
41
+
42
+ ## Use
43
+
44
+ A manifest, one row per scan, tab separated:
45
+
46
+ ```
47
+ subject session time_years t1 flair mask brainmask
48
+ P1 T1 28.09 P1/T1/T1.nii.gz P1/T1/FLAIR.nii.gz P1/T1/MASK.nii.gz P1/T1/brain.nii.gz
49
+ P1 T2 28.51 P1/T2/T1.nii.gz P1/T2/FLAIR.nii.gz P1/T2/MASK.nii.gz P1/T2/brain.nii.gz
50
+ ```
51
+
52
+ `time_years` is any monotone clock (age, or years since the first scan).
53
+ `mask` and `brainmask` are optional: with `--segmenter lst-ai` the masks come
54
+ from LST-AI, and a missing brain mask is estimated (skull-stripped input: the
55
+ nonzero support; whole head: bidsgate's morphological estimate). T1w, FLAIR and
56
+ masks of one scan must share a grid.
57
+
58
+ ```bash
59
+ mscard run manifest.tsv --out derivatives/mscard # measure, calibrate, report
60
+ mscard run manifest.tsv --out derivatives/mscard --segmenter lst-ai
61
+ mscard run manifest.tsv --out derivatives/mscard --no-calibrate # measure and report only
62
+ mscard calibrate manifest.tsv --out derivatives/mscard # calibration only
63
+ mscard report derivatives/mscard # re-render pages
64
+ ```
65
+
66
+ Output per subject: `report.html` (self-contained), `measure/mscard.json`
67
+ (every number), `measure/lesiontrack/` (masks, label maps, Jacobian, tables),
68
+ `calibration/synthetic/` (the synthetic follow-up and its truth),
69
+ `calibration/grade.json`. Over the tree: `index.html`, one row per subject.
70
+
71
+ ## What is measured
72
+
73
+ * **Registration, tracking, SEL candidates**: lesiontrack. Halfway space, greedy
74
+ stationary-velocity deformable registration on T1w and FLAIR jointly, Jacobian
75
+ determinant, lesion matching on the overlap graph; classes follow the
76
+ Vanden Bulcke et al. 2025 bands (enlarging or shrinking beyond ±9 %/yr, stable
77
+ within ±4 %/yr, trend between); SEL candidates by the Elliott et al. 2019 rule.
78
+ A *definite* SEL is a cohort-relative ranking and is not claimed for one subject.
79
+ * **Brain volume change**: the mean Jacobian determinant of the same deformation
80
+ field over the baseline brain mask, minus one. When a brain mask exists for
81
+ both visits the mask-volume ratio is shown as a second, ungraded number.
82
+
83
+ ## How the grade is made
84
+
85
+ For each subject, its baseline scan becomes a synthetic follow-up one modelled
86
+ year later (`mscard/calibrate.py`, parameters in `mscard/config.py`):
87
+
88
+ 1. the whole brain contracted by a known factor (default 0.98, i.e. −2 %) with
89
+ bidsgate `inject-atrophy`; every image and mask follows the same field;
90
+ 2. a known set of new lesions (default 12, 30 to 1500 mm³) with bidsgate
91
+ `inject-lesions`, placed at least 6 mm from every baseline lesion so each is
92
+ truly new;
93
+ 3. a rigid repositioning (up to 1 degree, 1 voxel), per-image gain (0.9 to 1.1)
94
+ and 2 % noise.
95
+
96
+ Every baseline lesion is otherwise unchanged. The same pipeline measures
97
+ baseline against this synthetic scan and each report line is compared with its
98
+ truth:
99
+
100
+ | Report line | Truth | Grade |
101
+ |---|---|---|
102
+ | new lesions | the injected set | sensitivity; false new |
103
+ | enlarging / shrinking | none | share of unchanged lesions called changed |
104
+ | resolved | none | share called resolved |
105
+ | SEL candidates | none | candidates per baseline lesion |
106
+ | brain volume change | the injected factor | recovery = measured / injected |
107
+ | segmentation (LST-AI mode only) | the injected lesions | sensitivity, false positives, Dice |
108
+
109
+ The traffic-light bands are mscard's own and are printed on every page so the
110
+ reader can disagree with them. Green: read the number at face value. Amber: read
111
+ it with the calibration table. Red: the pipeline could not recover that kind of
112
+ change on this scan; do not use the number.
113
+
114
+ What the calibration does **not** cover: real new lesions are not ellipsoids and
115
+ can sit next to old ones; real atrophy is not uniform; a synthetic year has no
116
+ scanner change. It is a floor, not a validation.
117
+
118
+ ## Results
119
+
120
+ **MSLesSeg cohort, 2026-09-29, this box (4 CPU threads, greedy engine), expert lesion masks supplied
121
+ (`--segmenter given`), calibration factor 0.98, 12 injected lesions per subject.** Every report is
122
+ in the gallery: https://cedricconday.github.io/mscard/ (one self-contained page per subject).
123
+
124
+ | Subject | Years | Baseline lesions | New | Enlarging | Shrinking | Resolved | SEL cand. | Lesion vol %/yr | Brain vol %/yr (eroded) | Boundary | Injected found | False new | Unchanged called changed | SEL/lesion on unchanged | Atrophy recovery |
125
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---|---:|---:|---:|---:|---:|
126
+ | P1 | 1.40 | 18 | 4 | 3 | 4 | 7 | 20 | -18.0 | 1.30 (0.01) | amber | 12/12 | 0 | 0/18 | 1.33 | 1.15 |
127
+ | P2 | 4.59 | 15 | 2 | 6 | 1 | 0 | 1 | 6.5 | -0.77 (-0.73) | green | 12/12 | 0 | 0/15 | 1.07 | 1.07 |
128
+ | P3 | 4.41 | 41 | 5 | 4 | 3 | 21 | 3 | -8.3 | -0.26 (-0.39) | green | 12/12 | 0 | 0/37 | 0.34 | 1.26 |
129
+ | P4 | 2.19 | 19 | 4 | 2 | 4 | 5 | 77 | 6.6 | -0.90 (-1.39) | green | 12/12 | 0 | 0/18 | 7.21 | 1.26 |
130
+ | P5 | 1.59 | 22 | 4 | 5 | 3 | 9 | 4 | -6.2 | -0.15 (-0.73) | amber | 12/12 | 0 | 0/18 | 0.73 | 1.20 |
131
+ | P6 | 2.01 | 33 | 18 | 9 | 6 | 13 | 40 | 14.8 | -2.38 (-2.33) | green | 12/12 | 0 | 0/32 | 1.85 | 1.17 |
132
+ | P7 | 0.97 | 21 | 11 | 4 | 3 | 8 | 40 | 30.5 | 0.08 (-0.21) | green | 12/12 | 0 | 0/20 | 3.67 | 1.23 |
133
+ | P8 | 1.02 | 17 | 7 | 4 | 7 | 4 | 15 | 10.9 | -3.47 (-2.53) | amber | 12/12 | 0 | 0/16 | 0.41 | 1.15 |
134
+ | P9 | 2.15 | 14 | 3 | 4 | 7 | 2 | 4 | 0.6 | -2.46 (-1.23) | amber | 12/12 | 0 | 0/12 | 1.21 | 1.23 |
135
+ | P10 | 1.00 | 34 | 11 | 9 | 7 | 12 | 20 | 13.9 | -3.33 (-1.90) | amber | 12/12 | 0 | 0/33 | 0.41 | 1.13 |
136
+ | P11 | 0.58 | 14 | 1 | 3 | 4 | 4 | 11 | -44.7 | -3.64 (-5.69) | red | 12/12 | 0 | 0/13 | 0.79 | 1.20 |
137
+ | P12 | 3.16 | 32 | 13 | 5 | 8 | 9 | 39 | 5.7 | -1.84 (-1.87) | green | 12/12 | 0 | 0/28 | 2.88 | 1.13 |
138
+ | P13 | 1.39 | 38 | 22 | 14 | 14 | 5 | 40 | 4.4 | -2.16 (-2.14) | green | 12/12 | 0 | 0/37 | 1.16 | 1.17 |
139
+ | P14 | 3.75 | 16 | 17 | 1 | 2 | 4 | 11 | -0.8 | 0.39 (-0.38) | amber | 12/12 | 0 | 0/16 | 1.31 | 1.10 |
140
+ | P19 | 6.03 | 58 | 8 | 3 | 0 | 36 | 19 | 2.5 | 0.54 (0.20) | green | 12/12 | 0 | 1/56 | 1.35 | 1.19 |
141
+ | P20 | 4.37 | 8 | 10 | 0 | 1 | 7 | 3 | 24.5 | 0.65 (1.19) | amber | 12/12 | 0 | 0/8 | 0.12 | 1.18 |
142
+ | P22 | 0.59 | 21 | 3 | 7 | 9 | 4 | 4 | -14.2 | 0.69 (-1.41) | red | 12/12 | 0 | 0/19 | 0.38 | 1.17 |
143
+ | P28 | 0.97 | 8 | 14 | 1 | 3 | 2 | 2 | 25.2 | -8.18 (-6.25) | red | 12/12 | 0 | 0/8 | 0.00 | 1.18 |
144
+ | P31 | 1.48 | 28 | 7 | 15 | 4 | 2 | 12 | 34.8 | -0.58 (0.36) | amber | 12/12 | 0 | 0/24 | 0.85 | 1.20 |
145
+ | P33 | 2.42 | 41 | 2 | 3 | 8 | 21 | 9 | -16.3 | -0.81 (-0.54) | green | 12/12 | 0 | 0/37 | 1.00 | 1.31 |
146
+ | P50 | 1.00 | 47 | 8 | 14 | 10 | 13 | 35 | 298.5 | -0.38 (0.39) | amber | –/– | – | –/– | – | – |
147
+ | P51 | 3.01 | 43 | 18 | 6 | 2 | 26 | 33 | 9.5 | -1.29 (-1.72) | green | 12/12 | 0 | 0/40 | 1.70 | 1.34 |
148
+ | P52 | 0.16 | 26 | 3 | 5 | 4 | 15 | 24 | -87.5 | 29.48 (16.12) | red | 12/12 | 0 | 0/25 | 1.00 | 1.25 |
149
+ | P53 | 1.17 | 22 | 21 | 0 | 1 | 21 | 21 | -7.6 | -0.97 (-1.41) | green | 12/12 | 0 | 0/21 | 1.14 | 1.13 |
150
+
151
+ Subjects: 24. Injected new lesions reported: 276 of 276; false new: 0. Unchanged lesions called enlarging or shrinking: 1 of 551; called resolved: 0. SEL candidates per unchanged lesion: median 1.07 (range 0.00 to 7.21). Atrophy recovery: median 1.18 (range 1.07 to 1.34). Boundary check on the real pairs: {'green': 11, 'amber': 9, 'red': 4}.
152
+
153
+ Two of 26 longitudinal subjects are not in the table: P49's released follow-up T1w is empty
154
+ (lesiontrack refuses it; reported upstream as MSLesSeg-2024 issue #1) and P50's baseline gives
155
+ bidsgate too little white matter to place lesions after the 6 mm exclusion around its existing ones.
156
+
157
+ What the numbers say, and what they do not:
158
+
159
+ * **New lesions, supplied masks: matching only.** With masks drawn by an annotator, the synthetic
160
+ follow-up mask contains the injected lesions by construction, so 276 of 276 says that
161
+ lesiontrack's tracking calls an injected lesion "new" rather than a fragment or a merge, and
162
+ nothing about detection. That is why the badge is grey. The LST-AI mode grades detection; its
163
+ numbers follow below as they land.
164
+ * **Enlarging, shrinking, resolved: 1 false call in 551 lesions, 0 false resolved.** Each baseline
165
+ lesion is judged against its own truth volume in the synthetic mask, with lesiontrack's ±9 %/yr
166
+ and ±4 %/yr bands. Registration and tracking do not invent change on a one-year synthetic
167
+ interval. The real pairs still show many resolved and shrinking lesions (P1: 7 resolved of 18);
168
+ the calibration cannot tell annotation drift between visits from biology, and the page says so.
169
+ * **Brain volume change: recovery 1.07 to 1.34, median 1.18.** The deformation field over-reads a
170
+ uniform 2 % contraction by about a fifth, consistently (lesiontrack's lesion-expansion backtest
171
+ gave 1.16). On the real pairs the boundary check is green for 11, amber for 9, red for 4: where it
172
+ is red, the full-mask and eroded-mask numbers disagree by more than 1.5 points per year and the
173
+ page calls the number rim-dominated.
174
+ * **SEL candidates: red for 17 of 23.** With no lesion expanding, the Elliott et al. 2019 candidate
175
+ rule still marks a median 1.07 candidates per baseline lesion. That is the noise floor of the
176
+ candidate stage at this registration; the definite/possible split is a cohort ranking on top of
177
+ it. This is the finding a reader of any SEL count should have next to it.
178
+
179
+ ## Citations
180
+
181
+ * Elliott C, et al. Slowly expanding/evolving lesions as a magnetic resonance imaging marker of chronic active multiple sclerosis lesions. *Mult Scler* 2019.
182
+ * Vanden Bulcke C, et al. 2025 (lesion volume change bands, see lesiontrack).
183
+ * Wiltgen T, et al. LST-AI: a deep learning ensemble for accurate MS lesion segmentation. *NeuroImage Clin* 2024.
184
+ * Guarnera C, et al. MSLesSeg: baseline and benchmarking of a new multiple sclerosis lesion segmentation dataset. 2024/2025.
185
+
186
+ ## Licence
187
+
188
+ MIT.
@@ -0,0 +1,3 @@
1
+ """mscard: the longitudinal MS MRI report that grades itself."""
2
+
3
+ __version__ = "0.1.0"