image thumbnail

eogui – a software to analyze electro-oculogram (EOG) recordings

by

 

10 Aug 2011 (Updated )

detects blinks and saccadic eye movements in EOG recordings

filterdlg.m
function varargout = filterdlg(varargin)
% $Id: filterdlg.m 6 2004-12-13 12:28:39Z maik $

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @filterdlg_OpeningFcn, ...
                   'gui_OutputFcn',  @filterdlg_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 filterdlg is made visible.
function filterdlg_OpeningFcn(hObject, eventdata, handles, varargin)

% Choose default command line output for filterdlg
handles.output = [];

if(nargin>3)
  filt=varargin{1};
  set(handles.eName,'String',filt.name);
  if(filt.isvert)
      set(handles.cbV,'Value',get(handles.cbV,'Max'));
  end
  if(filt.ishori)
      set(handles.cbH,'Value',get(handles.cbH,'Max'));
  end


  if(filt.isminamp)
      set(handles.cbMinA,'Value',get(handles.cbMinA,'Max'));
      set(handles.eMinA,'String',num2str(filt.minamp));
  end  
  if(filt.ismaxamp)
      set(handles.cbMaxA,'Value',get(handles.cbMaxA,'Max'));
      set(handles.eMaxA,'String',num2str(filt.maxamp));
  end



  if(filt.ismindauer)
      set(handles.cbMinD,'Value',get(handles.cbMinD,'Max'));
      set(handles.eMinD,'String',num2str(filt.mindauer));
  end  
  if(filt.ismaxdauer)
      set(handles.cbMaxD,'Value',get(handles.cbMaxD,'Max'));
      set(handles.eMaxD,'String',num2str(filt.maxdauer));
  end

  
   
  if(filt.ismingeschw)
      set(handles.cbMinG,'Value',get(handles.cbMinG,'Max'));
      set(handles.eMinG,'String',num2str(filt.mingeschw));
  end  
  if(filt.ismaxgeschw)
      set(handles.cbMaxG,'Value',get(handles.cbMaxG,'Max'));
      set(handles.eMaxG,'String',num2str(filt.maxgeschw));
  end

  
  
  
      
  
end

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes filterdlg wait for user response (see UIRESUME)
uiwait(handles.figure1);




% --- Outputs from this function are returned to the command line.
function varargout = filterdlg_OutputFcn(hObject, eventdata, handles) 
if(isfield(handles,'output'))      
    varargout{1} = handles.output;    
else
    varargout{1} = [];
end

if(isfield(handles,'figure1'))      
    close(handles.figure1);    
end

    





% --- Executes on button press in cbMinA.
function cbMinA_Callback(hObject, eventdata, handles)


function eMinA_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
function eMinA_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function eMaxA_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function eMaxA_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function eMinD_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function eMinD_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function eMaxD_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
function eMaxD_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in cbMaxA.
function cbMaxA_Callback(hObject, eventdata, handles)

% --- Executes on button press in cbMinD.
function cbMinD_Callback(hObject, eventdata, handles)


% --- Executes on button press in cbMaxD.
function cbMaxD_Callback(hObject, eventdata, handles)



function eMinG_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function eMinG_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function eMaxG_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
function eMaxG_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in cbMinG.
function cbMinG_Callback(hObject, eventdata, handles)

% --- Executes on button press in cbMaxG.
function cbMaxG_Callback(hObject, eventdata, handles)

% --- Executes on button press in cbH.
function cbH_Callback(hObject, eventdata, handles)


% --- Executes on button press in cbV.
function cbV_Callback(hObject, eventdata, handles)


% --- Executes on button press in bOk.
function bOk_Callback(hObject, eventdata, handles)



dfilter.name=get(handles.eName,'String');
if(isempty(dfilter.name)) % ist ein Name gesetzt ?
    errordlg('kein Filtername angegeben.','Fehler');
    return; 
end 

