-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathscil_score_ismrm_Renauld2023.sh
More file actions
65 lines (55 loc) · 2.07 KB
/
scil_score_ismrm_Renauld2023.sh
File metadata and controls
65 lines (55 loc) · 2.07 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
if [ $# -eq 0 ] || [ $1 = '-h' ] || [ $1 = '--help' ]
then
echo "-----"
echo "Usage: "
echo ">> scil_score_ismrm_Renauld2023.sh tractogram out_dir scoring_data"
echo "If you are using an old version of scilpy (<2.2.0), the '.py' extensions"
echo "were required when calling python scripts"
echo "Then, usage becomes:"
echo ">> scil_score_ismrm_Renauld2023.sh tractogram out_dir scoring_data .py "
echo "-----"
exit
fi
tractogram=$1
out_dir=$2
scoring_data=$3
ext=$4
config_file_segmentation=$scoring_data/config_file_segmentation.json
config_file_tractometry=$scoring_data/config_file_tractometry.json
ref=$scoring_data/ROI/all_masks/CA.nii.gz
if [ ! -f $tractogram ]
then
echo "Tractogram $tractogram does not exist"
exit
fi
if [ -d $out_dir ]
then
echo "Out dir $out_dir already exists. Delete first."
exit
fi
echo '------------- SEGMENTATION ------------'
scil_tractogram_segment_with_ROI_and_score$ext $tractogram $config_file_segmentation $out_dir --no_empty \
--gt_dir $scoring_data --reference $ref --json_prefix tmp_ --no_bbox_check;
echo '------------- Merging CC sub-bundles ------------'
CC_files=$(ls $out_dir/segmented_VB/CC* 2> /dev/null)
if [ "$CC_files" != '' ]
then
scil_tractogram_math$ext lazy_concatenate $CC_files $out_dir/segmented_VB/CC_VS.trk;
fi
echo '------------- Merging ICP left sub-bundles ------------'
ICP_left_files=$(ls $out_dir/segmented_VB/ICP_left* 2> /dev/null)
if [ "$ICP_left_files" != '' ]
then
scil_tractogram_math$ext lazy_concatenate $ICP_left_files $out_dir/segmented_VB/ICP_left_VS.trk;
fi
echo '------------- Merging ICP right sub-bundles ------------'
ICP_right_files=$(ls $out_dir/segmented_VB/ICP_right* 2> /dev/null)
if [ "$ICP_right_files" != '' ]
then
scil_tractogram_math$ext lazy_concatenate $ICP_right_files $out_dir/segmented_VB/ICP_right_VS.trk;
fi
echo '------------- FINAL SCORING ------------'
scil_bundle_score_many_bundles_one_tractogram$ext $config_file_tractometry $out_dir \
--gt_dir $scoring_data --reference $ref --no_bbox_check -v
cat $out_dir/results.json