-
Notifications
You must be signed in to change notification settings - Fork 30
/
.gitlab-ci.yml
239 lines (217 loc) · 6.96 KB
/
.gitlab-ci.yml
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
# -----------------------------------Set Up------------------------------------
variables:
PY_VERSION: 3
PRIVATE: 0
TMPDIR: ./tmp
DATADIR: /home/mebner/data/ci/FetalBrain
VENV: pysitk-test-py${PY_VERSION}
ITK_DIR: /mnt/shared/mebner/environment/ITK/ITK_NiftyMIC-python${PY_VERSION}-build
FSL_DIR: /mnt/shared/mebner/environment/FSL/fsl
TEST_DIR: /home/mebner/Development/NiftyMIC/data/tests
NIFTYREG_INSTALL: /mnt/shared/mebner/environment/NiftyReg/NiftyReg-master-install
CONVERT3D_INSTALL: /mnt/shared/mebner/environment/Convert3D/c3d-git-install
before_script:
# add NiftyReg to PATH
- export PATH="${NIFTYREG_INSTALL}/bin:$PATH"
# add FSL
- PATH=${FSL_DIR}/bin:${PATH}
- export PATH="${FSL_INSTALL}/bin:$PATH"
- export FSLOUTPUTTYPE=NIFTI_GZ
# add Convert3D to PATH
- export PATH="${CONVERT3D_INSTALL}/bin:$PATH"
# save current folder path
- cwd_dir=$(pwd)
# create virtual environment
- rm -rf ${VENV}
- mypython=$(which python${PY_VERSION})
- virtualenv -p $mypython ${VENV}
- cd ${VENV}
- venv_dir=$(pwd)
- source bin/activate
# print Python version to CI output
- which python
- python --version
# copy ITK_NiftyMIC-build WrapITK to site-packages of python venv
- py_sitepkg=${venv_dir}/lib/python*/site-packages
- cp -v ${ITK_DIR}/Wrapping/Generators/Python/WrapITK.pth ${py_sitepkg}
- cd $cwd_dir
# If PRIVATE is used:
# add CI_JOB_TOKEN for cloning dependent repositories in requirements.txt
# (https://docs.gitlab.com/ee/user/project/new_ci_build_permissions_model.html#dependent-repositories)
- >
(if [ ${PRIVATE} == 1 ];
then sed -i -- "s#github.com/gift-surg#gitlab-ci-token:${CI_JOB_TOKEN}@PRIVATE.cs.ucl.ac.uk/GIFT-Surg#g" requirements.txt;
fi);
# install requirements
- pip install -r requirements.txt
# set environment variables for installation
- export NIFTYMIC_ITK_DIR=$ITK_DIR
# run installation
- pip install -e .
# replace TEST_DIR in niftymic/definitions.py file
- sed -i -- 's:DIR_TEST = os.path.join(DIR_ROOT, "data", "tests"):DIR_TEST = "'"$TEST_DIR"'":g' niftymic/definitions.py
- cat niftymic/definitions.py
after_script:
# delete tmp-directory
- rm -rfv ${TMPDIR}
# ----------------------------------Test Jobs----------------------------------
builddocs:
# only:
# - master
script:
- cd doc
- doxygen doxyfile
tags:
- gift-adelie
installation:
# only:
# - master
script:
- python -m nose tests/installation_test.py
tags:
- gift-adelie
reconstruct_volume_tk1l2:
# only:
# - master
script:
- >
niftymic_reconstruct_volume
--filenames ${DATADIR}/input_data/axial.nii.gz ${DATADIR}/input_data/coronal.nii.gz ${DATADIR}/input_data/sagittal.nii.gz
--output ${TMPDIR}/srr_from_slices_tk1l2.nii.gz
--suffix-mask _mask
--verbose 0
--isotropic-resolution 2
--reconstruction-type TK1L2
--two-step-cycles 1
--iter-max 2
--iter-max-first 2
tags:
- gift-adelie
reconstruct_volume_huberl2:
# only:
# - master
script:
- >
niftymic_reconstruct_volume
--filenames ${DATADIR}/input_data/axial.nii.gz ${DATADIR}/input_data/coronal.nii.gz ${DATADIR}/input_data/sagittal.nii.gz
--output ${TMPDIR}/srr_from_slices_huberl2.nii.gz
--suffix-mask _mask
--verbose 0
--isotropic-resolution 2
--reconstruction-type HuberL2
--two-step-cycles 1
--iter-max 2
--iter-max-first 2
--iterations 1
tags:
- gift-adelie
reconstruct_volume_from_slices:
# only:
# - master
script:
- >
niftymic_reconstruct_volume_from_slices
--filenames ${DATADIR}/input_data/axial.nii.gz ${DATADIR}/input_data/coronal.nii.gz ${DATADIR}/input_data/sagittal.nii.gz
--dir-input-mc ${DATADIR}/motion_correction_oriented
--suffix-mask _mask
--reconstruction-space ${DATADIR}/SRR_stacks3_TK1_lsmr_alpha0p03_itermax10_oriented.nii.gz
--output ${TMPDIR}/srr_from_slices.nii.gz
--verbose 0
--isotropic-resolution 2
--iter-max 2
tags:
- gift-adelie
run_reconstruction_pipeline:
# only:
# - master
script:
- >
niftymic_run_reconstruction_pipeline
--filenames ${DATADIR}/input_data/axial.nii.gz
--filenames-masks ${DATADIR}/input_data/axial_mask.nii.gz
--dir-output ${TMPDIR}
--suffix-mask _mask
--bias-field-correction 1
--two-step-cycles 0
--iter-max 1
--run-diagnostics 1
--slice-thicknesses 3.85
--verbose 0
tags:
- gift-adelie
param_study_huberl2:
# only:
# - master
script:
- recon_type=HuberL2
- >
niftymic_run_reconstruction_parameter_study
--filenames ${DATADIR}/input_data/axial.nii.gz ${DATADIR}/input_data/coronal.nii.gz ${DATADIR}/input_data/sagittal.nii.gz
--dir-input-mc ${DATADIR}/motion_correction_oriented
--suffix-mask _mask
--reference ${DATADIR}/SRR_stacks3_TK1_lsmr_alpha0p03_itermax10_oriented.nii.gz
--dir-output ${TMPDIR}/param_study
--alphas 0.01 0.05
--iter-max 2
--verbose 0
--iterations 2
--reconstruction-type ${recon_type}
tags:
- gift-adelie
rsfmri_estimate_motion:
# only:
# - master
script:
- recon_type=HuberL2
- >
niftymic_rsfmri_estimate_motion
--filename ${DATADIR}/rsfmri/bold.nii.gz
--filename-mask ${DATADIR}/rsfmri/bold_4Dmask.nii.gz
--dir-output ${TMPDIR}/rsfmri
--two-step-cycles 1
--iterations 2
--sda
--alpha 1
--verbose 0
--prototyping
tags:
- gift-adelie
rsfmri_reconstruct_volume_from_slices:
# only:
# - master
script:
- recon_type=TK1L2
- >
niftymic_rsfmri_reconstruct_volume_from_slices
--filename ${DATADIR}/rsfmri/bold.nii.gz
--filename-mask ${DATADIR}/rsfmri/bold_4Dmask.nii.gz
--output ${TMPDIR}/rsfmri/foo.nii.gz
--alpha 0.05
--iter-max 2
--verbose 0
--reconstruction-type ${recon_type}
--reconstruction-spacing 2 2 5
--use-masks-srr 1
--prototyping
tags:
- gift-adelie
##
# Results can (slightly) change depending on the downloaded library version;
# enough so that the accuracy limits are not met. Run them locally instead.
# unit_tests:
# # only:
# # - master
# script:
# - python -m nose tests/brain_stripping_test.py
# - python -m nose tests/case_study_fetal_brain_test.py
# - python -m nose tests/data_reader_test.py
# - python -m nose tests/image_similarity_evaluator_test.py
# - python -m nose tests/intensity_correction_test.py
# - python -m nose tests/linear_operators_test.py
# - python -m nose tests/niftyreg_test.py
# - python -m nose tests/residual_evaluator_test.py
# - python -m nose tests/segmentation_propagation_test.py
# - python -m nose tests/simulator_slice_acquisition_test.py
# - python -m nose tests/stack_test.py
# tags:
# - gift-adelie