-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathREADME.Rmd
More file actions
257 lines (210 loc) · 8.89 KB
/
Copy pathREADME.Rmd
File metadata and controls
257 lines (210 loc) · 8.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = ""
)
library(neurobase)
library(dplyr)
library(tidyr)
library(readr)
```
# Multiple Sclerosis Lesion Data
The data in this repository is from the Laboratory of Imaging Technologies (http://lit.fe.uni-lj.si/tools.php?lang=eng).
## Cross-sectional data
The cross-sectional data is from the "3D MR image database of Multiple Sclerosis patients with white matter lesion segmentations" section of the website.
The database is released under the Creative-Commons
Attribution (CC-BY) license. Please cite the references
below in any published work that uses this database.

### References
The data is described in:
Lesjak, Žiga, et al. "A novel public MR image dataset of multiple sclerosis patients with lesion segmentations based on multi-rater consensus." Neuroinformatics (2017): 1-13.
### Demographics
```{r, echo=FALSE, message=FALSE}
cs_demog = read_csv("cross_sectional/patient_info.csv")
remove_na = function(x) {
x[ x %in% "N/A"] = NA
x
}
cs_demog = rename(cs_demog, id = patient_id)
cs_demog$id = sprintf("patient%02.0f", cs_demog$id)
cs_demog$ms_type = remove_na(cs_demog$ms_type)
cs_demog$edss = remove_na(cs_demog$edss)
cs_demog$criteria = remove_na(cs_demog$criteria)
cs_demog$edss = as.numeric(cs_demog$edss)
cn_order = c("id", "age", "sex", "ms_type")
cn = colnames(cs_demog)
in_order = cn %in% cn_order
cn = cn[ c(which(in_order), which(!in_order)) ]
cs_demog = cs_demog[, cn]
save(cs_demog, file = "cs_demog.rda", compress = "xz")
knitr::kable(cs_demog)
```
### Raw Data
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "cross_sectional/raw", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
bn = basename(dirname(x))
x = x[grepl("patient", bn)]
mods = nii.stub(x, bn = TRUE)
mods = recode(mods, "consensus_gt" = "Gold_Standard",
T1W = "T1", T1WKS = "T1Post", T2W = "T2")
df = tibble(file = x, mod = mods, id = basename(dirname(x)))
cs_raw = as.data.frame(df)
save(cs_raw, file = "cs_raw.rda", compress = "xz")
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
### Slightly Processed/Coregistered Data
These images were co-registered to the FLAIR and bias corrected and include a brain mask (in the FLAIR space.)
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "cross_sectional/coregistered/", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
mods = nii.stub(x, bn = TRUE)
mods = recode(mods, "consensus_gt" = "Gold_Standard",
brainmask = "Brain_Mask",
T1W = "T1", T1WKS = "T1Post", T2W = "T2")
df = tibble(file = x, mod = mods, id = basename(dirname(x)))
cs_coreg = as.data.frame(df)
save(cs_coreg, file = "cs_coreg.rda", compress = "xz")
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
### Processed + Resampled
These images were are the slightly processed data, but resampled to 1x1x1mm isotropic voxel sizes. The images were interpolated using a linear interpolator and the binary images (mask and brain mask) were done using a nearest neighbor interpolator.
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "cross_sectional/coregistered_resampled/", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
mods = nii.stub(x, bn = TRUE)
mods = recode(mods, "consensus_gt" = "Gold_Standard",
brainmask = "Brain_Mask",
T1W = "T1", T1WKS = "T1Post", T2W = "T2")
df = tibble(file = x, mod = mods, id = basename(dirname(x)))
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
### Process, Registered to MNI
These images were are the processed data, and registered to an MNI template. The images were processed using the following methodology:
1. N4 bias field correction
2. Neck removal
3. Reduced the dimensions of the image to non-zero images.
4. Winsorization using the 99.9th percentile
6. Registration to the FLAIR image.
7. Brain extraction using MALF.
8. N4 bias field correction on the brain only.
9. Registration to the MNI brain template
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "cross_sectional/MNI", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
mods = nii.stub(x, bn = TRUE)
mods = sub("_N4.*", "", mods)
mods = recode(mods, "GOLD_STANDARD" = "Gold_Standard",
brainmask = "Brain_Mask",
T1 = "T1", T1POST = "T1Post", T2 = "T2")
df = tibble(file = x, mod = mods, id = basename(dirname(x)))
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
## Longitudinal data
The longitudinal data is from the "Longitudinal MR image database of Multiple Sclerosis patients with white matter lesion change segmentation" section of the website.
This archive contains longitudinal Magnetic Resonance (MR) images of patients with Multiple Sclerosis (MS) with corresponding
ground truth segmentations of white matter lesion changes. Each patient has been imaged twice on two separate occasions. The
images are grouped intro folders for each of the patients.
The database is released under the Creative-Commons
Attribution (CC-BY) license. Please cite the references
below in any published work that uses this database.

### Description
This archive contains longitudinal Magnetic Resonance (MR) images
of Multiple Sclerosis (MS) patients with corresponding ground
truth segmentations of white matter lesion changes. Each patient
has been imaged twice on two separate occasions. The images are
grouped into folders for each of the patients. Each patient's
folder consists of:
- Co-registered and N4 corrected T1-weighted, T2-weighted and FLAIR images for both MR studies
- Brain mask
- White matter lesion change mask
- RAW images in their original space
- Intra-study transform parameters and transform parameters from RAW to common space
### Demographics
```{r, echo=FALSE, message=FALSE}
long_demog = read_csv("longitudinal/patient_info.csv")
long_demog = rename(long_demog, id = patient_id)
long_demog$id = sprintf("patient%02.0f", long_demog$id)
cn = colnames(long_demog)
in_order = cn %in% cn_order
cn = cn[ c(which(in_order), which(!in_order)) ]
long_demog = long_demog[, cn]
save(long_demog, file = "long_demog.rda", compress = "xz")
knitr::kable(long_demog)
```
### Raw Data
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "longitudinal/raw", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
x = x[ !grepl("gt[.]nii", x)]
mods = nii.stub(x, bn = TRUE)
mods = gsub("study\\d_", "", mods)
mods = recode(mods,
"gt" = "Gold_Standard",
T1W = "T1", T1WKS = "T1Post", T2W = "T2")
df = tibble(file = x, mod = mods,
id = basename(dirname(x)),
study = sub(".*study(\\d).*", "\\1", x))
df = df %>%
mutate(Gold_Standard = file.path(dirname(file), "gt.nii.gz"))
long_raw = as.data.frame(df)
save(long_raw, file = "long_raw.rda", compress = "xz")
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"),
Gold_Standard = paste0("[Gold_Standard](", Gold_Standard, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
### Slightly Processed/Coregistered Data
```{r, echo=FALSE, message=FALSE}
x = list.files(
path = "longitudinal/coregistered/", pattern = ".nii.gz",
recursive = TRUE, full.names = TRUE)
x = x[ !grepl("(gt|brainmask)[.]nii", x)]
mods = nii.stub(x, bn = TRUE)
mods = gsub("study\\d_", "", mods)
mods = recode(mods,
"gt" = "Gold_Standard",
brainmask = "Brain_Mask",
T1W = "T1", T1WKS = "T1Post", T2W = "T2")
df = tibble(file = x, mod = mods,
id = basename(dirname(x)),
study = sub(".*study(\\d).*", "\\1", x))
df = df %>%
mutate(Gold_Standard = file.path(dirname(file), "gt.nii.gz"),
Brain_Mask = file.path(dirname(file), "brainmask.nii.gz"))
long_coreg = as.data.frame(df)
save(long_coreg, file = "long_coreg.rda", compress = "xz")
df = df %>%
mutate(file = paste0("[", mod, "](", file, ")"),
Gold_Standard = paste0("[Gold_Standard](", Gold_Standard, ")"),
Brain_Mask = paste0("[Brain_Mask](", Brain_Mask, ")"))
df = spread(df, key = mod, value = file)
knitr::kable(df, col.names = rep("", ncol(df)))
```
### References
The data is described in:
Lesjak, Žiga, Franjo Pernuš, Boštjan Likar, and Žiga Špiclin. "Validation of White Matter Lesion Change Detection Methods on a Novel Publicly Available MRI Image Database." Neuroinformatics (2016): 1-18.