Keith A. Goatman (K.A.Goatman@abdn.ac.uk)
Department of Radiology, Aberdeen University, Scotland.
Some notes following the Four Nations Camera and Software Working Group meeting 10th May 2006.
The goal posts for choosing camera resolution have not so much shifted as been completely dug up in the past three years. Not so long ago it was safe to go for the highest possible resolution. In the early days this meant video screen resolution; 640x480 or 768x576 pixels and a bulky three-chip video camera. As camera resolution improved the ultimate goal became to match the resolution of 35mm slide film.
However, rapid improvements in sensor technology — driven by a market which judges cameras only on the number of pixels they produce — means that the highest possible resolution today is probably too high. It wastes valuable bandwidth and processing time for no gain whatsoever.
Modern cameras usually allow the user to save downscaled images, primarily in order to fit more images on memory cards. For instance, at full resolution a typical JPEG compressed image (i.e. not a retinal image) from the 12MP Canon EOS-5D averages around 5.5 megabytes, so 180 would fit on a gigabyte memory card. It also has settings for 6.7MP and 4.2MP. Similarly the EOS-30D, an 8MP camera, has 4.3MP and 2MP settings. Nikon's D200 is a 10MP camera with 5.6MP and 2.5MP settings.
Downsampling of large images, providing it's done properly, doesn't lose any information from the image (it wasn't there to start with) but can actually improve the image by reducing the noise level. In contrast, any JPEG compression increases the noise in the image.
The biggest problem with large images is not so much storage (large terabyte disc arrays are available and are relatively inexpensive) as transmission bandwidth. Even if all the graders' workstations are connected by a 100MB/s network to the server, there is still the problem of transferring the image from the camera to the host computer. Although USB2 has improved the situation (or at least it would if cameras fully utilised the available USB2 bandwidth) the difference between transferring a 12MB raw Canon 6MP image file and a 1.5MB high quality JPEG version of it is considerable.
Image compression may be categorised as lossy or loss-less. In loss-less compression the uncompressed image is identical to the original image. In contrast, lossy compression introduces some errors into the uncompressed image to allow much greater compression of the image. The degree of compression which is possible depends greatly on the image content. "Busy" images (which can be imagined to contain a lot of information) do not compress as well as smoother images with fewer changes in colour and brightness and less detail.
The compression ratio describes the relative size of the original, uncompressed image with respect to the (hopefully) smaller compressed image.
The following two images have both been compressed using the same JPEG algorithm (immitating that from the image Trevor sent us). The images below are large thumbnails — click on the image to see the full-size compressed image.
Scottish glen. Compression ratio 18:1. Using loss-less PNG compression (deflate algorithm, same as used by zip) a compression ratio of 1.4:1 was achieved. Here is the original uncompressed image.
A typical retinal image (Canon DGi with EOS-10D back — note the mask Digital Healthcare add to the image, its sharp edges are seen on the original uncompressed image). JPEG compression ratio 140:1. Using loss-less PNG compression a ratio of 3.9:1 was achieved, i.e. better than the landscape image with JPEG compression!
Figure shows breakdown of correct colouring with excessive JPEG compression.
The JPEG compression algorithm was carefully designed to disguise errors in typical images for normal viewing. The algorithms on the commercial equipment have not been optimised for ophthalmic images. Nevertheless, overall performance can be remarkable. Trevor's example image looked stunning even at a compression ratio of 150:1 — much better than I would have expected. The important distinction is between a visually acceptable image (which may be suitable for GP notes for instance) and one which is considered of diagnostic quality for grading from.
Large regions of exudates will be visible even at extreme compression ratios.
More subtle features, such as microaneurysms, isolated small exudates and new
vessels are a completely different matter. Probably the best place to look in
the image to see the effect of compression on subtle features is the macula,
where faint vessels and subtle brightness gradients are found, as these are the
features JPEG is not good at reproducing. Below is the macula region (with
contrast increased) from Trevor's image.
Macula region from Trevor's example image (whole image in colour).
Note the "blocky" appearance and the brightness contouring. Below is the same region from one of our images, also using a Canon 10D back, showing the original image and the same JPEG compression used in the above image.
Macula region from our Canon DGi and 10D back using the best quality camera compression setting (whole image in colour).
As above but using JPEG parameters from Trevor's image (whole image in colour).
Comparing the high quality compression with the lower quality compression we can see the degradation we must avoid in images intended for diagnostic purposes. Note in the more compressed image the false contouring and loss of low contrast detail (parts of the vessels disappearing). This could obscure microaneurysms (remember their size is of the same order of magnitude as the 8 by 8 blocks) and subtle new vessels.
Once the resolution limit of the eye has been exceeded no more information about the retina is added to the image. With low noise modern cameras this results in images which achieve higher compression ratios than smaller images with less redundancy.
However, I would recommend downscaling the image first (if it is larger than 6MP), since in theory this does not lose any image information and may improve the noise characteristics of the image. Then apply the best quality JPEG compression, which should only add structure-less noise which should have less impact on edge definition and subtle shading than applying more aggresive JPEG compression on the larger image, which introduces unnatural artefacts in the image.
There are many variables which affect the compression ratio achieved:
Since there are so many factors which affect the compression ratio, it is difficult to specify an acceptable compression ratio for retinal images, let alone for medical images in general.
We have a number of ideas and work in progress to validate image quality following lossy compression, which we can discuss in more detail at a later date. One way of testing the quality of the compression is to acquire a simultaneous compressed and uncompressed version of the same image (some cameras have this facility writing to the memory card). Look at the error map (difference between the images) and look for structural noise. In Aberdeen we have compared a number of lossy compression algorithms, including JPEG and JPEG 2000, with visual appearance and an automated image quality measurement .