Redrawing an image in a UIAxes that has already been drawn

조회 수: 4 (최근 30일)
Jason
Jason 2020년 10월 12일
댓글: Jason 2020년 10월 13일
Hello, I am using Appedesigner where I have a ImageButtonDownCallback(app, source, eventargs) event that takes an image from a UIAxes and creates a ROI in UIAxes2. The ROI is created from the larger image on UIAxes centred around the mouse click coordinates. This works fine.
%Add ROI to UIAXES2
cla(app.UIAxes2,'reset');
n=str2num(app.ImageScalenEditField.Value);
[high,low] = Autoscale(app,ROI,n); %My autoscale function
app.myimage=imshow(ROI,[low,high],'Parent',app.UIAxes2) %image creation
My issue is, I also use the UIAxes2 to view plots from other analaysis and sometimes want to redraw the original ROI that was on the UIAxes2 with the same image scaling that was used in the original imshow. I thought I could some how use app.myimage like
imshow(app.myimage,'Parent',app.UIAxes2); %image creation using previous settings
or
app.UIAxes2=app.myimage
Is this possible or do I have to fully calc and draw it again like
n=str2num(app.ImageScalenEditField.Value);
[high,low] = Autoscale(app,ROI,n); %My autoscale function
app.myimage=imshow(ROI,[low,high],'Parent',app.UIAxes2) %image creation
Thanks
Jason

채택된 답변

Geoff Hayes
Geoff Hayes 2020년 10월 13일
Hi Jason - from image created by imshow, the app.myData is an image object which (from the tests I did) may no longer be valid depending upon how you update the UIAxes2. You may want to try something like
%Add ROI to UIAXES2
cla(app.UIAxes2,'reset');
n=str2num(app.ImageScalenEditField.Value);
[high,low] = Autoscale(app,ROI,n); %My autoscale function
imageObject = imshow(ROI,[low,high],'Parent',app.UIAxes2) %image creation
app.myimage = imageObject.CData;
which you can then later show on the axes as
imshow(app.myimage,'Parent',app.UIAxes2);
  댓글 수: 1
Jason
Jason 2020년 10월 13일
Thats what I was looking for "CData"!
Thnak you Geoff
Jason

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by