ctf_read_gui.m
来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 448 行 · 第 1/2 页
M
448 行
function [ctf,GUI] = ctf_read_gui(command);% ctf_read_gui - GUI interface to read data from a CTF .ds folder%% [ctf,FIG] = ctf_read_gui( [command] );% % eg,% ctf = ctf_read_gui;% % ctf struct has fields:%% ctf.folder% ctf.header% ctf.setup% ctf.sensor% ctf.data%% This function calls:% ctf_read_res4 - to read in header, gain/offset, and sensor information% ctf_read_meg4 - to read in the data% % <>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %% < > % % < DISCLAIMER: > %% < > %% < THIS PROGRAM IS INTENDED FOR RESEARCH PURPOSES ONLY. > %% < THIS PROGRAM IS IN NO WAY INTENDED FOR CLINICAL OR > %% < OFFICIAL USE. > %% < > %% <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<> %%% $Revision: 1.3 $ $Date: 2004/07/18 06:10:17 $% Copyright (C) 2004 Darren L. Weber% % This program is free software; you can redistribute it and/or% modify it under the terms of the GNU General Public License% as published by the Free Software Foundation; either version 2% of the License, or (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.% Modified: 11/2003, Darren.Weber_at_radiology.ucsf.edu% - modified from NIH code% simply to allocate data into one large struct%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if ~exist('command','var'), command = 'init'; end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Paint the GUI%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%switch command, case 'init', [ctf,GUI] = INIT; case 'update', CTFopen = get(gcbf,'Userdata'); ctf = CTFopen.ctf; % update the folder set(CTFopen.handles.EctfFolder,'String',ctf.folder); CTFopen.CHANNELS = 1:ctf.setup.number_channels; CTFopen.TIME = ctf.setup.time_sec; CTFopen.TRIALS = 1:ctf.setup.number_trials; % update the channels channelvalue = get(CTFopen.handles.PctfCHANNELS,'Value'); channeltype = CTFopen.channeltypes{channelvalue}; switch channeltype, case 'all', CTFopen.CHANNELS = 1:ctf.setup.number_channels; case 'eeg', CTFopen.CHANNELS = ctf.sensor.index.eeg; case 'meg', CTFopen.CHANNELS = ctf.sensor.index.meg; case 'ref', CTFopen.CHANNELS = ctf.sensor.index.ref; case 'other', CTFopen.CHANNELS = ctf.sensor.index.other; otherwise, CTFopen.CHANNELS = []; end; set(CTFopen.handles.EctfCHANNELS,'value',CTFopen.CHANNELS); set(CTFopen.handles.EctfCHANNELS,'string',num2str(CTFopen.CHANNELS)); % update time start = sprintf('%6.5f', CTFopen.TIME(1)); step = sprintf('%6.5f',[CTFopen.TIME(2) - CTFopen.TIME(1)]); stop = sprintf('%6.5f', CTFopen.TIME(end)); timestring = [start,':',step,':',stop]; set(CTFopen.handles.TctfTIME,'String',timestring); set(CTFopen.handles.EctfTIME,'Value',CTFopen.TIME); set(CTFopen.handles.EctfTIME,'String',num2str(CTFopen.TIME')); % update trials start = num2str(CTFopen.TRIALS(1)); stop = num2str(CTFopen.TRIALS(end)); trialstring = [start,':',stop]; set(CTFopen.handles.TctfTRIALS,'String',trialstring); set(CTFopen.handles.EctfTRIALS,'Value',CTFopen.TRIALS); set(CTFopen.handles.EctfTRIALS,'String',num2str(CTFopen.TRIALS)); set(CTFopen.handles.EctfTRIALS,'Value',CTFopen.TRIALS); set(gcbf,'Userdata',CTFopen); case 'return', CTFopen = get(gcbf,'Userdata'); ctf = CTFopen.ctf; CHANNELS = CTFopen.CHANNELS; TIME = CTFopen.TIME; TRIALS = CTFopen.TRIALS; ctf = ctf_read_meg4(ctf.folder, ctf, CHANNELS, TIME, TRIALS ); close gcbf; case 'plot', fprintf('\nCTF_GUI_READ: Plot not implemented yet.\n'); % CTFopen = get(gcbf,'Userdata');% % CTFopen.p = ctf_open(CTFopen.p,CTFopen.gui);% set(CTFopen.gui,'Userdata',CTFopen); % update GUI with CNT data% % p = gui_updateparent(CTFopen,0);% % if isequal(get(CTFopen.handles.Bhold,'Value'),0),% close gcbf;% if isfield(CTFopen,'parent'),% parent = CTFopen.parent.gui;% else% parent = [];% end% else% parent = CTFopen.gui;% end% % plotfig = figure('Name',CTFopen.p.ctf.file,...% 'NumberTitle','off',...% 'UserData',CTFopen.p);% movegui(plotfig,'center');% % plot(CTFopen.p.ctf.timeArray,CTFopen.p.ctf.data); axis tight;% eeg_plot_metric;% % if isempty(parent), [Xpoint,Ypoint] = eeg_crosshair('init',CTFopen.p);% else [Xpoint,Ypoint] = eeg_crosshair('init',CTFopen.p,parent);% end case 'save', fprintf('\nCTF_GUI_READ: Save not implemented yet.\n'); otherwise, CTFopen = get(gcbf,'Userdata'); GUI.parent = CTFopen.parent; gui_updateparent(GUI); close gcbf; endreturn%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [ctf,GUI] = INIT% GUI General Parametersctf = ctf_folder;ctf = ctf_read_res4(ctf.folder);% check if the data is greater than 500 Mbdata_size = ctf.setup.number_samples * ctf.setup.number_channels * ctf.setup.number_trials;data_bytes = data_size * 8;if data_bytes > 5e9, warning('data is greater than 500 Mb'); endclear data_size data_bytes;CTFopen.CHANNELS = 1:ctf.setup.number_channels;CTFopen.TIME = ctf.setup.time_sec;CTFopen.TRIALS = 1:ctf.setup.number_trials;GUIwidth = 800;GUIheight = 150;ver = '$Revision: 1.3 $';name = sprintf('CTF Open [v %s]\n',ver(11:15));GUI = figure('Name',name,'Tag','CTF_OPEN',... 'NumberTitle','off',... 'MenuBar','none','Position',[1 1 GUIwidth GUIheight]);movegui(GUI,'center');%Font.FontName = 'Helvetica';Font.FontUnits = 'Pixels';Font.FontSize = 12;Font.FontWeight = 'normal';Font.FontAngle = 'normal';
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?