forked from nadegecorbin/hMRI-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbx_scfg_hmri_QUIQI_build.m
152 lines (132 loc) · 5.83 KB
/
tbx_scfg_hmri_QUIQI_build.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
function quiqi_build=tbx_scfg_hmri_QUIQI_build
%
% PURPOSE: Compute dictionaries of covariance matrices from the motion
% degradation index.The disctionary will be used by spm_reml.m or
% spm_reml_sc.m to account for heteroscedasticity of the data.
% See " reference to the paper " for more details
%
%
% METHODS: SPM.mat created when designing the model is modified to add in
% SPM.xVi.Vi the dictionary of covariance matrices.
%
%_______________________________________________________________________
% Nad?ge Corbin
% 2021.03.30
% Centre de R?sonance Magn?tique des Syst?mes Biologiques, Bordeaux, France
% ======================================================================
% ---------------------------------------------------------------------
% SPM.mat file
% ---------------------------------------------------------------------
spm_mat_file = cfg_files;
spm_mat_file.tag = 'spm_mat_file';
spm_mat_file.name = 'SPM.mat file';
spm_mat_file.help = {'Select the SPM.mat file containing the design of the model '};
spm_mat_file.ufilter = '^SPM.mat$';
spm_mat_file.num = [1 1];
% ---------------------------------------------------------------------
% Power of the MDI included in the dictionary
% ---------------------------------------------------------------------
lambda = cfg_entry;
lambda.tag = 'lambda';
lambda.name = 'MDI powers ';
lambda.val = {[0]};
lambda.strtype = 'e';
lambda.num = [1 Inf];
lambda.help = {['Specify the powers of the MDI to include in the dictionary.',...
'Vector of integers is expected. By default, a power of 0 is used,'...
'equivalent to the OLS case ']};
% ---------------------------------------------------------------------
% MDI json files
% ---------------------------------------------------------------------
MDIfname = cfg_files;
MDIfname.tag = 'filename';
MDIfname.name = 'filename';
MDIfname.help = {'Select a list of json files containing the quality assessment of the qMRI maps (one file per participant) '};
MDIfname.ufilter = 'hMRI_map_creation_quality_assessment.json$';
MDIfname.num = [1 Inf];
%----------------------------------------------------------------------
% MDI to be selected from the json file
% ---------------------------------------------------------------------
MTw = cfg_menu;
MTw.tag = 'MTw';
MTw.name = 'MTw';
MTw.help = {'MDI from MTw images'};
MTw.labels = {'yes' 'no'};
MTw.values = {true false};
MTw.val = {false};
T1w = cfg_menu;
T1w.tag = 'T1w';
T1w.name = 'T1w';
T1w.help = {'MDI from T1w images'};
T1w.labels = {'yes' 'no'};
T1w.values = {true false};
T1w.val = {false};
PDw = cfg_menu;
PDw.tag = 'PDw';
PDw.name = 'PDw';
PDw.help = {'MDI from PDw images'};
PDw.labels = {'yes' 'no'};
PDw.values = {true false};
PDw.val = {true};
%----------------------------------------------------------------------
% Data Type
% ---------------------------------------------------------------------
MDISource = cfg_branch;
MDISource.tag = 'MDIsource';
MDISource.name = 'MDI source';
MDISource.help = {'Use MDI obtained from PD weighted images, T1 weighted',...
'images, MT weighted image or a combination '};
MDISource.val = {PDw T1w MTw};
% ---------------------------------------------------------------------
% MDI values
% ---------------------------------------------------------------------
MDIvalues = cfg_entry;
MDIvalues.tag = 'MDIvalues';
MDIvalues.name = 'MDI values';
MDIvalues.val = {[ones(10,1) 2*ones(10,1)]};
MDIvalues.strtype = 'e';
MDIvalues.num = [Inf Inf];
MDIvalues.help = {['Specify the Motion Degradation Index ',...
'for each participant (one line per participant). Several columns ',...
'can be used if several MDI are available (For example, T1 maps have ',...
'2 MDI available for each participant , one from the PDw images and ',...
'another one from the T1w images']};
%----------------------------------------------------------------------
% MDI json file
% ---------------------------------------------------------------------
MDIjson = cfg_branch;
MDIjson.tag = 'MDIjsonfile';
MDIjson.name = 'MDI jsonfile';
MDIjson.help = {'For this type, the user will provide a list of json file'};
MDIjson.val = {MDIfname MDISource};
%----------------------------------------------------------------------
% MDI matrix type
% ---------------------------------------------------------------------
MDImatrix = cfg_branch;
MDImatrix.tag = 'MDImatrix';
MDImatrix.name = 'MDI matrix';
MDImatrix.help = {'For this type, the user will provide a matrix of MDI'};
MDImatrix.val = {MDIvalues};
%----------------------------------------------------------------------
% MDI type
% ---------------------------------------------------------------------
MDItype = cfg_choice;
MDItype.tag = 'MDItype';
MDItype.name = 'MDI type';
MDItype.help = {'Type of MDI data. The user can provide a matrix of MDI',...
'values or provide a list of json files containing the information'};
MDItype.values = {MDImatrix MDIjson };
MDItype.val = {MDImatrix};
% ---------------------------------------------------------------------
% Compute dictionnary of covariance matrices based on the otion degradation
% index
% ---------------------------------------------------------------------
quiqi_build = cfg_exbranch;
quiqi_build.tag = 'quiqi_build';
quiqi_build.name = 'QUIQI BUILD';
quiqi_build.val = { spm_mat_file lambda MDItype};
quiqi_build.help = {'Given the MDI index of each participant, a dictionary of'...
'covariance matrices is built and stored in SPM.xVi.Vi. this dictionary',...
'will be used subsequently by spm_reml.m or spm_reml_sc.m to account for',...
'the heteroscedasticity of the data when estimating the model parameters '};
quiqi_build.prog = @hmri_quiqi_build;