File size: 9,130 Bytes
c50e2dd
 
a5c185b
 
 
 
 
 
 
c50e2dd
a5c185b
 
 
cf605fe
a5c185b
cf605fe
 
a5c185b
cf605fe
9f2c9aa
cf605fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22ffa45
a5c185b
 
b64741a
22ffa45
a5c185b
 
cf605fe
22ffa45
cf605fe
9f2c9aa
a5c185b
 
9f2c9aa
 
cf605fe
9f2c9aa
9f413e7
 
 
a5c185b
cf605fe
a5c185b
cf605fe
 
9f413e7
cf605fe
 
 
 
9f413e7
cf605fe
 
 
 
9f413e7
cf605fe
 
 
 
9f413e7
 
cf605fe
9f413e7
cf605fe
9f413e7
cf605fe
9f413e7
cf605fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5c185b
cf605fe
9f413e7
cf605fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5c185b
cf605fe
a5c185b
cf605fe
 
 
f4ed7d1
cf605fe
 
 
 
9f413e7
a5c185b
 
 
 
2070ac8
 
a5c185b
9f2c9aa
cf605fe
c5eade3
cf605fe
c5eade3
cf605fe
 
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
---
license: cc-by-4.0
language:
- en
tags:
- medical
- MRI
- spine
- segmentation
---

# Dataset Card for Spine Segmentation: Discs, Vertebrae and Spinal Canal (SPIDER)

The SPIDER dataset contains (human) lumbar spine magnetic resonance images (MRI) and segmentation masks described in the following paper:

- van der Graaf, J.W., van Hooff, M.L., Buckens, C.F.M. et al. *Lumbar spine segmentation in MR images: a dataset and a public benchmark.*
  Sci Data 11, 264 (2024). https://doi.org/10.1038/s41597-024-03090-w

