impoly on multiple axes

I have a gui with 4 axes (ax1..ax4), each containing a grayscale image (handles.image{1:4}).
When I use impoly to draw a ROI in one of the axes, the images in some of the other axes are "covered up" in the background color of the gui. When I delete the ROI, the images in the other axes return.
If impoly is invoked on ax1, all other images are covered. If it is invoked on ax2, no other images are covered. If it is invoked on ax3, only the image in ax2 is covered and if impoly is invoked in ax4, the images in ax2 and ax3 are covered.
Can anyone explain this behavior, and how can i get rid of it?
Thanks very much Chris
Matlab R2012a

回答(1 个)

Image Analyst
Image Analyst 2013-3-10

0 个投票

I don't observe that. Can you show your code where you invoked impoly for a particular and the other axes vanished (got replaced by the GUI's background color)?

3 个评论

Dear Image Analyst, thanks for your consideration. The code is part of a larger Matlab program (a multidimensional slice viewer for medical image volume data).
In order to be able to dynamically adress the axes, the axes handles are kept in another handle:
handles.AxesHandle={handles.Axes1 handles.Axes2 handles.Axes3 handles.Axes4};
Images are displayed in the axes using imshow:
handles.ImageHandle{Target}=imshow(image,'Parent',handles.AxesHandle{Target});
For fast update of the images when scrolling through a volume, only cdata of the image objects is changed:
set(handles.ImageHandle{Target},'CData',Pixel)
After selecting the axes where the ROI shall be drawn (handles.ROI2D.SelectAxes), this line invokes impoly:
h=impoly(handles.AxesHandle{handles.ROI2D.SelectAxes});
When at a later time point, the same image is displayed in the axes, the same ROI is drawn by
handles.TmpHandles{count}=impoly(handles.AxesHandle{Target},handles.ROI2D.ROI{t(i)}.Vertices);
The observed vanishing of the other images occures with both impoly commands.
Image Analyst
Image Analyst 2013-3-11
移动:DGM 2023-12-29
I've never used h=impoly(handles.AxesHandle{handles.ROI2D.SelectAxes}) - why can't you do h=impoly(handles.AxesHandle{Target}), since you know what Target is?
What is handles.ROI2D.SelectAxes anyway? ROI2D.SelectAxes is a field of ROI2D but SelectAxes sounds like a method of a class - like a function that is supposed to do something rather than a property.
handles.ROI2D.SelectAxes is just a variable containing the number of the axis where impoly shall be run. It is not a function handle. I also tried to call impoly with the plain axes handle:
h=impoly(handles.Axes1)
but still the images in the other axes disappear. Could it have something to do with the way the image data is managed in the other axes?
handles.ImageHandle{Target}=imshow(image,'Parent',handles.AxesHandle{Target});
and
set(handles.ImageHandle{Target},'CData',Pixel);
By the way, I noticed that the other images do not disappear completely, but a 1 pixel wide vertical line remains at the far right border of the axes. Doesn't make any sense to me.

请先登录,再进行评论。

提问:

2013-3-10

移动:

DGM
2023-12-29

Community Treasure Hunt

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

Start Hunting!

Translated by