function varargout = GUI(varargin)
% GUI M-file for GUI.fig
%      GUI, by itself, creates a new GUI or raises the existing
%      singleton*.
%
%      H = GUI returns the handle to a new GUI or the handle to
%      the existing singleton*.
%
%      GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI.M with the given input arguments.
%
%      GUI('Property','Value',...) creates a new GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GUI_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

% Edit the above text to modify the response to help GUI

% Last Modified by GUIDE v2.5 14-May-2012 18:01:55

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_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 GUI is made visible.
function GUI_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 GUI (see VARARGIN)

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

% handles.img = 0;
% handles.FP = 0;
% handles.pocetFP = 0;
% handles.matchedFP = 0;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = GUI_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 selection change in FPmatching.
function FPmatching_Callback(hObject, eventdata, handles)
% hObject    handle to FPmatching (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns FPmatching contents as cell array
%        contents{get(hObject,'Value')} returns selected item from FPmatching


% --- Executes during object creation, after setting all properties.
function FPmatching_CreateFcn(hObject, eventdata, handles)
% hObject    handle to FPmatching (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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


% --- Executes on selection change in Detector.
function Detector_Callback(hObject, eventdata, handles)
% hObject    handle to Detector (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns Detector contents as cell array
%        contents{get(hObject,'Value')} returns selected item from Detector


% --- Executes during object creation, after setting all properties.
function Detector_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Detector (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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


% --- Executes on selection change in PlotType.
function PlotType_Callback(hObject, eventdata, handles)
% hObject    handle to PlotType (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns PlotType contents as cell array
%        contents{get(hObject,'Value')} returns selected item from PlotType


% --- Executes during object creation, after setting all properties.
function PlotType_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PlotType (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 FileType_Callback(hObject, eventdata, handles)
% hObject    handle to FileType (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 FileType as text
%        str2double(get(hObject,'String')) returns contents of FileType as a double


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


% --- Executes on button press in pushbutton1.
function [img pocet FP pocetFP matchedFP] = pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

Path = handles.path;
FileType = get(handles.FileType,'String');
FPmatching = get (handles.FPmatching,'Value');
Detector = get (handles.Detector, 'Value');

if Detector == 5
    [img pocet files] = img_load(Path, FileType);
    FP = cell(1,pocet);
    matchedFP = cell(1,(pocet-1));
    
    for i =1:pocet-1
        tic;
        [FP1 FP2 matchedFP_temp pocetFP] = SIFT( img(:,:,i), img(:,:,i+1) );
        
        matchedFP{i} = matchedFP_temp;
        time(i) = toc;
        
        
    end
    
    handles.img = img;
    handles.pocet = pocet;
    % handles.FP = FP;
    handles.pocetFP = pocetFP;
    handles.matchedFP = matchedFP;
    handles.files = files;
else

    [img pocet FP pocetFP matchedFP files detect_t matching_t] = start_reg (Path, FileType, Detector, FPmatching );

    detect_time = detect_t;
    matching_time = matching_t;
    handles.img = img;
    handles.pocet = pocet;
    handles.FP = FP;
    handles.pocetFP = pocetFP;
    handles.matchedFP = matchedFP;
    handles.files = files;
end
guidata(hObject, handles);


set (handles.FileNumber,'String',pocet);
% uisave;

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

PlotType = get (handles.PlotType,'Value');
Detector = get (handles.Detector, 'Value');

i = str2num( get (handles.CisloSuboru, 'String'));

geomtform = get (handles.geomtform, 'Value');

pocet = handles.pocet;
img = handles.img;
% FP = handles.FP;
pocetFP = handles.pocetFP;
matchedFP = handles.matchedFP;
path = handles.path;

files = cell(1,pocet);
for j = 1:pocet
    file_name = handles.files(j).name;
    files{j} = [path,'\',file_name];
end

clear (file_name);


if Detector == 5
    
    if i == pocet
        i = i-1;
    elseif i == 0
        i = 1;
    
        
    end
    FP{i}(:,1:2) = matchedFP{i}(:,1:2);
    FP{i+1}(:,1:2) = matchedFP{i}(:,3:4);
else
     FP = handles.FP;
    
end

if PlotType == 1
    %% Original + vyznacenie FP a obraz 2 + vyznacenie FP
    if i < 1
            i = 1;
        elseif i > pocet
            i = pocet;
        else
            i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    axes(handles.obraz1);
    imshow(img(:,:,i));
    set(gca,'Title',text('String','Original'))
    
    axes(handles.obraz2);
    imshow(img(:,:,i));
    set(gca,'Title',text('String','Original s FP'))
    hold on
    scatter(FP{i}(:,2),FP{i}(:,1),'r');
    hold off
    
    axes(handles.obraz5);
    imshow(img(:,:,i+1));
    set(gca,'Title',text('String','Registrovany'))
    axes(handles.obraz6);
    imshow(img(:,:,i+1));
    set(gca,'Title',text('String','Registrovany s FP'))
    hold on
    scatter(FP{i+1}(:,2),FP{i+1}(:,1),'r');
    hold off
    
elseif PlotType == 2
    %% Dva obrazy + obraz s prepojenými FP
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    axes(handles.obraz1);
    imshow(img(:,:,i));
    set(gca,'Title',text('String','Original'))
    axes(handles.obraz2);
    imshow(img(:,:,i+1));
    set(gca,'Title',text('String','Original s FP'))
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet-1;
    else
        i = i;
    end
    
    
    
    img_matched(size(img,1),((size(img,2))*2)) = zeros;
    img_matched(:,1:(size(img,2))) = img(:,:,i);
    img_matched(:,((size(img,2))+1):size(img_matched,2)) = img(:,:,i+1);
    
    axes(handles.obraz3);
    imshow(img_matched,[]);
    hold on;
    matchedFP_show = matchedFP{i};

    for j = 1:size(matchedFP_show,1)
        a = [ matchedFP_show(j,2), (matchedFP_show(j,4)+(size(img,2))) ];
        b = [ matchedFP_show(j,1), matchedFP_show(j,3) ];
        plot(a,b,'r+-');
        hold on
    end
    title('Vyznacenie prepojenia FP v originaly a registrovanom obraze')
    hold off;
    
elseif PlotType == 3
    %% Dva obrazy s vyznačením FP + obraz s prepojenými FP
    
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet-1;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    img_matched(size(img,1),((size(img,2))*2)) = zeros;
    
    axes(handles.obraz1);
    imshow(img(:,:,i));
    hold on
    scatter(FP{i}(:,2),FP{i}(:,1),'r');
    hold off
    set(gca,'Title',text('String','Original s FP'))
                
    axes(handles.obraz2);
    imshow(img(:,:,i+1));
    hold on
    scatter(FP{i+1}(:,2),FP{i+1}(:,1),'r');
    hold off
    set(gca,'Title',text('String','Registrovany s FP'))
                
    axes(handles.obraz3);
    img_matched(:,1:(size(img,2))) = img(:,:,i);
    img_matched(:,((size(img,2))+1):size(img_matched,2)) = img(:,:,i+1);

    imshow(img_matched,[]);
    hold on;
    

    matchedFP_show = matchedFP{i};

    for j = 1:size(matchedFP_show,1)

        a = [ matchedFP_show(j,2), (matchedFP_show(j,4)+(size(img,2))) ];
        b = [ matchedFP_show(j,1), matchedFP_show(j,3) ];

        plot(a,b,'r-', a,b,'go');
        hold on

    end

    hold off;
    title('Vyznacenie prepojenia FP v originaly a registrovanom obraze')
    
    
elseif PlotType == 4
    %% FP v obraze
    
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet-1;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    axes(handles.obraz4);
%     figure(1)
       [M N] = size(img(:,:,1));

    img_matched(1:M,1:N) = img(:,:,i);
    img_matched(1:M,N+1:N*2) = img(:,:,i+1);
    img_matched(M+1:M*2,1:N)   = img(:,:,i+1);

    imshow(img_matched,[]);
    hold on;
    

    matchedFP_show = matchedFP{i};

    for j = 1:size(matchedFP_show,1)

        a = [ matchedFP_show(j,2), (matchedFP_show(j,4)+(size(img,2))) ];
        b = [ matchedFP_show(j,1), matchedFP_show(j,3) ];

        plot(a,b,'r-', a,b,'g+');
        hold on

    end
    

%     img_matched = zeros(M*2,N);
    
    
    
    
    hold on;
    
    
     for j = 1:size(matchedFP_show,1)

        a = [ matchedFP_show(j,2), matchedFP_show(j,4) ];
        b = [ matchedFP_show(j,1), (matchedFP_show(j,3) + M) ];

        plot(a,b,'r-',a,b,'g+');
        hold on

     end
    hold off;

   
    title('Vyznacenie prepojenia FP v originaly a registrovanom obraze')
    
    
elseif PlotType == 5
    %% Posunutie FP v nasledujúcom obraze


    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    axes(handles.obraz4);
%     figure(3)   
    matchedFP_show = matchedFP{i};
    imshow(img(:,:,i),[]);
    hold on;
                
    for j = 1:size(matchedFP_show,1)
        a = [ matchedFP_show(j,2), matchedFP_show(j,4) ];
        b = [ matchedFP_show(j,1), matchedFP_show(j,3) ];
        plot(a,b,'r');
        hold on
    end
    hold off;
    set(gca,'Title',text('String','Original s naznacenim posunu FP v registrovanom obraze'))
    
elseif PlotType == 6
    %% Originál + registrovany obraz + transformovany registrovany obraz +
    %  prekrytie obrazov
    
    
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    matchedFP_transf = matchedFP{i};
    path_img1 = files{i};
    path_img2 = files{i+1};
    [img2transf] = imgTransform (img(:,:,i), img(:,:,i+1), path_img1, path_img2, matchedFP_transf, geomtform);
    [R C] = size(img(:,:,i));
    img2transf_resized = imresize(img2transf, [R C]);
    
    axes(handles.obraz1);
    imshow(img(:,:,i));
    set(gca,'Title',text('String','Original'))
    
    axes(handles.obraz2);
    imshow(img(:,:,i+1));
    set(gca,'Title',text('String','Registrovany'))
    
    axes(handles.obraz5);
    imshow(img2transf);
    set(gca,'Title',text('String','Transformacia registrovaneho obrazu'))
    
    axes(handles.obraz6);
    I = img(:,:,i);
    plot_overlayed(I,img2transf_resized);
    set(gca,'Title',text('String','Prekrytie originalu a transformovaneho registrovaneho obrazu'))
    
elseif PlotType == 7
    %% Originál + registrovany obraz + transformovany registrovany obraz +
    %  prekrytie obrazov
    
    
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    matchedFP_transf = matchedFP{i};
    path_img1 = files{i};
    path_img2 = files{i+1};
    [img2transf] = imgTransform (img(:,:,i), img(:,:,i+1), path_img1, path_img2, matchedFP_transf, geomtform);
    [R C] = size(img(:,:,i));
    img2transf_resized = imresize(img2transf, [R C]);
    
    axes(handles.obraz1);
    imshow(img(:,:,i));
    set(gca,'Title',text('String','Original'))
    
    axes(handles.obraz2);
    imshow(img(:,:,i+1));
    set(gca,'Title',text('String','Registrovany'))
    
    axes(handles.obraz5);
    imshow(img2transf);
    set(gca,'Title',text('String','Transformacia registrovaneho obrazu'))
    
    axes(handles.obraz6);
    
    I = img(:,:,i);
    plot_overlayed_transparency(I,img2transf_resized);    
%     Overlayed_image = (I + img2transf_resized);
%     imshow(Overlayed_image,[]);
    set(gca,'Title',text('String','Prekrytie originalu a transformovaneho registrovaneho obrazu'))
    
elseif PlotType == 8
    %% Prekrytie originálu a transformovaneho registrovaneho obrazu -
    %% sachovnica
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet;
    else
        i = i;
    end
    
     matchedFP_transf = matchedFP{i};
    path_img1 = files{i};
    path_img2 = files{i+1};
    [img2transf] = imgTransform (img(:,:,i), img(:,:,i+1), path_img1, path_img2, matchedFP_transf, geomtform);
%     [R C] = size(img(:,:,i));
%     img2transf_resized = imresize(img2transf, [R C]);
      img2transf_resized = img2transf;
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    axes(handles.obraz4);
%     figure(1)
    I = img(:,:,i);
    plot_overlayed(I,img2transf_resized);
    set(gca,'Title',text('String','Sachovnicove prekrytie originalu a transformovaneho registrovaneho obrazu - chybovy obraz'))
        
elseif PlotType == 9
    %% Vysledok registracie
    if i < 1
        i = 1;
    elseif i > pocet
        i = pocet;
    else
        i = i;
    end
    
    axes(handles.obraz1);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz2);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz3);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz4);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz5);
    cla;
    set(gca,'Title',text('String',''))
    axes(handles.obraz6);
    cla;
    set(gca,'Title',text('String',''))
    
    matchedFP_transf = matchedFP{i};
    path_img1 = files{i};
    path_img2 = files{i+1};
    [img2transf] = imgTransform (img(:,:,i), img(:,:,i+1), path_img1, path_img2, matchedFP_transf, geomtform);
%     [R C] = size(img(:,:,i));
%     img2transf_resized = imresize(img2transf, [R C]);
    img2transf_resized = img2transf;
    
    axes(handles.obraz4);
%     figure (2)
    I = img(:,:,i);
     plot_overlayed_transparency(I,img2transf_resized);
    
%     Overlayed_image = (I + img2transf_resized);
%     imshow(Overlayed_image,[]);
    set(gca,'Title',text('String','Prekrytie originalu a transformovaneho registrovaneho obrazu - vysledok registracie'))

else
    
    
end




% --- Executes on selection change in FileNumber.
function FileNumber_Callback(hObject, eventdata, handles)
% hObject    handle to FileNumber (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns FileNumber contents as cell array
%        contents{get(hObject,'Value')} returns selected item from FileNumber


% --- Executes during object creation, after setting all properties.
function FileNumber_CreateFcn(hObject, eventdata, handles)
% hObject    handle to FileNumber (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 CisloSuboru_Callback(hObject, eventdata, handles)
% hObject    handle to CisloSuboru (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 CisloSuboru as text
%        str2double(get(hObject,'String')) returns contents of CisloSuboru as a double


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



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


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


% --- Executes on button press in load_button.
function load_button_Callback(hObject, eventdata, handles)
% hObject    handle to load_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
path = uigetdir('C:\','Vyber priečinok so súbormi k registrácii');

set(handles.umiestnenie,'String',path);
handles.path = path;
guidata(hObject, handles);


% --- Executes on selection change in geomtform.
function geomtform_Callback(hObject, eventdata, handles)
% hObject    handle to geomtform (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns geomtform contents as cell array
%        contents{get(hObject,'Value')} returns selected item from geomtform


% --- Executes during object creation, after setting all properties.
function geomtform_CreateFcn(hObject, eventdata, handles)
% hObject    handle to geomtform (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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
