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

% Last Modified by GUIDE v2.5 15-Jul-2013 10:15:39

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

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

% set initial values
imagesc(rand(100,100,3), 'Parent', handles.axesImg);
set(handles.axesImg, 'NextPlot', 'add');
set(handles.axesImg, 'ButtonDownFcn', @axesImg_ButtonDownFcn); 
zoom on;


% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = minimalExample_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 when selected object is changed in uipanelMode.
function uipanelMode_SelectionChangeFcn(hObject, eventdata, handles)
% hObject    handle to the selected object in uipanelMode 
% eventdata  structure with the following fields (see UIBUTTONGROUP)
%	EventName: string 'SelectionChanged' (read only)
%	OldValue: handle of the previously selected object or empty if none was selected
%	NewValue: handle of the currently selected object
% handles    structure with handles and user data (see GUIDATA)

switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
    case 'radiobuttonZoom'
        zoom on
        handles.displayMode = 'zoom';
    case 'radiobuttonSelect'
        zoom off
        handles.displayMode = 'select';
    otherwise
        % Code for when there is no match.
end

get(handles.axesImg, 'ButtonDownFcn')

guidata(hObject, handles);

% --- Executes on mouse press over axes background.
function axesImg_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axesImg (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
display(clock)


