Re: How to convert a threshold area to a selection?
Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/How-to-convert-a-threshold-area-to-a-selection-tp3700180p3700182.html
On Monday 20 February 2006 12:43, Hugo Gratama van Andel wrote:
> If I specifiy a threshold value ( with Image->Adjust->Threshold )How can
> I convert the threshold area to a selection afterwards? I can't see how
> to do this with ImageJ.
Here there is way (you probably do not need the Set Measurements line):
Please mind the line breaks inserted by the mailer.
//-------------------------8<---------------------------
// AreasToROIs.txt
// G. Landini @ bham. ac. uk
// 26/Nov/2004
// Converts thresholded areas to a complex ROI
//
// No to be used with stacks! (works on the current slice only)
// --- example image
run("Dot Blot (7K)");
run("Smooth");
run("Smooth");
setThreshold(0,159);
// --- example image
run("Select None");
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20 show=Nothing
clear record");
run("Select None");
for (i=0; i<nResults; i++) {
x = getResult('XStart', i);
y = getResult('YStart', i);
if (i!=0) setKeyDown("shift");
doWand(x,y);
}
setKeyDown("none");
resetThreshold();
//-------------------------8<---------------------------