forked from FernandoPalazuelos/Displasias
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplasia_viz_streamlines.sh
executable file
·112 lines (83 loc) · 1.96 KB
/
displasia_viz_streamlines.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
source `which my_do_cmd`
help(){
echo "
How to use:
`basename $0` [options] <resultsfolder>
resultsfolder is the output folder for nii2streams_T2analysis.sh
Options:
-n Show results in native (brkraw) space.
-p Show results in permuted space.
LU15 (0N(H4
INB UNAM
Feb 2022
lconcha@unam.mx
"
}
if [ $# -lt 1 ]
then
echolor red "Not enough arguments"
help
exit 2
fi
doNative=0
doPermuted=0
while getopts np flag
do
case "${flag}" in
n) doNative=1;shift;;
p) doPermuted=1;shift;;
esac
done
if [ $doNative -eq 0 -a $doPermuted -eq 0 ]
then
echolor red "Need to specify -p (permuted) or/and -n (native)"
exit 2
fi
outfolder=$1
image=${outfolder}/*image*.nii.gz
lines=${outfolder}/lines.nii.gz
streamlines=""
if [ $doPermuted -eq 1 ]
then
for f in ${outfolder}/??/tck/*resampled.tck
do
n=`tckinfo -count $f | grep count: | head -n 1 | awk -F: '{print $2}' | sed 's/ //g'`
#echolor yellow "$f has $n streamlines"
f_linenums=${f%.tck}_linenumbers.txt
seq 1 $n > $f_linenums
f_linelengths=${f%.tck}_linelengths.txt
tckstats -quiet -force -dump $f_linelengths $f
streamlines="${streamlines} -tractography.load $f -tractography.tsf_load $f_linenums"
done
for f in ${outfolder}/??/tck/*seeds*_resampled_imagespace.tck
do
streamlines="${streamlines} -tractography.load $f \
-tractography.geometry points"
#-tractography.tsf_load $f_linenums"
done
fi
if [ $doNative -eq 1 ]
then
for f in ${outfolder}/??/tck/*native.tck
do
streamlines="${streamlines} -tractography.load $f -tractography.geometry points"
done
fi
images=""
images=""
if [ $doPermuted -eq 1 ]
then
imtolodad=`ls ${outfolder}/*image.nii.gz`
images="$images $imtolodad"
fi
if [ $doNative -eq 1 ]
then
imtolodad=`ls ${outfolder}/*image_native.nii.gz`
images="$images $imtolodad"
fi
my_do_cmd mrview $images \
-interpolation false \
-mode 2 \
-roi.load $lines \
$streamlines