Login  Register

Re: Intermittent Problem With Analyze Particles Masks

Posted by gankaku on Apr 04, 2014; 10:08am
URL: http://imagej.273.s1.nabble.com/Intermittent-Problem-With-Analyze-Particles-Masks-tp5007197p5007201.html

Hi Jan, hi Gabriel,

@ Jan
Thanks for pointing that out regarding my confusion about X and XStart. I
actually missed this point.
I agree that this should not miss any particle using doWand(x,y);
Thus, this might really point to differences between performing this in a
macro or a plugin/script.

@ Gabriel:
Thanks for the hint with the floodFill(). Something I actually could have
thought about from beginning on. Sometimes one is just blind for the
obvious solution.
In theory, this would improve actions if used in the Advanced Particle
Analyzer with big images containing many particles.

After some trials:
I implemented the floodFill in the Advanced Particle
Analyzer. Unfortunately, I ended up with several particles which were not
eliminated while they actually should be due to the shape descriptor
limitations keyed in.
So, without changing anything else in the code except the method for
particle elimination as described earlier by the floodFill()-method the
particle analysis performs unreliably. It's a little bit weird and I still
have no clue why this might be. Potentially, still a mistake in the code I
missed. When I take the actual values from the results table and use it to
do the floodFill manually on those coordinates it works.
Just for those interested and using the Advanced Particle Analyzer: Until I
can solve that issue with the flood filler, I will keep the voronoi region
elimination method in the Advanced Particle Analyzer for the moment to not
influence results created with it so far. Time performance thus might not
be as optimal as it could be.

Cheers,
Jan


2014-04-04 10:47 GMT+02:00 Gabriel Landini <[hidden email]>:

> On Thursday 03 Apr 2014 14:20:54 you wrote:
> > I have been having an intermittent problem with using Analyze Particles
> > masks in a macro.  My code usually works but every once in a while I get
> an
> > unexpected result: the contents of the entire mask gets "cleared".
>
> > run("Analyze Particles...", "size="+size40+"-Infinity
> > circularity=0.00-"+circ40+" show=Masks clear record");
> >
> >                for (n=0; n<nResults; n++) {
> >                     X40c = getResult('XStart',n);
> >                     Y40c = getResult('YStart',n);
> >                     aspectRatio40 = getResult('AR',n);
> >                     doWand(X40c,Y40c);
> >                     if (aspectRatio40<aspra40) {
> >                         run("Clear");
> >                    }
> >                }
> > --------------------------
>
> If the image you are analysing is binary (i.e. 2 colours), then what I
> usually
> do is the floodfill with the background colour(with the 8 neighbours
> connectivity option) the XStart YStart pixel of the region I want to
> delete.
> That is not only less time consuming (you avoid setting ROIs) but you won't
> encounter the problem you describe.
>
> I guess that for some strange reason the wand gets a confusing pixel
> configuration and chooses the background instead of foreground.
>
> Also in the code above you do not need "doWand" for all the regions, but
> only
> for those with <aspra40. Anyway if you follow my suggestion above, it will
> work. Ask if you do not know how to do that.
>
> Cheers
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--

CEO: Dr. rer. nat. Jan Brocher
phone:  +49 (0)6234 917 03 39
mobile: +49 (0)176 705 746 81
e-mail: [hidden email]
info: [hidden email]
inquiries: [hidden email]
web: www.biovoxxel.de

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