TDSC-ABUS2023 PyTorch Dataset
A lightweight PyTorch Dataset for the TDSC-ABUS2023 challenge (Tumor Detection, Segmentation, and Classification on Automated 3D Breast Ultrasound). It downloads the data on first use and hands back ready-to-train volumes, masks, labels, and tumor bounding boxes — no manual file wrangling required.
from tdsc_abus2023_pytorch import TDSC, DataSplits
dataset = TDSC(path="./data", split=DataSplits.TRAIN, download=True)
volume, mask, label, bbox = dataset[0]
Contents
Installation
pip install tdsc-abus2023-pytorch
Requires Python 3.9+. The only runtime dependencies are torch, numpy, pandas, pynrrd, and gdown — nothing else is pulled in.
Quick Start
Full volumes
from tdsc_abus2023_pytorch import TDSC, DataSplits
dataset = TDSC(path="./data", split=DataSplits.TRAIN, download=True)
volume, mask, label, bbox = dataset[0]
# volume, mask : np.ndarray — full 3D ultrasound volume / segmentation mask
# label : int — 0 = Malignant, 1 = Benign
# bbox : ((x0, y0, z0), (x1, y1, z1)) — tumor bounding box, in the volume's native coordinates
Tumor crops only
TDSCTumors returns the volume and mask already cropped to the tumor's bounding box — handy for classification or patch-based segmentation.
from tdsc_abus2023_pytorch import TDSCTumors, DataSplits
dataset = TDSCTumors(path="./data", split=DataSplits.TRAIN, download=True)
volume, mask, label = dataset[0]
Changing the anatomical view
ViewTransformer transposes each volume/mask pair into a different anatomical plane before it's returned.
from tdsc_abus2023_pytorch import TDSC, DataSplits, ViewTransformer, ViewTransposeConfig
transformer = ViewTransformer(view=ViewTransposeConfig.CORONAL)
dataset = TDSC(path="./data", split=DataSplits.TRAIN, transforms=[transformer])
volume, mask, label, bbox = dataset[0]
Custom transforms
Any callable of the form (volume, mask) -> (volume, mask) can be used as a transform. Pass several to transforms=[...] and they run in order.
class MyTransform:
def __call__(self, volume, mask):
return volume, mask # your logic here
dataset = TDSC(path="./data", split=DataSplits.TRAIN, transforms=[ViewTransformer(ViewTransposeConfig.AXIAL), MyTransform()])
Dataset
200 3D breast ultrasound volumes acquired with an Invenia ABUS (GE Healthcare) system at Harbin Medical University Cancer Hospital, China. Tumor segmentation masks and bounding boxes were created and verified by experienced radiologists.
| Split | Cases | Malignant | Benign |
|---|---|---|---|
| Train | 100 | 58 | 42 |
| Validation | 30 | 17 | 13 |
| Test | 70 | 40 | 30 |
- Volume size: varies between 843×546×270 and 865×682×354 voxels
- Voxel spacing: 0.200 mm × 0.073 mm (X–Y) × ~0.475674 mm (Z)
- File format:
.nrrd - Mask labels:
0background,1tumor
On first use (download=True), each requested split is fetched from Google Drive, extracted, and cached at path/<Split>/; subsequent runs reuse the cached copy without touching the network.
API Reference
| Class | Returns | Notes |
|---|---|---|
TDSC(path, split, transforms, download) |
(volume, mask, label, bbox) |
Full volume and mask |
TDSCTumors(path, split, transforms, download) |
(volume, mask, label) |
Cropped to the tumor bounding box |
ViewTransformer(view) |
(volume, mask) |
view is ViewTransposeConfig.{AXIAL, CORONAL, SAGITTAL} |
DataSplits |
— | DataSplits.{TRAIN, VALIDATION, TEST} |
All datasets accept a plain string instead of the enum (e.g. split="Train").
On-Disk Layout
data/
├── Train/
│ ├── DATA/
│ ├── MASK/
│ ├── labels.csv
│ └── bbx_labels.csv
├── Validation/
│ └── ...
└── Test/
└── ...
Development
git clone https://github.com/mralinp/tdsc-abus2023-pytorch.git
cd tdsc-abus2023-pytorch
pip install -r requirements.txt
pip install pytest pytest-cov
pytest
The test suite runs entirely offline against a small synthetic dataset — it never downloads the real data.
Citation
If you use this dataset in your research, please cite:
@misc{luo2025tumordetectionsegmentationclassification,
title={Tumor Detection, Segmentation and Classification Challenge on Automated 3D Breast Ultrasound: The TDSC-ABUS Challenge},
author={Gongning Luo and others},
year={2025},
eprint={2501.15588},
archivePrefix={arXiv},
primaryClass={eess.IV},
url={https://arxiv.org/abs/2501.15588},
}
License
Released under the MIT License.
Contributions are welcome — fork the repository, make your changes, and open a pull request.
Metadata
Release files for tdsc-abus2023-pytorch 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tdsc_abus2023_pytorch-0.2.0.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tdsc_abus2023_pytorch-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / tdsc_abus2023_pytorch-0.2.0.tar.gz
| Download URL | tdsc_abus2023_pytorch-0.2.0.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
402d07eb31b7bc31e5b4895afaeb80edcf907e70fd00e9d8a7c1b876e7da13d3
|
|
BLAKE2b-256 checksum How to use checksums |
6dce6d057df6b7f5e175f651aae520e707af34982c69d9f89d12e6232367005b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / tdsc_abus2023_pytorch-0.2.0-py3-none-any.whl
| Download URL | tdsc_abus2023_pytorch-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
892f049b12bba9a05af0bd6ebcfbeff8170c67463453f2c17ecfdbf64963859d
|
|
BLAKE2b-256 checksum How to use checksums |
5a181b8917b18a92f5444dbcebcb816dffa00f8d813df325c081d2ffb600ed32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log