Login  Register

Re: Particle counting macro

Posted by Stoyan Pavlov on Jun 03, 2009; 1:11pm
URL: http://imagej.273.s1.nabble.com/Particle-counting-macro-tp3692303p3692305.html

Hi Michael,
Thank you very much for your answer!
I'll try the suggested algorithm!


On Wed, Jun 3, 2009 at 3:49 PM, Michael Schmid <[hidden email]>wrote:

> Hi Stoyan,
>
> your code looks fine. There is one point where I don't see whether you have
> done it:
> It might help to switch off all types of measurements in Analyze>Set
> Measurements.
>
> An alternative that might be faster if you have a very large number of
> rois:
> - Run the particle analyzer once, create a mask with the particles of
> correct size.
> - Run 'Find Maxima' on the mask, with output type 'single points'.
> - In the loop, for each roi, getRawStatistics(nPixels, mean). The number of
> particles will be nPixels*mean/255.
>
> This will give you a slightly different result - a particle may be partly
> inside a roi, but the point created by 'find maxima' can be outside.
>
> Michael
> ________________________________________________________________
>
>
> On 3 Jun 2009, at 12:09, Stoyan Pavlov wrote:
>
>  Dear ImageJ users,
>> I have  stacks of binarized images and set of RoIs associated with certain
>> slides. I need a macro which counts particles of specific sizes within
>> each
>> RoI and produces a table with the Label of the RoI, and the number of
>> particles found inside.  I am quite inexperienced with the macro language.
>> I
>> could devise something, which is both awfully clumsy and time consuming:
>>
>>
>>  n = roiManager("count");
>>        for (i=0; i<n; i++)  {
>>        roiManager("select", i);
>>         run("Analyze Particles...", "size=2-20 circularity=0.00-1.00
>> show=Nothing display exclude clear ");
>>    m=nResults;
>>        print (i,"    ",":","    ", m) ;
>>
>>
>>
>>
>> Can anyone help me?
>>
>> Thanks in advance!
>> --
>> Dr. Stoyan P. Pavlov, MD
>> Departament of Anatomy, Histology and Embryology
>> Medical University "Prof. Dr. Paraskev Stoyanov", Varna
>> Prof. Marin Drinov Str.55
>> 9002 Varna
>> Bulgaria
>> Tel: +359 (0) 52 - 650 - 061 #295
>> Fax: +359 (0) 52 - 650 - 019
>> e-mail: [hidden email]
>>
>


--
Dr. Stoyan P. Pavlov, MD
Departament of Anatomy, Histology and Embryology
Medical University "Prof. Dr. Paraskev Stoyanov", Varna
Prof. Marin Drinov Str.55
9002 Varna
Bulgaria
Tel: +359 (0) 52 - 650 - 061 #295
Fax: +359 (0) 52 - 650 - 019
e-mail: [hidden email]