I am developing an image processing algorithm / plugin for Fiji (ImageJ) that processes scanned microscope slide images (20x magnification) and extracts features from the slides.

The slides contain histological tumor sections that are stained immunohistochemically with an antibody that identifies nuclei positive with the Ki-67 protein, along with a counter-stain that identifies all nuclei. The so called proliferation index, which measures how fast the cells are dividing, is then calculated as the ratio of positive-to-negative nuclei. For the feature extraction, I basically need to extract two color components from the RGB image; the one corresponding to the positive nuclei (diaminobenzidine; brown color) and the other corresponding the negative cells (methyl green; light green color).

I am using Fiji's Color Deconvolution plugin (http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html) for separating the two stains. This works remarkably well, except when the slide has been drawn onto with a marker pen. Pathologists sometimes mark regions of interest on the slide with a marker pen so that it would be easier to inspect the slide later on. My data set contains slides that have been drawn onto with a red/blue/green or a black marker. The problem is that the presence of colors other than the two stains fails the color deconvolution algorithm totally.

An example of an artifact from a black marker pen Above is an example of a slide at 20x magnification showing the edge of a line drawn with a black marker pen on the top-half of the image. The lower part of the image shows the brown positive nuclei and the light green negative nuclei.

Is there any chance for filtering out these marker pen artifacts? The effect is similar to looking through a welder's mask, and I'd wan't to somehow subtract the mask from the image. If I can't filter out the marker, I'll probably just need to manually crop out the portions having these artifacts.


I've given high-pass filtering a try as suggested by Aaron. I used ImageJ's High-pass filter plugin, which creates a Gaussian blurred image from the source and then subtracts this blurred image from the original. The image is here (the radius / blur length or standard deviation of the Gaussian used was 20 pixels):

enter image description here

The artifact is almost gone and the nuclei are still recognizable, which is nice. The yellowish background color in the original (due to a calibration problem with the scanner) is also gone.

However, I'd also like to understand how this works. :) What does the Gaussian do to the RGB values of each pixel? How should I select the pixel radius for the Gaussian? Wikipedia's Gaussian Blur article wasn't all that clear to me. Are there other ways for implementing a high-pass filter for image data?

  • 1
    $\begingroup$ Do a high pass filter $\endgroup$ – Aaron May 3 '14 at 16:48
  • $\begingroup$ @Aaron, I've given the high-pass filtering a try and it seems quite promising. Would you want to write an answer that gives some details as to why this works? $\endgroup$ – Mick Mnemonic May 5 '14 at 23:11
  • 1
    $\begingroup$ Another thing you might want to try a different color space besides RGB. You could use HSV and then only apply the gaussian filter trick to the V channel. $\endgroup$ – Aaron May 5 '14 at 23:59

You could also try local contrast enhancement or similar. Fiji has a function called Enhance Local Contrast (CLAHE) which does this. Looks like high pass filtering works reasonably well for you though.

As for your second question. The Gaussian Blur wikipedia you mention refers to Low pass filter. For the low pass filter each pixel is average over the surrounding pixels, weighted by a Gaussian centred on the pixel. In your case you are doing a high pass filter. This can can be given by the original minus the low pass filter, which is probably the easiest way of thinking about it (IMO).


The image looks like it would be mostly bi-modal ( see Otsu Method). You may be able to segment it and then apply separate Histogram Equalizations to both segments separately then recombine the results in the same range of values.

  • $\begingroup$ My plan is to do something similar to what you suggest (deconvolve the two stains and threshold the resulting two images separately). However, deconvolution and thresholding (Otsu's method) will fail with the example image because of the artifact, which is why I'd like an answer that addresses the artifact removal problem. $\endgroup$ – Mick Mnemonic May 5 '14 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.