forked from MICA-MNI/micapipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix_settings.sh
213 lines (186 loc) · 6.92 KB
/
fix_settings.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Settings file for FIX
# Modify these settings based on your system setup
FIXVERSION=1.06
# (actually this version is 1.068 - see wiki page for details)
# Get the OS and CPU type
FSL_FIX_OS=$(uname -s)
FSL_FIX_ARCH=$(uname -m)
if [ -z "${FSL_FIXDIR}" ]; then
if [ "X$0" = "X-bash" ]; then
FSL_FIXDIR=$(pwd)
else
FSL_FIXDIR=$( cd "$(dirname "$0")" ; pwd)
fi
export FSL_FIXDIR
fi
# Disable errexit so that which commands can't cause abort
cur_errexit=$(set -o | grep "errexit" | awk '{ print $2 }')
if [ "${cur_errexit}" = "on" ]; then
set +o errexit
fi
# edit the following variables according to your local setup
# Part I MATLAB/Octave mode
# =========================
# This variable selects how we run the MATLAB portions of FIX.
# It takes the values 0-2:
# 0 - Try running the compiled version of the function
# 1 - Use the MATLAB script version
# 2 - Use Octave script version
if [ -z "${FSL_FIX_MATLAB_MODE}" ]; then
FSL_FIX_MATLAB_MODE=0
fi
# Part IIa MATLAB compiled version
# ================================
if [ "$FSL_FIX_MATLAB_MODE" -eq 0 ]; then
# Point this variable at the folder containing an installed MATLAB compiler runtime.
# e.g. /usr/local/mcr
# Within this folder must be the versioned runtimes, e.g. v93 etc
if [ -z "${FSL_FIX_MCRROOT}" ]; then
FSL_FIX_MCRROOT="/opt/matlabmcr-2017b"
if [ ! -x "$FSL_FIX_MCRROOT" ]; then
echo "Can't find the MATLAB compiler runtime, please set FSL_FIX_MCRROOT in the settings.sh file." >2
fi
fi
# The following variables should not need changing
# This is name of the folder containing the compiled MATLAB functions
if [ -z "${FSL_FIX_MLCDIR}" ]; then
FSL_FIX_MLCDIR="${FSL_FIXDIR}/compiled/${FSL_FIX_OS}/${FSL_FIX_ARCH}"
fi
# This is the version of the runtime FIX has been compiled for
if [ -z "${FSL_FIX_MCRV}" ]; then
if [ -f "${FSL_FIX_MLCDIR}/MCR.version" ]; then
FSL_FIX_MCRV=$(cat "${FSL_FIX_MLCDIR}/MCR.version")
fi
fi
# This is where FIX will look for the compiler runtime
if [ ! -z "${FSL_FIX_MCRV}" -a -z "${FSL_FIX_MCR}" ]; then
FSL_FIX_MCR="${FSL_FIX_MCRROOT}/${FSL_FIX_MCRV}"
fi
fi
# Part IIb MATLAB settings
# ========================
# Skip this if you aren't using mode 1
if [ "$FSL_FIX_MATLAB_MODE" -eq 1 ]; then
# Look for installed MATLAB
MATLAB_BIN=/opt/matlabmcr-2017b
if [ -z "${MATLAB_BIN}" ]; then
MATLAB_BIN=$(which matlab 2>/dev/null)
fi
# Look for installed MCC - not needed if you aren't going to compile FIX
if [ -z "${MCC_BIN}" ]; then
MCC_BIN=$(which mcc 2>/dev/null)
fi
# Point this variable at your MATLAB command - this is usually $FSL_FIX_MATLAB_ROOT/bin/matlab
if [ -z "${FSL_FIX_MATLAB}" ]; then
FSL_FIX_MATLAB="${MATLAB_BIN}"
fi
if [ -z "${FSL_FIX_MATLAB}" ]; then
echo "Please set FSL_FIX_MATLAB variable in the settings.sh file to point at your MATLAB program" >2
fi
# Point this variable at your MATLAB install folder
if [ -z "${FSL_FIX_MATLAB_ROOT}" ]; then
FSL_FIX_MATLAB_ROOT="$(dirname "${FSL_FIX_MATLAB}")/.."
# On OS X this will most likely be something like /Applications/MATLAB_R20XX.app
fi
# Point this variable at your MATLAB compiler command - this is usually $FSL_FIX_MATLAB_ROOT/bin/mcc
# Not needed if you don't intend to compile FIX
if [ -z "${FSL_FIX_MCC}" ]; then
FSL_FIX_MCC="${MCC_BIN}"
fi
# The following variables should not need changing
# This is name of the folder containing the compiled MATLAB functions
if [ -z "${FSL_FIX_MLCDIR}" ]; then
FSL_FIX_MLCDIR="${FSL_FIXDIR}/compiled/${FSL_FIX_OS}/${FSL_FIX_ARCH}"
fi
# See README for instructions on compilation of the MATLAB portions
# Set this to the MATLAB start-up options. Typically you will
# want to disable Java, display output, the desktop environment
# and the splash screen
if [ -z "${FSL_FIX_MLOPTS}" ]; then
FSL_FIX_MLOPTS="-nojvm -nodisplay -nodesktop -nosplash"
fi
# Set this to the MATLAB 'evaluate string' option
if [ -z "${FSL_FIX_MLEVAL}" ]; then
FSL_FIX_MLEVAL="-r"
fi
# Set this to the pass in file option
if [ -z "${FSL_FIX_MLFILE}" ]; then
FSL_FIX_MLFILE="\<"
fi
fi
# Part IIb Octave settings
# =======================
# Skip this if you aren't using mode 2
if [ "$FSL_FIX_MATLAB_MODE" -eq 2 ]; then
# Point this variable at your Octave command (or leave it blank to disable Octave mode)
# Linux:
if [ -z "${FSL_FIX_OCTAVE}" ]; then
FSL_FIX_OCTAVE=$(which octave 2>/dev/null)
#FSL_FIX_OCTAVE="/usr/bin/octave" #Linux
#FSL_FIX_OCTAVE="/opt/local/bin/octave" # Mac OS X installed via MacPorts
if [ -z "${FSL_FIX_OCTAVE}" ]; then
echo "Please set FSL_FIX_OCTAVE variable in the settings.sh file to point at your MATLAB program" >2
fi
fi
# Set this to the Octave start-up options. Typically you will need to
# enable 'MATLAB' mode (--traditional) and disable display output
if [ -z "${FSL_FIX_OCOPTS}" ]; then
FSL_FIX_OCOPTS="--traditional -q --no-window-system"
fi
# Set this to the Octave 'evaluate string' option
if [ -z "${FSL_FIX_OCEVAL}" ]; then
FSL_FIX_OCEVAL="--eval"
fi
# Set this to the pass in file option
if [ -z "${FSL_FIX_OCFILE}" ]; then
FSL_FIX_OCFILE=""
fi
fi
# Part III R Settings
# ===================
if [ -z "${FSL_FIX_R_CMD}" ]; then
FSL_FIX_R_CMD="/usr/bin/R"
if [ ! -x "${FSL_FIX_R_CMD}" ]; then
# Set this to the location of the R binary, e.g.
# Linux: /usr/bin/R
# macOS: $FSLDIR/fslpython/envs/fslpython/bin/R
FSL_FIX_R_CMD=$(which R 2>/dev/null)
fi
if [ -z "${FSL_FIX_R_CMD}" ]; then
echo "R not found - please set FSL_FIX_R_CMD to point to it in the settings.sh file" >2
fi
fi
# Part IV General settings
# =========================
# Set this to CIFTI Matlab Reader/Writer for use within HCP pipelines
# i.e., location of the ciftiopen.m, ciftisave.m, and ciftisavereset.m functions
# https://wiki.humanconnectome.org/display/PublicData/HCP+Users+FAQ#HCPUsersFAQ-2.HowdoyougetCIFTIfilesintoMATLAB?
# Note that the GIFTI library will need to be in your matlab/octave path as well (see previous link)
# This variable is only relevant if using FSL_FIX_MATLAB_MODE of 1 or 2.
# [If using the compiled version of FIX, the CIFTI I/O functionality is already part of the compiled executables].
if [ -z "${FSL_FIX_CIFTIRW}" ]; then
FSL_FIX_CIFTIRW='/opt/fmrib/workbench_ciftireader/CIFTIMatlabReaderWriter';
fi
if [ -z "${FSL_FIX_WBC}" ]; then
FSL_FIX_WBC="$(which wb_command 2>/dev/null)"
if [ -z "${FSL_FIX_WBC}" ]; then
# Set this to the location of the HCP Workbench folder for your platform
WBENCH="/opt/fmrib/workbench/"
if [ "${FSL_FIX_OS}" = "Darwin" ]; then
FSL_FIX_WBC="${WBENCH}/bin_macosx64/wb_command"
elif [ "${FSL_FIX_OS}" = "Linux" ]; then
FSL_FIX_WBC="${WBENCH}/bin_linux64/wb_command"
fi
fi
fi
export FSL_FIX_CIFTIRW FSL_FIX_WBC
# Set this to the location of the FSL MATLAB scripts
if [ -z "${FSLDIR}" ]; then
echo "FSLDIR is not set - FIX will not be able to run"
fi
FSL_FIX_FSLMATLAB="${FSLDIR}/etc/matlab"
#############################################################
# reset errexit
if [ "$cur_errexit" = "on" ]; then
set -o errexit
fi