CTSpine1K is a large publicly available annotated spine CT dataset for vertebra segmentation research. This comprehensive dataset addresses the critical need for large-scale annotated spine image data in deep learning-based medical image analysis.
Key Features:
| Split | CT Volumes | Description |
|---|---|---|
| Train | 610 | Training set for model development |
| Validation | 197 | Validation set for hyperparameter tuning |
| Test | 198 | Test set for final evaluation |
| Total | 1,005 | Complete dataset |
Technical Specifications:
Install the required dependencies:
pip install datasets nibabel
There are two ways to use the dataset: Raw format or Arrow format. Raw refers to downloading the original .nii.gz files using the Hugging Face Hub. The other option converts files to Apache Arrow format, enabling all advanced features Hugging Face offers with seamless PyTorch or TensorFlow integration.
You need specific files only You have existing NIfTI processing pipelines You want maximum control over data loading You're doing exploratory analysis
You want seamless PyTorch/TensorFlow integration You need fast I/O with intelligent caching You prefer standardized dataset interfaces You're training models repeatedly on the same data
[!TIP] When in doubt, start with the Arrow option — if you decide it's not needed, you can always access the raw files from the cache since the data downloads anyway.
This approach downloads the dataset files as you see them on Hugging Face. This is useful when you need only parts of the data, want to explore the structure, or already have logic to read and process .nii.gz files.
from huggingface_hub import snapshot_download
# Download entire repository
local_dir = snapshot_download(
repo_id="alexanderdann/CTSpine1K",
repo_type="dataset",
cache_dir="/your/cache/dir" # optional
)
# Now you can access files directly:
# local_dir/rawdata/volumes/[dataset]/*.nii.gz
# local_dir/rawdata/labels/[dataset]/*_seg.nii.gz
This offers maximum flexibility since you can also easily filter specific files from urls and download these. Mind to convert these to actual urls before downloading.
from huggingface_hub import HfApi
hf_api = HfApi()
urls = hf_api.list_repo_files(
"alexanderdann/CTSpine1K",
repo_type="dataset",
)
This option offers all the benefits of Hugging Face's datasets library. Apache Arrow is a columnar memory format optimized for analytics workloads, providing significant I/O acceleration through efficient data layouts and zero-copy operations. Once converted to Arrow format, the dataset supports fast random access, intelligent caching, and seamless integration with ML frameworks. The conversion process automatically handles data splitting, type optimization, and creates efficient indexes for rapid access patterns—particularly beneficial when training models that repeatedly access the same data.
[!WARNING] Memory Warning for 3D mode: Set
writer_batch_size=1if you have limited RAM. Use tools such ashtopon Linux to supervise the procedure and how it behaves.
During the initial Arrow conversion, the system collects multiple samples in memory before writing them as optimized chunks to disk. This batching improves I/O performance but can consume significant memory. If experiencing memory issues, use writer_batch_size=1 to process one sample at a time.
[!NOTE] The
trust_remote_code=Trueoption is needed for the script at https://huggingface.co/datasets/alexanderdann/CTSpine1K/blob/main/CTSpine1K.py to run.
from datasets import load_dataset
# Load 3D volumetric data
dataset_3d = load_dataset(
'alexanderdann/CTSpine1K',
name="3d",
trust_remote_code=True,
writer_batch_size=5, # see the warning above
)
# Load 2D slice-based data
dataset_2d = load_dataset(
'alexanderdann/CTSpine1K',
name="2d",
trust_remote_code=True,
)
# Access training, validation, and test splits
train_data = dataset_3d["train"]
val_data = dataset_3d["validation"]
test_data = dataset_3d["test"]
Each sample contains:
image: Raw CT volume/slice as numpy array (float32)segmentation: Corresponding segmentation mask (int32)patient_id: Unique identifier for the CT scanFile Organization:
rawdata/
├── volumes/ # Original CT scans
│ └── [dataset]/ # Organized by source dataset
│ └── *.nii.gz
└── labels/ # Segmentation masks
└── [dataset]/ # Organized by source dataset
└── *_seg.nii.gz
CTSpine1K is curated from four established medical imaging datasets to ensure diversity and clinical relevance:
This multi-source approach provides:
For detailed information about each source dataset and acquisition protocols, please refer to our research paper.
The dataset includes comprehensive vertebrae annotations covering the full spinal column. For specific details about the labeling schema, vertebrae classes, and handling of pathological cases (L6 vertebrae in sacral lumbarization and lumbar sacralization), please consult the original paper.
Special Cases:
liver_106_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0004_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0067_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0149_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0167_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0175_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0189_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0215_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0261_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0267_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0344_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0401_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0587_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0666_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0672_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0699_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0737_seg.nii.gz
verse506_CT-iso_seg.nii.gz
verse519_CT-iso_seg.nii.gz
verse532_seg.nii.gz
verse539_CT-iso_seg.nii.gz
verse542_CT-iso_seg.nii.gz
verse565_CT-iso_seg.nii.gz
verse586_CT-iso_seg.nii.gz
verse619_CT-iso_seg.nii.gz
liver_83_seg.nii.gz
liver_93_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0064_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0104_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0107_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0110_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0537_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0554_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0555_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0615_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0721_seg.nii.gz
verse100_seg.nii.gz
verse584_seg.nii.gz
verse594_seg.nii.gz
name="3d")name="2d")Arrow format requires ~1TB compared to ~150GB for raw files (6-7x increase) Initial conversion to Arrow format can take mutltiple hours depending on hardware.
keep_in_memory=False when loading to avoid RAM limitationsload_dataset(..., split="train")If you use the CTSpine1K dataset in your research, please cite our paper:
@misc{deng2024ctspine1klargescaledatasetspinal,
title={CTSpine1K: A Large-Scale Dataset for Spinal Vertebrae Segmentation in Computed Tomography},
author={Yang Deng and Ce Wang and Yuan Hui and Qian Li and Jun Li and Shiwei Luo and Mengke Sun and Quan Quan and Shuxin Yang and You Hao and Pengbo Liu and Honghu Xiao and Chunpeng Zhao and Xinbao Wu and S. Kevin Zhou},
year={2024},
eprint={2105.14711},
archivePrefix={arXiv},
primaryClass={eess.IV},
url={https://arxiv.org/abs/2105.14711},
}
This dataset is released under the Creative Commons Attribution-NonCommercial-ShareAlike (CC-BY-NC-SA) license.
We thank all the original data providers and authors for the contribution of this dataset.
For questions, issues, or contributions, please refer to the original repository or contact the dataset maintainers.
153 commits
CTSpine1K is a large publicly available annotated spine CT dataset for vertebra segmentation research. This comprehensive dataset addresses the critical need for large-scale annotated spine image data in deep learning-based medical image analysis.
Key Features:
| Split | CT Volumes | Description |
|---|---|---|
| Train | 610 | Training set for model development |
| Validation | 197 | Validation set for hyperparameter tuning |
| Test | 198 | Test set for final evaluation |
| Total | 1,005 | Complete dataset |
Technical Specifications:
Install the required dependencies:
pip install datasets nibabel
There are two ways to use the dataset: Raw format or Arrow format. Raw refers to downloading the original .nii.gz files using the Hugging Face Hub. The other option converts files to Apache Arrow format, enabling all advanced features Hugging Face offers with seamless PyTorch or TensorFlow integration.
You need specific files only You have existing NIfTI processing pipelines You want maximum control over data loading You're doing exploratory analysis
You want seamless PyTorch/TensorFlow integration You need fast I/O with intelligent caching You prefer standardized dataset interfaces You're training models repeatedly on the same data
[!TIP] When in doubt, start with the Arrow option — if you decide it's not needed, you can always access the raw files from the cache since the data downloads anyway.
This approach downloads the dataset files as you see them on Hugging Face. This is useful when you need only parts of the data, want to explore the structure, or already have logic to read and process .nii.gz files.
from huggingface_hub import snapshot_download
# Download entire repository
local_dir = snapshot_download(
repo_id="alexanderdann/CTSpine1K",
repo_type="dataset",
cache_dir="/your/cache/dir" # optional
)
# Now you can access files directly:
# local_dir/rawdata/volumes/[dataset]/*.nii.gz
# local_dir/rawdata/labels/[dataset]/*_seg.nii.gz
This offers maximum flexibility since you can also easily filter specific files from urls and download these. Mind to convert these to actual urls before downloading.
from huggingface_hub import HfApi
hf_api = HfApi()
urls = hf_api.list_repo_files(
"alexanderdann/CTSpine1K",
repo_type="dataset",
)
This option offers all the benefits of Hugging Face's datasets library. Apache Arrow is a columnar memory format optimized for analytics workloads, providing significant I/O acceleration through efficient data layouts and zero-copy operations. Once converted to Arrow format, the dataset supports fast random access, intelligent caching, and seamless integration with ML frameworks. The conversion process automatically handles data splitting, type optimization, and creates efficient indexes for rapid access patterns—particularly beneficial when training models that repeatedly access the same data.
[!WARNING] Memory Warning for 3D mode: Set
writer_batch_size=1if you have limited RAM. Use tools such ashtopon Linux to supervise the procedure and how it behaves.
During the initial Arrow conversion, the system collects multiple samples in memory before writing them as optimized chunks to disk. This batching improves I/O performance but can consume significant memory. If experiencing memory issues, use writer_batch_size=1 to process one sample at a time.
[!NOTE] The
trust_remote_code=Trueoption is needed for the script at https://huggingface.co/datasets/alexanderdann/CTSpine1K/blob/main/CTSpine1K.py to run.
from datasets import load_dataset
# Load 3D volumetric data
dataset_3d = load_dataset(
'alexanderdann/CTSpine1K',
name="3d",
trust_remote_code=True,
writer_batch_size=5, # see the warning above
)
# Load 2D slice-based data
dataset_2d = load_dataset(
'alexanderdann/CTSpine1K',
name="2d",
trust_remote_code=True,
)
# Access training, validation, and test splits
train_data = dataset_3d["train"]
val_data = dataset_3d["validation"]
test_data = dataset_3d["test"]
Each sample contains:
image: Raw CT volume/slice as numpy array (float32)segmentation: Corresponding segmentation mask (int32)patient_id: Unique identifier for the CT scanFile Organization:
rawdata/
├── volumes/ # Original CT scans
│ └── [dataset]/ # Organized by source dataset
│ └── *.nii.gz
└── labels/ # Segmentation masks
└── [dataset]/ # Organized by source dataset
└── *_seg.nii.gz
CTSpine1K is curated from four established medical imaging datasets to ensure diversity and clinical relevance:
This multi-source approach provides:
For detailed information about each source dataset and acquisition protocols, please refer to our research paper.
The dataset includes comprehensive vertebrae annotations covering the full spinal column. For specific details about the labeling schema, vertebrae classes, and handling of pathological cases (L6 vertebrae in sacral lumbarization and lumbar sacralization), please consult the original paper.
Special Cases:
liver_106_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0004_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0067_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0149_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0167_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0175_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0189_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0215_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0261_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0267_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0344_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0401_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0587_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0666_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0672_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0699_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0737_seg.nii.gz
verse506_CT-iso_seg.nii.gz
verse519_CT-iso_seg.nii.gz
verse532_seg.nii.gz
verse539_CT-iso_seg.nii.gz
verse542_CT-iso_seg.nii.gz
verse565_CT-iso_seg.nii.gz
verse586_CT-iso_seg.nii.gz
verse619_CT-iso_seg.nii.gz
liver_83_seg.nii.gz
liver_93_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0064_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0104_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0107_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0110_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0537_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0554_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0555_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0615_seg.nii.gz
1.3.6.1.4.1.9328.50.4.0721_seg.nii.gz
verse100_seg.nii.gz
verse584_seg.nii.gz
verse594_seg.nii.gz
name="3d")name="2d")Arrow format requires ~1TB compared to ~150GB for raw files (6-7x increase) Initial conversion to Arrow format can take mutltiple hours depending on hardware.
keep_in_memory=False when loading to avoid RAM limitationsload_dataset(..., split="train")If you use the CTSpine1K dataset in your research, please cite our paper:
@misc{deng2024ctspine1klargescaledatasetspinal,
title={CTSpine1K: A Large-Scale Dataset for Spinal Vertebrae Segmentation in Computed Tomography},
author={Yang Deng and Ce Wang and Yuan Hui and Qian Li and Jun Li and Shiwei Luo and Mengke Sun and Quan Quan and Shuxin Yang and You Hao and Pengbo Liu and Honghu Xiao and Chunpeng Zhao and Xinbao Wu and S. Kevin Zhou},
year={2024},
eprint={2105.14711},
archivePrefix={arXiv},
primaryClass={eess.IV},
url={https://arxiv.org/abs/2105.14711},
}
This dataset is released under the Creative Commons Attribution-NonCommercial-ShareAlike (CC-BY-NC-SA) license.
We thank all the original data providers and authors for the contribution of this dataset.
For questions, issues, or contributions, please refer to the original repository or contact the dataset maintainers.
153 commits