forked from CoBrALab/minc-toolkit-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAGeT-object-QC.sh
executable file
·71 lines (57 loc) · 1.89 KB
/
MAGeT-object-QC.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
#Generate auto-scaled MaGeT QC image
#TODO
#-option for label on-off slices
#-option for number of slices
#-option for image size
#-clobber check
set -e
image=$1
shift
output="${@: -1}"
tmpdir=$(mktemp -d)
#Join objects with objconcat
objconcat ${@:1:$#-1} $(for((i=1;i<=$# - 1;i++));do printf "%s" "none ";done) $tmpdir/combined.obj none
scan_object_to_volume $image $tmpdir/combined.obj $tmpdir/label.mnc
mincresample $(mincbbox -mincresample $tmpdir/label.mnc) $tmpdir/label.mnc $tmpdir/label-crop.mnc
minccalc -expression "A[0]?1:1" $tmpdir/label-crop.mnc $tmpdir/bounding.mnc
colours=(red green blue magenta orange)
overlay_list=""
i=0
for object in ${@:1:$#-1}
do
overlay_list+="surface_overlay:$object:${colours[$i]} "
((i++)) || true
done
#Trasverse
echo create_verify_image $tmpdir/$(basename $image .mnc)_t.rgb \
-width 3840 -autocols 20 -autocol_planes t \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray \
$overlay_list
create_verify_image $tmpdir/$(basename $image .mnc)_t2.rgb \
-width 3840 -autocols 20 -autocol_planes t \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray
#Saggital
create_verify_image $tmpdir/$(basename $image .mnc)_s.rgb \
-width 3840 -autocols 20 -autocol_planes s \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray \
$overlay_list
create_verify_image $tmpdir/$(basename $image .mnc)_s2.rgb \
-width 3840 -autocols 20 -autocol_planes s \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray
#Coronal
create_verify_image $tmpdir/$(basename $image .mnc)_c.rgb \
-width 3840 -autocols 20 -autocol_planes c \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray \
$overlay_list
create_verify_image $tmpdir/$(basename $image .mnc)_c2.rgb \
-width 3840 -autocols 20 -autocol_planes c \
-bounding_volume $tmpdir/bounding.mnc \
-row $image color:gray
convert -append -trim $tmpdir/*.rgb $output
rm -rf $tmpdir