DSPRelated.com
Forums

gui AXES not showing in the correct window

Started by "slick.user" December 3, 2007
I don't know why the GUI axes are not showing the correct image in the
axes.
When I click browse, it should show on the top left.

The first time it show correct, then the second time it show on the
bottom right.

I use cla reset to clear all the image from axes.

How can I fix this, thank you. any help would be great.

All files are here:
http://download.yousendit.com/93E35A95586666AE
//Full source code
function varargout = window(varargin)
% WINDOW M-file for window.fig
% WINDOW, by itself, creates a new WINDOW or raises the existing
% singleton*.
%
% H = WINDOW returns the handle to a new WINDOW or the handle to
% the existing singleton*.
%
% WINDOW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in WINDOW.M with the given input arguments.
%
% WINDOW('Property','Value',...) creates a new WINDOW or raises the
% existing singleton*. Starting from the left, property value
pairs are
% applied to the GUI before window_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to window_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 window

% Last Modified by GUIDE v2.5 02-Dec-2007 00:12:43

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

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes window wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = window_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 button press in browse.
function browse_Callback(hObject, eventdata, handles)
% hObject handle to browse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

cla reset;

global IMG_orig;

% Get file name
[FileName,PathName] = uigetfile('*.bmp;*.asc','Select image file');
FullPathName = [PathName,'\',FileName];

% make sure a picture is select
if FileName ~= 0

asc_match = regexp(FullPathName, '\w*.asc', 'end');

if (asc_match > 1)
IMG_orig = load(FullPathName);
% normalize
IMG_orig = IMG_orig/255;
else
IMG_orig = imread(FullPathName);
end

showImage(IMG_orig,0);

end

return;
function showImage(image_in,mode)

if(mode == 0)
% original
originalPaneDisplay = findobj(gcf,'Tag','originalPane');
set(gcf,'CurrentAxes',originalPaneDisplay);
else
filterPaneDisplay = findobj(gcf,'Tag','filterPane');
set(gcf,'CurrentAxes',filterPaneDisplay);
end
imshow(image_in);

return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%