Skip to main content

A toolbox for analysing neuro-oncology MRI

Project description

oncoprep

Documentation License: GPL3.0 Python 3.10+

A toolbox for preprocessing and analyzing neuro-oncology MRI using standardized, reproducible pipelines. The toolbox is centered on Nipype workflows, with fMRIprep-style preprocessing, automated tumor segmentation, and radiomics, plus utilities for DICOM→BIDS conversion, BIDS Apps execution, and report generation.

Scope

In-scope

  • DICOM→BIDS conversion (heuristic + mapping workflows) with correct sidecars/headers
  • BIDS App runner for preprocessing and tumor segmentation (BIDS Derivatives outputs)
  • fMRIPrep-style HTML reports
  • Multi-site robustness features (sequence missingness, vendor variability, optional defacing)

Out-of-scope (initially)

  • Regulatory/clinical certification (THIS IS NOT A CLINICAL TOOL!)
  • PACS/REST integration (can be a later adapter)
  • Non-MRI modalities unless explicitly added later (PET, perfusion, etc.)

Architecture

OncoPrep is structured as a three-layer Nipype workflow system following nipreps conventions (fMRIPrep, sMRIPrep):

┌─────────────────────────────────────────────────────────────────────┐
│                          CLI / BIDS App                             │
│           oncoprep <bids_dir> <out_dir> participant|group           │
└──────────────────────────────┬──────────────────────────────────────┘
                               │
          ┌────────────────────┴───────────────────┐
          │                                        │
          ▼                                        ▼
┌─────────────────────────────────────┐  ┌─────────────────────────┐
│      Participant-Level Stage        │  │   Group-Level Stage     │
│    init_oncoprep_wf()  (base.py)    │  │  run_group_analysis()   │
│  per-subject/session processing     │  │    (group.py)           │
└──┬────────┬──────────┬──────────┬───┘  │                         │
   │        │          │          │      │ •Collect radiomics      │
   ▼        ▼          ▼          ▼      │  JSONs across cohort    │
┌──────┐┌──────┐┌──────────┐┌────────┐   │ •ComBat harmonization   │
│Anat. ││Segm. ││ Fusion   ││Radiom. │   │  (neuroCombat)          │
│ WF   ││ WF   ││   WF     ││  WF    │   │ •Longitudinal auto-     │
│      ││      ││          ││        │   │  detect & handling      │
│•reg  ││•Dock.││•MAV      ││•Hist   │   │ •Age/sex covariates     │
│•skull││ mod. ││•SIMPLE   ││ norm   │   │ •HTML report            │
│ strip││•nnIn.││•BraTS    ││•SUSAN  │   └────────────┬────────────┘
│•def. ││ act. ││ fusion   ││•PyRad  │                │
│•temp.││ ens. ││          ││ feat.  │                │
└──┬───┘└──┬───┘└────┬─────┘└───┬────┘                │
   │       │         │          │                     │
   └───────┴─────────┴──────────┘                     │
                      │                               │
┌─────────────────────▼───────────────────────────────▼───────────────┐
│                        Outputs Layer                                │
│              DerivativesDataSink → BIDS Derivatives                 │
│   sub-XXX/anat/  •NIfTI  •JSON  •TSV  •HTML reports  •ComBat JSON   │
└─────────────────────────────────────────────────────────────────────┘

Data flow

Participant stage (per-subject):
  BIDS input ─► Anatomical WF ─► registered T1w/T1ce/T2w/FLAIR (native space)
                   │
                   ├──► Segmentation WF ─► tumor labels (native space)
                   │         │
                   │         ├──► Fusion WF ─► consensus segmentation
                   │         │
                   │         └──► Radiomics WF ─► features JSON + report
                   │                  (native-space mask, histogram norm + SUSAN)
                   │
                   ├──► Deferred Template Registration
                   │         (ANTs SyN with dilated tumor mask as -x exclusion)
                   │         │
                   │         └──► Resample tumor seg to template space
                   │                  │
                   │                  └──► VASARI WF ─► features + radiology report
                   │
                   └──► DerivativesDataSink ─► BIDS-compliant derivatives/

Group stage (cohort-wide, after all participants):
  BIDS sidecars ─► generate batch CSV (scanner metadata + age/sex)
       │
       └──► Collect all radiomics JSONs ─► ComBat harmonization ─► harmonized JSONs
                                              │
                                              └──► group_combat_report.html

