Re: macro threshold values

Posted by CARL Philippe (LBP) on
URL: http://imagej.273.s1.nabble.com/macro-threshold-values-tp5015759p5015762.html

Dear Natalie,
I guess you are looking for a code like this:
        nBins = 256;
        ratio = 0.5;
        run("Blobs (25K)");
        getHistogram(values, counts, nBins);
        Array.getStatistics(values, valuesMin, valuesMax, valuesMean, valuesStdDev);
        setThreshold(0, ratio * valuesMax );
        setOption("BlackBackground", true);
        run("Convert to Mask");
with in your case ratio = 0.98;
My best regards.
Philippe

Philippe CARL
Laboratoire de Biophotonique et Pharmacologie
UMR 7213 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Natalie M
Envoyé : lundi 29 février 2016 18:43
À : [hidden email]
Objet : macro threshold values

Hi all,
I am writing a macro to count cells in images I've taken of slides. Does anyone know what code I could use to have the macro threshold each image at the top 2% of each histogram, rather than at a set number value on each histogram?
Thanks in advance,
Natalie Morel
University of Wisconsin

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

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