JPEG Compression in Medical Imaging
The EasyCopy Company - the manufacturer of JPEG PRO
September 11, 1996
Filmbased X-ray archives
The German physicist Wilhelm Conrad Röntgen (1845 - 1923), discovered X rays, for which he in 1901 received the first Nobel Prize for physics. He observed in 1895 - just over hundred years ago - that barium platinocyanide crystals across the room fluoresced whenever he turned on a Crooke's, or cathode-ray discharge, tube, even when the tube, an electron emitter, was shielded by black cardboard or thin metal sheets. Röntgen correctly hypothesized that a previously unknown form of radiation of very short wavelength was involved.
These X-rays, as he named them, were immediately put at the service of medicine, enabling doctors to "see" inside their patients. The penetrating rays exposed photographic films, and the shadows of bones, tissue, etc. in the body emerged when the films were developed.
Since then, archives with endless miles of shelves containing films have been established in connection with X-ray departments in the worlds hospitals. Such archives suffer from three major drawbacks:
- They occupy many, very expensive square feet - and they still grow
- It takes a lot of time and man-power to fetch the films
- 30 percent of the films simply disappear from the archives!
Within the last couple of decades, new X-ray equipment (modalities) - like Computer Tomography (CT) and Magnetic Resonance (MR) scanners - have come to use in the X-ray departments.
Unlike the traditional X-ray equipment, these new scanners cannot expose films directly. The output from the devices is the result of complex mathematical calculations on signals detected during the scanning - and it is thus digital rather than analogue images of the patients that result from such scannings.
Even in the more traditional examinations, the directly exposed films are disappearing. Instead plates of phosphor or selenium are placed behind the patient, exposed with X-rays and subsequently placed in a reader, which with the help of a laser beam converts the latent image to a digital signal.
What happens now to all these digital images? They are sent to so-called laser cameras, which print them out on film. Back to the archives!
The obvious question is now: Why not store all these digital images in databases, rather than printing them on films?
This has actually been done, but the number of such PACS (Picture Archival and Communications System) systems replacing completely the filmbased archives are few worldwide - and for a number of reasons:
- A medium size hospital with 50.000 X-ray examinations per year produce the equivalent of 3-4 Gigabytes per day. The health authorities normally require that some years production is archived. In Denmark, for example, the National Board of Health rules that 5 years production must be stored.
What is more important though, is the need of the radiologists to be able to refer to earlier examinations for comparison. So the capacity of the archive should be at least 5 Terabytes (5.000 Gigabytes) - and it should be online!
- Although the images from CT and MR scanners are normally quite small, typically 512 x 512 pixels with 10-12 bits per pixel, the majority of the images are much larger.
Typically a digital chest X-ray is 2000 x 2500 pixels, again with 10-12 bits per pixel. Such an image takes up 10 Megabytes in the archive. The distribution of these images within the X-ray department requires a very fast network.
- Due to the lack of standards, it has been extremely difficult, if not impossible, to hook up digital X-ray equipment from different vendors to a network for image distribution and archival.
Most of the few completely filmless departments in the world have been set up with equipment from only one vendor - X-ray devices, network, archive, everything. Result - a very inflexible, and very expensive solution.
Major advances in the last years have remedied this situation.
- Off-the-shelf, standardized ATM networks starting at 155 Megabits per second as well as network adapters for workstations, PC's and MAC's are now readily available.
- An internationally approved, complete protocol for medical image communication, DICOM, is being defined. Basing a department completely on this standard will make it possible to choose the different components from different vendors.
The capacity of the archive is still a problem however. Even though it is technically possible to set up multi-terabyte archives online, it is still very expensive, if a decent performance is to be achieved. Even this problem can be solved, however, and the solution is image compression.
A major danish county hospital and AutoGraph International have performed a number of experiments with JPEG compression of medical images, and the results have been very encouraging. The first results were obtained on digitized film images, and these have later been confirmed on CR images.
Such high resolution images can typically be compressed 50:1 without endangering the diagnostic quality. 98% of the original data can thus be discarded. An image indistinguishable from the original can be reconstructed from the remaining 2%. In other words: 10 MBytes image data for a chest X-ray can be compressed and stored in merely 250 KBytes!
Three major advantages result:
- The hospital's need for X-ray archive capacity is reduced from 5 Terabytes to less than 200 Gigabytes, even when a conservative estimate of an overall compression factor as low as 30 is assumed. This brings it to the capacity of off-the-shelves optical disc jukeboxes.
- The overall performance on image display will improve. Although decompression of the compressed images obviously is more time consuming than just receiving uncompressed data, this is more than compensated by the reduction in time of reading the data from slow traditional archive media and piping it through the network. It also implies that the load on the network is reduced enormously, thus minimizing the risk of request clashes.
- Export of images outside the fast network of the X-ray department will suddenly be possible. The small amounts of data constituting the compressed images can without any problems be sent over a slower twisted pair hospital wide network for decompression on simple Hospital Information System (HIS) terminals. Thereby any sector of the hospital may gain access to the images. This concept is obviously extendable to the general practitioners outside the hospitals.
DICOM and JPEG
What now about the standards?
The very good news are that DICOM supports the use of all modes of JPEG compression. There remains however still a legal rather than a technical obstacle to the use of compressed images. It is formulated in the DICOM standard:
The context where the usage of lossy compression of medical images is clinically acceptable is beyond the scope of the DICOM Standard. The policies associated with the selection of appropriate compression parameters (e.g. compression ratio) for JPEG lossy compression is also beyond the scope of this standard.
DICOM standardizes how JPEG should be used, but not that it can be used legally. When specifying the archive and network to be set up in the new filmless X-ray department in the Danish county hospital it was decided to go for the full usage of image compression to obtain all the advantages, and the Danish National Board of Health was approached to rule whether or not lossy compression would be legally accepted. Their decision was equally short and wise:
The result of an X-ray examination is the written report of the radiologist. The image is merely an addendum to this report, and must - as such - clearly exhibit what is described. Whether the image has been compressed or not is therefore irrelevant!
This decision paved the legal way for the new X-ray department, which will open in the early fall of this year.
JPEG modes and quality
A number of things must be taken into account when using JPEG in medical imaging:
- To many people, JPEG means baseline JPEG. Baseline mode, however, is the simplest form with only 8 bits per color compent - or per pixel in gray scale - are allowed. This is insufficient for most medical images. Therefore the so-called extended sequential mode, which allows for either 8 or 12 bits per color component, must be used.
- JPEG quality is neither standardized in JPEG nor in DICOM. It has been proven over and over again that JPEG can produce very high quality images with very high compression factors. JPEG can, however, also produce arbitrarily horrendous images even at very low compression factors if not used properly.
Image quality is managed via the so-called quantization matrices, which is defined for each image to be compressed. The matrices used for a given image is part of the compressed data stream. These matrices must be chosen with great care! The optimal matrices for medical images depend on the image resolution, the type of examination, the X-ray modality from where the image came, etc. If sub-optimal matrices are chosen artifacts like blocking or blurring may occur.
- Images that are subject to subsequent severe manipulation of brightness and contrast (window and level in the X-ray terminology) should be compressed more conservatively than normal images.
It may sometimes be necessary to use a lossless compression, which will allow an exact reconstruction of the original image. To this end the lossless mode of JPEG serves perfectly. This mode is also supported in DICOM.
- A very exciting possibility even in medical imaging is the progressive mode of JPEG. When using this mode, the image is reconstructed in various scans, each scan adding quality to the image.
This is realized by reshuffling the information laid down in the compressed datastream. The total size of the compressed image is therefore the same as in baseline or extended sequential mode. By using typically only the first 10% of the progressively compressed datastream (around a 300th of the original image!) a full image is obtained. When displayed in thumbnail size this is perfect for browsing purposes.
Note, that this feature is obtained - not with multiple versions of the image - but with one file per image, and thus no redundancy in the database.
JPEG versus other compression algorithms
A number of very interesting image compression algorithms different from JPEG exist. The most promising of these is wavelet compression, which can be seen as a generalization of the JPEG algorithm, and thus almost per definition at least as good as JPEG. Where JPEG decomposes the images in two-dimensional cosine functions in fixed blocks, wavelet compression can select more flexibly the decomposition functions.
Successful experiments with wavelet compression has been performed on medical images. It is however not trivial to compare the results with JPEG. It is sometimes heard that JPEG produces blocky images and wavelets does not. As mentioned above, JPEG can produce blocky images, if not treated properly. The artifacts introduced in wavelet compression are more "noisy", and can thus be confused with digitization noise. We have knowledge of some fair comparisons between wavelet and JPEG. These indicate that wavelets can compress up to 30 percent better than JPEG at comparable subjective quality. This difference can probably be reduced somewhat with further fine-tuning of the JPEG quantization matrices.
There is, however, one crucial catch to using wavelet compression: It is not standardized! This means that the highly desirable open architecture for an X-ray department cannot be obtained.
Using JPEG in practice
The way JPEG compression will be used in practice in the Danish county hospital is briefly as follows:
Each DICOM image coming from the modalities to the network is - still in an uncompressed version - described by the radiologists, if necessary with changes to window and level. When signed and contrasigned the image is compressed using predefined quantization matrices for precisely this type of examination resulting in this type of image, coming from this modality. To begin with, conservative quantization matrices will be used, ensuring that the radiologists feel completely comfortable with the quality of the archived images. After a period - 6 months to a year - the results will be revised, and the matrices will be adjusted accordingly. The radiologists will therefore not be troubled in the daily work with decisions on quality.
The reason that this scheme is feasible lies in the JPEG algorithm. Once a given quantization matrix is selected, a given, well-defined image quality - not compression factor - follows. Very complex images, full of fine details compress with a relatively low factor, whereas simple images, with few details and large slow-varying areas will automatically compress very well. As of example of this, examinations where part of the image has been masked out, compress very well. The algorithm immediately identifies the unexposed areas and use a minimum of information to represent them in the compressed datastream.
Even though Denmark is one of the very few countries that officially has taken a stand on the usage of lossy image compression in medical imaging, we are confident that the benefits of image compression will soon be evident.
The radiologists at the county hospital - a general rather than university hospital! - are certain that the images are clinically acceptable, and the reaction from radiologists around the world on test images is the same.
While waiting for the legislators, lossless compression can be used.