lungct-kit

Load public lung CT nodule datasets in one line, with correct coordinates, standard preprocessing, and train/test splits that never put the same patient on both sides.

Why

No patient leakage

LUNA25 labels are effectively patient-level. Row-level splits inflate AUC; group_kfold splits by patient.

Correct coordinates

World mm (x, y, z) to voxel [z, y, x], including direction cosines. Tested against SimpleITK.

Standard preprocessing

Isotropic resampling, lung window, and nodule patches that pad with air at scan edges.

Works with PyTorch

A plain map-style dataset: pass it straight to DataLoader. Core needs only NumPy and SciPy.

Install

pip install "lungct-kit[io] @ git+https://github.com/reshamrajs/lungct-kit"

Quick start

from lungct_kit import load, group_kfold, check_no_leakage

ds = load("luna25",
          annotations="LUNA25_Public_Training_Development_Data.csv",
          images="luna25_images/",
          patch_size=64, spacing=1.0)

ds[0]["image"].shape      # (1, 64, 64, 64), float32 in [0, 1]

for train_idx, test_idx in group_kfold(ds.groups, ds.labels, n_folds=5):
    check_no_leakage(ds.groups, train_idx, test_idx)
    train, test = ds.subset(train_idx), ds.subset(test_idx)

Command line

lungct list
lungct info luna25
lungct check luna25 --annotations a.csv --images imgs/
lungct split luna25 --annotations a.csv --folds 5 --out splits.json
lungct export luna25 --annotations a.csv --images imgs/ --patch 64 --out patches.npz

Datasets

DatasetLoaderSizeLicence
LUNA16Ready888 scans, 1,186 nodulesCC BY 4.0
LUNA25Ready2,120 patients, 6,163 annotationsCC BY 4.0
LIDC-IDRIPlanned1,018 scans, 4-reader ratingsCC BY 3.0