Skip to content

Bash script to batch process structural MRI (sMRI) brain scans using FastSurfer's segmentation pipeline

License

Notifications You must be signed in to change notification settings

mahirsowad3/FastSurfer-sMRI-preprocessing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FastSurfer-sMRI-preprocessing

Bash script to batch process structural MRI (sMRI) brain scans using FastSurfer's segmentation pipeline


Setting up FastSurfer

FastSurfer can be installed using several different ways, but the following script was primarily developed, tested, and run using FastSurfer on Docker on WSL 2 on a Windows 10 host machine. However, this script will also work with FastSurfer on Docker on a native Linux installation as well. The script was developed, tested, and run on a machine with the following specifications:

Operating System (OS) Processor (CPU) RAM Graphics Card (GPU) Storage
Windows 10 Intel Core i9-8950 HK @ 2.90 GHz 16.0 GB NVIDIA GeForce GTX 1070 (8 GB) 500 GB SSD + 1.82 TB HDD


Steps to run the run_fastsurfer_custom_sample.sh bash script from an installation from Docker:

  1. Install Docker for the respective host Operating System that you are running on by following the instructions on the Docker website.

  2. Run the following command in an Ubuntu terminal: docker pull deepmi/fastsurfer:gpu-latest. Make sure that the Docker engine is first running, otherwise the command may not work. Refer to DockerDocs to help debug any Operating System-specific issues. This command will pull the latest Docker image of FastSurfer with GPU support. If running on CPU, utilize the following command: docker pull deepmi/fastsurfer:latest.

  3. Download the ADNI dataset and place all of the images inside of a folder called ExtractedAll.

  4. List the absolute file paths of all the images that you would like to run through the pipeline within the images_paths.txt file with the file path of each image on a separate line. Since this script was run on ADNI T1-weighted sMRI images, this script handles the images best in the folder/file structure that ADNI organized them with all of the DICOM slices for one image in a directory named with the image ID.

    • Note: This script assumes that the paths in the images_paths.txt file are all in the Windows-style path format. The script will convert these Windows-style paths to Unix-style ones as one of the first steps. In order to run this on Unix-style paths, there are two options: either convert all of the paths to Windows-style paths with the wslpath -w <path-to-folder-with-dcm-files> command or change line 24 of the script.
  5. Run the following command to run the script: ./run_fastsurfer_custom_sample.sh

  6. The output is stored in a folder called ExtractedAllOutput which is created at the same directory level as ExtractedAll.

About

Bash script to batch process structural MRI (sMRI) brain scans using FastSurfer's segmentation pipeline

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages