Re: macro threshold values

Posted by Natalie M on
URL: http://imagej.273.s1.nabble.com/macro-threshold-values-tp5015759p5015801.html

Thank you all for your feedback! The reason I am thresholding the values to
count the cells is because the cells I want to count have been stained with
fluorescent dye, and I want to count only cells with the brightest
fluorescence (i.e., only the cells which are positive for the actin I am
measuring). Instead of counting them by hand, I thought setting a global
threshold would eliminate any bias on my part and allow me to choose which
cells are the most brightly stained in each image. Does this still seem
like an accurate way of achieving the cell count, or would something
different be recommended?
-Natalie

On Wed, Mar 2, 2016 at 9:53 AM, Ewing James <[hidden email]>
wrote:

> From a statistics point of view, measures based on ranges (i.e., maximum
> values) are often not recommended because sample ranges depend on sample
> sizes.  You might be able to parameterize your distribution via its
> moments, and then take the predicted 98% upper confidence interval as a
> threshold.
>
> - Jim
>
>
> > On Mar 2, 2016, at 10:28 AM, Swayne, Theresa C. <[hidden email]>
> wrote:
> >
> > Hi Natalie,
> >
> >
> > If you want to get the top 2% of the pixel population, there is a
> possibly related thread on the forum, where the poster is trying to get the
> top 2% of the pixel population using a cumulative sum.
> >
> http://forum.imagej.net/t/thresholding-as-a-percentage-of-intensity-histogram-in-a-macro/923/
> >
> > However, I agree with Jeremy that differing amounts of positive staining
> per image will change the shape of the histogram, so the population
> approach may not be robust.
> >
> > Philippe’s solution gives you a threshold = 98% of the maximum value in
> the image, which would seem to be robust to differing amounts of positive
> signal per image, as well as to inconsistent staining levels.
> >
> > Hope this helps,
> > Theresa
> >
> > On Mar 2, 2016, at 3:19 AM, Philippe CARL <[hidden email]
> <mailto:[hidden email]>> wrote:
> >
> > 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]<mailto:[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
> >
> > ------------------------------------
> > Theresa Swayne, Ph.D.
> > Manager
> > Confocal and Specialized Microscopy Shared Resource<
> http://hiccc.columbia.edu/research/sharedresources/confocal>
> >
> > Herbert Irving Comprehensive Cancer Center
> > Columbia University Medical Center
> > 1130 St. Nicholas Ave., Room 222A
> > New York, NY 10032
> > Phone: 212-851-4613
> > [hidden email]<mailto:[hidden email]>
> >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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