function ImageGUI()
warning off all
close all

global h var
h=[];
var=[];

initialvisibility='off';

var.Hpoints = 48;
var.Vpoints = 32;

set(0,'Units','pixels');
scnsize = get(0,'ScreenSize');

h.f = figure('Position',[1 30 scnsize(3)-3 scnsize(4)-45],'MenuBar','none',...
   'ToolBar','none');
set(h.f,'Units','normalized');

h.image = axes('parent',h.f,'Position',[.1 .03 .88 .94]);

h.buttons.load = uicontrol('parent',h.f,'Style','pushbutton','string','Load', ...
    'position',[.005 .95 .03 .03],'Units','normalized', ...
    'callback',@load_pushbutton_Callback,'Backgroundcolor','r');

h.species = uibuttongroup('Position',[.005 .87 .07 .07],'Backgroundcolor','r');
% Create three radio buttons in the button group.
h.drosophila = uicontrol('Style','Radio','String','Drosophila',...
    'Position',[.1 .4 .8 .3],'Units','normalized','parent',h.species,'Backgroundcolor','r');
h.mouse = uicontrol('Style','Radio','String','Mouse',...
    'Position',[.1 .1 .8 .3],'Units','normalized','parent',h.species,'Backgroundcolor','r');
h.general= uicontrol('Style','Radio','String','General',...
    'Position',[.1 .7 .8 .3],'Units','normalized','parent',h.species,'Backgroundcolor','r');
% Initialize some button group properties. 
set(h.species,'SelectionChangeFcn',@selcbk1);
set(h.species,'SelectedObject',[]);  % No selection


h.plate = uibuttongroup('Position',[.005 .80 .07 .06],'Backgroundcolor','r');
% Create 2 radio buttons in the button group.
h.plate1 = uicontrol('Style','Radio','String','Plate 1',...
    'Position',[.1 .6 .8 .3],'Units','normalized','parent',h.plate,'Backgroundcolor','r');
h.plate2 = uicontrol('Style','Radio','String','Plate 2',...
    'Position',[.1 .1 .8 .3],'Units','normalized','parent',h.plate,'Backgroundcolor','r');
% Initialize some button group properties. 
set(h.plate,'SelectionChangeFcn',@selcbk);
set(h.plate,'SelectedObject',[]);  % No selection



h.background = uibuttongroup('Position',[.005 .73 .08 .06],'Backgroundcolor','r');
% Create 2 radio buttons in the button group.
h.nocorrect = uicontrol('Style','Radio','String','No Correction',...
    'Position',[.1 .6 .8 .3],'Units','normalized','parent',h.background,'Backgroundcolor','r');
h.correct = uicontrol('Style','Radio','String','Correct',...
    'Position',[.1 .1 .8 .3],'Units','normalized','parent',h.background,'Backgroundcolor','r');
% Initialize some button group properties. 
set(h.background,'SelectionChangeFcn', @sselcbk2);
set(h.background,'SelectedObject',[]);  % No selection



h.frame.Corners = uicontrol('parent',h.f,'Style','frame','string','corner choice',...
    'position',[.005 .52 .065 .15],'units','normalized','visible',initialvisibility);

h.buttons.BLbutton = uicontrol('parent',h.f,'Style','pushbutton','string','Bottom Left', ...
    'position',[.008 .63 .06 .03],'Units','normalized', ...
    'callback',@find_BL_pushbutton,'visible',initialvisibility);

h.buttons.TLbutton = uicontrol('parent',h.f,'Style','pushbutton','string','Top Left', ...
    'position',[.008 .58 .06 .03],'Units','normalized', ...
    'callback',@find_TL_pushbutton,'visible',initialvisibility);

h.buttons.BRbutton = uicontrol('parent',h.f,'Style','pushbutton','string','Bottom Right', ...
    'position',[.008 .53 .06 .03],'Units','normalized', ...
    'callback',@find_BR_pushbutton,'visible',initialvisibility);

h.text.Corners = uicontrol('parent',h.f,'style','text','string','Choose Image first', ...
    'position',[.008 .58 .06 .03],'Units','normalized','visible','off');



h.frame.Grid = uicontrol('parent',h.f,'Style','frame','string','corner choice',...
    'position',[.005 .33 .065 .15],'units','normalized','visible',initialvisibility);

h.buttons.gridbutton= uicontrol('parent',h.f,'Style','pushbutton','string','Draw Grid', ...
    'position',[.008 .44 .06 .03],'Units','normalized', ...
    'callback',@draw_grid,'visible',initialvisibility);

h.buttons.accept_grid= uicontrol('parent',h.f,'Style','pushbutton','string','Accept Grid', ...
    'position',[.008 .39 .06 .03],'Units','normalized', ...
    'callback',@accept_grid,'visible',initialvisibility);


    
h.buttons.reject_grid= uicontrol('parent',h.f,'Style','pushbutton','string','Reject Grid', ...
    'position',[.008 .34 .06 .03],'Units','normalized', ...
    'callback',@reject_grid,'visible',initialvisibility);

h.text.Grid = uicontrol('parent',h.f,'style','text','string','Define Corner first', ...
    'position',[.008 .39 .06 .03],'Units','normalized','visible','off','Backgroundcolor','w');



h.buttons.show_interactions=uicontrol('parent',h.f,'Style','pushbutton','string','Show Interactions', ...
    'position',[.005 .19 .07 .03],'Units','normalized', ...
    'callback',@show_interactions,'visible',initialvisibility);
% 
h.text.info = uicontrol('parent',h.f,'style','text','string','Load Image',...
    'position',[.005 .2 .07 .06],'Units','normalized','visible','off');

h.text.results = uicontrol('parent',h.f,'style','text','string','none',...
    'position',[.005 .2 .08 .2],'Units','normalized','visible','off');

h.buttons.change_inte=uicontrol('parent',h.f,'Style','pushbutton','string','Int', ...
    'position',[.005 .28 .04 .03],'Units','normalized', ...
    'callback',@InteThres,'visible',initialvisibility);

h.buttons.change_ext=uicontrol('parent',h.f,'Style','pushbutton','string','Ext', ...
    'position',[.055 .28 .04 .03],'Units','normalized', ...
    'callback',@ExtThres,'visible',initialvisibility);


end