Using App Designer to Draw Elliptical ROI's
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
EDIT: See bottom of this post for solution.
Hi all,
I want to make a GUI that allows a user to draw an ellipse onto an image. The ellipse needs to be drawn with the mouse (i.e. like drawellipse function, not by entering coordinates, axes, etc) and the program needs to save the ellipse data (center coordinates, axes, and rotation angle) to a .mat file.
I'm having trouble with the first part. Currently, I have a GUI which displays an image onto UIAxes like so:
imshow(app.imgcur, 'Parent', app.UIAxes, ...
'XData', [1 app.UIAxes.Position(3)], ...
'YData', [1 app.UIAxes.Position(4)]);
When the user clicks the "Draw ROI" button, the following callback occurs
% Button pushed function: DrawROIButton
function DrawROIButtonPushed(app, event)
h = drawellipse('Color', app.UITable.Data{1,2}, 'Parent', app.UIAxes)
end
However, I get the following error:
Error using images.roi.Ellipse/set
Functionality not supported with UIAxes. For more information, see Graphics Support in App Designer.
From what I've read, drawing ROI's on UIAxes is not a feature supported by Matlab R2019a. Does anyone have a workaround for this issue? I'd rather be able to draw the ROI onto the Axes (or at least set up the code so that from the user's POV it looks that way) so that the app looks clean.
EDIT: If anyone else runs into the same problem for drawing ROIs on a UIAxes, the following code was helpful! Just change the Position vector to whatever your image specs are.
app.myAx = axes(app.UIFigure, 'Units', 'Pixels', 'Position',[1,332,800,450], 'XTick', [], 'YTick', []);
Then, to draw:
drawellipse('Parent', app.myAx)
Cheers
0 comentarios
Respuestas (1)
Shubham Sangle
el 10 de Jul. de 2019
drawellipse function is available in matlab
You can access documentation of drawellipse as https://in.mathworks.com/help/images/ref/drawellipse.html
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!