A problem with Analyze, Particles

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

A problem with Analyze, Particles

Avital Steinberg
Hi,
I have a problem - when I use Analyze, Particles, I get strange results.
when I run the following code on the attached image:

importClass(Packages.ij.IJ);
importClass(Packages.ij.plugin.frame.RoiManager);
importClass(Packages.ij.io.OpenDialog);
importClass(Packages.ij.io.DirectoryChooser);
importClass(Packages.java.io.File);
importClass(Packages.ij.gui.GenericDialog);
importClass(Packages.ij.util.Tools);
importClass(Packages.ij.plugin.Duplicator);
importClass(Packages.ij.measure.ResultsTable);
importClass(Packages.ij.ImagePlus);
importClass(Packages.ij.process.ImageProcessor);
importClass(Packages.ij.util.ArrayUtil);
importClass(Packages.ij.gui.Overlay);
importClass(Packages.ij.plugin.filter.ParticleAnalyzer);
importClass(Packages.ij.gui.Roi);
importClass(Packages.ij.plugin.filter.Analyzer);
importClass(Packages.ij.plugin.RGBStackMerge);
importClass(Packages.ij.process.ImageConverter);
importClass(Packages.ij.gui.OvalRoi);
importClass(Packages.ij.WindowManager);
importClass(Packages.ij.ImageStack);
importClass(Packages.ij.gui.ProfilePlot);
importClass(Packages.ij.gui.Line);
importClass(Packages.ij.gui.Plot);
importClass(Packages.ij.measure.CurveFitter);
importClass(Packages.ij.plugin.frame.Fitter);
importClass(Packages.ij.gui.PolygonRoi);
importClass(Packages.ij.process.ImageStatistics);
importClass(Packages.ij.measure.Measurements);
importClass(Packages.ij.plugin.ZProjector);
importClass(Packages.ij.gui.ShapeRoi);
importPackage(java.awt);

imp = IJ.getImage();
IJ.run(imp, "Set Scale...", "distance=0");
rm = RoiManager.getInstance();
if (rm==null) rm = new RoiManager();
IJ.run("ROI Manager...", "");
IJ.run("To ROI Manager", "");
rm.select(0);
IJ.setThreshold(imp, 105, 362);
IJ.run(imp, "Analyze Particles...", "size=50-Infinity display add");

I get one new Roi that resulted from Analyze, Particles. The strange thing
about this Roi is that it is identical to the original Roi that was
segmented. I would expect the resulting Roi to be smaller.

Can anyone understand why I'm getting such a strange result? I'm using
ImageJ 1.51a13, java 1.6.0_65 on a mac OSX 10.9.5.

I also shared it in the other forum, but since here I can attach a .tif
image as is (rather than as a .zip file), I am more optimistic about
getting a response.

Thanks,
Avital

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

