Hi there,
I have recently downloaded imageJ and and exploring the procedures for standardising DAB quantification. The plugin by Gabriel Landini has been great and I am learning to modify the procedure to suit my protocol. When I tried to do background correction as specified in http://imagejdocu.tudor.lu/doku.php?d=howto:working:how_to_correct_background_illumination_in_brightfield_microscopy I have converted the digital images ( of the image in question, darkfield and brightfield) to 8 bits. I then performed the background correction as specified , including the use of the IJ_Robot plugin for multiplying the output by 255. I am getting a background clear image that looks black and white. I try to convert it to RGB by going to imageJ > image> RGB but the image still looks black and white. When I do the background correction using the rolling ball method of imageJ, I am able to do a good deal of the background correction. I was wondering if there is something simple I am missing out on in doing the background correction to convert the image back to colour? Thanks Vivek |
Hi Vivek,
when doing the background correction, if you don't use the 'CalculatorPlus plugin, you have to work with float (32-bit) images when dividing. Below is a macro that does this for dark and flat (brightfield) correction; if you like you can paste it into your StatupMacros.txt file. If you want to convert back to 8 bits after correction, disable 'scale when converting' in Edit>Options>Conversions and set the 'maxRatioOverFlat' variable to get good contrast in your image (typical values are slightly above 1.0). Mind possible line breaks introduced by the mailer (all lines inside the macro body should be indented by at least two spaces; any non-indented lines inside the macro body are due to line breaks by the mailer). Michael ________________________________________________________________ // Dark screen and flat field correction // Author: Michael Schmid, 06-Oct-2010 //global variables for dark screen/flat field correction var dark = 2e9; //dark&flat image numbers: initialize to impossible value var flat = 2e9; var image = 2e9; var minFlat = 0.1; //minimum flat field as percentage of maximum var maxRatioOverFlat = 5; //how much image may be brighter than flat //Dark screen and flat field correction macro "Dark & Flat Correction..." { n = nImages(); if (n<3) exit("Error: 3 images needed:\nimage, dark frame and flat field"); startId = getImageID(); setBatchMode(true); imgNames = newArray(n); for (i=0; i<n; i++) { selectImage(i+1); title = getTitle(); id = getImageID(); imgNames[i] = title; if (matches(title,".*[dD][aA][rR][kK].*")) { if (!isOpen(dark)) dark = id; } else if (matches(title,".*[fF][lL][aA][tT].*")) { if (!isOpen(flat)) flat = id; } } if (!isOpen(dark)) dark = startId; selectImage(dark); darkTitle = getTitle(); if (!isOpen(flat)) flat = startId; selectImage(flat); flatTitle = getTitle(); if (!isOpen(image)) image = startId; selectImage(image); imageTitle = getTitle(); Dialog.create("Dark Field and Flat Screen"); Dialog.addChoice("Image", imgNames, imageTitle); Dialog.addChoice("Dark", imgNames, darkTitle); Dialog.addChoice("Flat", imgNames, flatTitle); Dialog.addNumber("Min Flat Intensity", minFlat, 3, 6, "(fraction of max)"); Dialog.addNumber("Max Image/Flat Ratio", maxRatioOverFlat, 3, 6, ""); Dialog.show(); selectImage(Dialog.getChoice()); image = getImageID(); slices = nSlices(); imageTitle = getTitle(); selectImage(Dialog.getChoice()); dark = getImageID(); selectImage(Dialog.getChoice()); flat = getImageID(); minFlat = Dialog.getNumber(); maxRatioOverFlat = Dialog.getNumber(); imageCalculator("Subtract create 32-bit", flat, dark); flatMinusDark = getImageID(); getStatistics(area, mean, min, max); setThreshold(min-1, max* minFlat); run("Create Selection"); roiManager("Reset"); roiManager("Add"); if (slices>1) { newImage(imageTitle+"_corr", "32-bit", getWidth(), getHeight(), slices); out = getImageID(); setPasteMode("Copy"); } for (i=1; i<=slices; i++) { selectImage(image); setSlice(i); label = getInfo("slice.label"); imageCalculator("Subtract create 32-bit", image, dark); imgMinusDark = getImageID(); imageCalculator("Divide create 32-bit", imgMinusDark, flatMinusDark); run("Min...", "value=-1"); run("Max...", "value="+maxRatioOverFlat); roiManager("Select", 0); run("Set...", "value="+maxRatioOverFlat); run("Select None"); if (slices>1) { run("Copy"); close(); selectImage(out); setSlice(i); run("Paste"); setMetadata("Label", label); } else { rename(imageTitle+"_corr"); } selectImage(imgMinusDark); close(); } selectImage(flatMinusDark); close(); setBatchMode("exit and display"); } ________________________________________________________________ On May 22, 2012, at 19:36, vsaroha wrote: > Hi there, > > I have recently downloaded imageJ and and exploring the procedures for > standardising DAB quantification. The plugin by Gabriel Landini has been > great and I am learning to modify the procedure to suit my protocol. > > When I tried to do background correction as specified in > http://imagejdocu.tudor.lu/doku.php?d=howto:working:how_to_correct_background_illumination_in_brightfield_microscopy > > I have converted the digital images ( of the image in question, darkfield > and brightfield) to 8 bits. I then performed the background correction as > specified , including the use of the IJ_Robot plugin for multiplying the > output by 255. > > I am getting a background clear image that looks black and white. I try to > convert it to RGB by going to imageJ > image> RGB but the image still looks > black and white. > When I do the background correction using the rolling ball method of imageJ, > I am able to do a good deal of the background correction. > > I was wondering if there is something simple I am missing out on in doing > the background correction to convert the image back to colour? > > Thanks > > Vivek > > > -- > View this message in context: http://imagej.1557.n6.nabble.com/a-priori-background-correction-in-brightfield-microscopy-tp4998229.html > Sent from the ImageJ mailing list archive at Nabble.com. |
On Tuesday 22 May 2012 19:33:49 Michael Schmid wrote:
> when doing the background correction, if you don't use the 'CalculatorPlus > plugin, you have to work with float (32-bit) images when dividing. Hi, @ Michael: you can do :-) I use it all the time. In fact, the Calculator Plus does the division in 32 bit mode. That is the point of the plugin. It is not only a division, but a compound operation: (i1/i2)*k1+k2. @ Vivek I am puzzled by this: > I have converted the digital images ( of the image in question, darkfield > and brightfield) to 8 bits. So you are capturing in greyscale? >I then performed the background correction as > specified , including the use of the IJ_Robot plugin for multiplying the > output by 255. I guess that this mean you are using the "Image Calculator" instead of the "Calculator Plus"? You need to use the "Calculator Plus" as is indicated in that article. The division and multiplication by 255 is done in one single step. But, the most important thing is that if you are trying to quantify DAB intensity, you are not going to be able to do it reliably. Read the whole Colour Deconvolution plugin page. There is enough explanation why. Regards Gabriel |
Hi Gabriel,
yes, of course it works with the Calculator_Plus as in your Wiki page! By the way, my macro is for grayscale only; the reason for doing it that way was having a float result where I can adjust brightness and contrast before converting to 8 bits again. Michael ________________________________________________________________ On May 22, 2012, at 20:55, Gabriel Landini wrote: > On Tuesday 22 May 2012 19:33:49 Michael Schmid wrote: >> when doing the background correction, if you don't use the 'CalculatorPlus >> plugin, you have to work with float (32-bit) images when dividing. > > Hi, > @ Michael: you can do :-) I use it all the time. > In fact, the Calculator Plus does the division in 32 bit mode. That is the > point of the plugin. It is not only a division, but a compound operation: > (i1/i2)*k1+k2. > > @ Vivek > I am puzzled by this: >> I have converted the digital images ( of the image in question, darkfield >> and brightfield) to 8 bits. > > So you are capturing in greyscale? > >> I then performed the background correction as >> specified , including the use of the IJ_Robot plugin for multiplying the >> output by 255. > > I guess that this mean you are using the "Image Calculator" instead of the > "Calculator Plus"? > You need to use the "Calculator Plus" as is indicated in that article. The > division and multiplication by 255 is done in one single step. > > But, the most important thing is that if you are trying to quantify DAB > intensity, you are not going to be able to do it reliably. Read the whole > Colour Deconvolution plugin page. There is enough explanation why. > > Regards > Gabriel |
In reply to this post by vsaroha
Dear Gabriel,
Thank you for your reply and more importantly for the great plugin. I am not trying to quantify the stain intensity ( after reading the reasons in your helpful post on the webpage) , I need to quantify the satined area and also identify the location (to the type of cells) in the tissue. So far, I have been doing this: Take image with the Volocity software, Convert to TIFF, Open in imageJ, Background reduction and seperate colours ( As I am yet to learn to successfully do the a priori background correction, I do have the Darkfield and brightfield images from the time of acquisition), Colour Deconvolution, Convert to 8 Bits, standardised thresholding ( Threshold identified from the negative controls with no antibodies ). Quantification of the area and I plan to localise the tissue bu merging this thresholded image with the background corrected or the blue deconvoluted image. Regarding the apriori background correction (I do use the calculator plus plugin and multiply with 255 ) : I converted the image to 8 bits because the instructions on the background substraction with colour correcton website mentions 8 bit channel in step five: " 5. Apply the correction The operation (in a 8 bit channel) consists of calculating the transmittance through the specimen: Corrected_Image = (Specimen - Darkfield) / (Brightfield - Darkfield) * 255" I will be really grateful for your opinion regarding my method and also about where I am going wrong in performing the background reduction. Should I not be converting them to 8 bits? Best regards Vivek |
> I have been doing this:
> Take image with the Volocity software, Convert to TIFF, Open in imageJ, > Background reduction and seperate colours ( As I am yet to learn to > successfully do the a priori background correction, You shouldn't apply the "a posteriori" background reduction if you are planning to do colour deconvolution. Are you using colour images? If so, the background correction is applied to the colour image, not to the deconvolved image, and no conversion to 8 bits. > Regarding the apriori background correction (I do use the calculator plus > plugin and multiply with 255 ) : I converted the image to 8 bits because > the instructions on the background substraction with colour correcton > website mentions 8 bit channel in step five: > 5. Apply the correction > > The operation (in a 8 bit channel) consists of calculating the transmittance > through the specimen: Corrected_Image = (Specimen - Darkfield) / > (Brightfield - Darkfield) * 255" It does not say anywhere that you need to convert to 8 bits. It says that within each of the RGB channels (which are 8 bits) the operation is ... Cheers G. |
Free forum by Nabble | Edit this page |