Posted by
Michael Schmid on
Mar 02, 2010; 1:29pm
URL: http://imagej.273.s1.nabble.com/ParticleAnalyzer-output-in-Java-does-not-agree-with-program-tp3689167p3689170.html
Hi,
ok, you are doing something different, not IJ.run, and not a macro.
See the documentation of the ParticleAnalyzer:
@param minSize the smallest particle size in pixels
@param maxSize the largest particle size in pixels
The ImageJ command uses scaled units for the size range unless you
select 'Pixel Units'.
You can have a look at what ParticleAnalyzer.java does with the input
in its showDialog method:
If you don't use 'Pixel Units' and the image has a calibration,
minSize and maxSize are divided by unitSquared, which is
cal.pixelWidth*cal.pixelHeight ('cal' is the Calibration of the
ImagePlus). So you will have to do the same if you want to convert
scaled units into pixel units.
Michael
________________________________________________________________
On 2 Mar 2010, at 12:55, Cspr wrote:
> Thanks for your reply.
>
> In the following ParticleAnalyzer has been abbreviated to "PartAn",
> and
> Analyzer will be abbreviated to "An" to circumvent the spam detector.
>
> Let me clarify for a moment.
> I work on only one picture in this context, so the chance of
> messing that up
> doesn't seem likely. I figured out that a major problem I had was not
> setting the scale right (from pixel to microns does make a
> difference) and
> now the call:
>
> IJ.run(imp3, "AnalyzeParticles...", "size=0.15-999999.00
> circularity=0-1
> show=Nothing display exclude clear include record add");
>
> does indeed work, i.e. it produces the same result as when useing
> ImageJ as
> any other program using identical steps. This is good news, however
> when I
> try to initialize a ParticleAnalyzer object using:
>
> PartAn pa = new PartAn(options, measurements, null, 0.15,
> Double.POSITIVE_INFINITY);
>
> with options as:
>
> int options = PartAn.SHOW_RESULTS +
> PartAn.EXCLUDE_EDGE_PARTICLES +
> PartAn.CLEAR_WORKSHEET +
> PartAn.INCLUDE_HOLES +
> PartAn.RECORD_STARTS +
> PartAn.ADD_TO_MANAGER;
>
> and measurements as:
>
> int measurements = An.STD_DEV + An.MIN_MAX + An.MEAN + An.AREA;
>
> The problem persists. The result-table shows an incredible 411
> measurements.
> I know for a fact the problem is the minSize - the smallest
> particle size in
> pixels i.e. the 0.15 parameter. However when in microns I need some
> form of
> conversion between them to make it work.
>
> My only solution suggestion was to take the microns-to-pixel ratio
> (which is
> something like 14) and multiply it by 0.15 to get the appropriate
> scale.
> This did not work.
>
> Can you spot the error?
>
> Thank you.