File size: 1,982 Bytes
db9ed10
07eb621
 
 
 
db9ed10
 
 
 
 
 
 
07eb621
 
 
 
 
 
 
 
 
 
 
 
db9ed10
 
 
 
 
 
 
 
07eb621
 
 
 
 
 
 
 
db9ed10
 
 
 
 
 
 
07eb621
 
db9ed10
07eb621
 
 
 
958909d
07eb621
db9ed10
958909d
 
 
 
 
db9ed10
958909d
 
 
 
db9ed10
 
 
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
"""AeroPath: An airway segmentation benchmark dataset with challenging pathology."""


import datasets

_DESCRIPTION = """\
AeroPath: An airway segmentation benchmark dataset with challenging pathology.
"""

_HOMEPAGE = "https://github.com/raidionics/AeroPath"

_LICENSE = "MIT"

_CITATION = """\
@misc{støverud2023aeropath,
title={AeroPath: An airway segmentation benchmark dataset with challenging pathology}, 
author={Karen-Helene Støverud and David Bouget and Andre Pedersen and Håkon Olav Leira and Thomas Langø and Erlend Fagertun Hofstad},
year={2023},
eprint={2311.01138},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
"""

_URLS = [
    {
        "ct": f"data/{i}/{i}_CT_HR.nii.gz",
        "airways": f"data/{i}/{i}_CT_HR_label_airways.nii.gz",
        "lungs": f"data/{i}/{i}_CT_HR_label_lungs.nii.gz",
    }
    for i in range(1, 28)
]


class AeroPath(datasets.GeneratorBasedBuilder):
    """An airway segmentation benchmark dataset with challenging pathology."""

    VERSION = datasets.Version("1.0.0")

    def _info(self):
        features = datasets.Features(
            {
                "ct": datasets.Value("string"),
                "airways": datasets.Value("string"),
                "lungs": datasets.Value("string")
            }
        )
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            homepage=_HOMEPAGE,
            license=_LICENSE,
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        data_dirs = dl_manager.download(_URLS)
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TEST,
                # These kwargs will be passed to _generate_examples
                gen_kwargs={
                    "data_dirs": data_dirs,
                },
            ),
        ]

    def _generate_examples(self, data_dirs):
        for key, patient in enumerate(data_dirs):
            yield key, patient