using ParticleAnalyzer in Java

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

using ParticleAnalyzer in Java

jck
Hi.

I am trying to use the ParticleAnalyzer from a Java Programm written by myself.

When i call the analyze method i get the reply that my Image is not 8-bit Binary or Threshold.
I already used .convertToGray8() and .autoThreshold() on the picture.

So i looked up the source code in imageJ:

ImageStatistics stats = imp.getStatistics();
if (imageType!=BYTE || (stats.histogram[0]+stats.histogram[255]!=stats.pixelCount)) {
                                IJ.error(...


It checks if the imageType is correct (which i tested also, it is correct).
Then it tests something with the stats.histogram which i don't understand.

Anyway, how can i get the particle analyzer to work with my image?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: using ParticleAnalyzer in Java

Barry DeZonia
Hello,

It's a little difficult to understand your issue given you reference method
names but no class names. Not quite sure what you're doing.

Anyhow the histogram test code is trying to determine if the input image
follows IJ1's convention of a binary image (8 bit image with only two kinds
of values present: 0 & 255).

You can make a regular image into a binary image by calling the Thresholder
plugin.


On Sun, Apr 7, 2013 at 11:51 AM, jck <[hidden email]> wrote:

> Hi.
>
> I am trying to use the ParticleAnalyzer from a Java Programm written by
> myself.
>
> When i call the analyze method i get the reply that my Image is not 8-bit
> Binary or Threshold.
> I already used .convertToGray8() and .autoThreshold() on the picture.
>
> So i looked up the source code in imageJ:
>
> ImageStatistics stats = imp.getStatistics();
> if (imageType!=BYTE ||
> (stats.histogram[0]+stats.histogram[255]!=stats.pixelCount)) {
>                                 IJ.error(...
>
>
> It checks if the imageType is correct (which i tested also, it is correct).
> Then it tests something with the stats.histogram which i don't understand.
>
> Anyway, how can i get the particle analyzer to work with my image?
>
> Thanks!
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.n6.nabble.com/using-ParticleAnalyzer-in-Java-tp5002577.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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