forked from CyclotronResearchCentre/FASST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrc_main.m
308 lines (267 loc) · 11.8 KB
/
crc_main.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
function varargout = crc_main(varargin)
%__________________________________________________________________________
% ________ _____________ ___
% / __ _/ |/ ___/_/_ __/|__ \
% / /_ / /| |\__ \ \ / / __/ /
% / __// ___ |__/ / // / _ / __/
% /_/ /_/ |_|___/_//_/ (_)____/
%
% fMRI Artefact removal and Sleep Scoring Toolbox, FASST.2
% http://www.montefiore.ulg.ac.be/~phillips/FASST.html
%__________________________________________________________________________
%
% CRC_MAIN M-file for crc_main.fig
% CRC_MAIN, by itself, creates a new CRC_MAIN or raises the existing
% singleton.
%
% H = CRC_MAIN returns the handle to a new CRC_MAIN or the handle to
% the existing singleton*.
%
% CRC_MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CRC_MAIN.M with the given input arguments.
%
% CRC_MAIN('Property','Value',...) creates a new CRC_MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before crc_main_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to crc_main_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
%__________________________________________________________________
% Copyright (C) 2009 Cyclotron Research Centre
% Written by Y. Leclercq & C. Phillips, 2008.
% Cyclotron Research Centre, University of Liege, Belgium
% $Id$
% Edit the above text to modify the response to help crc_main
% Last Modified by GUIDE v2.5 15-Oct-2009 11:43:00
% Display ASCII Welcome
disp(' ');
disp(' ________ _____________ ___ ');
disp(' / ____/ |/ ___/_/_ __/|__ \ ');
disp(' / /_ / /| |\__ \ \ / / __/ / ');
disp(' / __// ___ |__/ / // / _ / __/ ');
disp(' /_/ /_/ |_|___/_//_/ (_)____/ ');
disp(' ');
disp(' fMRI Artefact removal and Sleep Scoring Toolbox, FASST.2 ');
disp(' http://www.montefiore.ulg.ac.be/~phillips/FASST.html ');
disp(' An SPM8-compatible toolbox. ');
fprintf('\n');
% Check if SPM is available, and maybe more one day...
ok = check_installation;
if ~ok
beep
fprintf('INSTALLATION PROBLEM!');
return
end
% Add the fieldtrip toolbox from SPM, if necessary
if ~exist('ft_defaults','file')
addpath(fullfile(spm('Dir'),'external','fieldtrip'));
end
ft_defaults;
% Check for Signal Processing Toolbox
persistent flag_TBX
if isempty(flag_TBX)
flag_TBX = license('checkout','signal_toolbox');
if ~flag_TBX
pth = fullfile(spm_str_manip(mfilename('fullpath'),'h'),'SPTfunctions');
addpath(pth)
disp(['warning: using freely distributed equivalent to filtering functions ', ...
'as Signal Processing Toolbox is not available.']);
end
end
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @crc_main_OpeningFcn, ...
'gui_OutputFcn', @crc_main_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 crc_main is made visible.
function crc_main_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 crc_main (see VARARGIN)
[A] = imread('LOGO_Simple.png','BackgroundColor',0.94*[1 1 1]);
image(A)
axis off
% Choose default command line output for crc_main
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes crc_main wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = crc_main_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
varargout{1} = handles.output;
% --- Executes on button press in push_dis_main.
function push_dis_main_Callback(hObject, eventdata, handles)
% hObject handle to push_dis_main (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%delete(handles.figure1)
dis_selchan;
% --- Executes on button press in push_dis_cmp.
function push_dis_cmp_Callback(hObject, eventdata, handles)
% hObject handle to push_dis_cmp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% flags.multcomp=1;
% setappdata(hObject,'multcomp',1);
flags.multcomp=1;
dis_selchan(flags);
% --- Executes on button press in push_credits.
function push_credits_Callback(hObject, eventdata, handles)
% hObject handle to push_credits (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fig = figure;
set(fig,'Position',[73 145 398 503])
set(fig,'NumberTitle','off')
set(fig,'Name','License & Copyright')
h = axes('Position',[0 0 1 1],'Visible','off');
str{1}= 'Please refer to this version as "FASST, fMRI Artefact Removal and';
str{2}= 'Sleep scoring Toolbox" in papers and communication';
str{3}= ' ';
str{4}= '_____________________________________________________________________';
str{5}= ' ';
str{6}= '';
str{7}= 'For bug reports, contact directly';
str{8}= '';
str{9}= 'Jessica Schrouff, [email protected]';
str{10}='Dorothée Coppieters, [email protected]';
str{11}='Christophe Phillips, [email protected]';
str{12}=' ';
str{13}='Feel free to submit add-ons to this toolbox';
str{14}='but please note that support will not be provided for';
str{15}='"home-made" changes of the distributed code.';
str{16}=' ';
str{17}='More details are available on';
str{18}=' http://www.montefiore.ulg.ac.be/~phillips/FASST.html';
str{19}=' ';
str{20}='Reference:';
str{21}=' Y. Leclercq, J. Schrouff, Q. Noirhomme, P. Maquet, C. Phillips,';
str{22}=' "fMRI Artefact rejection and Sleep Scoring Toolbox",';
str{23}=' Computational Intelligence and Neuroscience, 2011,';
str{24}=' http://www.hindawi.com/journals/cin/2011/598206/';
str{25}='___________________________________________________________________';
str{26}=' ';
str{27}='FASST is developed by the Cyclotron Research Centre, part of';
str{28}='the University of Liege (ULg), BE. This work is supported by the ';
str{29}='FRS-FNRS, the Queen Elizabeth''s funding and the University of Liege.';
str{30}=' ';
str{31}='___________________________________________________________________';
str{32}=' ';
str{33}='FASST (being the collection of files given in the manifest in the';
str{34}='Contents.m file) is free but copyright software, distributed under the';
str{35}='terms of the GNU General Public Licence as published by the Free Software';
str{36}='Fundation (either version 2, as given in file CRC_LICENCE.man or at your';
str{37}='option, any later version). Further details on "copyleft" can be found at';
str{38}='http://www.gnu.org/copyleft/';
str{39}=' ';
str{40}='___________________________________________________________________';
str{41}='Copyright (C) 2010 Cyclotron Research Centre, University of Liege';
str{42}=' ';
text(.025,.5,str,'FontSize',8)
% --- Executes on button press in push_concatenate.
function push_concatenate_Callback(hObject, eventdata, handles)
% hObject handle to push_concatenate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_concatenate;
% --- Executes on button press in push_disfrqcomp.
function push_disfrqcomp_Callback(hObject, eventdata, handles)
% hObject handle to push_disfrqcomp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
dis_frqcomp;
% --- Executes on button press in push_freqplot.
function push_freqplot_Callback(hObject, eventdata, handles)
% hObject handle to push_freqplot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
dis_frq;
% --- Executes on button press in push_crcgar.
function push_crcgar_Callback(hObject, eventdata, handles)
% hObject handle to push_crcgar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_gar;
% --- Executes on button press in push_crcpar.
function push_crcpar_Callback(hObject, eventdata, handles)
% hObject handle to push_crcpar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_par;
% --- Executes on button press in push_score.
function push_score_Callback(hObject, eventdata, handles)
% hObject handle to push_score (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
dis_selchan;
% --- Executes on button press in push_freqplotstat.
function push_freqplotstat_Callback(hObject, eventdata, handles)
% hObject handle to push_freqplotstat (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
dis_frq;
% --- Executes on button press in push_chunk.
function push_chunk_Callback(hObject, eventdata, handles)
% hObject handle to push_chunk (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_chunks;
% --- Executes on button press in sws.
function sws_Callback(hObject, eventdata, handles)
% hObject handle to sws (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_wave_detection;
function push_batch_Callback(hObject, eventdata, handles)
% hObject handle to push_chunk (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crc_batch;
%% SUBFUNCTION
function ok = check_installation
% function to check installation state of toolbox,
% particullarly the SPM path setup
ok = true;
% Check SPM installation
if exist('spm.m','file')
[SPMver, SPMrel] = spm('Ver');
if ~(strcmpi(SPMver,'spm8') && str2double(SPMrel)>8.5) && ...
~strcmpi(SPMver,'spm12b')
beep
fprintf('\nERROR:\n')
fprintf('\tThe *latest* version of SPM8 or SPM12b should be installed on your computer,\n')
fprintf('\tand be available on MATLABPATH!\n\n')
ok = false;
end
else
beep
fprintf('\nERROR:\n')
fprintf('\tThe *latest* version of SPM8 should be installed on your computer,\n')
fprintf('\tand be available on MATLABPATH!\n\n')
ok = false;
end
return