Re: Biggest object measure
Posted by Gabriel Landini on May 30, 2008; 1:51pm
URL: http://imagej.273.s1.nabble.com/Biggest-object-measure-tp3696071p3696074.html
On Friday 30 May 2008 14:08:09 Josep M. wrote:
> I managed to buid a macro to measure the biggest object of an image. It
> uses G.Landini's KeepLargestParticlePixel macro: duplicates the image,
> binarizes, deletes all particles except the biggest, selects the object and
> measures inside the selection in the original image.
> It still does not work, there are some problems when I try to batch measure
> a whole directory.
One suggestion:
Read the measurement you want to keep from the results table and print it in
the log window.
> - The results of a previous image is not kept in the results table, so
> after batch measuring all the directory, there only remains the last
> measure in the results table.
Of course, you call the particles8 each time because you need to know how big
the particles are. You can't have more than 1 results table, so the
suggestion above should work.
> - G.Landini's macro keeps asking in a dialog box if particles are black or
> white ones, so you must click once for each image that is measured.
> Does anyone have a hint on these?
This assumes that all the particles are white and so it will not ask anything
//==================
// assumes white particles
requires("1.30e");
run("Particles8 ", "white show=Particles overwrite");
// look for Pixels, not Area!
ar=0;
for (i=0; i<nResults; i++) {
ca = getResult('Pixels', i);
if (ca>ar) ar=ca;
}
run("Particles8 ", "white show=Particles filter minimum=" + ar +" maximum="+
ar +" overwrite");
//==================
Mind the line breaks.
Regards,
Gabriel