-
Notifications
You must be signed in to change notification settings - Fork 8
/
rest_GRF_for_sliceview.m
executable file
·241 lines (189 loc) · 9.99 KB
/
rest_GRF_for_sliceview.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
function varargout = rest_GRF_for_sliceview(varargin)
% REST_GRF_FOR_SLICEVIEW MATLAB code for rest_GRF_for_sliceview.fig
% REST_GRF_FOR_SLICEVIEW, by itself, creates a new REST_GRF_FOR_SLICEVIEW or raises the existing
% singleton*.
%
% H = REST_GRF_FOR_SLICEVIEW returns the handle to a new REST_GRF_FOR_SLICEVIEW or the handle to
% the existing singleton*.
%
% REST_GRF_FOR_SLICEVIEW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in REST_GRF_FOR_SLICEVIEW.M with the given input arguments.
%
% REST_GRF_FOR_SLICEVIEW('Property','Value',...) creates a new REST_GRF_FOR_SLICEVIEW or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before rest_GRF_for_sliceview_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to rest_GRF_for_sliceview_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help rest_GRF_for_sliceview
% Last Modified by GUIDE v2.5 07-Sep-2012 23:40:51
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @rest_GRF_for_sliceview_OpeningFcn, ...
'gui_OutputFcn', @rest_GRF_for_sliceview_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_GRF_for_sliceview is made visible.
function rest_GRF_for_sliceview_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to rest_GRF_for_sliceview (see VARARGIN)
% Choose default command line output for rest_GRF_for_sliceview
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
movegui(handles.fig_GRFCorrection_SliceViewer, 'center');
% UIWAIT makes rest_GRF_for_sliceview wait for user response (see UIRESUME)
try
uiwait(handles.fig_GRFCorrection_SliceViewer);
catch
uiresume(handles.fig_GRFCorrection_SliceViewer);
end
% --- Outputs from this function are returned to the command line.
function varargout = rest_GRF_for_sliceview_OutputFcn(hObject, eventdata, handles)
% 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
if isempty(handles)
varargout{1}='';
varargout{2}='';
varargout{3}='';
varargout{4}='';
else
varargout{1} = handles.mask_file;
varargout{2} = handles.voxel_p;
varargout{3} = handles.cluster_p;
varargout{4} = handles.Is_two_tail;
delete(handles.fig_GRFCorrection_SliceViewer);
end
function Data_entry_Callback(hObject, eventdata, handles)
% hObject handle to Data_entry (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 Data_entry as text
% str2double(get(hObject,'String')) returns contents of Data_entry as a double
% --- Executes during object creation, after setting all properties.
function Data_entry_CreateFcn(hObject, eventdata, handles)
% hObject handle to Data_entry (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 Data_select_pushbutton.
function Data_select_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to Data_select_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function Mask_entry_Callback(hObject, eventdata, handles)
% hObject handle to Mask_entry (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 Mask_entry as text
% str2double(get(hObject,'String')) returns contents of Mask_entry as a double
% --- Executes during object creation, after setting all properties.
function Mask_entry_CreateFcn(hObject, eventdata, handles)
% hObject handle to Mask_entry (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 Mask_select_pushbutton.
function Mask_select_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to Mask_select_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[RESTPath , Filename , extn]=fileparts(which('rest.m'));
RESTMask=[RESTPath , filesep , 'mask'];
current_directory=pwd;
cd(RESTMask);
[mask_filename,mask_pathname]=uigetfile({'*.img;*.nii;*.nii.gz','Brain Image Files (*.img;*.nii;*.nii.gz)';'*.*', 'All Files (*.*)';}, ...
'Pick one mask file');
cd(current_directory);
mask_path=[mask_pathname,mask_filename];
if ischar(mask_path)
set(handles.Mask_entry,'string',mask_path);
end
function Voxel_P_entry_Callback(hObject, eventdata, handles)
% hObject handle to Voxel_P_entry (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 Voxel_P_entry as text
% str2double(get(hObject,'String')) returns contents of Voxel_P_entry as a double
% --- Executes during object creation, after setting all properties.
function Voxel_P_entry_CreateFcn(hObject, eventdata, handles)
% hObject handle to Voxel_P_entry (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 Cluster_P_entry_Callback(hObject, eventdata, handles)
% hObject handle to Cluster_P_entry (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 Cluster_P_entry as text
% str2double(get(hObject,'String')) returns contents of Cluster_P_entry as a double
% --- Executes during object creation, after setting all properties.
function Cluster_P_entry_CreateFcn(hObject, eventdata, handles)
% hObject handle to Cluster_P_entry (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 Run_pushbutton.
function Run_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to Run_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mask_file = get(handles.Mask_entry,'string');
if strcmp(mask_file,'Select mask for image (Default: NO MASK!!!)')
mask_file='';
end
handles.mask_file=mask_file;% Mask filename
handles.voxel_p = str2num(get(handles.Voxel_P_entry,'string'));% Voxel's p
handles.cluster_p = str2num(get(handles.Cluster_P_entry,'string'));% Cluster's p
handles.Is_two_tail=get(handles.Two_tail_radiobutton,'Value');
guidata(hObject, handles);
uiresume(handles.fig_GRFCorrection_SliceViewer);
% --- Executes when selected object is changed in uipanel1.
function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanel1
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
is_two_tag=get(handles.Two_tail_radiobutton , 'Value');
if is_two_tag
uiwait(msgbox('The "two-tailed" option is doing as following (e.g., if set VoxelPThreshold = 0.01 and cluster level p<0.05): 1) Get Group A > Group B, set Z>2.576 (two-tailed p <0.01) and cluster level p<0.025 2) Get Group A < Group B, set a Z<-2.576 (two-tailed p <0.01) and cluster level p<0.025. 3) Add 1 and 2 together, which could ensure the total p<0.05.','Two-tailed'));
end