forked from BBillot/SynthSeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_synthseg.sh
executable file
·50 lines (43 loc) · 1.58 KB
/
run_synthseg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/bash
## ---------------------------
##
## PURPOSE
## This script runs the SynthSeg model on smri images of interest to segment ## them into regions
##
## AUTHOR(S)
## Margot Wagner (mwagner@ucsd.edu)
##
## DATE CREATED
## 2023-02-03
##
## TODO
## - Change batch and event entry to use CLI with flags and error checking (usage statement)
##
## ---------------------------
##
## Usage Notes:
## - Set DATA_DIR and OUTPUT_DIR paths as needed (must be same type)
##
## ---------------------------
# set number of threads to use (tako has 2336)
N_THREADS=500
BATCH_NO=0022
EVENT="baseline"
# set paths
DATA_DIR="/snl/abcd/raw-data/smri/$EVENT/batch-$BATCH_NO/"
OUTPUT_DIR="/cnl/abcd/data/imaging/smri/interim/synthseg/$EVENT/batch-$BATCH_NO/segmentations/"
SYNTHSEG_DIR="./commands/SynthSeg_predict.py"
VOL_PATH="/cnl/abcd/data/imaging/smri/interim/synthseg/$EVENT/batch-$BATCH_NO/volumes-$BATCH_NO.csv"
QC_PATH="/cnl/abcd/data/imaging/smri/interim/synthseg/$EVENT/batch-$BATCH_NO/qc-$BATCH_NO.csv"
PROBS_DIR="/cnl/abcd/data/imaging/smri/interim/synthseg/$EVENT/batch-$BATCH_NO/posteriors/"
#RESAMPLE_DIR="/cnl/abcd/data/imaging/smri/interim/synthseg/baseline/resampled/"
# activate python 3.8 environment
source "/home/mwagner/bin/anaconda3/etc/profile.d/conda.sh"
conda activate synthseg
# run synthseg on folder
# see https://github.com/BBillot/SynthSeg for additional flag options
cmd="python $SYNTHSEG_DIR --i $DATA_DIR --o $OUTPUT_DIR --parc --robust --vol $VOL_PATH --qc $QC_PATH --post $PROBS_DIR --threads $N_THREADS"
echo "$cmd"
$cmd
# deactivate environment
conda deactivate