Table of contents
CancerVision is an AI project that uses computer vision and deep learning to segment brain tumors from MRI scans. It identifies tumor regions such as the core, edema, and enhancing areas to support medical analysis and treatment planning. The aim is to build accurate models that reduce manual work and improve consistency in diagnosis.
- Git: Ensure that git is installed on your machine. Download Git
- Python 3.13: Required for the project. Download Python
- UV: Used for managing Python environments. Install UV
- Docker (optional): For DevContainer development. Download Docker
-
Clone the repository:
git clone https://github.com/CogitoNTNU/CancerVision cd CancerVision -
Install dependencies:
uv sync
-
Resources:
- Set up pre commit (only for development):
uv run pre-commit install
This project leverages several brain imaging datasets for model training and validation:
-
Juvekar, P., Dorent, R., Kögl, F., Torio, E., Barr, C., Rigolo, L., Galvin, C., Jowkar, N., Kazi, A., Haouchine, N., Cheema, H., Navab, N., Pieper, S., Wells, W. M., Bi, W. L., Golby, A., Frisken, S., & Kapur, T. (2023). The Brain Resection Multimodal Imaging Database (ReMIND) (Version 1) [dataset]. The Cancer Imaging Archive. https://doi.org/10.7937/3RAG-D070
-
Calabrese, E., Villanueva-Meyer, J., Rudie, J., Rauschecker, A., Baid, U., Bakas, S., Cha, S., Mongan, J., Hess, C. (2022). The University of California San Francisco Preoperative Diffuse Glioma MRI (UCSF-PDGM) (Version 5) [dataset]. The Cancer Imaging Archive. https://doi.org/10.7937/tcia.bdgf-8v37
-
Moreau, N. N., Leclercq, A. G., Desmonts, A., Poirier, Y., Dubru, A., Guillemette, L., Lecoeur, P., Lemasson, K., Jaudet, C., Brunaud, C., Valable, S., Geffrelot, J., Stefan, D., Leleu, T., Raboutet, C., Le Henaff, L., Batalla, A., Lacroix, J., Rouzier, R., & Corroyer-Dulmont, A. (2025). Pre and post treatment MRI and radiotherapy plans of patients with glioblastoma: the CFB-GBM cohort (CFB-GBM) (Version 2) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/V9PN-2F72
-
Gagnon, L., Gupta, D., Mastorakos, G., White, N., Goodwill, V., McDonald, C., Beaumont, T., Conlin, C., Seibert, T., Nguyen, U., Hattangadi-Gluth, J., Kesari, S., Schulte, J., Piccioni, D., Schmainda, K., Farid, N., Dale, A., Rudie, J. (2025). The University of California San Diego annotated post-treatment high-grade glioma multimodal MRI dataset (UCSD-PTGBM) (Version 3) [dataset]. The Cancer Imaging Archive. https://doi.org/10.7937/fwv2-dt74
-
Reddy, D., Saadat, N., Holcomb, J., Wagner, B., Truong, N., Bowerman, J., Hatanpaa, K., Patel, T., Pinho, M., Yu, F., Zhang, K., Lodhi, S., Madhuranthakam, A., Bangalore Yogananda, C. G., & Maldjian, J. (2026). The University of Texas Southwestern Glioma MRI dataset with molecular marker characterization and segmentations (UTSW-Glioma) (Version 1) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/DFAE-1B86
-
Chadha, S., Weiss, D., Janas, A., Ramakrishnan, D., Hager, T., Osenberg, K., Willms, K., Zhu, J., Chiang, V., Bakas, S., Maleki, N., Sritharan, D. V., Schoenherr, S., Westerhoff, M., Zawalich, M., Davis, M., Malhotra, A., Bousabarah, K., Deusch, C., Lin, M., Aneja, S., & Aboian, M. S. (2025). Yale longitudinal dataset of brain metastases on MRI with associated clinical data (Yale-Brain-Mets-Longitudinal) (Version 1) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/3YAT-E768
-
Bakas, S., Sako, C., Akbari, H., Bilello, M., Sotiras, A., Shukla, G., Rudie, J. D., Flores Santamaria, N., Fathi Kazerooni, A., Pati, S., Rathore, S., Mamourian, E., Ha, S. M., Parker, W., Doshi, J., Baid, U., Bergman, M., Binder, Z. A., Verma, R., … Davatzikos, C. (2021). Multi-parametric magnetic resonance imaging (mpMRI) scans for de novo Glioblastoma (GBM) patients from the University of Pennsylvania Health System (UPENN-GBM) (Version 2) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.709X-DN49
-
Shapey, J., Kujawa, A., Dorent, R., Wang, G., Bisdas, S., Dimitriadis, A., Grishchuck, D., Paddick, I., Kitchen, N., Bradford, R., Saeed, S., Ourselin, S., & Vercauteren, T. (2021). Segmentation of Vestibular Schwannoma from Magnetic Resonance Imaging: An Open Annotated Dataset and Baseline Algorithm (version 2) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.9YTJ-5Q73
Local CancerVision training from repo root:
uv run python -m src.training.train --experiment-id dynunet_brats_baselinePreview a resolved training setup without running it:
uv run python -m src.training.train --experiment-id dynunet_brats_baseline --dry-runRun single-case inference with the registry-backed CLI:
uv run python -m src.inference.inference \
--model-id dynunet_latest \
--case-dir /path/to/BraTS20_Training_001Run inference for all case folders in a directory:
uv run python -m src.inference.inference \
--model-id dynunet_latest \
--input-root /path/to/MICCAI_BraTS2020_TrainingData \
--output-root res/predictions/dynunet_latestDeployable model definitions live in res/models/model_registry.json.
Each entry maps a model id to architecture and checkpoint metadata so inference does not depend on hardcoded paths.
Serve a browser-based inference UI that accepts arbitrary model weights and the four BraTS MRI modalities via drag-and-drop:
uv run python -m src.web --host 127.0.0.1 --port 8080See docs/manuals/web-interface.md for details.
Classify predicted segmentations into case-level tumor categories:
uv run python -m src.classification.classify \
--classifier-id brats_rule_based_v1 \
--input-root res/predictions/dynunet_latestClassifier definitions live in res/classification/classifier_registry.json.
uv run python -m src.models.dynnet
--dataset-source cancervision_binary_seg
--task-manifest res/dataset/cancervision-standardized/task_manifests/segmentation_binary_curated.csv
Canonical SLURM launch:
```bash
sbatch --account=<account> --constraint=gpu40g scripts/train_dynnet.sbatch
# or
sbatch --account=<account> --constraint=gpu80g scripts/train_dynnet.sbatch
Trainer now uses one batch script and auto-detects GPU profile from Slurm constraints. Old split scripts like clean_slurm*.slurm and run_slurm.slurm are removed. To run raw BraTS folders instead of CancerVision manifests, submit with DATASET_SOURCE=brats and DATA_DIR=/path/to/brats/root.
If one manifest must work across local and cluster path layouts, remap prefixes at runtime:
uv run python -m src.models.dynnet \
--dataset-source cancervision_binary_seg \
--task-manifest res/dataset/cancervision-standardized/task_manifests/segmentation_binary_broad.csv \
--path-prefix-map 'Z:\dataset\cancervision-standardized=/cluster/home/eldarja/CancerVision/res/dataset/cancervision-standardized'To build and preview the documentation site locally:
uv run mkdocs build
uv run mkdocs serveThis will build the documentation and start a local server at http://127.0.0.1:8000/ where you can browse the docs and API reference. Get the documentation according to the lastes commit on main by viewing the gh-pages branch on GitHub: https://cogitontnu.github.io/PROJECT-TEMPLATE/.
To run the test suite, run the following command from the root directory of the project:
uv run pytest --doctest-modules --cov=src --cov-report=htmlThis project would not have been possible without the hard work and dedication of all of the contributors. Thank you for the time and effort you have put into making this project a reality.
Distributed under the MIT License. See LICENSE for more information.

