function clbBtnFilename

global FileName
global MapExtent
global ButtonBackColor
global hndlAxes

[filename, pathname, filterindex] = uigetfile( ...
       {'*.tif;*.tiff','TIF-files (*.tif, *.tiff)'}, ...
        'Select a TIF file', FileName);

if ~filterindex
    return
end    
    
if isstr(pathname) && isstr(filename)
   FileName = [pathname filename];   

   h=findobj('Tag','txtFileName');
   set(h,'String',FileName);
   
   %Get the extent info of the map
   FileTags = tifftags(FileName);

   
   %check whether it is a geo tiff
   [AllTags,FileTags] = GeoTiff(FileTags,FileName);
   if AllTags
        % Coordinates Upper right corner


       MapExtent.Geo = true;
       
       m=cell2mat(FileTags(find(ismember(FileTags(:,2),'ModelTiepointTag')),3));
       MapExtent.Xul = m(4);
       MapExtent.Yul = m(5);
       % Cellsize
       m=cell2mat(FileTags(find(ismember(FileTags(:,2),'ModelPixelScaleTag')),3));
       MapExtent.dxCell = m(1);
       MapExtent.dyCell = m(2);

       % # rows and columns
       m=cell2mat(FileTags(find(ismember(FileTags(:,2),'ImageWidth')),3));
       MapExtent.NrOfColumns = m(1);
       m=cell2mat(FileTags(find(ismember(FileTags(:,2),'ImageLength')),3));
       MapExtent.NrOfRows = m(1);
       
       MapExtent.Xll = MapExtent.Xul;
       MapExtent.Yll = MapExtent.Yul - MapExtent.dyCell * MapExtent.NrOfRows;
       MapExtent.Ylr = MapExtent.Yll;

       MapExtent.Yur = MapExtent.Yul;
       MapExtent.Xur = MapExtent.Xul + MapExtent.dxCell * MapExtent.NrOfColumns;
       MapExtent.Xlr = MapExtent.Xur;
       
       h=findobj('Tag','edtXLowerLeft');
       set(h,'String',MapExtent.Xll);
       h=findobj('Tag','edtXUpperRight');
       set(h,'String',MapExtent.Xur);
       h=findobj('Tag','edtYLowerLeft');
       set(h,'String',MapExtent.Yll);
       h=findobj('Tag','edtYUpperRight');
       set(h,'String',MapExtent.Yur);
       set(gca,'XLim',[MapExtent.Xll MapExtent.Xur],'YLim',[MapExtent.Yll MapExtent.Yur]);
       h=findobj('Tag','btnMatrixBrowse');
       set(h,'Backgroundcolor',ButtonBackColor.on,'Enable','on');
       
       MapExtent.Xmin = MapExtent.Xll;
       MapExtent.Xmax = MapExtent.Xur;
       MapExtent.Ymin = MapExtent.Yll;
       MapExtent.Ymax = MapExtent.Yur;
   else
       MapExtent.Geo = false;
       h=findobj('Tag','edtXLowerLeft');
       set(h,'String','');
       h=findobj('Tag','edtXUpperRight');
       set(h,'String','');
       h=findobj('Tag','edtYLowerLeft');
       set(h,'String','');
       h=findobj('Tag','edtYUpperRight');
       set(h,'String','');
       h=findobj('Tag','btnMatrixBrowse');
       set(h,'Backgroundcolor',ButtonBackColor.inactive,'Enable','inactive');
   end
   
   [X,map] = imread(FileName);
   hold off
   tst = image(X); axis equal;
   h=get(tst);
   MapExtent.NrOfColumns = h.XData(2);
   MapExtent.NrOfRows = h.YData(2);
   hold on
end   