/aide-svrtk

SVRTK packaged as a MONAI Application Package (MAP), including for deployment on AIDE

Primary LanguageShell


aide-svrtk

AI-driven, automated SVR reconstruction packaged as an AIDE Application, based on the open-source MONAI Application Package (MAP) standard.

View repo · Report Bug · Request Feature

Overview

The slice-to-volume reconstruction toolkit (SVRTK) is an image-based registration framework for reconstruction of 3D volumes from multiple 2D image slices. SVRTK is used extensively for performing motion-corrected reconstruction of MRI data.

Currently, this MAP implements SVRTK for reconstruction of 2D fetal brain MRI data into motion-corrected 3D volumes. Further MAPs for reconstruction of other fetal organs are in development and coming soon.

AIDE is an open-source platform for the deployment of AI applications in healthcare settings. This repo, created and led by Tom Roberts, packages automated 3D fetal brain MRI reconstruction into a MONAI Application Package (MAP) for execution on AIDE, and other platforms compatible with the MAP standard.

aide-svrtk MAP workflow

The input to the aide-svrtk MAP is multiple 2D DICOM Series, each containing multi-slice 2D MRI data. The output is a 3D MRI DICOM Series contained the motion-corrected reconstruction.

The aide-svrtk MAP consists of three operators:

  1. dcm2nii_operator.py – converts the input 2D MRI DICOM Series into NIfTI format required by SVRTK, using dcm2niix
  2. fetal_mri_3d_brain_recon_operator.py – runs automated fetal brain SVRTK reconstruction, in three main steps: a. AI-driven brain masking b. Slice-to-volume registration reconstruction c. AI-driven brain reorientation
  3. nii2dcm_operator.py – converts the SVRTK output NIfTI into a 3D DICOM Series, using nii2dcm

Developers

Prerequisites

  • GPU-enabled machine
  • Docker
    • Required for running the MAP

Setup

  1. Download
git clone https://github.com/SVRTK/aide-svrtk.git
  1. Setup virtual env
cd aide-svrtk

python -m venv venv
source venv/bin/activate

pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
  1. Create input and output directories
mkdir input output

Run MAP source code with MONAI Deploy

  1. Ensure Python venv running
  2. Copy DICOM Series files to input/ directory
    • Standard or Enhanced DICOMs
# input - 2D multi-stack DICOM Series files
# output – 3D SVRTK-reconstructed DICOM Series
monai-deploy exec app -i input/ -o -output/

Build and run as MONAI Application Package (MAP)

  1. Ensure Python venv running
  2. Ensure Docker running
  3. Copy DICOM Series files within input/ directory

Important: we create an initial MAP map-init upon which we build any 3rd-party non-Python software (e.g. dcm2niix). The final MAP is called map

# Initial packaging of MAP
monai-deploy package app -t ghcr.io/svrtk/aide-svrtk/map-init:0.2.0 -r requirements.txt -l DEBUG

# Build 3rd-party software on top of MAP
docker build -t ghcr.io/svrtk/aide-svrtk/map:0.2.0 app/

# Test MAP with MONAI Deploy
monai-deploy run ghcr.io/svrtk/aide-svrtk/map:0.2.0 input/ output/

# Push initial MAP and final MAP to GHCR
docker push ghcr.io/svrtk/aide-svrtk/map-init:0.2.0
docker push ghcr.io/svrtk/aide-svrtk/map:0.2.0

Optional

Enter Docker container for testing

docker run --gpus all -it --rm -v local/path/to/aide-svrtk/input:/var/monai/input/ --entrypoint /bin/bash ghcr.io/svrtk/aide-svrtk/map:0.2.0

Run on specified GPU if machine has >1 available

CUDA_VISIBLE_DEVICES=2 monai-deploy run ghcr.io/svrtk/aide-svrtk/map:0.2.0 input/ output/

Running on AIDE

To run aide-svrtk MAP on AIDE, two files from the app/workflows directory are required, namely:

  • fetal-3d-brain-mri.json – AIDE Clinical Workflow file.
    • Effectively a sequence of tasks run on AIDE
  • fetal-brain-3d-recon-argo-template.yaml – Argo Workflow Template file.
    • Called by the AIDE Clinical Workflow file. Executes the aide-svrtk MAP using Argo. This is the central task within the AIDE Clinical Workflow file.