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:
Docker is installed on your system. Refer to the Docker Installation Guide or the official Docker documentation for setup instructions.
Your system meets the hardware requirements for running Docker containers, especially if you plan to use GPU acceleration.
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/datawith the directory containing your input CT images.Replace
/path/to/your/outputwith the directory where you want the output files to be saved.Use the
-device cudaflag for GPU-based inference. For CPU-based inference, replacecudawithcpuand remove--gpus allflag.Replace
<version>with the version of ctbet you want to use.
Example Workflow¶
Here’s a step-by-step example to demonstrate CTbet usage:
Prepare directories:
mkdir output_directory ls input_data/ > image1.nii.gz image2.nii.gz
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
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¶
Dockerhub: Dockerhub
GitHub Repository: CTbet-Docker
Docker Documentation: Get Started with Docker