CT Brain Extraction

The CT Brain Extraction tool (CTbet) is a powerful utility designed to efficiently extract brain regions from CT images using a Docker container.

Prerequisites

Before using CTbet, ensure the following:

Important: If you want to run the inference using CUDA, please use NVIDIA driver 560 or higher and CUDA 12.6 or higher.

Installation

To install CTbet, pull the Docker image from the repository:

docker pull avnirlab/ctbet:<version>

Usage

To run the inference, run the following command:

docker run -ti -v /path/to/your/data:/input -v /path/to/your/output:/output \
-u 0:$(id -g) --gpus all --rm --shm-size 2g avnirlab/ctbet:<version> -device cuda
  • Replace /path/to/your/data with the directory containing your input CT images.

  • Replace /path/to/your/output with the directory where you want the output files to be saved.

  • Use the -device cuda flag for GPU-based inference. For CPU-based inference, replace cuda with cpu and remove --gpus all flag.

  • Replace <version> with the version of ctbet you want to use.

Example Workflow

Here’s a step-by-step example to demonstrate CTbet usage:

  1. Prepare directories:

    mkdir output_directory
    ls input_data/
    > image1.nii.gz  image2.nii.gz
    
  2. Run CTbet:

    docker run -ti -v $(pwd)/input_data:/input -v $(pwd)/output_directory:/output \
    -u 0:$(id -g) --gpus all --rm --shm-size 2g avnirlab/ctbet:latest -device cuda
    
  3. Check the output:

    ls output_directory/results
    > image1.nii.gz image2.nii.gz dataset.json plans.json predict_from_raw_data_args.json
    

    In the output_directory, the Nifti images are the predicted brain extraction masks.

Additional Resources