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!
sct_deepseg -install-task seg_sc_epi
sct_deepseg -task seg_sc_epi -i <IMAGE_PATH> -c bold -o <OUTPUT_PATH>
Open a terminal and clone the repository using the following command:
git clone https://github.com/sct-pipeline/fmri-segmentation.git
cd fmri-segmentation
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.
Create a conda environment with the following command:
conda create -n fmri_seg python=3.9
Activate the environment with the following command:
conda activate fmri_seg
pip install -r scripts/run_nnunet_inference_requirements.txt
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"
Download the dataset from OpenNeuro
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
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>