you can use the following method in a plugin:
//////////////////////////
float[][] findConvexArea(ResultsTable rt, ImageProcessor ipTemp){
int nParticles = rt.getCounter();
ResultsTable systemRT= ResultsTable.getResultsTable();
float[][] cValues = new float[2][nParticles]; //Array for the area
and perimeter convex dimension for each particle
ImagePlus impTemp = new ImagePlus("Test", ipTemp);
WindowManager.setTempCurrentImage(impTemp);
for (int i=0; i<nParticles;i++){
IJ.doWand((int)rt.getValue("XStart", i),(int)rt.getValue
("YStart", i));
IJ.run("Convex Hull");
IJ.run("Measure");
cValues[0][i] = (float)systemRT.getValue("Area", i);
cValues[1][i] = (float)systemRT.getValue("Perim.", i);
}
systemRT.reset();
return cValues;
}
/////////////////////////////
But I wonder if it is possible to include the the convex hull in the
particle analyzer. Or how to extend the particle analyzer to also
include the convex hull so we avoid the IJ.doWand and IJ. commands.
These commands slow down the plugin performance.
Gary.
On Mar 7, 2006, at 5:59 PM, Wayne Rasband wrote:
>> I'd like to use the function convex and hull that appears in
>> the menu Edit/Selection/Convex Hull in my plugin.
>> unfortunately, I could not find the api of the function
>> because the documentation is too old.
>
> The command recorder (Plugins>Macros>Record) is your friend. It
> generates this macro function
>
> run("Convex Hull");
>
> which can be converted to Java code by adding "IJ."
>
> IJ.run("Convex Hull");
>
> -wayne
>
>