Skip to content

NKI-RT/DecideDocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DECIDE Docker

This repository contains scripts and configuration files to build and run a Docker container for image segmentation, post-editing, and (soon) anomaly detection as part of the DECIDE project.


πŸš€ Getting Started


NB: If you are using cloud computing and port forwarding, please refer to:
Cloud Compute Deployment (In ARGOS-1 directory for XNAT) for additional setup instructions.

1. Setup

  • Clone the repository to your machine:
    git clone https://github.com/NKI-RT/DecideDocker.git
  • Navigate into the directory:
    cd DecideDocker
  • Configure environment variables:
    • Edit the workspace/.env file (make sure hidden files are visible).
    • Or, rename default.env to .env.

2. Run the Container

Start the container using Docker Compose:

sudo docker compose up -d

πŸ”„ Note:
The container will perform runtime installations and builds via the startup.sh script. This may take a few minutes.


βœ… Access JupyterLab

  • URL:
    Open http://<your_ip_address>:8888 in your browser.
  • Login Token:
    Use the configured token (default: token123).

⏹ Stop the Container

To stop the container:

sudo docker compose down

πŸ•° Legacy Docker Compose (Standalone Tool)

For environments using the deprecated standalone docker-compose tool, use:

Start:

sudo docker-compose -f docker-compose-legacy.yml up -d

Stop:

sudo docker-compose -f docker-compose-legacy.yml down

☁️ Cloud Compute Deployment (In ARGOS-1 dir. for the XNAT)

If you're using cloud computing and your virtual machine's IP address is not public, follow these steps to deploy XNAT and Decide together using a shared proxy network.

πŸ“¦ Setup Instructions

  1. Stop the existing XNAT container (of ARGOS-1):

    # in ARGOS-1
    cd xnat-docker-compose
    # stop the XNAT
    sudo docker compose down
  2. Download this repository into the same directory.:

    git clone https://github.com/NKI-RT/DecideDocker.git
  3. Copy the cloud compute Docker Compose file:

    cp DecideDocker/docker-compose-cloudcompute.yml ./
  4. Run the integrated deployment:

    sudo docker compose -f docker-compose-cloudcompute.yml up -d
  5. To stop the deployment:

    sudo docker compose -f docker-compose-cloudcompute.yml down

Congratulations! You can now access your XNAT at: http://xnat-nginx:80


πŸ”— Notes

  • This setup runs XNAT, Decide, and NGINX in a shared proxynet Docker network.
  • The container will expose:
    • JupyterLab (Decide) on port 8888
    • XNAT NGINX proxy on port 80

πŸ”„ Staying Up to Date (Force Sync with Upstream)

To update your local copy with the latest changes from the original repository and discard any local changes:

  1. Add the original repo as a remote (if not already):

    git remote add upstream https://github.com/NKI-RT/DecideDocker.git
  2. Fetch the latest changes from upstream:

    git fetch upstream
  3. Reset your local main branch to match upstream/main:

    git checkout main
    git reset --hard upstream/main
  4. (Optional) Clean up untracked files and directories:

    git clean -fd

⚠️ Warning: This will permanently discard all local changes, including uncommitted edits and untracked files.


πŸ“’ Updates

We will release more features and scripts/notebooks as the project progresses.
Stay tuned and keep your local copy up to date!


πŸ“ Repository Structure

DecideDocker/
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ docker-compose-legacy.yml
β”œβ”€β”€ docker-compose-cloudcompute.yml
β”œβ”€β”€ startup.sh
β”œβ”€β”€ workspace/
β”‚   β”œβ”€β”€ .env (default.env)
β”‚   β”œβ”€β”€ decide/
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   β”œβ”€β”€ config_total_segmentator.yaml
β”‚   β”‚   β”‚   └── dicomdata_config.yaml
β”‚   β”‚   β”œβ”€β”€ logs/
β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   |   └── LUNG1-001/
β”‚   β”‚   |       β”œβ”€β”€ CT
β”‚   β”‚   |       β”œβ”€β”€ RTSTRUCT
β”‚   β”‚   |       └── NIfTI
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   └── decide/
β”‚   β”‚   └── pyproject.toml
β”‚   β”œβ”€β”€ notebooks/
β”‚   β”‚   β”œβ”€β”€ 001_test_essentials.ipynb
β”‚   β”‚   β”œβ”€β”€ 002_get_nifti.ipynb
β”‚   |   └── 002_get_niftiv2.ipynb
β”‚   └── scripts/
β”‚       └── get_nifti.py
└── nnUNet/

πŸ›  Dockerfile Overview

The Dockerfile uses a multi-stage build:

Stage 1: JupyterLab Setup

  • Base: ubuntu:22.04
  • Installs latest JupyterLab and extensions

Stage 2: DECIDE Environment

  • Base: TotalSegmentator image
  • Adds JupyterLab from Stage 1
  • Installs:
    • Plastimatch
    • PyRadiomics
    • nnUNet patch for Plastimatch
    • DECIDE tools (including XNAT Python API)
  • Resolves dependency issues
  • Launches JupyterLab on port 8888

βš™οΈ docker-compose.yml

Defines container behavior:

  • Uses host IPC (required for nnUNet models)
  • Enables GPU support
  • Mounts workspace/ directory for live sync between host and container

πŸ“œ startup.sh

The startup.sh script is executed when the container starts. It performs the following tasks:

  • Builds and installs Plastimatch from source
  • Installs required Python packages (e.g., PyRadiomics, Platipy)
  • Applies a patch to nnUNet for compatibility
  • Installs DECIDE tools if present in /workspace/decide
  • Fixes specific package versions (e.g., numpy, pydicom)
  • Registers the Jupyter kernel
  • Configures and launches JupyterLab on port 8888

πŸ” .env File

Stores environment variables:

JUPYTER_TOKEN=token123

πŸ“¦ Workspace

  • Mounted inside the container
  • Contains all scripts, notebooks, and configurations
  • src/ includes Python packages for segmentation, post-editing, etc.

🧠 nnUNet Compatibility Fixes

Common Errors

When installed platipy platipy[nnunet] or platipy[cardiac] and deployed, encountered the error:

UnpicklingError: Weights only load failed...

Cause

PyTorch 2.6 changed the default weights_only argument in torch.load to True.

Fix

  1. Use nnUNet version 1.7.0:

    git clone https://github.com/MIC-DKFZ/nnUNet.git
    cd nnUNet
    git checkout tags/v1.7.0 -b nnunet-1.7.0
  2. Patch model_restore.py:

    from torch.serialization import safe_globals
    import numpy
    
    with safe_globals([numpy.dtype]):
        all_params = [torch.load(i, map_location=torch.device('cpu'), weights_only=False) for i in all_best_model_files]

🧱 Architecture Comparison

ARGOS-1

  • Single Docker Compose managing XNAT, JupyterLab, and tools

  • Adding new containers required editing XNAT's Docker Compose

    ARGOS Architecture


DECIDE

  • Separation of data containers and tool containers

  • No modification needed to data containers when adding/removing tools

    DECIDE Architecture

Test Data Attribution

This repository includes data derived from the NSCLC-Radiomics dataset available via the Imaging Data Commons (IDC).

Original dataset citation: The Cancer Imaging Archive. https://www.cancerimagingarchive.net/collection/nsclc-radiomics/

License: CC BY-NC 3.0 β€” Non-commercial use only.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published