Background: Many digital microscopy images suffer from poor illumination at the peripheries (vignetting), often attributable to factors related to the light path between the camera and the microscope. A commonly used method for correcting this has been to use the illumination of an empty field as a correction filter (white shading correction).
Aims: To develop an alternative shading correction method that does not require this additional image.
Methods/Results: This report outlines an alternative shading correction method that is based upon the intrinsic properties of the image, which are revealed through Gaussian smoothing. The technique can be implemented within Adobe Photoshop or other graphics editing software and works well with both haematoxylin and eosin and immunohistochemical images.
Conclusions: This technique provides an effective means of optimising digital microscopy image appearances for printing, image analysis, or telepathology.
- shading correction
- digital microscopy
- digital imaging
- low pass filtering
Statistics from Altmetric.com
L ow cost digital imaging has grown exponentially over the past few years and the popularity of digital microscopy has increased accordingly. However, theoretical and practical knowledge of the subject among practising pathologists has not parallelled this growth and many users are frustrated by their early results.
Cameras such as the Nikon Coolpix series and Olympus C-3030/4030 are midrange home consumer cameras that can be adapted to standard C mount adaptors and mounted on top of the microscope. Those unwilling to pay for this option can gain reasonable pictures by holding the camera up to the microscope eyepiece lens.1
A common problem irrespective of the type of camera and method of microscope attachment is uneven illumination at the edges of the image, otherwise known as vignetting. This may be attributed to multiple factors from the illumination filament, the design of the light path between the camera and the microscope, or the behaviour of the imaging device.2 Conventional digital cameras—for example, are not designed for microscopy imaging, and many of their automatic functions can interfere with the correct aperture and exposure settings.
“A common problem irrespective of the type of camera and method of microscope attachment is uneven illumination at the edges of the image, otherwise known as vignetting”
More expensive dedicated microscopy cameras such as the Nikon DXM1200 and ProgRes C14 have a function in their image acquisition software known as “white shading correction” to reduce the problem of vignetting. This works by taking a photograph of a blank (white) image and subtracting or dividing it pixel by pixel from the image to be corrected. Some normalisation of brightness is performed afterwards to improve appearances. This is one of the benefits of working in the digital medium over conventional chemical based imaging. Unfortunately, a white shading correction image must be acquired for each objective magnification and recalculated if the microscope illumination settings are altered.
For those using simple techniques, such as holding a digital camera to the eyepiece, this task is difficult and inaccurate, particularly given variations in the positioning of the camera relative to the eyepiece between photographs.
In other situations, the vignetting is not obvious when acquiring images and only becomes apparent when the microscopist adjusts contrast or brightness within their image editing software. By then, it may be too late to take the white reference image. In the absence of insight, to avoid this many circumvent the problem by cropping the image, thus reducing the image field of view. Others attempt to compensate by approximating the shading gradient, but this is unreliable and inaccurate, particularly when the uneven illumination is asymmetrical. Likar and colleagues3 and Russ4 have described various approaches to shading correction. The principle method of Likar et al involved modelling the image creation process by two parametric components and used entropy as a measure of global intensity uniformity. Their corrected image was one in which the entropy was minimised. This technique adapts well to unevenness in illumination background and also unevenness in the object being illuminated. Russ has described sampling intensity values of an image and using a least squares fitting to determine a polynomial function B(x,y) that approximates the background. He has also discussed separately using rank neighbourhood intensity value comparisons and Fourier transformation to separate background illumination on the basis of it being a low frequency signal.4
We outline a method of shading correction that does not require a reference white image. Instead, it extracts the underlying illumination pattern and uses this to correct the image. Its implementation is straightforward and uses relatively common software.
Our method is based upon the assumption that the uneven illumination is an additive low frequency signal. Therefore, low pass filtering can be used to extract it from an image. This filtering may be achieved by convolving the image p(x) with a Gaussian kernel. The Gaussian function G(x,y) is defined by:
where σ defines the effective spread of the function. The effect of this function is to delimit the spatial frequencies in an image, resulting in loss of edge definition and averaging of intensity values.5,6 The larger the value of σ, the greater the smoothing effect. Approximating the shading in this manner is not a new idea but merely a recognised feature of the Gaussian function. What we have done is to implement this in a manner that is accessible to digital microscopy users who may lack this background knowledge. Many microscopists have used Adobe Photoshop, albeit tentatively and in a trial and error manner, without understanding the underlying mathematical processes. However, Photoshop is based upon some fundamental image processing techniques. We used Photoshop v5 on a Windows 2000 workstation (650 MHz Pentium III, 256 M RAM), but the functions outlined are not version specific.
The first step is to convert a copy of the original 24 bit colour image to an 8 bit greyscale image (a “black and white” image). There are several different methods of greyscale quantisation but any technique is satisfactory in this situation. It is perfectly adequate to use the “desaturate” command (shift/control/u).
This image is convolved with a Gaussian kernal filter. Photoshop has this as an inbuilt command. The “radius” value in Photoshop is the size of the numerical kernal (filter) that is applied to the image and is proportional to σ, the standard deviation of the Gaussian curve (fig 1).
The optimal size of the Gaussian filter is dependent upon the scale of the objects in the image and the size of the digital image. We found that for 1600 × 1200 pixel histological images taken with a ×4 objective lens (Nikon E1000, ×4 Plan Apo), with a ×0.63 relay lens between the microscope and the camera, a radius value of 120 was adequate. The aim is to smooth the image until it is devoid of features but retains the weighted average intensity across the image and corresponds to the underlying illumination pattern.
To use this filter to correct the original image involves inverting it, placing it as a “layer” on top of the original image, and blending it using the Photoshop “hard light” blend mode. In this mode, the pixel value of the upper layer (correction image) is assessed and if greater/less than 50% grey, is divided/multiplied by the corresponding lower layer pixel (original image). Unfortunately, the result overcorrects the shading imbalance, so to reduce the effect, the opacity of the correction layer is set to 50%.
Take home messages
We describe a shading correction method for digital images that does not require white shading correction and is based upon the intrinsic properties of the image, which are revealed through Gaussian smoothing
The method can be implemented within Adobe Photoshop or other graphics editing software and works well with both haematoxylin and eosin and immunohistochemical images
This technique provides an effective means of optimising digital microscopy image appearances for printing, image analysis, or telepathology
Several examples are illustrated in fig 2. They demonstrate the effectiveness of this method. The tasks required to achieve this effect do not require excessive computer processing and were achieved in less than a minute.
It may be necessary to make minor adjustments to the tonal range of the correction image to achieve optimum illumination, but adjusting the blend between the two image layers is often all that is required. As with any illumination correction technique, there is a small decrease in the dynamic range of the image; that is, the range between the brightest and the darkest pixel. Applying contrast expansion compensates for this, and one way of doing this in Photoshop is by adding a levels adjustment layer and defining the black and white point at the extremes of the intensity histogram. This process may be streamlined by using the Photoshop autocontrast function.
Digital microscopy images are fundamental to the practice of telemicroscopy/telepathology,7 and have many advantages beyond conventional chemical film based imaging. The correction of uneven illumination is not needed just for aesthetic reasons, it is often a necessary precursor to image analysis,4 or may be required if the image is to be printed for publication or if it is to be combined with others in a digital slide.8 Our method may be applied using any graphics editing software with a Gaussian blur function and support for multiple image layers. Adobe Photoshop was used because it is regarded as an industry standard. The process can be implemented in a under a minute and can even be automated as an “action macro” (a set of prerecorded commands) within Photoshop and applied to a set of images as a batch process.
“Our method may be applied using any graphics editing software with a Gaussian blur function and support for multiple image layers”
The effectiveness of a digital microscopy imaging system can be undermined if any component in this system in suboptimal. The fact that post-acquisition digital image processing may take place is not an excuse for poor photographic or microscopy technique. The importance of clean optics and Kohler illumination has not diminished, but even diligent application of these factors will not prevent illumination problems.
Rather than focus on the exaggerated perils of digital images,9 histopathologists and other microscopy users should be examining the potential benefits of digital imaging to their work practice. We have described one example of the versatility of working with microscopy images in the digital medium. It is useful in any situation where suboptimal imaging has taken place and is not correctable by microscope manipulations.
The Photoshop implementation of this function will be made available directly from the authors.
If you wish to reuse any or all of this article please use the link below which will take you to the Copyright Clearance Center’s RightsLink service. You will be able to get a quick price and instant permission to reuse the content in many different ways.