Features

Feature Description
BIDS-native Full BIDS and BIDS Derivatives compliance for inputs, outputs, and file naming (via PyBIDS + niworkflows DerivativesDataSink).
Nipype workflows Composable Nipype workflow graphs — parallel execution, HPC plugin support (SGE, PBS, SLURM), provenance tracking, and crash recovery.
Container-based segmentation 14 BraTS-challenge Docker models in isolated containers; supports Docker and Singularity/Apptainer runtimes with GPU passthrough.
nnInteractive segmentation Zero-shot 3D promptable segmentation (Isensee et al., 2025) — no Docker needed, CPU or GPU, ~400 MB model weights from HuggingFace.
Ensemble fusion Three fusion algorithms (majority vote, SIMPLE, BraTS-specific) combine predictions from multiple models for robust consensus labels.
IBSI-compliant radiomics Intensity normalization (z-score, Nyul, WhiteStripe), SUSAN denoising, and PyRadiomics feature extraction; reproducible across scanners and sites.
ComBat harmonization Group-level ComBat batch-effect correction (neuroCombat) removes scanner/site effects from radiomics features while preserving biological covariates (age, sex). Auto-generates batch labels from BIDS sidecars. Supports longitudinal multi-session data with automatic detection.
Multi-modal support Joint processing of T1w, T1ce, T2w, and FLAIR with automatic handling of missing modalities.
fMRIPrep-style reports Per-subject HTML reports with registration overlays, tumor ROI contour plots, radiomics summary tables, and methods boilerplate.
HPC-ready Singularity/Apptainer support with pre-downloadable model caches; PBS/SLURM job script patterns included.
Portable & reproducible Docker image with all neuroimaging dependencies (ANTs, FSL, FreeSurfer, dcm2niix) pinned; deterministic workflow hashing for cache reuse.

Installation

pip install oncoprep

Optional extras:

pip install "oncoprep[radiomics]"   # PyRadiomics feature extraction
pip install "oncoprep[dev]"         # development (pytest, ruff)

Docker:

docker pull nko11/oncoprep:latest

Quick start

Convert DICOMs to BIDS:

oncoprep-convert /path/to/dicoms /path/to/bids --subject 001

Run preprocessing:

oncoprep /path/to/bids /path/to/derivatives participant \
  --participant-label 001

Run with segmentation (nnInteractive, no Docker needed):

oncoprep /path/to/bids /path/to/derivatives participant \
  --participant-label 001 --run-segmentation --default-seg

Run with radiomics:

oncoprep /path/to/bids /path/to/derivatives participant \
  --participant-label 001 --run-radiomics --default-seg

Run group-level ComBat harmonization (after participant-level radiomics):

oncoprep /path/to/bids /path/to/derivatives group \
  --generate-combat-batch

Generate reports from existing outputs:

oncoprep /path/to/bids /path/to/derivatives participant \
  --participant-label 001 --reports-only

Documentation

Full documentation — including tutorials, CLI reference, Docker/HPC usage, segmentation details, radiomics configuration, and Python API — is available at:

https://oncoprep.readthedocs.io/en/latest

Development

git clone https://github.com/nikitas-k/oncoprep.git
cd oncoprep
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oncoprep-0.2.4.tar.gz (15.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oncoprep-0.2.4-py3-none-any.whl (15.4 MB view details)

Uploaded Python 3

File details

Details for the file oncoprep-0.2.4.tar.gz.

File metadata

  • Download URL: oncoprep-0.2.4.tar.gz
  • Upload date:
  • Size: 15.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for oncoprep-0.2.4.tar.gz
Algorithm Hash digest
SHA256 fa0dd3c30470362c9ef6e8e144c7481c91dfe5d1f6ff843564979a1d4ab204a1
MD5 9c31e46dbb61fdf90520097d63c3005d
BLAKE2b-256 d7be272bbf32778c32fa03d4af3bde777a59cd98f5452f72a71edc13d58e77d1

See more details on using hashes here.

File details

Details for the file oncoprep-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: oncoprep-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 15.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for oncoprep-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 088e3c438efea288667f6ea9548e0ee0d6415291b684fe7a4c9edf846b94b0fc
MD5 82e3dce06af06345d029993c971dee38
BLAKE2b-256 3291a8e9e5a2f3bcf26d34b32480a9869d267001336e38d3a7bd04a567e8a485

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page