Good morning,
I'm sorry to bother but I'm new to ImageJ. I am trying to apply the Beer-Lambert law to get Absorbance of my images. I have a stack (named I) and the z-projection of max intensity (named I0). Absorbance = ln(I0)-ln(I). I understood that the log in Imagej is ln(p)*255/ln(255) so I have to multiply by 0.02173 to get the ln of my image. The problem: 0.02173*[log(I0)-log(I)] gives me a different value than 0.02173*log(I0)-0.02173*log(I) hence if I make the difference of the two images and then multiply by the constant I get a different value of mean intensity than multiply each image by the constant and the make the difference. Is it a problem in my software? Or is it how imagej function? Because all my data could either be good or wrong. Thank you very much for your help, Best regards, Edouardo -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Eduardo,
Make sure your calculations are done with pictures in 32Bits depth. Otherwise the best would probably be to make an example of your pictures available. My best regards, Philippe Philippe CARL Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 42 89 ----- Le 9 Avr 20, à 18:59, Edouardo [hidden email] a écrit : Good morning, I'm sorry to bother but I'm new to ImageJ. I am trying to apply the Beer-Lambert law to get Absorbance of my images. I have a stack (named I) and the z-projection of max intensity (named I0). Absorbance = ln(I0)-ln(I). I understood that the log in Imagej is ln(p)*255/ln(255) so I have to multiply by 0.02173 to get the ln of my image. The problem: 0.02173*[log(I0)-log(I)] gives me a different value than 0.02173*log(I0)-0.02173*log(I) hence if I make the difference of the two images and then multiply by the constant I get a different value of mean intensity than multiply each image by the constant and the make the difference. Is it a problem in my software? Or is it how imagej function? Because all my data could either be good or wrong. Thank you very much for your help, Best regards, Edouardo -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Philippe,
Thank you for your answer, I'm working with 8-bits grayscale images. I'll attach a frame and the z_projection of the sequence. What I'm doing is math->log of each image and then make difference of MAX-seq and brut and then multiply the result with 0.02173 to get ln(I0)-ln(I). But I realized that if I multiply each log with the constant to get the ln of each image and then make the difference I get different mean values. I am also coupling with a python code using the library pims and I am getting the same result as the second case in ImageJ. I am struggling to understand why doing cte*[log(I0)-log(I)] is different than cte*log(I0)-cte*log(I), the last case being the one I get using python code. Thank you very much, Bien Cordialement, Edouardo <http://imagej.1557.x6.nabble.com/file/t382607/brut0000-1.jpg> <http://imagej.1557.x6.nabble.com/file/t382607/MAX_seq.jpg> -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Eduouardo,
Please consider the following macro code: open("http://imagej.1557.x6.nabble.com/file/t382607/brut0000-1.jpg"); run("32-bit"); run("Log"); rename("I0"); open("http://imagej.1557.x6.nabble.com/file/t382607/MAX_seq.jpg"); run("32-bit"); run("Log"); rename("I"); // Difference 1 imageCalculator("Subtract create 32-bit", "I","I0"); run("Multiply...", 0.02173); rename("Difference1"); // Difference 2 selectWindow("I0"); run("Multiply...", 0.02173); selectWindow("I"); run("Multiply...", 0.02173); imageCalculator("Subtract create 32-bit", "I","I0"); rename("Difference2"); // Difference 1 - Difference 2 imageCalculator("Subtract create 32-bit", "Difference1","Difference2"); rename("Difference1-2"); getMinAndMax(min, max); print(max); The result of the maximum difference I get is 3.5763E-7 which is within the calculation errors. Also I guess you are aware that calculations shouldn't be done using jpeg pictures since the format is destrutive. Additionally, I got all the pasted code using the "Plugins>Macro>Record..." feature. Feel free to contact me if something is still not clear. I wish you a happy week-end and Eastern. Take care, Philippe Philippe CARL Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 42 89 ----- Mail original ----- De: "Edouardo" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Jeudi 9 Avril 2020 21:47:06 Objet: Re: Multiplying the log of two images by a constant is giving different results. Dear Philippe, Thank you for your answer, I'm working with 8-bits grayscale images. I'll attach a frame and the z_projection of the sequence. What I'm doing is math->log of each image and then make difference of MAX-seq and brut and then multiply the result with 0.02173 to get ln(I0)-ln(I). But I realized that if I multiply each log with the constant to get the ln of each image and then make the difference I get different mean values. I am also coupling with a python code using the library pims and I am getting the same result as the second case in ImageJ. I am struggling to understand why doing cte*[log(I0)-log(I)] is different than cte*log(I0)-cte*log(I), the last case being the one I get using python code. Thank you very much, Bien Cordialement, Edouardo <http://imagej.1557.x6.nabble.com/file/t382607/brut0000-1.jpg> <http://imagej.1557.x6.nabble.com/file/t382607/MAX_seq.jpg> -- Sent from: http://imagej.1557.x6.nabble.com/ -- 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 Edouardo
Greetings Edouardo,
If your data is in physical units spatially distributed throughout a plane, i.e., you do not have a picture, you should first convert your data to '32 bit' float Image>Type>32 bit. The acquired data may have been stored in 8 bit format for convenience and/or to save space. I assume that the way log was implemented for '8 bit' images has to do with how pictures are processed. If you are doing a nonorthogonal projection, then you will want to convert your data to 32 bit float before the projection. The quantization of your data will give you many more headaches than just the log. Enjoy, Fred On Thu, April 9, 2020 2:47 pm, Edouardo wrote: > Dear Philippe, > Thank you for your answer, I'm working with 8-bits grayscale images. I'll > attach a frame and the z_projection of the sequence. > > What I'm doing is math->log of each image and then make difference of > MAX-seq and brut and then multiply the result with 0.02173 to get > ln(I0)-ln(I). But I realized that if I multiply each log with the > constant > to get the ln of each image and then make the difference I get different > mean values. > > I am also coupling with a python code using the library pims and I am > getting the same result as the second case in ImageJ. > > I am struggling to understand why doing cte*[log(I0)-log(I)] is different > than cte*log(I0)-cte*log(I), the last case being the one I get using > python > code. > > Thank you very much, > Bien Cordialement, > Edouardo > > > <http://imagej.1557.x6.nabble.com/file/t382607/brut0000-1.jpg> > <http://imagej.1557.x6.nabble.com/file/t382607/MAX_seq.jpg> > > > > -- > Sent from: http://imagej.1557.x6.nabble.com/ > > -- > 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 |