Dear All,
Could you please help me with calculation of infiltration area. I have slices of tissue with damage and it is need to count damage area in % (dark purple color). Please find attached picture. Using ImageJ I transformed the image in an 8-bit format. Then, using the threshold function I applied for needed levels of threshold. (See slice image 0006.1) Then, I set measurements parametrs: Area, Area fraction, Limit to threshold, Display label. After measurement, ImageJ counted 37, 476 % . But actually damaged area on this image is about 70-80 % Could you give me suggestions or recommendation with this calculation? Or could you point out my mistakes? Thank you in advance. Kind regards, Olga -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
This macro shows how to get the percentage, but it will vary considerably with the threshold you select.
// ********** begin macro ********* run("Duplicate...", "title=HSB"); run("HSB Stack"); selectWindow("HSB"); setSlice(3); run("Set Measurements...", "area limit redirect=None decimal=2"); setThreshold(0, 183); // this was the auto threshold run("Measure"); resetThreshold(); run("Select All"); run("Measure"); damageArea = getResult("Area", 0); totalArea = getResult("Area", 1); percentageArea = (damageArea / totalArea) * 100; setResult("percentage damage", 0, percentageArea); // ********** end macro ********* On Oct 29, 2012, at 1:13 PM, Olga Tokareva wrote: > Dear All, > Could you please help me with calculation of infiltration area. I have > slices of tissue with damage and it is need to count damage area in % (dark > purple color). Please find attached picture. > Using ImageJ I transformed the image in an 8-bit format. Then, using the > threshold function I applied for needed levels of threshold. (See slice > image 0006.1) > Then, I set measurements parametrs: Area, Area fraction, Limit to > threshold, Display label. > After measurement, ImageJ counted 37, 476 % . But actually damaged area on > this image is about 70-80 % > Could you give me suggestions or recommendation with this calculation? Or > could you point out my mistakes? > Thank you in advance. > > > Kind regards, > Olga > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > <image0006.jpg><image0006.1.jpg> Christopher Coulon, Ph.D. The GAIA Group http://gaiag.net -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Olga Tokareva
Once you have the thresholded image, if you open up the histogram feature
of image j, it will have two bins, one for the black pixels and one for the white pixels. If you take the ratio of the counts in these bins (eg #black/#white) it is your area covered. On Mon, Oct 29, 2012 at 4:13 PM, Olga Tokareva <[hidden email]> wrote: > Dear All, > Could you please help me with calculation of infiltration area. I have > slices of tissue with damage and it is need to count damage area in % (dark > purple color). Please find attached picture. > Using ImageJ I transformed the image in an 8-bit format. Then, using the > threshold function I applied for needed levels of threshold. (See slice > image 0006.1) > Then, I set measurements parametrs: Area, Area fraction, Limit to > threshold, Display label. > After measurement, ImageJ counted 37, 476 % . But actually damaged area on > this image is about 70-80 % > Could you give me suggestions or recommendation with this calculation? Or > could you point out my mistakes? > Thank you in advance. > > > Kind regards, > Olga > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Olga Tokareva
Hi Olga,
thresholding your image is a bit tricky. The best solution I found is thresholding the 'hue' channel in HSB (Threshold Color can do this, either the built-in version in ImageJ or Gabriel Landini's external plugin). Nevertheless, I typically get something like 43% for the purple areas. This does not include some out-of focus areas with a slight purple tinge. Probably the most accurate method is to convert the image to a HSB stack and run the histogram, then fit it by a sum of two Gaussians: y = a*f*exp(-(x-b)*(x-b)/c/c) + (1-a)*f*exp(-(x-d)*(x-d)/e/e) with starting values (have 'show settings' checked) a=0.5 (ratio between peaks) b=193 (center of 1st peak) d=218 (center of 2nd peak) c=e=10 (width of peaks) f=40000 (sum of peak heights) Fitting takes quite a long time, and gives me a=0.54, i.e., 54% of the area belongs to the peak at 194 in the hue histogram, which is the purple (dark) area. So, one should not trust the eye too much when thresholding. Nevertheless, I think that your image is not consistent with 70-80% of the area being dark purple. If that number stems from a method that measures a larger area, maybe you have happened to find an image of a spot where fewer cells have been damaged? Michael ________________________________________________________________ On Oct 29, 2012, at 21:13, Olga Tokareva wrote: > Dear All, > Could you please help me with calculation of infiltration area. I have > slices of tissue with damage and it is need to count damage area in % (dark > purple color). Please find attached picture. > Using ImageJ I transformed the image in an 8-bit format. Then, using the > threshold function I applied for needed levels of threshold. (See slice > image 0006.1) > Then, I set measurements parametrs: Area, Area fraction, Limit to > threshold, Display label. > After measurement, ImageJ counted 37, 476 % . But actually damaged area on > this image is about 70-80 % > Could you give me suggestions or recommendation with this calculation? Or > could you point out my mistakes? > Thank you in advance. > > > Kind regards, > Olga > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > <image0006.jpg><image0006.1.jpg> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Just my 2 cents.
When we have to do thresholding on a lot of images, I usually have my labmates take a "low" and "high" estimate of the threshold by eye and then we use the disparity in the results as an estimate to of error. Our images are not of stains but of nanoparticles, so this may not be relevant to you, but this method actually gives us really nice results and cuts down on a lot of the error. On Tue, Oct 30, 2012 at 5:50 AM, Michael Schmid <[hidden email]>wrote: > Hi Olga, > > thresholding your image is a bit tricky. The best solution I found is > thresholding the 'hue' channel in HSB (Threshold Color can do this, either > the built-in version in ImageJ or Gabriel Landini's external plugin). > Nevertheless, I typically get something like 43% for the purple areas. This > does not include some out-of focus areas with a slight purple tinge. > > Probably the most accurate method is to convert the image to a HSB stack > and run the histogram, then fit it by a sum of two Gaussians: > y = a*f*exp(-(x-b)*(x-b)/c/c) + (1-a)*f*exp(-(x-d)*(x-d)/e/e) > with starting values (have 'show settings' checked) > a=0.5 (ratio between peaks) > b=193 (center of 1st peak) > d=218 (center of 2nd peak) > c=e=10 (width of peaks) > f=40000 (sum of peak heights) > > Fitting takes quite a long time, and gives me a=0.54, i.e., 54% of the > area belongs to the peak at 194 in the hue histogram, which is the purple > (dark) area. > > So, one should not trust the eye too much when thresholding. > > Nevertheless, I think that your image is not consistent with 70-80% of the > area being dark purple. If that number stems from a method that measures a > larger area, maybe you have happened to find an image of a spot where fewer > cells have been damaged? > > Michael > ________________________________________________________________ > On Oct 29, 2012, at 21:13, Olga Tokareva wrote: > > > Dear All, > > Could you please help me with calculation of infiltration area. I have > > slices of tissue with damage and it is need to count damage area in % > (dark > > purple color). Please find attached picture. > > Using ImageJ I transformed the image in an 8-bit format. Then, using the > > threshold function I applied for needed levels of threshold. (See slice > > image 0006.1) > > Then, I set measurements parametrs: Area, Area fraction, Limit to > > threshold, Display label. > > After measurement, ImageJ counted 37, 476 % . But actually damaged area > on > > this image is about 70-80 % > > Could you give me suggestions or recommendation with this calculation? Or > > could you point out my mistakes? > > Thank you in advance. > > > > > > Kind regards, > > Olga > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > <image0006.jpg><image0006.1.jpg> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
Hi Olga,
my procedure was roughly the following: Image>Type>HSB stack select Hue channel Analyze>Histogram press 'list', copy the list to the clipboard Analyze>Tools>Curve Fitting select data and replace by Paste Eliminate first and last values of the list - these are from overexposed areas In the dropdown menu, select 'User Defined' instead of 'Straight line' check 'show settings' Press 'Fit' Enter the equation: y = a*f*exp(-(x-b)*(x-b)/c/c) + (1-a)*f*exp(-(x-d)*(x-d)/e/e) Enter the initial parameters (as in my previous mail) ...be patient (unfortunately no progress bar) The fit parameters are written to the log window. The 'a' value in the fit is the area fraction of the first peak You can automate this to some degree in a macro, use the commands getHistogram(values, counts, 256) and Fit.doFit(equation, values, counts, initialGuesses) where equation is a string with the formula and initialGuesses is an array with the starting values a to f. Unfortunately, one has to guess them manually, but maybe all of your images are very similar, so you can always try the same ones. If a 'double Gaussian' fit is of general interest, I might try to implement it as a standard function in ImageJ (which would also make it slightly faster), but that will need some time... Michael ________________________________________________________________ On Oct 30, 2012, at 21:45, Olga Tokareva wrote: > Dear Michael, > Thank you for your reply. Could you please explain me in more details applying with two Gaussians, > It is not entirely clear for me. > Thank you in advance. > > Olga > > 2012/10/30 Michael Schmid <[hidden email]> > Hi Olga, > > thresholding your image is a bit tricky. The best solution I found is thresholding the 'hue' channel in HSB (Threshold Color can do this, either the built-in version in ImageJ or Gabriel Landini's external plugin). Nevertheless, I typically get something like 43% for the purple areas. This does not include some out-of focus areas with a slight purple tinge. > > Probably the most accurate method is to convert the image to a HSB stack and run the histogram, then fit it by a sum of two Gaussians: > y = a*f*exp(-(x-b)*(x-b)/c/c) + (1-a)*f*exp(-(x-d)*(x-d)/e/e) > with starting values (have 'show settings' checked) > a=0.5 (ratio between peaks) > b=193 (center of 1st peak) > d=218 (center of 2nd peak) > c=e=10 (width of peaks) > f=40000 (sum of peak heights) > > Fitting takes quite a long time, and gives me a=0.54, i.e., 54% of the area belongs to the peak at 194 in the hue histogram, which is the purple (dark) area. > > So, one should not trust the eye too much when thresholding. > > Nevertheless, I think that your image is not consistent with 70-80% of the area being dark purple. If that number stems from a method that measures a larger area, maybe you have happened to find an image of a spot where fewer cells have been damaged? > > Michael > ________________________________________________________________ > On Oct 29, 2012, at 21:13, Olga Tokareva wrote: > >> Dear All, >> Could you please help me with calculation of infiltration area. I have >> slices of tissue with damage and it is need to count damage area in % (dark >> purple color). Please find attached picture. >> Using ImageJ I transformed the image in an 8-bit format. Then, using the >> threshold function I applied for needed levels of threshold. (See slice >> image 0006.1) >> Then, I set measurements parametrs: Area, Area fraction, Limit to >> threshold, Display label. >> After measurement, ImageJ counted 37, 476 % . But actually damaged area on >> this image is about 70-80 % >> Could you give me suggestions or recommendation with this calculation? Or >> could you point out my mistakes? >> Thank you in advance. >> >> >> Kind regards, >> Olga >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> <image0006.jpg><image0006.1.jpg> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Adam Hughes
Many thanks for your help and explanations.
Kind regards, Olga 2012/10/30 Adam Hughes <[hidden email]> > Just my 2 cents. > > When we have to do thresholding on a lot of images, I usually have my > labmates take a "low" and "high" estimate of the threshold by eye and then > we use the disparity in the results as an estimate to of error. > > Our images are not of stains but of nanoparticles, so this may not be > relevant to you, but this method actually gives us really nice results and > cuts down on a lot of the error. > > On Tue, Oct 30, 2012 at 5:50 AM, Michael Schmid <[hidden email] > >wrote: > > > Hi Olga, > > > > thresholding your image is a bit tricky. The best solution I found is > > thresholding the 'hue' channel in HSB (Threshold Color can do this, > either > > the built-in version in ImageJ or Gabriel Landini's external plugin). > > Nevertheless, I typically get something like 43% for the purple areas. > This > > does not include some out-of focus areas with a slight purple tinge. > > > > Probably the most accurate method is to convert the image to a HSB stack > > and run the histogram, then fit it by a sum of two Gaussians: > > y = a*f*exp(-(x-b)*(x-b)/c/c) + (1-a)*f*exp(-(x-d)*(x-d)/e/e) > > with starting values (have 'show settings' checked) > > a=0.5 (ratio between peaks) > > b=193 (center of 1st peak) > > d=218 (center of 2nd peak) > > c=e=10 (width of peaks) > > f=40000 (sum of peak heights) > > > > Fitting takes quite a long time, and gives me a=0.54, i.e., 54% of the > > area belongs to the peak at 194 in the hue histogram, which is the purple > > (dark) area. > > > > So, one should not trust the eye too much when thresholding. > > > > Nevertheless, I think that your image is not consistent with 70-80% of > the > > area being dark purple. If that number stems from a method that measures > a > > larger area, maybe you have happened to find an image of a spot where > fewer > > cells have been damaged? > > > > Michael > > ________________________________________________________________ > > On Oct 29, 2012, at 21:13, Olga Tokareva wrote: > > > > > Dear All, > > > Could you please help me with calculation of infiltration area. I have > > > slices of tissue with damage and it is need to count damage area in % > > (dark > > > purple color). Please find attached picture. > > > Using ImageJ I transformed the image in an 8-bit format. Then, using > the > > > threshold function I applied for needed levels of threshold. (See > slice > > > image 0006.1) > > > Then, I set measurements parametrs: Area, Area fraction, Limit to > > > threshold, Display label. > > > After measurement, ImageJ counted 37, 476 % . But actually damaged area > > on > > > this image is about 70-80 % > > > Could you give me suggestions or recommendation with this calculation? > Or > > > could you point out my mistakes? > > > Thank you in advance. > > > > > > > > > Kind regards, > > > Olga > > > > > > -- > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > <image0006.jpg><image0006.1.jpg> > > > > -- > > 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 |
Free forum by Nabble | Edit this page |