Login  Register

Re: Reject filled hole partially surrounded by open circle

Posted by Michael Schmid on Oct 31, 2013; 4:53pm
URL: http://imagej.273.s1.nabble.com/Reject-filled-hole-partially-surrounded-by-open-circle-tp5005398p5005415.html

Hi Justin,

looks difficult. The only approach that comes into my mind - it will need some macro programming:

Analyze particles with a circularity and size bounds to get only the filled blobs; writing the areas and center coordinates to the Results Table (Set Measurements). Create arrays of these coordinates.

For each line of the Results (now in the arrays), create a square selection around the blob center with the maximum size of a partial circle. Then duplicate the selection 4 times; on these images apply all possible flip operations (unchanged, flip horizontally, flip vertically, flip both). Combine the images such that you get an 'or' operation of all lines (with background=0 and lines=255, simply add all images).

From the partial circles, this should give you a closed line; if holes may remain, use Binary>Dilate.
Then run Analyze particles with and without 'include holes', and see whether the object closest to the center has a larger size with 'iclude holes'; in such a case it is surrounded by a circle.
If this is true, doWand on the center position in the original image and delete the object [do Wand on the center assumes there is no U-shaped object where the center is not in the object. If this is a problem, you need also two arrays with the XStart, YStart from the Analyze Particles>'Record Starts' of the original image].

But maybe someone has a more elegant solution...

Michael
________________________________________________________________
On Oct 31, 2013, at 10:52, jmcginnity wrote:

> Hi,
> I would like to analyse filled holes but do not wish to exclude filled holes
> that are partially surrounded by a broken circle.  Is this possible in
> ImageJ ?  
> In the image below there are 11 filled holes.  Of these, 5 are enclosed by
> broken circles or concave lines.  I wish to exclude these 5 filled holes
> from being analysed by Analyse Particles.
> Thanks,
> Justin
> <http://imagej.1557.x6.nabble.com/file/n5005398/Filled_holes4.jpg>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html