-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrest_FDR_gui.m
executable file
·227 lines (181 loc) · 7.85 KB
/
rest_FDR_gui.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
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
function varargout = rest_FDR_gui(varargin)
% varargout = rest_FDR_gui(varargin)
% GUI for setting parameters for false discovery rate (FDR) correction.
% Input: Q-value, Mask filename, Conproc, Tchoose.
% Output: Q-value, Mask filename, Conproc, Tchoose.
% By YAN Chao-Gan and Dong Zhang-Ye 100201.
% State Key Laboratory of Cognitive Neuroscience and Learning, Beijing Normal University, China, 100875
% http://www.restfmri.net
% Mail to Authors: <a href="[email protected]">YAN Chao-Gan</a>; <a href="[email protected]">DONG Zhang-Ye</a>
% Version=1.0;
% Release=20100201;
%------------------------------------------------------------------------------------------------------------------------------
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @rest_FDR_gui_OpeningFcn, ...
'gui_OutputFcn', @rest_FDR_gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before rest_FDR is made visible.
function rest_FDR_gui_OpeningFcn(hObject, eventdata, handles, varargin)
if ~isempty(varargin),
handles.Qvalue =varargin{1};
handles.Qmaskname =varargin{2};
handles.Conproc =varargin{3};
handles.Tchoose =varargin{4};
else
error('There must be 3 parameters at least!');
end
InitControls(hObject, handles);
% Make Display correct in linux - YAN Chao-Gan 111025 Added.
if ~ispc
ZoomFactor=0.85;
ObjectNames = fieldnames(handles);
for i=1:length(ObjectNames);
eval(['IsFontSizeProp=isprop(handles.',ObjectNames{i},',''FontSize'');']);
if IsFontSizeProp
eval(['PCFontSize=get(handles.',ObjectNames{i},',''FontSize'');']);
FontSize=PCFontSize*ZoomFactor;
eval(['set(handles.',ObjectNames{i},',''FontSize'',',num2str(FontSize),');']);
end
end
end
% Update handles structure
guidata(hObject, handles);
try
uiwait(handles.figFDR);
catch
uiresume(handles.figFDR);
end
% UIWAIT makes rest_FDR wait for user response (see UIRESUME)
% uiwait(handles.figFDR);
% --- Outputs from this function are returned to the command line.
function varargout = rest_FDR_gui_OutputFcn(hObject, eventdata, handles)
if isempty(handles)%Added by Sandy to fix a bug when kill the FDR window
varargout{1} = '';
varargout{2} = '';
varargout{3} = '';
varargout{4} = '';
else
varargout{1} = handles.Qvalue;
varargout{2} = handles.Qmaskname;
varargout{3} = handles.Conproc;
varargout{4} = handles.Tchoose;
delete(handles.figFDR);
end
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
% --- Executes on button press in rtnIndependT.
function rtnIndependT_Callback(hObject, eventdata, handles)
handles.Conproc =1;
guidata(hObject, handles);
set(handles.rtnIndependT,'Value',1);
set(handles.rtnDepentT,'Value',0);
drawnow;
% --- Executes on button press in rtnDepentT.
function rtnDepentT_Callback(hObject, eventdata, handles)
handles.Conproc =2;
guidata(hObject, handles);
set(handles.rtnIndependT,'Value',0);
set(handles.rtnDepentT,'Value',1);
guidata(hObject, handles);
drawnow;
function edtQvalue_Callback(hObject, eventdata, handles)
% hObject handle to edtQvalue (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edtQvalue as text
% str2double(get(hObject,'String')) returns contents of edtQvalue as a double
% --- Executes during object creation, after setting all properties.
function edtQvalue_CreateFcn(hObject, eventdata, handles)
% hObject handle to edtQvalue (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edtMaskFile_Callback(hObject, eventdata, handles)
% hObject handle to edtMaskFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edtMaskFile as text
% str2double(get(hObject,'String')) returns contents of edtMaskFile as a double
% --- Executes during object creation, after setting all properties.
function edtMaskFile_CreateFcn(hObject, eventdata, handles)
% hObject handle to edtMaskFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in btnOK.
function btnOK_Callback(hObject, eventdata, handles)
handles.Qvalue=str2double(get(handles.edtQvalue, 'String'));
handles.Qmaskname=get(handles.edtMaskFile, 'String');
guidata(hObject, handles);
uiresume(handles.figFDR);
function btnMaskFile_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.img;*.nii;*.nii.gz','Brain Image Files (*.img;*.nii;*.nii.gz)';'*.*', 'All Files (*.*)';}, ...
'Pick a user''s mask');
if ~(filename==0)
handles.Qmaskname =[pathname filename];
end
set(handles.edtMaskFile,'String',handles.Qmaskname);
guidata(hObject, handles);
function InitControls(hObject, handles)
if handles.Conproc == 1
set(handles.rtnIndependT,'Value',1);
set(handles.rtnDepentT,'Value',0);
else
set(handles.rtnIndependT,'Value',0);
set(handles.rtnDepentT,'Value',1);
end
if handles.Tchoose == 1
set(handles.rtnOnetail,'Value',1);
set(handles.rtnTwetail,'Value',0);
% set(handles.rtnIndependT,'Enable','off'); %YAN Chao-Gan, 100201
% set(handles.rtnDepentT,'Enable','off'); %YAN Chao-Gan, 100201
else
set(handles.rtnTwetail,'Value',1);
set(handles.rtnOnetail,'Value',0);
% set(handles.rtnIndependT,'Enable','on'); %YAN Chao-Gan, 100201
% set(handles.rtnDepentT,'Enable','on'); %YAN Chao-Gan, 100201
end
set(handles.edtMaskFile,'String',handles.Qmaskname);
set(handles.edtQvalue,'String',num2str(handles.Qvalue));
guidata(hObject, handles);
% --- Executes on button press in rtnOnetail.
function rtnOnetail_Callback(hObject, eventdata, handles)
handles.Tchoose =1;
guidata(hObject, handles);
set(handles.rtnOnetail,'Value',1);
set(handles.rtnTwetail,'Value',0);
% set(handles.rtnIndependT,'Enable','off'); %YAN Chao-Gan, 100201
% set(handles.rtnDepentT,'Enable','off'); %YAN Chao-Gan, 100201
drawnow;
% --- Executes on button press in rtnTwetail.
function rtnTwetail_Callback(hObject, eventdata, handles)
handles.Tchoose =2;
guidata(hObject, handles);
set(handles.rtnOnetail,'Value',0);
set(handles.rtnTwetail,'Value',1);
% set(handles.rtnIndependT,'Enable','on'); %YAN Chao-Gan, 100201
% set(handles.rtnDepentT,'Enable','on'); %YAN Chao-Gan, 100201
drawnow;