-
Notifications
You must be signed in to change notification settings - Fork 3
/
INSTALL.txt
391 lines (327 loc) · 12.2 KB
/
INSTALL.txt
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
Michael Eager
Table of Contents
_________________
1 Setup and install
.. 1.1 Prerequisites
.. 1.2 Get the code
.. 1.3 Check
.. 1.4 Install Dicom3tools
.. 1.5 Install MRtrix
2 Setup matlab third party packages
.. 2.1 Non-local means filter
.. 2.2 Copy of NIFTI package (mathworks)
3 [Optional] Scipy install from source
1 Setup and install
===================
1.1 Prerequisites
~~~~~~~~~~~~~~~~~
Install the required applications and python packages your appropriate
linux distribution package manager (or Pip for local python
installations).
MASSIVE (Centos 6):
,----
| module load build atlas cuda/7.0 mrtrix3 fsl/5.0.8 dcmtk git boost python/2.7.8-gcc octave imagemagick mercurial matlab/r2014b
| pip install --user argparse mahotus pyfft pyopencl pycuda reikna pydicom
`----
On Debian/Ubuntu/LinuxMint:
,----
| sudo apt-get install python-setuptools python-dicom python-numpy python-tk dcmtk scipy
| sudo pip install argparse mahotus pyfft pycuda pyopencl
`----
or Redhat/CentOS/Fedora:
,----
| sudo yum install python-setuptools numpy scipy python-tk dcmtk
| sudo pip install pydicom argparse
`----
1.2 Get the code
~~~~~~~~~~~~~~~~
Pull the stable version from the MBI repository, using:
,----
| # hg clone ssh://hg@bitbucket.org/mbi-image/agilent2dicom Agilent2Dicom
| # git clone ssh://carbon2.mbi.monash.edu.au:mbi-image/agilent2dicom Agilent2Dicom
| git clone git@gitlab.erc.monash.edu.au:mbi-image/Agilent2Dicom.git
`----
On the Agilent 9.4T MR console, download the tar zipped bundle of the
source code and unpack it. Add the Agilent2Dicom source path to the
PATH environment variable (csh is the default shell, but also add the
path in the bash user config file).
,----
| # wget https://bitbucket.org/mbi-image/agilent2dicom/get/default.tar.gz
| # mkdir Agilent2Dicom
| # tar zxvf default.tar.gz Agilent2Dicom/
| # wget https://carbon2.mbi.monash.edu.au/mbi-image/Agilent2Dicom/repository/archive.zip
| wget https://gitlab.erc.monash.edu.au/mbi-image/Agilent2Dicom/repository/archive.zip
| unzip archive.zip
| cd Agilent2Dicom.git
| echo "export PATH=`pwd`:${PATH}" >> ~/.bashrc
| echo "setenv PATH `pwd`:$PATH" >> ~/.cshrc
`----
1.3 Check
~~~~~~~~~
Check your python installation for the required packages using the
check.py script:
,----
| cd Agilent2Dicom
| ./check.py
`----
1.4 Install Dicom3tools
~~~~~~~~~~~~~~~~~~~~~~~
Install dicom3tools from [http://www.dclunie.com/dicom3tools.html]
into the Agilent2Dicom folder. The default settings for MBI's Agilent
9.4T MR scanner are used below. The default UID root value
'1.3.6.1.4.1' is unique to the MBI Agilent 9.4T MR scanner and should
be changed for other devices. The dependencies for compiling
dicom3tools are imake, gcc and binutil-essentials.
On MASSIVE use:
,----
| module load imake gcc.
`----
On the Agilent console, use:
,----
| sudo yum install imake gcc binutil-essentials
`----
Once the dependencies have been installed, begin by downloading the
latest dicom3tools
[http://www.dclunie.com/dicom3tools/workinprogress/], adjust the
config/site.p-def file for the appropriate settings. Follow the
compile instructions below for installing on the Agilent console:
,----
| cd ~/src/ # On MASSIVE use cd ~/Monash016/eagerm/Agilent2Dicom
| wget http://www.dclunie.com/dicom3tools/workinprogress/dicom3tools_1.00.snapshot.20140306142442.tar.bz2
| tar jxvf dicom3tools_1.00.snapshot.20140306142442.tar.bz2
| cd dicom3tools_1.00.snapshot.20140306142442
|
| sed -i 's/CLUNIE/MBIAGILENT/' config/site.p-def
| ./Configure
| # setenv IMAKEINCLUDE -I./config # only needed for tcsh
| imake -I./config -DInstallInTopDir -DUseMBIAGILENT1ID -DDefaultUIDRoot=1.3.6.1.4.1
| make World
| make install # into ./bin
| make install.man # into ./man
`----
1.5 Install MRtrix
~~~~~~~~~~~~~~~~~~
MRtrix source code and documentation:
[http://www.brain.org.au/software/mrtrix/].
For MRtrix stable version (0.2.12), follow instructions on
[http://jdtournier.github.io/mrtrix-0.2/install/unix.html]. For
first-time installation, install required dependencies: g++, python,
gtkmm, gtkglext, libgsl & a working OpenGL environment
On debian:
,----
| sudo apt-get install g++ python libglib2.0-dev libgtk2.0-dev libglibmm-2.4-dev libgtkmm-2.4-dev libgtkglext1-dev libgsl0-dev libgl1-mesa-dev libglu1-mesa-dev
`----
On MASSIVE:
,----
| module load python/2.7.8-gcc qt/4.8.4 gcc/4.8.2 glew/1.10.0 glut gsl gtkglext zlib virtualgl/2.3.x pyqt4 git
`----
On RedHat 6 (Agilent console does not have the appropriate repos - so
look for rpms below and save to ~/src/):
,----
| sudo yum install -y gtkmm24 glibmm24 glib2-devel mesa-libGL-devel mesa-libGLw-devel freeglut-devel PyQt4-devel
| sudo rpm -i src/cairomm-devel-1.8.0-2.1.el6.x86_64.rpm \
| src/dcmtk-3.6.0-7.fc16.src.rpm \
| src/glibmm24-devel-2.22.1-1.el6.x86_64.rpm \
| src/glibmm24-devel-2.45.3-1.fc23.i686.rpm \
| src/gtkglext-1.0.6-1.el5.rf.x86_64.rpm \
| src/gtkglext-devel-1.0.6-1.el5.rf.x86_64.rpm \
| src/gtkmm24-devel-2.18.2-1.el6.x86_64.rpm \
| src/libsigc++20-devel-2.2.4.2-1.el6.x86_64-1.rpm \
| src/libsigc++20-devel-2.2.4.2-1.el6.x86_64.rpm \
| src/pangomm-devel-2.26.0-1.el6.x86_64.rpm
`----
Simple compile procedure:
,----
| # 1. Go to NITRC.org and download package
| # Unpack archive:
| tar xjf mrtrix-0.2.X.tar.bz2
|
| # 2. Compile:
| cd mrtrix-0.2.X/
| ./build
|
| # if there are compilation errors for pango_x_fonts*, add -lpangox-1.0 to build step
|
| # 3. Install (as root):
| sudo ./build install
| # this installs executables to /opt/mrtrix
| # unfortunately the lib in /opt/mrtrix/lib is not linked to /usr/lib
| # either add to LD_LIBRARY_PATH in bashrc or soft link it
`----
For mrtrix3 built on MASSIVE:
,----
| git clone https://github.com/jdtournier/mrtrix3
| cd mrtrix
| export PYTHONPATH=/usr/local/pyqt4/4.11/lib/python2.7/site-packages:/usr/local/python/2.7.8-gcc/lib/python2.7/site-packages:/usr/local/python/2.7.8-gcc/lib/python2.7
| export CFLAGS="-I/usr/include -DGLX_GLXEXT_PROTOTYPES"
| python2.7 ./configure
| python2.7 ./build
|
| # Known error in the build process: run the gl_core command
| g++ -c -fPIC -march=native -DMRTRIX_WORD64 -DMRTRIX_USE_TR1 -Wall -Wno-unused-function -Wno-unused-parameter -O2 -DNDEBUG -Isrc -Icmd -Ilib -Icmd -I/usr/local/gsl/1.12-gcc/include -I/usr/include -DHAVE_INLINE -DGLX_GLXEXT_PROTOTYPES src/gui/opengl/gl_core_3_3.cpp -o src/gui/opengl/gl_core_3_3.o
| # Then complete the build again
| python2.7 ./build
|
| # Optional: Install as root
| sudo python ./build install
`----
2 Setup matlab third party packages
===================================
2.1 Non-local means filter
~~~~~~~~~~~~~~~~~~~~~~~~~~
Read README file in NLmeans and compile vlfeat. MATLAB must be in PATH
for vlfeat to compile correctly.
,----
| mkdir matlab/NLmeans;
| cd matlab/NLmeans
| git clone https://github.com/UB-TFG-TFM-1415/SS-DDLS.git
| (cd SS-DDLS;patch -p1 ../SS-DDLS-patch.txt)
| mv SS-DDLS/Code/Utils/MRIDenoisingPackage ./
| rm -rf SS-DDLS
| git clone https://github.com/vlfeat/vlfeat.git
| cd vlfeat
| make
`----
Modified version of the MRIDenoising package are in
`matlab/NLmeans/MRIDenoisingModified'.
To compile the mex files, run:
,----
| matlab -nodesktop -nosplash -r "cd matlab/NLmeans/MRIDenoisingModified;
| mex -v -compatibleArrayDims COMPFLAGS='$COMPFLAGS -Ofast' myODCT3d.cpp;
| mex -v -compatibleArrayDims COMPFLAGS='$COMPFLAGS -Ofast' myMBONLM3D.cpp;
| mex -v -compatibleArrayDims COMPFLAGS='$COMPFLAGS -Ofast' myRINLM3d.cpp;
| "
`----
2.2 Copy of NIFTI package (mathworks)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
,----
| cd matlab
| zip_path=`curl http://www.mathworks.com.au/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image?download=true`
| zip_path=` echo $zip_path | sed 's#<html><body>You are being <a href="\(.*\)">redirected</a>.</body></html>#\1#'`
| wget $zip_path
| mkdir NIFTI
| cd NIFTI
| unzip ../NIFTI*.zip
`----
3 [Optional] Scipy install from source
======================================
Read this first: [http://www.scipy.org/scipylib/building/linux.html]
1. Download ATLAS and Lapack
ATLAS link:
[http://sourceforge.net/projects/math-atlas/files/latest/download?source=files]
Lapack link: [http://www.netlib.org/lapack/lapack-3.5.0.tgz]
1. Prerequistites for ATLAS and Lapack
The Agilent workstation is a RHEL 6. Use `yum groupinstall
"Developmental Tools"` to enable more features if you want more recent
packages (e.g. atlas-devel, lapack-devel, PyQt4-devel) required to
install numpy and scipy from source.
1. Install Numpy scipy prerequisites
,----
| pip install --user Tempita
| pip install --user cython
`----
1. ATLAS and lapack compilation
Read
[http://www.scipy.org/scipylib/building/linux.html#building-atlas]
,----
| tar zxvf ATLAS-3.11.30
| cd ATLAS-3.11.30/ATLAS
| mkdir ATLAS_LINUX
| cd ATLAS_LINUX
| sudo /usr/bin/cpufreq-selector -g performance
| ../configure -Fa alg -fPIC --with-netlib-lapack-tarfile=$HOME/src/lapack-3.5.0.tgz
| ## This will take some time
| make
| cd lib
| make shared
| make ptshared
| sudo make install
| ## when finished, reset the cpu throttling
| sudo /usr/bin/cpufreq-selector -g ondemand
`----
[Obsolete]
,----
| sudo yum install --upgrade python
| cd ~/src
| export LAPACK_SRC=/home/vnmr1/src/lapack-3.5.0/SRC/
| wget http://www.netlib.org/lapack/lapack-3.5.0.tgz
| tar zxvf lapack-3.5.0.tgz && cd lapack-3.5.0
| cp make.inc.example make.inc
| sed -i -e 's/^OPTS\(.*\)/OPTS \1 -m64 -fPIC/' -e 's/^NOOPT\(.*\)/NOOPT \1 -m64 -fPIC/' make.inc
|
| make
| make -C BLAS/SRC
|
| # ln -s blas_LINUX.a libblas.a
| # ln -s lapack_LINUX.a liblapack.a
| # ln -s tmglib_LINUX.a libtmglib.a
|
| export BLAS_SRC=/home/vnmr1/src/lapack-3.5.0/BLAS/SRC
| export ATLAS=/home/vnmr1/src/ATLAS_3.11.30/ATLAS
| export LD_LIBRARY_PATH=$HOME/src/lapack-3.5.0:$LD_LIBRARY_PATH
| export PYTHONPATH=~/.local/lib/python2.6/site-packages:/usr/lib64/python2.6/site-packages:/usr/lib/python2.6/site-packages
|
| pip install --user --force-reinstall --upgrade numpy
| pip install --user --force-reinstall --upgrade scipy
| python -c 'import numpy;numpy.test()
| python -c 'import scipy;scipy.test()'
`----
1. Compile Numpy and Scipy.
Use shared or threaded atlas in compilation. Numpy from pip is fine
(1.9.2) but scipy needs to come from the git repo.
,----
| cd ~/src
| git clone https://github.com/scipy/scipy.git
| cd scipy
| export ATLAS=/usr/local/atlas/lib/libsatlas.so
| export LAPACK=/usr/local/atlas/lib/liblapack.a
| export BLAS=/usr/local/atlas/lib/libcblas.a
| pip install --user --force-reinstall --upgrade numpy
| python setup.py install --user
|
| python -c 'import numpy; numpy.show_config()'
| python -c 'import numpy;numpy.test()'
| python -c 'import scipy;scipy.test()'
`----
1. Testing
,----
| #!/usr/bin/env python
| import numpy
| import sys
| import timeit
|
| try:
| import numpy.core._dotblas
| print 'FAST BLAS'
| except ImportError:
| print 'slow blas'
|
| print "version:", numpy.__version__
| print "maxint:", sys.maxint
| print
|
| x = numpy.random.random((1000,1000))
|
| setup = "import numpy; x = numpy.random.random((1000,1000))"
| count = 5
|
| t = timeit.Timer("numpy.dot(x, x.T)", setup=setup)
| print "dot:", t.timeit(count)/count, "sec"
`----
,----
| #!/usr/bin/env python
| import timeit
|
|
| setup = "import numpy;\
| import scipy.linalg as linalg;\
| x = numpy.random.random((1000,1000));\
| z = numpy.dot(x, x.T)"
| count = 5
|
| t = timeit.Timer("linalg.cholesky(z, lower=True)", setup=setup)
| print "cholesky:", t.timeit(count)/count, "sec"
|
| t = timeit.Timer("linalg.svd(z)", setup=setup)
| print "svd:", t.timeit(count)/count, "sec"
`----