Using two axes in one GUI

4 ビュー (過去 30 日間)
Christos Stefos
Christos Stefos 2014 年 2 月 2 日
編集済み: Christos Stefos 2014 年 2 月 4 日
%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)

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 2 日
  1 件のコメント
Christos Stefos
Christos Stefos 2014 年 2 月 4 日
編集済み: Christos Stefos 2014 年 2 月 4 日
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)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by