How to Run FastSurfer on Windows with Docker



NVIDIA Graphics Driver, WSL2 and Docker for Windows Desktop must be installed to follow.

Download Test NIfTI File

I mounted C:\nsimg\fastsurfer\data on the docker container /data.

The file will be located in /data/SubjectX in the docker container.
curl -L https://github.com/neurolabusc/niivue-images/raw/main/chris_t1.nii.gz > C:\nsimg\fastsurfer\data\subjectX\chris_t1.nii.gz


Run FastSurfer Docker container with GPU

Instead of Linux user ID and group, you can enter numbers respectively. See this page for the rest of commands.

I arbitrarily set it from --user$(id-u):$(id-g) to ---user 1000:1000 for running on Windows.

docker run --gpus all  
           -v C:\nsimg\fastsurfer\data:/data
           -v C:\nsimg\fastsurfer\output:/output
           -v C:\nsimg\fastsurfer\license:/fs_license
           --rm --user 1000:1000 deepmi/fastsurfer:latest 
           --fs_license /fs_license/license.txt 
           --t1 /data/subjectX/chris_t1.nii.gz 
           --sid subjectX --sd /output 

One line command for GPU

# Using GPU
docker run --gpus all -v C:\nsimg\fastsurfer\data:/data -v C:\nsimg\fastsurfer\output:/output --rm --user 1000:1000 deepmi/fastsurfer:latest --fs_license /fs_license/license.txt --t1 /data/subjectX/chris_t1.nii.gz --sid subjectX --sd /output


Run FastSurfer Docker container with CPU

This is quite slow. But it seems to be faster than FreeSurfer.

If you run it without --gpu, container will run on the CPU.
 
docker run -v C:\nsimg\fastsurfer\data:/data
           -v C:\nsimg\fastsurfer\output:/output
           -v C:\nsimg\fastsurfer\license:/fs_license
           --rm --user 1000:1000 deepmi/fastsurfer:latest
           --fs_license /fs_license/license.txt 
           --t1 /data/subjectX/chris_t1.nii.gz 
           --sid subjectX --sd /output 

One line command for CPU

# Using CPU
docker run -v C:\nsimg\fastsurfer\data:/data -v C:\nsimg\fastsurfer\output:/output --rm --user 1000:1000 deepmi/fastsurfer:latest --fs_license /fs_license/license.txt --t1 /data/subjectX/chris_t1.nii.gz --sid subjectX --sd /output


Reference

댓글