Login  Register

Intermittent Problem With Analyze Particles Masks

Posted by Dan McDonald on Apr 03, 2014; 6:20pm
URL: http://imagej.273.s1.nabble.com/Intermittent-Problem-With-Analyze-Particles-Masks-tp5007197.html

Dear List,

 

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".

 

I use analyze particles with a size limit and a circularity limit on a
thresholded image with "Show" set to mask and "Clear Results" checked.

 

The relevant code is below.  It goes through the "Results Table" and
"Clears" every entry that has a lower aspect ratio than a specific value.
As the Results Table entries are cleared the associated particle is removed
from the mask.  I can watch the particles that don't meet my shape criteria
disappear one by one as the macro executes.

 

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");

                   }

               }


--------------------------

 

Every once in a while (~4 times out of 150 image files) the macro will clear
an entire mask.  When watching the screen I can see the particles removed as
expected but suddenly the entire mask is cleared.  The macro seems to
continue to run through the Results Table unaware of what it's done to the
mask.  It seems that only the mask is affected.  The debug window at the
time of the unexpected clearing is below.  I do not see an obvious
indication of a problem.

 

The debug window shows the following after it clears the entire content of
the mask:

aspra40                                3

n                             1820

X40c                       2786

Y40c                       9117

aspectRatio40                    1.6813        

---------------

 

Is this a bug in ImageJ or am I doing something wrong?

 

Thank you,

 

Dan

 

Daniel W. McDonald,

Co-founder and President,

Phenotype Screening Corporation,

4028 Papermill Road, Suite 10,

Knoxville, TN 37909

(865) 385-8641 cell

(865) 694-9459 office

[hidden email]

daniel.w.mcdonald1 on Skype

www.phenotypescreening.com

 


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