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

uigetangle.m
function varargout = uigetangle(varargin)
% $Id: uigetangle.m 6 2004-12-13 12:28:39Z maik $
% modified by Robert Schleicher August 2011
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @uigetangle_OpeningFcn, ...
                   'gui_OutputFcn',  @uigetangle_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 uigetangle is made visible.
function uigetangle_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 uigetangle (see VARARGIN)

% Choose default command line output for uigetangle
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);


% Positioniere die GUI im Mittelpunkt
dlgRes=get(handles.fschritt1,'position');
monRes=get(0,'MonitorPositions');
dlgRes(1)=(monRes(3)-dlgRes(3))/2;  %x-achse
dlgRes(2)=(monRes(4)/2)-(dlgRes(4)/2);  %x-achse
set(handles.fschritt1,'position',dlgRes);


% Zeichne das Bild ein
axes(handles.Image);
RGB = imread('Angle.bmp');
x=image(RGB);
set(handles.Image,'XTick',[],'XTickLabel',[],'XTickMode','manual');
set(handles.Image,'YTick',[],'YTickLabel',[],'YTickMode','manual');



% UIWAIT makes uigetangle wait for user response (see UIRESUME)
uiwait(handles.fschritt1);


% --- Outputs from this function are returned to the command line.
function varargout = uigetangle_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

% gibt es das feld ?
if(isfield(handles,'output'))  
    %disp(handles.output);
    varargout{1} = handles.output;
    close();    
else
    varargout{1} = -1;
end








function editL_Callback(hObject, eventdata, handles)
calk(handles);



% --- Executes during object creation, after setting all properties.
function editL_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editL (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function editH_Callback(hObject, eventdata, handles)
calk(handles);

% --- Executes during object creation, after setting all properties.
function editH_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editH (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function editB_Callback(hObject, eventdata, handles)
calk(handles);

% --- Executes during object creation, after setting all properties.
function editB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editB (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


% --- Executes on button press in bCancel.
function bCancel_Callback(hObject, eventdata, handles)
% hObject    handle to bCancel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles.output=-1;  
guidata(hObject, handles);

uiresume(handles.fschritt1);


% --- Executes on button press in bNext.
function bNext_Callback(hObject, eventdata, handles)
% hObject    handle to bNext (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% prfe ob alles ok
out=calk(handles);
if(length(out)==1) 
    return;
end

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

%beende Dialog
uiresume(handles.fschritt1);



function editOutH_Callback(hObject, eventdata, handles)
% hObject    handle to editOutH (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 editOutH as text
%        str2double(get(hObject,'String')) returns contents of editOutH as a double


% --- Executes during object creation, after setting all properties.
function editOutH_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editOutH (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
    set(hObject,'BackgroundColor','gray'); %cannot enter values directly
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function editOutV_Callback(hObject, eventdata, handles)
% hObject    handle to editOutV (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 editOutV as text
%        str2double(get(hObject,'String')) returns contents of editOutV as a double


% --- Executes during object creation, after setting all properties.
function editOutV_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editOutV (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
    set(hObject,'BackgroundColor','gray'); %cannot enter values directly
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


% --- Executes on button press in bHelp.
function bHelp_Callback(hObject, eventdata, handles)
% hObject    handle to bHelp (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


function result=calk(handles)
    result=0;
    L = str2double(get(handles.editL,'string'));
    if isnan(L)
        errordlg('ungltige Eingabe fr L','Fehler','modal')
        return
    end 
    
    H = str2double(get(handles.editH,'string'));        
    if isnan(H)
        errordlg('ungltige Eingabe fr H','Fehler','modal')
        return
    end     
    
    B = str2double(get(handles.editB,'string'));        
    if isnan(B)
        errordlg('ungltige Eingabe fr B','Fehler','modal')
        return
    end         
        
    if(L==0)        
        return;
    end
    
    %----------------------------------------------
      %RS: Horizontal=Hhe? 
      %RS: Am 20.1. korrigierten Abschnitt erstellt.
      % Logik: calk (diese Funktion) liefert output fr uigetangle
      % (out=calk...handles.output=out)
      % in eichen.m:
      % winkel=uigetangle();
      % winkel wird als Vektor mit [horizontal vertikal] angenommen, z.B.
      % parameter.reizx=winkel(1);
    OH=0;
    OV=0;
        
    if (B~=0) %RS: vorher: if (H~=0)
        %RS: vorher: OH=atand((H/2)/L)*2;
        OH=atand((B/2)/L)*2;
        set(handles.editOutH,'string',sprintf('%15.2f',OH));
    end
    
    if (H~=0) %RS: vorher: if (B~=0)
        %RS: vorher: OV=atand((B/2)/L)*2;    
        OV=atand((H/2)/L)*2;
        set(handles.editOutV,'string',sprintf('%15.2f',OV));
    end

    % nur wenn beide Winkel berechnet werden konnten ist alles ok
    if(B~=0 & H~=0)
        result=[OH OV];
    end
    
    

Contact us