%........................................................
if(get(handles.cbV,'Value')==get(handles.cbV,'Max'))
    dfilter.isvert=true;    
else
    dfilter.isvert=false;        
end

if(get(handles.cbH,'Value')==get(handles.cbH,'Max'))
    dfilter.ishori=true;    
else
    dfilter.ishori=false;        
end

if(~dfilter.ishori && ~dfilter.isvert) %mind ein Kanal mu sein
    errordlg('kein Kanal ausgewhlt.','Fehler');
    return; 
end; 

%........................................................

if(get(handles.cbMinA,'Value')==get(handles.cbMinA,'Max'))    
    dfilter.isminamp=true;
    dfilter.minamp=str2double(get(handles.eMinA,'String'));
    if(isnan(dfilter.minamp))
        errordlg('Wert in min. Amplitude ist ungltig.','Fehler');
        return;
    end
else
    dfilter.isminamp=false;    
    dfilter.minamp=0;
end

if(get(handles.cbMaxA,'Value')==get(handles.cbMaxA,'Max'))    
    dfilter.ismaxamp=true;
    dfilter.maxamp=str2double(get(handles.eMaxA,'String'));
    if(isnan(dfilter.maxamp))
        errordlg('Wert in max. Amplitude ist ungltig.','Fehler');
        return;
    end
else
    dfilter.ismaxamp=false;    
    dfilter.maxamp=0;
end


%........................................................

if(get(handles.cbMinD,'Value')==get(handles.cbMinD,'Max'))    
    dfilter.ismindauer=true;
    dfilter.mindauer=str2double(get(handles.eMinD,'String'));
    if(isnan(dfilter.mindauer))
        errordlg('Wert in min. Dauer ist ungltig.','Fehler');
        return;
    end
else
    dfilter.ismindauer=false;    
    dfilter.mindauer=0;
end

if(get(handles.cbMaxD,'Value')==get(handles.cbMaxD,'Max'))    
    dfilter.ismaxdauer=true;
    dfilter.maxdauer=str2double(get(handles.eMaxD,'String'));
    if(isnan(dfilter.maxdauer))
        errordlg('Wert in max. Dauer ist ungltig.','Fehler');
        return;
    end
else
    dfilter.ismaxdauer=false;    
    dfilter.maxdauer=0;
end


%........................................................

if(get(handles.cbMinG,'Value')==get(handles.cbMinG,'Max'))    
    dfilter.ismingeschw=true;
    dfilter.mingeschw=str2double(get(handles.eMinG,'String'));
    if(isnan(dfilter.mingeschw))
        errordlg('Wert in min. Geschwindigkeit ist ungltig.','Fehler');
        return;
    end
else
    dfilter.ismingeschw=false;    
    dfilter.mingeschw=0;
end

if(get(handles.cbMaxG,'Value')==get(handles.cbMaxG,'Max'))    
    dfilter.ismaxgeschw=true;
    dfilter.maxgeschw=str2double(get(handles.eMaxG,'String'));
    if(isnan(dfilter.maxgeschw))
        errordlg('Wert in max. Geschwindigkeit ist ungltig.','Fehler');
        return;
    end
else
    dfilter.ismaxgeschw=false;    
    dfilter.maxgeschw=0;
end


if(~dfilter.ismaxgeschw && ...
   ~dfilter.ismingeschw && ...
   ~dfilter.ismaxdauer && ...
   ~dfilter.ismindauer && ...
   ~dfilter.ismaxamp && ...
   ~dfilter.isminamp)                  
    errordlg('kein Regel ausgewhlt.','Fehler');
    return; 
end; 



% sichere result
handles.output=dfilter;
guidata(hObject, handles);

%beende Dialog
uiresume(handles.figure1);






% --- Executes on button press in bCancel.
function bCancel_Callback(hObject, eventdata, handles)
uiresume(handles.figure1);


function eName_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
function eName_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


Contact us