convexHull fails on some ROI



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:


Did you try this

  • New>Image>dimensions 2048x2048
  • in the ROI manager More>open>the ROI provided


The point-selections I get are quite different from what you’ve posted.




The picture above is a large zoom-in, it works for me


Not sure what can be done:

In the ROI-Manager the file opens as a single ROI that can’t be split.

Different from your image it has much smaller dimensions and I don’t understand why I have to create a ver large canvas to get this small selection.

I can’t further process this single selection point-cloud.




I am processing the ROI with the Jython macro language.
I create a canvas of size identical to the original image, otherwise the ROI would be out of the canvas for a smaller image. We could use a smaller canvas if I could change the position of this ROI somehow.

The ROI is supposed to be a multipoint ROI so it is indeed suprising that one cannot split it. One can move the individual points though but it is not really useful.

Thanks for the attempt !