I use the MSER function from opencv in Fiji to detect some regions of interest.
The function returns the list of ROI as filled clouds of points, by filled I mean that I have all the points in the ROI not just the contour (see picture). Unfortunatly I cant change that.
So logically I apply a convexHull to recover fewer points from this MultiPointRoi and have just a PolygonRoi.
It works fine for most cases, but sometimes the function convexHull does not converge and just returns None.
I have attached such a ROI, that was initially displayed on a 2048x2048 image.
You can try it yourself :
- New>Image>dimensions 2048x2048
- in the ROI manager More>open>the ROI provided
- then selecting the ROI and finally Edit>Selection>ConvexHull and…nothing happens
The workaround I found is to convert the MultiPointRoi to a line (getContainedFloatPoints) then Fit a spline and finally fit the convexHull.
The ROI file (I changed the extensions to .mat otherwise I could not upload it, change it back to .roi):
ConvexHullFail.mat (19.6 KB)
And how it looks: