Login  Register

Re: ParticleAnalyzer class and stacks

Posted by Aryeh Weiss on Jul 07, 2014; 6:57am
URL: http://imagej.273.s1.nabble.com/ParticleAnalyzer-class-and-stacks-tp5008596p5008600.html

On 7/7/14, 9:14 AM, Paul van Schayck wrote:

> Dear Aryeh,
>
> On Mon, Jul 7, 2014 at 4:43 AM, Aryeh Weiss <[hidden email]> wrote:
>> I was trying to do it using the the ParticleAnalyzer class without  IJ.run .
>> Is there a way to do that? For that matter, is it generally better to use
>> the API rather than use
>>   IJ.run ?
> That's certainly possible. And probably as you already found in your
> example. You can do something like this (this is Javascript, but can
> be adapted to Python
>
>      table = new ResultsTable()
>      pa = ParticleAnalyzer(0, Measurements.CENTER_OF_MASS, table,
> 300,Number.POSITIVE_INFINITY, 0.4, 1.0)
>      pa.analyze(imp)
>
>      // Loop through objects and store them in list object
>      r = []
>      for (i=0; i < table.getCounter(); i++)  {
>           r[i] = { "XM": table.getValue("XM",i), "YM": table.getValue("YM",i) }
>      }
>
> I'm not sure what drawback you find with looping through the stacks.
> Internally, this is what Analyze Particle plugin is doing internally
> as well AFAIK.
>
> Kind regards,
>
> Paul
>
Hi Paul,


Thank you for your reply.
I have a student who is converting some algorithms which I implemented
as macros to python.
I thought that it would be cleaner (and maybe more efficient) to have
the analyzer operate on the stack,
just as in the macro I have a "stack" keyword.
Also, if I generate a mask, I prefer that a stack be generated, rather
then get each slice, and append it to a stack
(although that can certainly be done).

The API docs mention processStack, which appears to be a flag that tell
it to process a stack (just a guess), but I dont know how to use it.

Best regards,
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


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