-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbx_cfg_MEHBfmri.m
184 lines (161 loc) · 6.09 KB
/
tbx_cfg_MEHBfmri.m
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
function MEHBfmri = tbx_cfg_MEHBfmri
if ~isdeployed, addpath(fullfile(spm('dir'),'toolbox','MEHBfMRI')); end
% Echo data
%---------------------------------------
func = cfg_files;
func.tag = 'func';
func.name = 'Functional data';
func.filter = 'image';
func.ufilter = '.*';
func.num = [1 Inf];
func.help = {'Select the fMRI data.'};
te = cfg_entry;
te.tag = 'te';
te.name = 'TE (ms)';
te.help = {'TE in ms'};
te.val = {};
te.strtype = 'r';
te.num = [1 1];
%--------------------------------------------------------------------------
% subj Subject
%--------------------------------------------------------------------------
tedat = cfg_branch;
tedat.tag = 'tedat';
tedat.name = 'Data';
tedat.val = {func te};
tedat.help = {'Data for each echo.'};
%--------------------------------------------------------------------------
% TE Data
%--------------------------------------------------------------------------
tefmri = cfg_repeat;
tefmri.tag = 'data';
tefmri.name = 'TE data';
tefmri.help = {'List of echoes'};
tefmri.values = {tedat};
tefmri.num = [1 Inf];
%--------------------------------------------------------------------------
% Method
%--------------------------------------------------------------------------
method = cfg_menu;
method.tag = 'method';
method.name = 'Method';
method.help = {
['The weighting method to combine the different echo images ' ...
'(w1*S1 + w2*S2 + ...)/(w1 + w2 + ...)']
'AVE: simple averaging (wi=1)'
'BS: BOLD sensitivity (wi=TEi)'
'tSNR: temporal SNR (wi=tSNRi)'
'tBS: temporal BOLD sensitivity (wi=tSNRi * TEi)'
'T2* weighted: T2* weighted based on a T2* map determined per dynamic (wi(t)=TEi * exp(-TEi/T2*(t)))'
'T2* mapping: T2* mapping per dynamic'
}';
method.labels = {
'AVE'
'BS'
'tSNR'
'tBS'
'T2* weighted'
'T2* mapping'
}';
method.values = {0 1 2 3 4 5};
method.val = {5};
%--------------------------------------------------------------------------
% Corregistration
%--------------------------------------------------------------------------
correg = cfg_menu;
correg.tag = 'correg';
correg.name = 'Corregistration per echo?';
correg.help = {
['Should each echo be corregistered to the first echo per dynamic?']
}';
correg.labels = {
'Yes'
'No'
}';
correg.values = {1 0};
correg.val = {0};
% Main structure ME-fMRI
%---------------------------------------
mems_fmri = cfg_exbranch;
mems_fmri.tag = 'mems_fmri';
mems_fmri.name = 'Combine echoes for Muli-Echo fMRI';
mems_fmri.help = {'This function combines the multiple echoes from a ME-fMRI experiment'};
mems_fmri.val = {tefmri method correg};
mems_fmri.prog = @(job)vout_memsfmri('run',job);
mems_fmri.vout = @(job)vout_memsfmri('vout',job);
%--------------------------------------------------------------------------
% scans Session
%--------------------------------------------------------------------------
scans = cfg_files;
scans.tag = 'scans';
scans.name = 'Session';
scans.help = {'Select images to slice-time correct.'};
scans.filter = 'image';
scans.ufilter = '.*';
scans.num = [1 Inf];
scans.preview = @(f) spm_check_registration(char(f));
%--------------------------------------------------------------------------
% Slice time correction
%--------------------------------------------------------------------------
SliceT = cfg_entry;
SliceT.tag = 'SliceT';
SliceT.name = 'Slice Timings';
SliceT.help = {'Give the slice timings in seconds (see json file)'};
SliceT.val = {};
SliceT.strtype = 'r';
SliceT.num = [1 Inf];
TR = cfg_entry;
TR.tag = 'TR';
TR.name = 'TR (s)';
TR.help = {'Enter the TR in s.'};
TR.strtype = 'r';
TR.num = [1 1];
refslice = cfg_entry;
refslice.tag = 'refslice';
refslice.name = 'Reference Slice';
refslice.help = {'Enter the reference slice.'};
refslice.strtype = 'r';
refslice.num = [1 1];
prefix = cfg_entry;
prefix.tag = 'prefix';
prefix.name = 'Filename Prefix';
prefix.help = {'Specify the string to be prepended to the filenames of the slice-time corrected image file(s).','Default prefix is ''a''.'};
prefix.strtype = 's';
prefix.num = [1 Inf];
prefix.def = @(val)spm_get_defaults('slicetiming.prefix', val{:});
% Main structure Slice Time Correction
%---------------------------------------
stcor = cfg_exbranch;
stcor.tag = 'stcor';
stcor.name = 'Slice time correction for HyperBand';
stcor.help = {'This function is the addapted slice time correction for when using HyperBand'};
stcor.val = {scans SliceT TR refslice prefix};
stcor.prog = @(job)vout_stcor('run',job);
stcor.vout = @(job)vout_stcor('vout',job);
% Main structure of the toolbox
%---------------------------------------
MEHBfmri = cfg_choice;
MEHBfmri.tag = 'MEHBfmri';
MEHBfmri.name = 'Multi echo & HyperBand';
MEHBfmri.help = {'This toolbox is meant to do the extra processing steps when using multi-echo fMRI or HypperBand'};
MEHBfmri.values = {mems_fmri stcor};
function out = vout_memsfmri(cmd,job)
switch lower(cmd)
case 'run'
out.files=mems_fmri_run(job);
case 'vout'
out(1) =cfg_dep;
out(1).sname =sprintf('MEMS fMRI files');
out(1).src_output=substruct('.','files');
out(1).tgt_spec =cfg_findspec({{'filter','image','strtype','e'}});
end
function out = vout_stcor(cmd,job)
switch lower(cmd)
case 'run'
out.files=stcor_run(job);
case 'vout'
out(1) =cfg_dep;
out(1).sname =sprintf('Slice time correction files');
out(1).src_output=substruct('.','files');
out(1).tgt_spec =cfg_findspec({{'filter','image','strtype','e'}});
end