ROI width/height (diameter)

Writing a java plugin, how can I get an ROI’s width/height from the ROI object? In the specific context of the plugin, I need an EllipseRoi’s vertical and horizontal diameter.


Have a look at the API documention of the Roi class.

Something along these lines should help:

Roi roi = imp.getRoi();
int width = roi.getBounds().width
int height = roi.getBounds().height
1 Like

Hi @MaxLeiter,

you can check out the EllipseRoi API.
The getParams() method should give you the coordinates to calculate the distances.
Potentially, the getFeretValues() does the job directly, but I haven’t tested this.