-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
128 lines (108 loc) · 4.38 KB
/
Makefile
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
# default parameters {{{
pe_dir ?= AP
regopts ?= -cost mutualinfo -dof 12 -searchrz -180 180 -searchry -180 180 -searchrx -180 180
ntrack ?= 15M
ct_thresh ?= 1000
nthread ?= 8
resamp_target ?= fsaverage5
resamp_parc ?= aparc.a2009s
resamp_sval ?= pial
elec_mode ?= CT
# }}}
# default data layout {{{
DATA ?= data
# Shorthand for the Data Directory for use in the params file
DD = $(DATA)/$(SUBJECT)
T1 ?= $(DATA)/$(SUBJECT)/t1/
DWI ?= $(DATA)/$(SUBJECT)/dwi/
ELEC ?= $(DATA)/$(SUBJECT)/elec/elec.nii.gz
SEEGRECDIR ?= $(DATA)/$(SUBJECT)/seeg
XLSX ?= $(DATA)/$(SUBJECT)/patient.xlsx
# Only one of the following should be present
ELEC_POS_GARDEL ?= $(DATA)/$(SUBJECT)/elec/pos_vox.txt
ELEC_MM_GARDEL ?= $(DATA)/$(SUBJECT)/elec/pos_mm.txt
ELEC_ENDPOINTS ?= $(DATA)/$(SUBJECT)/elec/elec_endpoints.txt
ELEC_LABEL_SCHEMA ?= $(DATA)/$(SUBJECT)/elec/schema.txt
# }}}
ifneq ($(and $(BVECS),$(BVALS)),)
raw_mif_convert_flags := -fslgrad $(BVECS) $(BVALS)
endif
# misc util {{{
export SUBJECTS_DIR
sd = $(SUBJECTS_DIR)/$(SUBJECT)
rtd = $(SUBJECTS_DIR)/$(resamp_target)
fs_done = $(sd)/mri/aparc+aseg.mgz
here := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export PYTHONPATH:=$(here):$(PYTHONPATH)
lut_fs := $(here)/util/data/VepFreeSurferColorLut.txt
# }}}
# Keep all intermediate files
.SECONDARY:
.PHONY: fs_recon resamp-anat dwi seeg tvb clean mrinfo # {{{
default:
echo "please read Makefile to use correctly"
fs-recon: $(fs_done)
resamp-anat: $(sd)/surf/lh.$(resamp_sval).$(resamp_target) $(sd)/surf/rh.$(resamp_sval).$(resamp_target)
tck: $(sd)/dwi/100k.tck
conn: $(sd)/dwi/counts.dk.txt $(sd)/dwi/lengths.dk.txt \
$(sd)/dwi/counts.destrieux.txt $(sd)/dwi/lengths.destrieux.txt \
$(sd)/dwi/counts.vep.txt $(sd)/dwi/lengths.vep.txt
conn_label: $(sd)/dwi/label_in_T1.dk.nii.gz $(sd)/dwi/label_in_T1.destrieux.nii.gz $(sd)/dwi/label_in_T1.vep.nii.gz
labeled_elec: $(sd)/elec/labeled_elec-$(elec_mode).nii.gz
elec: $(sd)/elec/seeg.xyz $(sd)/elec/img \
$(sd)/elec/elec.dk.png $(sd)/elec/gain_dipole_no-subcort.dk.txt \
$(sd)/elec/elec.destrieux.png $(sd)/elec/gain_dipole_no-subcort.destrieux.txt \
$(sd)/elec/elec.vep.png $(sd)/elec/gain_dipole_no-subcort.vep.txt \
$(sd)/elec/gain_inv-square.dk.txt $(sd)/elec/gain_volume.dk.txt \
$(sd)/elec/gain_inv-square.destrieux.txt $(sd)/elec/gain_volume.destrieux.txt \
$(sd)/elec/gain_inv-square.vep.txt $(sd)/elec/gain_volume.vep.txt
tvb: $(sd)/tvb/connectivity.dk.zip $(sd)/tvb/img/connectivity.dk.png \
$(sd)/tvb/connectivity.destrieux.zip $(sd)/tvb/img/connectivity.destrieux.png \
$(sd)/tvb/connectivity.vep.zip $(sd)/tvb/img/connectivity.vep.png
ez: $(sd)/tvb/ez_hypothesis.dk.txt $(sd)/tvb/img/ez_hypothesis.dk.png \
$(sd)/tvb/ez_hypothesis.destrieux.txt $(sd)/tvb/img/ez_hypothesis.destrieux.png \
$(sd)/tvb/ez_hypothesis.vep.txt $(sd)/tvb/img/ez_hypothesis.vep.png
vep: $(sd)/vep/data.R
mrinfo:
echo $(SUBJECT)
mrinfo $(T1)
mrinfo $(DWI)
clean:
rm -rf $(sd) $(SUBJECT)-T1_raw.nii.gz
nothing:
echo "doing nothing for subject $(SUBJECT) per request"
dag.png: Makefile make/FreeSurfer.mk make/Diffusion.mk make/StereoEEG.mk make/VEP.mk make/Utilities.mk
mkdir -p dag/t1 dag/dwi dag/elec dag/seeg
touch dag/elec/pos_vox.txt dag/elec/elec.nii.gz dag/patient.xlsx
make -Bnd SUBJECTS_DIR=. SUBJECT=dag DATA=. \
dag/mri/aparc+aseg.dk.mgz dag/mri/aparc+aseg.destrieux.mgz \
dag/dwi/t2d.mat \
dag/mri/aparc+aseg.dk.RAS.nii.gz dag/mri/aparc+aseg.destrieux.RAS.nii.gz \
dag/mri/aparc+aseg.dk.RAS.RO.nii.gz dag/mri/aparc+aseg.destrieux.RAS.RO.nii.gz \
dag/dwi/aparc+aseg.dk.nii.gz dag/dwi/aparc+aseg.destrieux.nii.gz \
dag/dwi/label.dk.mif dag/dwi/label.destrieux.mif \
dag/dwi/all.tck \
dag/dwi/triu_counts.dk.txt dag/dwi/triu_counts.destrieux.txt \
resamp-anat conn tvb elec seeg ez \
| make2graph \
| egrep -v "Makefile|make/.*\.mk" \
| sed '1 agraph [pad="0.5", nodesep="0.2", ranksep="1.7"];' \
| dot -Tpng -o dag.png
rm -r dag
docker:
cd docker && sudo docker build -t maedoc/tvb-make .
tmux:
tmux
notebook:
jupyter notebook --allow-root --ip=0.0.0.0
# }}}
# rules {{{
include $(here)/make/FreeSurfer.mk
include $(here)/make/Diffusion.mk
include $(here)/make/StereoEEG.mk
include $(here)/make/VEP.mk
include $(here)/make/Utilities.mk
#}}}
# user provided config file
-include $(CONFIG)
# vim: foldmethod=marker