AeroPath / AeroPath.py
albertvillanova's picture
Update script to download data from the Hub
db9ed10 verified
raw
history blame
1.98 kB
"""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