Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.81 KB

README.md

File metadata and controls

77 lines (53 loc) · 2.81 KB

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>