Using two axes in one GUI

4 Ansichten (letzte 30 Tage)
Christos Stefos
Christos Stefos am 2 Feb. 2014
Bearbeitet: Christos Stefos am 4 Feb. 2014
%I would like display the image (I) that the user selects in the axis with name axis1 and graph %the values of handle.perc_nu from different images in axis2 with hold on(while keeping previous %plots).A segment of my code follows. I am doing something wrong and it wont work!Can you please %help
function varargout = cell_confluency_calc(varargin)
varargout{1} = handles.output;
--- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
handles.output = hObject;
[fn, pn] = uigetfile('*.jpg','Please select your image file');
impath = strcat(pn,fn);
set(handles.edit1,'string',impath);
I = imread(impath);
imshow(I,[]);
pause(5)
handles.BI = I;%backup gia toggle buttpn
run('grayklim.m');
CI= I;
run('filterit.m');
run ('gemiseholes.m');
imshow(I,[]);
pause(5)
level= graythresh(I)- 0.22;
blackwhite= im2bw(I,level);
blackwhite= bwareaopen(blackwhite,100);
imshow(blackwhite,[] )
handles.bw= blackwhite;
mask =uint8 (blackwhite);
handles.blackcell= CI.*mask;
imshow (handles.blackcell, [] )
pause(5)
guidata(hObject, handles);
-- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
A = sum(sum(handles.bw));
cell_pixels = A;
all_pixels= numel(handles.bw);
handles.perc_nu=(cell_pixels/all_pixels*100)
handles.perc = [num2str(cell_pixels/all_pixels*100) '%'];
set(handles.edit2,'string',handles.perc )
hold
plot(axes2, handles.perc_nu)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Feb. 2014
  1 Kommentar
Christos Stefos
Christos Stefos am 4 Feb. 2014
Bearbeitet: Christos Stefos am 4 Feb. 2014
Oh ok now I get it. I corrected my code and it works fine..Thank very much..The corected version follows:
function pushbutton1_Callback(hObject, eventdata, handles)
handles.output = hObject;
[fn, pn] = uigetfile('*.jpg','Please select your image file');
impath = strcat(pn,fn);
set(handles.edit1,'string',impath);
I = imread(impath);
imshow(I,'Parent',handles.axes1);
pause(5)
handles.BI = I;%backup gia toggle buttpn
run('grayklim.m');
CI= I; %backup gia mask ths eikonas black and white parakatw
run('filterit.m');
run ('gemiseholes.m');
imshow(I,'Parent',handles.axes1);
pause(5)
level= graythresh(I)- 0.22;
blackwhite= im2bw(I,level);
blackwhite= bwareaopen(blackwhite,100);
imshow(blackwhite,'Parent',handles.axes1 )
handles.bw= blackwhite;
mask =uint8 (blackwhite);
handles.blackcell= CI.*mask;
imshow (handles.blackcell,'Parent',handles.axes1 )
pause(5)
guidata(hObject, handles);
function pushbutton2_Callback(hObject, eventdata, handles)
A = sum(sum(handles.bw));
cell_pixels = A;
all_pixels= numel(handles.bw);
handles.perc_nu=(cell_pixels/all_pixels*100)
handles.perc = [num2str(cell_pixels/all_pixels*100) '%'];
set(handles.edit2,'string',handles.perc )
hold on
plot(handles.axes2, handles.perc_nu,'Marker', 'o','markeredgecolor','k','markerfacecolor','r', 'MarkerSize',10 )
guidata(hObject, handles)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by