Adding an "arc" roi object to the images.roi toolbox

9 views (last 30 days)
Hello all,
I am attempting to create an ROI object that is a partial circle: an arc. This would probably be a hybrid of the images.roi.Line and images.roi.Circle. The control points would, in my view, be a moveable center, and two moveable arc endpoints; dragging the endpoints would allow one to both change the arc's angle span and it's radius. Powerpoint has an implementation of this, although theirs also supports squashing into an ellipse.
I had hoped to Frankenstein images.roi.Line and images.roi.Circle together, but unfortunately they are P-code so that is a non-starter.
I do know that there are many ways to draw an arc , and that is my kludged together solution for now: two roi.line objects act as my anchor points, and I have locked one end of them together so as to create a center control point, the other ends act as the arc control points. After construction, I add a 'movingROI' listener to each roi.line, and the callback updates the x-y position of the drawn arc. Yes, it works, but it is pretty clunky and doesn't easily support the handy interfaces of the other images.roi objects.
Has anyone in M.A. managed to create a functional arc with the same characteristics as the images.roi classes? Is someone at Matlab with access to the p-Code willing to play Dr. Frankenstein to my Igor, and glue roi.Line and roi.Circle together? If not, this may get moved to Feature Requests.
Cheers,
-Dan

Answers (1)

Daniel Plotnick
Daniel Plotnick on 22 Jan 2020
Edited: Daniel Plotnick on 22 Jan 2020
Ok, at least for now I came up with an answer to my own question. It is another kludge, but a better one.
The solution is to create a composite of the roi.Point and roi.Freehand objects, where the Point acts as the marker for the center, and the Freehand defines the arc. The points of the arc are set the same way as in most of the other arc-drawing examples, but only the first and last points are set as Waypoints.
The roiMoving callback for all three of the points is set to recalculate the Positions of the Freehand object. The Freehand object has Closed set to false, and the FaceAlpha set to 0.
This gives me a passable arc tool. Hope that helps someone else, or that Matlab adds a new class.
Thanks for being my rubber duck M.A.
Cheers, -Dan
  1 Comment
Ramzi Zahreddine
Ramzi Zahreddine on 15 May 2020
Dan,
I have a similar need. I'm just starting to hack together my own solution. Would you be willing to share your code? I'll share whatever I come up with (if I'm able to make any improvements on your effort.
Thanks,
Ramzi

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!