# Feret of combined roi

Hi everyone,

I have created several rois using thresholding, “Set Measurements…”, and “Analyze Particles”. I’ve combined them using “OR (Combine)” in the Roi manager and would like to measure the Feret diameter of the resulting combined roi. This works; however, the coordinates given for the Feret diameter (FeretX, FeretY and FeretAngle) are always 0. This is not the case if I measure rois that are not combined rois.

Is there any way to get around this problem? I particularly need the FeretAngle to make my analysis useful.

Thank you!
phyo

Good day Phoebe,

I guess you didn’t store the combined ROI in the manager and select it there. If I do, I get the desired Feret measures.

Regards

Herbie

Hi Herbie,

I thought I did that. I selected all the ROIs that I wanted, clicked “OR (Combine)” in the ROI manager, clicked Add in the ROI manager, selected only the new ROI, and did “Measure” (Ctrl+M). I’ve attached a screenshot with the results.

Thanks,
phyo

I believe the problem is that the ROIs you combine do not overlap. And if I read the definition of the Feret´s diameter in the ImageJ User Guide …

Feret’s diameter The longest distance between any two points along the selection boundary

… I think it makes sense that this fails in non-overlaping combined ROIs

Your combined ROI appears to consist of disjunct parts …

HTH

Herbie

Martin and Herbie,

There are two possibilities. If it searches along a contiguous boundary, then it should fail for non-overlapping combined ROIs. If it doesn’t mind that the boundary is not continuous and would accept any points along the boundaries on the combined ROI, then the calculation should work.

However, it does return a Feret’s diameter and a FeretMin which are meaningful lengths for the second definition of a boundary, indicating that it doesn’t completely fail.

phyo

My impression is that the problem is hidden in the way the Feret-parameters are computed. Just have a look at the source code. (Presently, I don’t have the time.)

Regards

Herbie

You are right. The feret´s diameter is also calculated (correctly, as far as I can tell) for non-contiguous ROIs.
Obviously I typed the last post without checking the facts carefully enough.
I agree with you: Since the Feret´s diameter is measured I would expect that also the coordinates and angle should appear in the results.
It´s definitely a problem of the non-overlapping combined ROIs. For overlapping combined ROIs everything is measured correctly.
No solution though. Possibly a bug?

Good point. I’ll have a look at the source code to see where that comes from. I may be able to use the bounding rectangle as an alternative, if the Feret’s diameter doesn’t work out for my application.

Thanks for the helpful input, Martin and Herbie!

Sorry,

but the Feret-diameters are reported for ROIs consisting of disjunct parts.

What you are missing is the angle and you won’t get it from the bounding rectangle either.

Regards

Herbie

Hi everyone,

it’s not so difficult to get a FeretAngle with an accuracy of about 0.5 degrees; I have sent a suggestion for the code to Wayne. You might see it soon in the daily build. I see no easy solution to get the FeretX, FeretY, however.

–Michael

Good day Michael!

it’s not so difficult to get a FeretAngle with an accuracy of about 0.5 degrees

I don’t know to what you are referring here and I don’t think that this was ever an issue discussed in this thread.

The problem is, that Feret-parameters differ for ROIs that are compact and for ROIs that consist of disjunct parts.
In the latter case the Feret-angle is always zero.

Regards

Herbie

One could define the feret of the set of disconnected regions taken as “one region”, is that what is needed here?
Compute the convex hull of the disconnected regions, then the maximum Feret diameter of the ensemble can be computed from the points in the convex hull.

Gabriel,

I fear this is not the issue because the Feret and Min-Feret are reported, only the Feret-angle and the coordinates are zero for presently unknown reasons. I didn’t have time to search the source code though.

Best

Herbie

Hi everyone,

the FeretAngle for ShapeRois (=composite rois) is in the latest daily build (1.52j33).
The code is different from polygon rois; for ShaprRois the angle is less accurate (only in 0.5 deg steps), while it is mathematically accurate for PolygonRois.

By the way, the convex hull for ShapeRois is not implemented, so one can’t get the Feret parameters via the convex hull. The convex hull of ShapeRois would be difficult to implement, since ShapeRois do not necessarily consist of ImageJ ROIs but they can contain any java.awt.Shape object. Shape objects can consist of straight, quadratic or cubic curves, and I am not aware of any easy and quick method that would get something like a polygon with single-pixel spacing, so one could use any of the “usual” convex-hull methods that take a set of points as the input.

–Michael

Thank you Michael,

it works perfectly as announced!

I hope the change is helpful for the OP @phyo.

Best

Herbie