Skip to content

Commit e3f3768

Browse files
authored
Merge pull request #44 from ivadomed/jv/segment_sc_using_contrast_agnostic_model
Segment SC using contrast agnostic model
2 parents 503a6f3 + 266ed3f commit e3f3768

File tree

4 files changed

+682
-0
lines changed

4 files changed

+682
-0
lines changed
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Segment SC using contrast-agnostic MONAI model from PSIR contrast and perform vertebral labeling
2+
3+
1. Create a conda virtual environment and install dependencies
4+
5+
```console
6+
yes | conda create -n monai python=3.9
7+
conda activate monai
8+
yes | pip install -r segment_sc_contrast-agnostic/requirements.txt
9+
```
10+
11+
2. Segment SC using the contrast-agnostic MONAI model from PSIR contrast and perform vertebral labeling
12+
13+
The `sct_run_batch` wrapper script is used to run the `segment_sc_contrast-agnostic/segment_sc_contrast-agnostic.sh` across multiple subjects in parallel.
14+
15+
```console
16+
sct_run_batch -config config.json
17+
```
18+
19+
Example `config.json` file:
20+
21+
```json
22+
{
23+
"path_data" : "<PATH_TO_DATASET>/canproco",
24+
"path_output" : "<PATH_TO_DATASET>canproco_contrast-agnostic_2023-10-06",
25+
"script" : "${HOME}/code/canproco/segment_sc_contrast-agnostic/segment_sc_contrast-agnostic.sh",
26+
"jobs" : 1,
27+
"include" : "ses-M0",
28+
"exclude_list": "sub-mon118 sub-mon006 sub-mon009 sub-mon032 sub-mon097 sub-mon148 sub-mon168 sub-mon191 sub-van176 sub-van206 sub-tor133 sub-cal149",
29+
"script_args" : "${HOME}/code/canproco/segment_sc_contrast-agnostic/run_inference_single_image.py ${HOME}/data/models/contrast-agnostic_final_monai_model/nnunet_nf=32_DS=1_opt=adam_lr=0.001_AdapW_CCrop_bs=2_64x192x320_20230918-2253"
30+
}
31+
```
32+
33+
ℹ️ The `exclude_list` is a list of subjects to exclude from the batch processing. It is based on the https://github.com/ivadomed/canproco/blob/main/exclude.yml file.
34+
35+
ℹ️ The conda environment with MONAI is required to run the `segment_sc_contrast-agnostic/segment_sc_contrast-agnostic.sh` script.
36+
37+
ℹ️ Note that the `segment_sc_contrast-agnostic/run_inference_single_image.py` script is just a copy of the
38+
[`contrast-agnostic-softseg-spinalcord/monai/run_inference_single_image.py`](https://github.com/sct-pipeline/contrast-agnostic-softseg-spinalcord/blob/nk/monai/monai/run_inference_single_image.py) script.
39+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dynamic_network_architectures==0.2
2+
joblib==1.3.0
3+
loguru==0.7.0
4+
monai[nibabel]==1.2.0
5+
scipy==1.11.2
6+
numpy==1.24.4
7+
--extra-index-url https://download.pytorch.org/whl/cpu
8+
torch==2.0.0

0 commit comments

Comments
 (0)