Login  Register

Re: Analyze particle & Flood fill

Posted by Philippe Grosjean on Dec 10, 2005; 4:28pm
URL: http://imagej.273.s1.nabble.com/Analyze-particle-Flood-fill-tp3704248p3704254.html

Gabriel Landini wrote:

> Hi Philippe,
>
> There is some error in the macro above. Note that the macro is set to use
> white particles and you are thresholding the image to remain "black":
>
> run("Threshold", "thresholded remaining black");
>
> The line above is not needed because the threshold is set between 128 and 255,
> but the "object" after thresholding is black (i.e. 0).
> Note that after running the line above, the threshold is set to (0,0) (if
> black is selected, 255,255 if it is not selected) and the macro finds luckily
> the particle.

OK, now I got it! Indeed, what I do is to binarize my image and then
analyze particles on the binary mask, possibly using another image as
redirection. Doing so, I never use the threshold functionnality, since
it is reset after binarisation. That is why I believe that 'Limit to
threshold' is not working in my particle analyzer. Thanks for the
explanation!

Now, I also understand what you mean with the conflict between 'Limit to
threshold' and 'Flood fill'. I totally agree that this is misleading.
Could we propose changes to ImageJ dialog boxes and/or documentation?

A logical approach would be to collect together the two options in the
same dialog box, and to rename 'Flood Fill' into 'Exclude holes & detect
nested' or something similar. Indeed, after thinking about it carefully,
there is no reasons that 'Exclude on edges' and 'Flood fill' (or its
renamed equivalent) are in the 'Analyze particles' dialog box (other
than because they do not apply to other measurement methods). They
really are measurement options. They should be placed into the 'Set
measurements' dialog box close to 'Limit to threshold'...

> With the macro you sent I still get:
>   Area XStart Ystart
> 1 1668 100 27
>
>
> I think the macro should include:
> setThreshold(128, 255);
> and the next line ignored.
> The particle analysis does not need a binarised image, but just a threshold
> set.
>
> With the corrected macro below I also get:
>   Area XStart Ystart
> 1 1668 100 27
>
> which is still not the expected result anyway.
>
> Here is the macro I think we should be using:
> //Test_1c "Limit" and "not Flooding" with manual thresholding
> run("Colors...", "foreground=white background=black selection=yellow");
> run("Options...", "iterations=1 black count=1");
> newImage("test", "8-bit Black", 200, 200, 1);
> makeOval(40, 28, 139, 139);
> run("Draw");
> run("Select None");
> run("Dilate");
> setThreshold(128, 255);
> run("Set Measurements...", "area limit redirect=None decimal=3");
> run("Analyze Particles...", "size=1-999999 circularity=0.00-1.00 show=Nothing
> display clear record");
> // -------------------
>
> Can you run this corrected macro above and report the result (and post which
> IJ version and platform. If we have different results, then there is
> something else playing up)?
> Thanks.
>
> Regards,
>
> Gabriel

Yes, it works like that (ImageJ 1.35b, Java 1.5.0_03 on Win XP sp2).
best,

Philippe