Skip to content

A General Rodent MRI Skull-Stripping Tool Based on Multi-Center Data

License

Notifications You must be signed in to change notification settings

VitoLin21/Rodent-Skull-Stripping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Model Overview

This repository contains the RSS-Net framework for the task of rodent MRI skull stripping

Installing Dependencies

Our framework is developed based on Python 3.9, PyTorch 2.0.0, MONAI, and nnUNet.

Dependencies can be installed using:

conda create -n rss python=3.9

conda activate rss

# CUDA 11.7
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia
# CUDA 11.8
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia
# CPU Only
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 cpuonly -c pytorch

pip install -r requirements.txt

python setup.py install

Model

Our network architecture is illustrated in the following diagram:

Network Architecture

Data Description

We trained the model using MRI data from rodent brains collected from 89 centers. You can download the pre-trained model files and the annotated brain masks Google Drive or MEGA.

You can find the download links for these datasets in our article (in submission)

Dataset MultiRat StdRat C Rat TRat C Mouse NeAt
Participant 646 209 132 24 16 10
Image 751 209 132 24 16 10
Sex Male 505 116 132 16 10
Female 141 93 24
Strain Wistar 256 189 16 24
SD 220 94
LE 80 10 22
F344 60 10
LH 30
WTC 16
IC 10
Age(months) 0-2 164 88
2-4 308 57 12-14 weeks
4-6 16 2
6-12 22 2
12-20 28
- 108 60 adult adult adult
Weight(grams) 100-200 71 20
200-250 78 71
250-300 97 56
300-350 173 40
350-400 81 13
400-700 94 9
- 52 132 16 25-30 grams
Vendor Bruker 568 180 132 24 16 10
MS 10
SD 68
A/B 10
Varian 10
Clinscan 9
Field Strength(T) 3 10
4.7 40 10
7 309 79
9.4 229 100 132 24 16 10
11.7 30
14 10
14.1 28
17.2 10

Usage

After the installation is complete, you can use the following command to run the framework:

 RS2_predict -i 'path/to/input' -o 'path/to/output' -m 'path/to/pretrained_model.pt'

We recommend using absolute paths to avoid unnecessary problem.

To meet the required naming format, ensure that your input files are organized as follows:

|input_folder_path
|---- <file-name1>_0000.nii.gz
|---- <file-name2>_0000.nii.gz

Additional Reminders

  1. In December 2024, the library "acvl_utils" was updated (version 0.2.2), which led to errors when used with Python 3.9(this issue). Please install an earlier version of "acvl_utils", such as version 0.2.1.
  2. If you encounter the following problem when using it: FileNotFoundError: [Errno 2] No such file or directory: 'your_conda_path/envs/rss/lib/python3.9/site-packages/RS2-1.0-py3.9.egg/RS2/jsons/dataset.json' Please copy all the files from "Rodent-Skull-Stripping/RS2/jsons" to "your_conda_path/envs/rss/lib/python3.9/site-packages/RS2-1.0-py3.9.egg/RS2/jsons". This should solve the problem.

Comand Parameters

Here are the parameters for the RS2_predict script in Markdown format:

  • -i: Input folder. Ensure that the files are in the .nii.gz format and end with _0000.nii.gz.

  • -o: Output folder. If it does not exist, it will be created. Predicted segmentations will have the same name as their source images.

  • -m: Path of the pretrained model you want to use. Default: RS2_pretrained_model.pt.

  • -device: Use this to set the device the inference should run with. Available options are 'cuda' (GPU), 'cpu' (CPU), and 'mps' (Apple M1/M2). Do NOT use this to set which GPU ID! Use CUDA_VISIBLE_DEVICES=X RS2_predict [...] instead.

  • -step_size: Step size for sliding window prediction. The larger it is, the faster but less accurate the prediction. Default: 0.5. Cannot be larger than 1. We recommend the default.

  • --disable_tta: Set this flag to disable test time data augmentation in the form of mirroring. Faster, but less accurate inference. Not recommended.

  • --verbose: Set this if you like being talked to. You will have to be a good listener/reader.

  • --save_probabilities: Set this to export predicted class "probabilities". Required if you want to ensemble multiple configurations.

  • --continue_prediction: Continue an aborted previous prediction (will not overwrite existing files).

  • -npp: Number of processes used for preprocessing. More is not always better. Beware of out-of-RAM issues. Default: 3.

  • -nps: Number of processes used for segmentation export. More is not always better. Beware of out-of-RAM issues. Default: 3.

Citation

If you find this repository useful, please consider citing our paper:

@article{lin2024rs2,
  title={RS2-Net: An end-to-end deep learning framework for rodent skull stripping in multi-center brain MRI},
  author={Lin, Yongkang and Ding, Yanhui and Chang, Shulei and Ge, Xinting and Sui, Xiaodan and Jiang, Yanyun},
  journal={NeuroImage},
  volume={298},
  pages={120769},
  year={2024},
  publisher={Elsevier}
}

About

A General Rodent MRI Skull-Stripping Tool Based on Multi-Center Data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages