Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Sep 18, 2013; 4:57am
URL: http://imagej.273.s1.nabble.com/Measure-without-displaying-results-tp5004809p5004841.html
On Sep 16, 2013, at 2:21 PM, Sidnei Paciornik wrote:
> Dear all,
>
> In an automation routine with a Clojure macro, I use a loop over all
> objects in an image with "DoWand", "Convex Hull" and then "Measure", so
> that I can get the convex perimeter of each object, calculate the
> Convexity, and then get the average Convexity from all objects in the field.
>
> However, the "Measure" command always displays the results in the standard
> output port, what creates an unnecessary delay in the routine. The "Analyze
> Particles" does have the "Display" option, but "Measure" apparently does
> not have such an option. I have actually used "Analyze Particles" instead
> of "Measure" (iterating over the objects) but that is much slower still.
>
> Is there a way to suppress the results display in "Measure"?
> Is there a lower level command I could use to replace "Measure" in such a
> Clojure macro?
> For that matter, is there such a lower level command for "Set Measurements"
> and/or "Analyze Particles"?
Use the Analyzer class. Specify the measurements when you call the constructor and call the measure() method to make measurements. Here is a JavaScript example.
-wayne
imp = IJ.createImage("Untitled", "8-bit ramp", 500, 500, 1);
measurements = Measurements.AREA;
measurements += Measurements.MEAN;
measurements += Measurements.PERIMETER;
measurements += Measurements.SHAPE_DESCRIPTORS;
rt = new ResultsTable();
analyzer = new Analyzer(imp, measurements, rt);
analyzer.measure();
xpoints = [318,359,371,409,385];
ypoints = [51,21,65,26,113];
poly = new Polygon(xpoints, ypoints, xpoints.length);
imp.setRoi(new PolygonRoi(poly,Roi.POLYGON));
analyzer.measure();
IJ.run(imp, "Convex Hull", "");
analyzer.measure();
rt.show("Results");
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html