Original data are available on [Zenodo](https://zenodo.org/records/8009680). More information can be found at [SPIDER Grand Challenge](https://spider.grand-challenge.org/).

<figure>
  <img src="docs/ex1.png" alt="Example MRI Image" style="height:300px;">
  <figcaption>Example MRI scan (at three different depths)</figcaption>
</figure>

<figure>
  <img src="docs/ex2.png" alt="Example MRI Image with Segmentation Mask" style="height:300px;">
  <figcaption>Example MRI scan with segmentation masks</figcaption>
</figure>

## Getting Started

First, you will need to install the following dependencies:

* `datasets >= 2.18.0`
* `scikit-image >= 0.19.3`
* `SimpleITK >= 2.3.1`

Then you can load the SPIDER dataset as follows:

```python
from datasets import load_dataset

dataset = load_dataset("cdoswald/SPIDER, name="default", trust_remote_code=True)
```

More detailed examples for [loading](tutorials/load_data.ipynb) the dataset with different configurations 
and using the dataset for [segmentation tasks](tutorials/segment_anything.ipynb) are provided in the [tutorials](tutorials) folder.

## Table of Contents

(Placeholder--to be filled in at end of project)

## Dataset Description

- **Paper:** [Lumbar spine segmentation in MR images: a dataset and a public benchmark](https://www.nature.com/articles/s41597-024-03090-w) 
- **Repository:** [Zenodo](https://zenodo.org/records/8009680)
- **Grand Challenge:** [SPIDER Grand Challenge](https://spider.grand-challenge.org/)

### Dataset Summary

The dataset includes 447 sagittal T1 and T2 MRI series collected from 218 patients across four hospitals.
Segmentation masks indicating the vertebrae, intervertebral discs (IVDs), and spinal canal are also included.
Segmentation masks were created manually by a medical trainee under the supervision of a medical imaging expert and an experienced musculoskeletal radiologist.

In addition to MR images and segmentation masks, additional metadata (e.g., scanner manufacturer, pixel bandwidth, etc.), limited
patient characteristics (biological sex and age, when available), and radiological gradings indicating specific degenerative
changes can be loaded with the corresponding image data.

### Modifications to Original Data

This version of the SPIDER dataset (i.e., available through the HuggingFace `datasets` library) differs from the original 
data available on [Zenodo](https://zenodo.org/records/8009680) in two key ways:

1. Image Rescaling/Resizing: The original 3D volumetric MRI data (images and masks) are stored as .mha files and do not have a standardized height, width, depth, and image resolution. 
To enable the data to be loaded through the HuggingFace `datasets` library, all 447 MRI series and masks are standardized to have size `(512, 512, 30)` and resolution `[0, 255]` (unisgned 8-bit integers); therefore,
n-dimensional interpolation is used to resize and/or rescale the images (via the `skimage.transform.resize` and `skimage.img_as_ubyte` functions). 
If you need a different standardization, you have two options:

    i. Pass your preferred standardization size as a `Tuple[int, int, int]` to the `resize_shape` argument in `load_dataset` (see the [LoadData Tutorial](placeholder)); OR
	
	ii. After loading the dataset from HuggingFace, use the `SimpleITK` library to import each image using the file path of the locally cached .mha file. 
	The local cache file path is provided for each example when iterating over the dataset (again, see the [LoadData Tutorial](placeholder)).

2. Train, Validation, and Test Set: The original dataset contained 257 unique studies (i.e., patients) that were partitioned into 218 (85%) studies for the public training/validation set
and 39 (15%) studies for the SPIDER Grand Challenge [hidden test set](https://spider.grand-challenge.org/data/). To enable users to train, validate, and test their models prior to submitting
their models to the SPIDER Grand Challenge, the original 218 studies that comprised the public training/validation set were further partitioned using a 60%/20%/20% split. The original split
for each study (i.e., training or validation set) is recorded in the `OrigSubset` variable in the study's linked metadata.


## Dataset Structure

### Data Instances

There are 447 images and corresponding segmentation masks for 218 unique patients.

### Data Format/Fields

The format for each generated data instance is as follows:

1. **patient_id**: a unique ID number indicating the specific patient (note that many patients have more than one scan in the data)

2. **scan_type**: an indicator for whether the image is a T1-weighted, T2-weighted, or T2-SPACE MRI

3. **image**: a 3-dimensional volumetric array (height, width, depth) of values indicating pixel intensities of MRI scan

4. **mask**: a 3-dimensional volumetric array (height, width, depth) of values indicating manually segmented feature of interest

5. **image_path**: path to the local cache containing the original (non-rescaled and non-resized) MRI image

6. **mask_path**: path to the local cache containing the original (non-rescaled and non-resized) segementation mask

7. **metadata**: a dictionary of metadata of image, patient, and scanner characteristics:

    - number of vertebrae
    - number of discs
    - biological sex
    - age
    - manufacturer
    - manufacturer model name
    - serial number
    - software version
    - echo numbers
    - echo time
    - echo train length
    - flip angle
    - imaged nucleus
    - imaging frequency
    - inplane phase encoding direction
    - MR acquisition type
    - magnetic field strength
    - number of phase encoding steps
    - percent phase field of view
    - percent sampling
    - photometric interpretation
    - pixel bandwidth
    - pixel spacing
    - repetition time
    - specific absorption rate (SAR)
    - samples per pixel
    - scanning sequence
    - sequence name
    - series description
    - slice thickness
    - spacing between slices
    - specific character set
    - transmit coil name
    - window center
    - window width

9. **rad_gradings**: radiological gradings by an expert musculoskeletal radiologist indicating specific degenerative
changes at all intervertebral disc (IVD) levels (see page 3 of the [original paper](https://www.nature.com/articles/s41597-024-03090-w)
 for more details). The data are provided as a dictionary of lists; an element's position in the list indicates the IVD level. Some elements
are ratings while others are binary indicators. For consistency, each list will have 10 elements, but some IVD levels may not be applicable
to every image (which will be indicated with an empty string).

### Data Splits

The dataset is split as follows:

- Training set:
	- 149 unique patients
	- 304 images
		- T1: 133 images
		- T2: 145 images
		- T2-SPACE: 26 images
- Validation set:
	- 37 unique patients
	- 75 images
		- T1: 34 images
		- T2: 34 images
		- T2-SPACE: 7 images
- Test set:
	- 32 unique patients
	- 68 images
		- T1: 29 images
		- T2: 31 images
		- T2-SPACE: 8 images

An additional hidden test set provided by the paper authors
(i.e., not available via HuggingFace) is available on the 
[SPIDER Grand Challenge](https://spider.grand-challenge.org/spiders-challenge/).

## Image Resolution

> Standard sagittal T1 and T2 image resolution ranges from 3.3 x 0.33 x 0.33 mm to 4.8 x 0.90 x 0.90 mm. 
> Sagittal T2 SPACE sequence images had a near isotropic spatial resolution with a voxel size of 0.90 x 0.47 x 0.47 mm.
> (https://spider.grand-challenge.org/data/)

Note that all images are rescaled to have pixel intensities in the range `[0, 255]` (i.e., unsigned 8-bit integers)
for compatibility with the HuggingFace `datasets` library. If you want to use the original resolution, you can
load the original images from the local cache indicated in each example's `image_path` and `mask_path` features.
See the data loading [tutorial](tutorials/load_data.ipynb) for more information.

## Additional Information

### License

The dataset is published under a CC-BY 4.0 license: https://creativecommons.org/licenses/by/4.0/legalcode.

### Citation

- van der Graaf, J.W., van Hooff, M.L., Buckens, C.F.M. et al. Lumbar spine segmentation in MR images: a dataset and a public benchmark. Sci Data 11, 264 (2024). https://doi.org/10.1038/s41597-024-03090-w.

### Disclaimer

I am not affiliated in any way with the aforementioned paper, researchers, or organizations. Please validate any findings using this curated dataset
against the original data provided by the researchers on [Zenodo](https://zenodo.org/records/8009680).)