File size: 2,556 Bytes
6fc89f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-sa-4.0
task_categories:
- image-segmentation
tags:
- medical
- CT
- lung
- segmentation
- Medical Segmentation Decathlon
size_categories:
- n<1K
configs:
- config_name: default
  data_files:
  - split: train
    path: train.jsonl
  - split: test
    path: test.jsonl
---

# Medical Segmentation Decathlon: Lung

## Dataset Description

This is the **Lung** dataset from the Medical Segmentation Decathlon (MSD) challenge. The dataset contains CT scans with segmentation annotations for lung tumor segmentation.

### Dataset Details

- **Modality**: CT
- **Task**: Task06_Lung
- **Target**: lung cancer
- **Format**: NIfTI (.nii.gz)

### Dataset Structure

Each sample in the JSONL file contains:
```json
{
  "image": "path/to/image.nii.gz",
  "mask": "path/to/mask.nii.gz",
  "label": ["label1", "label2", ...],
  "modality": "CT",
  "dataset": "MSD_Lung",
  "official_split": "train",
  "patient_id": "patient_id"
}
```

### Data Organization

```
Task06_Lung/
├── imagesTr/          # Training images
│   └── *.nii.gz
└── labelsTr/          # Training labels
    └── *.nii.gz
```

## Usage

### Load Metadata

```python
from datasets import load_dataset

# Load the dataset
ds = load_dataset("Angelou0516/msd-lung")

# Access a sample
sample = ds['train'][0]
print(f"Image: {sample['image']}")
print(f"Mask: {sample['mask']}")
print(f"Labels: {sample['label']}")
print(f"Modality: {sample['modality']}")
```

### Load Images

```python
from huggingface_hub import snapshot_download
import nibabel as nib
import os

# Download the full dataset
local_path = snapshot_download(
    repo_id="Angelou0516/msd-lung",
    repo_type="dataset"
)

# Load a sample
sample = ds['train'][0]
image = nib.load(os.path.join(local_path, sample['image']))
mask = nib.load(os.path.join(local_path, sample['mask']))

# Get numpy arrays
image_data = image.get_fdata()
mask_data = mask.get_fdata()

print(f"Image shape: {image_data.shape}")
print(f"Mask shape: {mask_data.shape}")
```

## Citation

If you use this dataset, please cite the Medical Segmentation Decathlon paper:

```bibtex
@article{antonelli2022medical,
  title={A large annotated medical image dataset for the development and evaluation of segmentation algorithms},
  author={Antonelli, Michela and Reinke, Annika and Bakas, Spyridon and others},
  journal={Nature Communications},
  volume={13},
  number={1},
  pages={1--13},
  year={2022},
  publisher={Nature Publishing Group}
}
```

## License

CC-BY-SA-4.0

## Dataset Homepage

http://medicaldecathlon.com/