Thresh105to362cropped.tif (694K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A problem with Analyze, Particles

Michael Schmid
Hi Avital,

the statement
   IJ.run(imp, "Set Scale...", "distance=0");
is wrong; the distance must not be zero and the known distance and unit
are missing. Use the command recorder to see how it should be.
'Analyze Particles' needs a proper image scale.

Best,

Michael
________________________________________________________________

On 2016-07-11 18:06, Avital Steinberg wrote:

> Hi,
> I have a problem - when I use Analyze, Particles, I get strange results.
> when I run the following code on the attached image:
>
> importClass(Packages.ij.IJ);
> importClass(Packages.ij.plugin.frame.RoiManager);
> importClass(Packages.ij.io.OpenDialog);
> importClass(Packages.ij.io.DirectoryChooser);
> importClass(Packages.java.io.File);
> importClass(Packages.ij.gui.GenericDialog);
> importClass(Packages.ij.util.Tools);
> importClass(Packages.ij.plugin.Duplicator);
> importClass(Packages.ij.measure.ResultsTable);
> importClass(Packages.ij.ImagePlus);
> importClass(Packages.ij.process.ImageProcessor);
> importClass(Packages.ij.util.ArrayUtil);
> importClass(Packages.ij.gui.Overlay);
> importClass(Packages.ij.plugin.filter.ParticleAnalyzer);
> importClass(Packages.ij.gui.Roi);
> importClass(Packages.ij.plugin.filter.Analyzer);
> importClass(Packages.ij.plugin.RGBStackMerge);
> importClass(Packages.ij.process.ImageConverter);
> importClass(Packages.ij.gui.OvalRoi);
> importClass(Packages.ij.WindowManager);
> importClass(Packages.ij.ImageStack);
> importClass(Packages.ij.gui.ProfilePlot);
> importClass(Packages.ij.gui.Line);
> importClass(Packages.ij.gui.Plot);
> importClass(Packages.ij.measure.CurveFitter);
> importClass(Packages.ij.plugin.frame.Fitter);
> importClass(Packages.ij.gui.PolygonRoi);
> importClass(Packages.ij.process.ImageStatistics);
> importClass(Packages.ij.measure.Measurements);
> importClass(Packages.ij.plugin.ZProjector);
> importClass(Packages.ij.gui.ShapeRoi);
> importPackage(java.awt);
>
> imp = IJ.getImage();
> IJ.run(imp, "Set Scale...", "distance=0");
> rm = RoiManager.getInstance();
> if (rm==null) rm = new RoiManager();
> IJ.run("ROI Manager...", "");
> IJ.run("To ROI Manager", "");
> rm.select(0);
> IJ.setThreshold(imp, 105, 362);
> IJ.run(imp, "Analyze Particles...", "size=50-Infinity display add");
>
> I get one new Roi that resulted from Analyze, Particles. The strange thing
> about this Roi is that it is identical to the original Roi that was
> segmented. I would expect the resulting Roi to be smaller.
>
> Can anyone understand why I'm getting such a strange result? I'm using
> ImageJ 1.51a13, java 1.6.0_65 on a mac OSX 10.9.5.
>
> I also shared it in the other forum, but since here I can attach a .tif
> image as is (rather than as a .zip file), I am more optimistic about
> getting a response.
>
> Thanks,
> Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: A problem with Analyze, Particles

Aryeh Weiss
In reply to this post by Avital Steinberg
Hi Avital

On 11/07/2016 7:06 PM, Avital Steinberg wrote:

> Hi,
> I have a problem - when I use Analyze, Particles, I get strange results.
> when I run the following code on the attached image:
>
>
> imp = IJ.getImage();
> IJ.run(imp, "Set Scale...", "distance=0");
> rm = RoiManager.getInstance();
> if (rm==null) rm = new RoiManager();
> IJ.run("ROI Manager...", "");
> IJ.run("To ROI Manager", "");
> rm.select(0);
> IJ.setThreshold(imp, 105, 362);
> IJ.run(imp, "Analyze Particles...", "size=50-Infinity display add");
>
> I get one new Roi that resulted from Analyze, Particles. The strange thing
> about this Roi is that it is identical to the original Roi that was
> segmented. I would expect the resulting Roi to be smaller.
If the image that you posted is indicative,  then your threshold
includes the entire ROI with a hole in the center.
If the selection is active, anyalyze particles respects the selection,
so your object fills the entire ROI.
If you include holes, it will also be the area of the ROI. If not, then
it should not incldue the hole is the area measurement.

best regards
--aryeh

> Can anyone understand why I'm getting such a strange result? I'm using
> ImageJ 1.51a13, java 1.6.0_65 on a mac OSX 10.9.5.
>
> I also shared it in the other forum, but since here I can attach a .tif
> image as is (rather than as a .zip file), I am more optimistic about
> getting a response.
>
> Thanks,
> Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
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
Reply | Threaded
Open this post in threaded view
|

Re: A problem with Analyze, Particles

Avital Steinberg
Thanks, Aryeh - I see your point. To handle these cases, I can look for the
bright region and then form a shapeRoi which is the cell Roi minus the
bright Roi. So now I know how to solve this problem.

Michael - I've always removed the scale on purpose and then Analyze,
particles used pixel units instead of distance units.

Thanks,
Avital





On Mon, Jul 11, 2016 at 7:52 PM, Aryeh Weiss <[hidden email]> wrote:

> Hi Avital
>
> On 11/07/2016 7:06 PM, Avital Steinberg wrote:
>
>> Hi,
>> I have a problem - when I use Analyze, Particles, I get strange results.
>> when I run the following code on the attached image:
>>
>>
>> imp = IJ.getImage();
>> IJ.run(imp, "Set Scale...", "distance=0");
>> rm = RoiManager.getInstance();
>> if (rm==null) rm = new RoiManager();
>> IJ.run("ROI Manager...", "");
>> IJ.run("To ROI Manager", "");
>> rm.select(0);
>> IJ.setThreshold(imp, 105, 362);
>> IJ.run(imp, "Analyze Particles...", "size=50-Infinity display add");
>>
>> I get one new Roi that resulted from Analyze, Particles. The strange thing
>> about this Roi is that it is identical to the original Roi that was
>> segmented. I would expect the resulting Roi to be smaller.
>>
> If the image that you posted is indicative,  then your threshold includes
> the entire ROI with a hole in the center.
> If the selection is active, anyalyze particles respects the selection, so
> your object fills the entire ROI.
> If you include holes, it will also be the area of the ROI. If not, then it
> should not incldue the hole is the area measurement.
>
> best regards
> --aryeh
>
> Can anyone understand why I'm getting such a strange result? I'm using
>> ImageJ 1.51a13, java 1.6.0_65 on a mac OSX 10.9.5.
>>
>> I also shared it in the other forum, but since here I can attach a .tif
>> image as is (rather than as a .zip file), I am more optimistic about
>> getting a response.
>>
>> Thanks,
>> Avital
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>
> --
> 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