Skip to content

Repository for the project on automatic spinal cord segmentation based on fMRI EPI data

License

Notifications You must be signed in to change notification settings

sct-pipeline/fmri-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatic Spinal Cord Segmentation on gradient-echo EPI Data

Repository for the project containing training information, model weights and inference instructions. The code is based on the nnUNetv2 framework. Dataset used for this project is open-sourced! Find it here on Openneuro.

To share data for the project, please read wiki here!

Link to latest segmentation model weights: here

Getting started

To run inference on your data, follow the below steps:

sct_deepseg -install-task seg_sc_epi
sct_deepseg -task seg_sc_epi -i <IMAGE_PATH> -c bold -o <OUTPUT_PATH>

To reproduce the model training:

Step 1: Cloning the Repository

Open a terminal and clone the repository using the following command:

git clone https://github.com/sct-pipeline/fmri-segmentation.git
cd fmri-segmentation

Step 2: Setting up the Environment & Analysis

The following commands show how to set up the environment. Note that the documentation assumes that the user has conda installed on their system. Instructions on installing conda can be found here.

  1. Create a conda environment with the following command:
conda create -n fmri_seg python=3.9
  1. Activate the environment with the following command:
conda activate fmri_seg
pip install -r scripts/run_nnunet_inference_requirements.txt
  1. Install nnUNetv2 from the nnUNetv2:
pip install nnunetv2
export nnUNet_raw="${HOME}/nnUNet_raw"
export nnUNet_preprocessed="${HOME}/nnUNet_preprocessed"
export nnUNet_results="${HOME}/nnUNet_results"
  1. Download the dataset from OpenNeuro

  2. Uzip the data and run the following to convert into nnUNetv2 dataset format:

cd scripts
python convert_bids_to_nnUNetV2.py --path-data <PATH_TO_DOWNLOADED_BIDS_DATASET> --path-out <PATH_TO_/nnUNet_raw> --split 0.8 0.2 --seed 42 --contrast bold --label-suffix seg-manual --data-type func --dataset-name <DATASET_NAME> --dataset-number <DATASET_ID> --copy True
  1. To train 3D model (as per nnUNetv2 documentation):
nnUNetv2_plan_and_preprocess -d <DATASET_ID> --verify_dataset_integrity
CUDA_VISIBLE_DEVICES=<GPU_ID> nnUNetv2_train <DATASET_ID> 3d_fullres <FOLD_NUMBER>

About

Repository for the project on automatic spinal cord segmentation based on fMRI EPI data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •