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

Answers (1)

Image Analyst
Image Analyst on 10 Mar 2013

0 votes

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 Comments

Chris
Chris on 11 Mar 2013
Moved: DGM on 29 Dec 2023
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 on 11 Mar 2013
Moved: DGM on 29 Dec 2023
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.
Chris
Chris on 11 Mar 2013
Moved: DGM on 29 Dec 2023
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.

Sign in to comment.

Asked:

on 10 Mar 2013

Moved:

DGM
on 29 Dec 2023

Community Treasure Hunt

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

Start Hunting!