Newer
Older
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
#!/bin/sh
# SIENAL - Local analysis of SIENA flow field
#
# Stephen Smith, FMRIB Image Analysis Group
#
# Copyright (C) 2002-2003 University of Oxford
#
# SHCOPYRIGHT
Usage() {
echo "Usage: sienal <fileroot2> <fileroot2> [-d]"
echo "-d : debug (don't delete intermediate files)"
exit
}
[ "$1" = "" ] && Usage
[ "$2" = "" ] && Usage
[ ! -f $1.hdr ] && Usage
[ ! -f $2.hdr ] && Usage
A=$1
B=$2
shift 2
if [ _$FSLDIR = _ ] ; then
FSLDIR=/usr/local/fsl
export FSLDIR
fi
debug=0
for opts in $@ ; do
if [ $opts = -d ] ; then
debug=1
fi
done
# register to MNI152 if not already done, and create halfway2tal transform
if [ ! -f ${A}_to_tal.mat ] ; then
if [ ! -f ${A}_brain.hdr ] ; then
${FSLDIR}/bin/bet $A ${A}_brain
fi
${FSLDIR}/bin/flirt -ref ${FSLDIR}/etc/standard/avg152T1_brain -in ${A}_brain -omat ${A}_to_tal.mat
fi
${FSLDIR}/bin/convert_xfm -omat ${A}_halfwayto_${B}_inv.mat -inverse ${A}_halfwayto_${B}.mat
${FSLDIR}/bin/convert_xfm -omat ${A}_halfwayto_${B}_to_tal.mat -concat ${A}_to_tal.mat ${A}_halfwayto_${B}_inv.mat
# dilate flow image, -> standard space -> mask with ss edge image -> blur -> remask
${FSLDIR}/bin/avwmaths ${A}_to_${B}_flow -dil -dil -dil -dil -dil -dil -dil -dil -dil -dil -dil -dil -dil -dil ${A}_to_${B}_flow_dil
${FSLDIR}/bin/flirt -in ${A}_to_${B}_flow_dil -ref ${FSLDIR}/etc/standard/avg152T1_brain -out ${A}_to_${B}_flow_to_tal -applyxfm -init ${A}_halfwayto_${B}_to_tal.mat
${FSLDIR}/bin/avwmaths ${A}_to_${B}_flow_to_tal -mas ${FSLDIR}/etc/standard/avg152T1_edges ${A}_to_${B}_flow_to_tal
${FSLDIR}/bin/ip ${A}_to_${B}_flow_to_tal ${A}_to_${B}_flow_to_tal 0 -s 10
${FSLDIR}/bin/avwmaths ${A}_to_${B}_flow_to_tal -mas ${FSLDIR}/etc/standard/avg152T1_edges ${A}_to_${B}_flow_to_tal
# cleanup
if [ $debug = 0 ] ; then
/bin/rm -f ${A}_halfwayto_${B}_inv.mat ${A}_brain.hdr ${A}_brain.img ${A}_to_${B}_flow_dil.hdr ${A}_to_${B}_flow_dil.img
fi