function varargout = GaborParam(varargin)
global BlockSize Thresold

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GaborParam_OpeningFcn, ...
                   'gui_OutputFcn',  @GaborParam_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

%Načtení výchozích hodnot z workspace
% if evalin('base','exist(''BlockSize'')') == 0     
%     set(handles.editBlockSize,'String', num2str(evalin('base', 'BlockSize')));              
%     set(handles.editThresold,'String', num2str(evalin('base', 'Thresold')));
%     set(handles.editGradientSigma,'String', num2str(evalin('base', 'GradientSigma')));
%     set(handles.editOrientSmoothSigma,'String', num2str(evalin('base', 'OrientSmoothSigma')));
%     set(handles.editBlockSigma,'String', num2str(evalin('base', 'BlockSigma')));
%     set(handles.editBlksze,'String', num2str(evalin('base', 'Blksze')));
%     set(handles.editWindsze,'String', num2str(evalin('base', 'Windsze')));
%     set(handles.editMinWaveLength,'String', num2str(evalin('base', 'MinWaveLength')));
%     set(handles.editMaxWaveLength,'String', num2str(evalin('base', 'MaxWaveLength')));
%     set(handles.editKx,'String', num2str(evalin('base', 'Kx')));
%     set(handles.editKy,'String', num2str(evalin('base', 'Ky')));
%     set(handles.editReliableParam,'String', num2str(evalin('base', 'ReliableParam')));
%    
% end

% --- Executes just before GaborParam is made visible.
function GaborParam_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 GaborParam (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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



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


function editBlockSize_Callback(hObject, eventdata, handles)


function editBlockSize_CreateFcn(hObject, eventdata, handles)

% 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 editThresold_Callback(hObject, eventdata, handles)


function editThresold_CreateFcn(hObject, eventdata, handles)

% 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 btnSave_Callback(hObject, eventdata, handles)
% --- Funkce starající se o uložení všech parametrů na workspace ---- 

assignin('base', 'BlockSize', str2num(get(handles.editBlockSize, 'String')))
assignin('base', 'Thresold', str2num(get(handles.editThresold, 'String')))
assignin('base', 'GradientSigma', str2num(get(handles.editGradientSigma, 'String')))
assignin('base', 'OrientSmoothSigma', str2num(get(handles.editOrientSmoothSigma, 'String')))
assignin('base', 'BlockSigma', str2num(get(handles.editBlockSigma, 'String')))
assignin('base', 'Blksze', str2num(get(handles.editBlksze, 'String')))
assignin('base', 'Windsze', str2num(get(handles.editWindsze, 'String')))
assignin('base', 'MinWaveLength', str2num(get(handles.editMinWaveLength, 'String')))
assignin('base', 'MaxWaveLength', str2num(get(handles.editMaxWaveLength, 'String')))
assignin('base', 'Kx', str2num(get(handles.editKx, 'String')))
assignin('base', 'Ky', str2num(get(handles.editKy, 'String')))
assignin('base', 'ReliableParam', str2num(get(handles.editReliableParam, 'String')))


%BlockSize = str2num(get(handles.editBlockSize, 'String'));
%Thresold = str2num(get(handles.editThresold, 'String'));

%guidata(hObject, handles);

close(GaborParam);


function editGradientSigma_Callback(hObject, eventdata, handles)


function editGradientSigma_CreateFcn(hObject, eventdata, handles)

% 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 editBlockSigma_Callback(hObject, eventdata, handles)


function editBlockSigma_CreateFcn(hObject, eventdata, handles)

% 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 editOrientSmoothSigma_Callback(hObject, eventdata, handles)


function editOrientSmoothSigma_CreateFcn(hObject, eventdata, handles)

% 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 editBlksze_Callback(hObject, eventdata, handles)


function editBlksze_CreateFcn(hObject, eventdata, handles)

% 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 editWindsze_Callback(hObject, eventdata, handles)


function editWindsze_CreateFcn(hObject, eventdata, handles)

% 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 editMaxWaveLength_Callback(hObject, eventdata, handles)


function editMaxWaveLength_CreateFcn(hObject, eventdata, handles)

% 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 editMinWaveLength_Callback(hObject, eventdata, handles)


function editMinWaveLength_CreateFcn(hObject, eventdata, handles)

% 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 editKy_Callback(hObject, eventdata, handles)


function editKy_CreateFcn(hObject, eventdata, handles)

% 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 editKx_Callback(hObject, eventdata, handles)


function editKx_CreateFcn(hObject, eventdata, handles)

% 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 editReliableParam_Callback(hObject, eventdata, handles)


function editReliableParam_CreateFcn(hObject, eventdata, handles)

% 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 figure1_CreateFcn(hObject, eventdata, handles)
