ParticleAnalyzer class option to show bare outlines

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ParticleAnalyzer class option to show bare outlines

Andrew Sonnier
Hello,

I am writing a java program using the ImageJ framework for image analysis.
In this program I would like to run the analyze particle command through the
ParticleAnalyzer.java class on an image but I am having issues setting the
correct options to meet my outputs:

Here are the options I would like:
*Show: Bare Outlines
*Include Holes
*Size: 0-Infinity
*Circulation: 0-1

Here is my code so far:
    ParticleAnalyzer pa = new
   
ParticleAnalyzer(ParticleAnalyzer.INCLUDE_HOLES+ParticleAnalyzer.SHOW_OUTLINES,
0, null, 0,
          Double.MAX_VALUE, 0, 1);
    pa.analyze(img);
    pa.getOutputImage().show();

img is a 8-bit binary image created through the
ImageProcessor.setThreshold().

The issue I have run into is there seems to be no way to get bare outlines
through the options constructor. When I analyzed the
ij.plugin.filter.ParticleAnalyzer source code, it seems that the flag exists
but is not implemented for some reason. What is the best option for me to
proceed?

I have found that the process/binary/fill holes and process/binary/outline
functions produce a similar result but I have had minimal success with
automating this as well.



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ParticleAnalyzer class option to show bare outlines

Wayne Rasband-2
> On May 24, 2019, at 1:48 PM, Andrew Sonnier <[hidden email]> wrote:
>
> Hello,
>
> I am writing a java program using the ImageJ framework for image analysis.
> In this program I would like to run the analyze particle command through the
> ParticleAnalyzer.java class on an image but I am having issues setting the
> correct options to meet my outputs:
>
> Here are the options I would like:
> *Show: Bare Outlines
> *Include Holes
> *Size: 0-Infinity
> *Circulation: 0-1

Use the code generated by the recorder (Plugins>Macros>Record). Here is an example:

  img = IJ.openImage("http://wsr.imagej.net/images/blobs.gif");
  IJ.setAutoThreshold(img, "Default");
  IJ.run(img, "Analyze Particles...", "  show=[Bare Outlines] include in_situ");
  img.show();

The code uses the “In situ” option to avoid having a second window opened. Note that the latest daily build (1.52p37) fixes a bug that caused the recorder to not work with the particle analyzer if the “In situ” option was used.

-wayne



>
> Here is my code so far:
>    ParticleAnalyzer pa = new
>
> ParticleAnalyzer(ParticleAnalyzer.INCLUDE_HOLES+ParticleAnalyzer.SHOW_OUTLINES,
> 0, null, 0,
>          Double.MAX_VALUE, 0, 1);
>    pa.analyze(img);
>    pa.getOutputImage().show();
>
> img is a 8-bit binary image created through the
> ImageProcessor.setThreshold().
>
> The issue I have run into is there seems to be no way to get bare outlines
> through the options constructor. When I analyzed the
> ij.plugin.filter.ParticleAnalyzer source code, it seems that the flag exists
> but is not implemented for some reason. What is the best option for me to
> proceed?
>
> I have found that the process/binary/fill holes and process/binary/outline
> functions produce a similar result but I have had minimal success with
> automating this as well.

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