You are on page 1of 8

IET-UK International Conference on Information and Communication Technology in Electrical Sciences (ICTES 2007), Dr. M.G.R.

University, Chennai, Tamil Nadu, India. Dec. 20-22, 2007. pp. 743-750.

Performance Analysis of Medical Image Compression Techniques with respect to the quality of compression
Department of Electrical Engineering Research Scholar IIT Roorkee, India. E-mail: m_ahmad786@rediffmail.com

M.A. Ansari *

Department of Electrical Engineering Indian Institute of Technology Roorkee UK E-mail: anandfee@isc.iitr.ernet.in

R.S. Anand 2

Keywords: DCT, Wavelet Transform, JPEG, Quality factor, compression ratio Abstract In this paper a qualitative analysis of different types of medical image compression techniques have been made. We find that lossless techniques are not much feasible for large data compression while the lossy compression techniques can compress a huge amount of data selectively to improve the over all compression ratio with a good quality factor. The emphasis is done on the recent trends of compression. The wavelet transform based techniques have shown better results in comparison to DCT based techniques (JPEG) due to manifold properties of Wavelet Transform over DCT. The results of the above techniques have been compared and qualitative analysis is done on the basis of compression ratio & quality for medical images. 1. Introduction Qualitative analysis and compression of medical images is an important area of Biomedical Engineering, especially for Telemedicine. This may be more useful and can play an important role for the diagnosis of sophisticated and complicated images through consultation [1]. As medical images (large size and huge volumes require much transmission time) are to be transmitted over networks at large distances for the use of telemedicine, hence it is necessary that they must be transmitted in compressed and secure form for the reliable, improved and fast diagnosis [2]. The difficulty, however, in several applications lies on the fact that, while high compression rates are desired, the applicability of the reconstructed images depends on whether some significant characteristics of the original images are preserved after the decompression process has been completed [3]. This depends upon the quality of the compression and the method used. In medical image compression, diagnosis is effective only when compression techniques preserve all the relevant information needed without any appreciable loss of information. This is the case with lossless compression while lossy compression techniques are more efficient in terms of storage and transmission needs because of high compression ratio and the quality [4]. In lossy compression, image

characteristics are usually preserved in the coefficients of the domain space in which the original image is transformed [5]. The quality of the image after compression is very important and it must be with in the tolerable limits which vary from image to image and the method to method and hence the compression becomes more interesting as a part of qualitative analysis of different types of medical image compression techniques [6]. There are mainly tow categories of compression namely: 1-Lossless or irreversible compression and 2-Lossy or reversible compression. 2. Lossless Compression: Lossless compression techniques generally are composed of two relatively independent operations: 1-Devising an alternative representation of the image in which its inter-pixel redundancies are reduced, and 2-coding the representation to eliminate coding redundancies. These steps correspond to the mapping and symbol coding operations of the source coding model. Various methods like, variable-length coding, Huffman coding have been used for obtaining error free compression, but the most useful is lossless predictive coding. 2.1 Variable Length Coding: Let us assume that a discrete random variable rk in the interval [0, 1] represents the gray level of an image and each rk occurs with probability pk(rk) defined as:

p k (rk ) =

nr ; k = 0 ,1, 2 ..., L 1 n

Where L is the number of gray level, nk is the number of times the kth gray level appears in the image, and n is the total number of pixels in the image. If number if bits used to represent each value of rk is l(rk), then the average number of bits required to represent each pixel is:

Lavg =

L 1 k =0

l (rk ) pr (rk ) ; Thus total number of

bits required to code M N image is MNLavg . The simplest approach to error free image compression is to reduce only coding redundancy. Coding redundancy normally is present in any natural binary encoding of gray levels in an image. It can be eliminated by coding the gray levels so that Lavg is

743

IET-UK International Conference on Information and Communication Technology in Electrical Sciences

minimized. To do so requires construction of variable length code that assigns shortest possible code words to most probable code word. 2.2 Huffman Coding: The most popular technique for removing coding redundancy is due to David Huffman. It creates variable length codes that are an integral number of bits. Huffman codes have unique prefix attributes which means that they can be correctly decoded despite being variable lengths. The Huffman codes are based on two observations regarding optimum prefix codes: 1-In an optimum code, symbols that occur more frequently (have higher probability of occurrence) will have shorter code words than symbols that occur less frequently and 2-In an optimum code, the two symbols that occur least frequently will have the same length. It is easy to see that the first observation is correct. If symbols that occur more frequently had code words that were longer than the code words for the symbol that occurred less often, the average number of bits per symbol would be larger if the condition were reversed. Therefore, a code that assigns longer code words to symbol that occurs more frequently cannot be optimum. According to second observation, the shorter codeword cannot be a prefix of the longer codeword. This means that if we drop last k bits of the longer codeword, the two code words would still be distinct. As these code words corresponds to least probable symbols in the alphabet, no other codeword can be longer than these code words; therefore, there is no danger that the shortened code word would become the prefix of some other code word. Algorithm for Generating Huffman Codes: The individual symbols are laid out as a string of leaf nodes that are going to be connected by a binary tree. Each node has a weight, which is simply the frequency or probability of the symbols appearance. The tree is then built with the following steps: 1. 2. Arrange the symbol probabilities pi in decreasing order and consider them as leaf nodes of a tree. While there is more than one node: Merge the two nodes with smallest probability to form a new node whose probability is sum of the two merges nodes. Arbitrary assign 1 and 0 to each pair branches merging into a node.

symbols. It is instantaneous because each code word is a string of code symbols can be decodes without referencing succeeding symbols. That is in any Huffman code, no codeword is a prefix to any other code word as explained earlier and it is uniquely decodable because string of code symbols can be decoded in only one way. Since no code word is prefix to another code, Huffman codes can be unambiguously decoded as they arrive in a stream. Thus any string of Huffman coded symbols can be decoded by examining the individual symbols of the string in a left to right manner. Algorithm for Huffman Encoding: The steps involved in the generation of y.code are summarized as follows: 1. Compute the histogram, h, of input x between the minimum and maximum values of x using unitwidths bins and scale it to fit in a UINT16 vector. Use Huffman to create a Huffman code, called map, based on the scaled histogram, h. Map input x using map(this creates a cell array) and convert it to a character array,hx, removing the blanks that are inserted like in h2f2 . Construct a version of vector hx that arranges its characters into 16 character segments. This is done by creating a modulo-16 character vector that will hold it (hx16 in the code), copying the elements of hx into it, and reshaping it into a 16 row by ysize array, where ysize= ceil(length(hx)/16). ceil function rounds a number toward positive infinity. The generalized MATLAB function: y = reshape (x, m, n) , returns an m by n matrix whose elements are taken column wise from x. an error is returned if x does not have m*n elements. Convert the 16- character elements of hx16 to 16bit binary numbers.

2. 3.

4.

5.

Algorithm for Huffman Decoding: Huffman encoded images are decoded to recreate the original images from which they have been derived. This process takes five steps, which are as follows: 1. 2. Extract dimensions m & n, and minimum value from input structure. Re-create the Huffman code that was used to encode the input image by passing its histogram to function Huffman,generated code is called map. Build the data structure to streamline the decoding of the encoded data through a series of computationally efficient binary searches.

3.

Read sequentially from the root node to the leaf node where the symbol is located.

Huffman code is an instantaneous uniquely decodable block code. It is a block code because each source symbol is mapped into a fixed sequence of code

3.

744

Performance Analysis of Medical Image Compression Techniques with Respect to the Quality of Compression

4.

Pass the data structure and the encoded data to C function unravel. This function minimizes the time required to perform the binary searches.

5.

Add minimum value to each element of input image and reshape it to match the dimensions of original image.

2.3 Lossless Predictive Coding: Lossless predictive coding is based on eliminating the interpixel redundancies of closely spaced pixels by extracting and coding only the new information in each pixel. Input Image

The new information of a pixel is defined as the difference between the actual and predicted value of that pixel. The fig1(a) & (b) below shows the basic components of a lossless predictive coding system.

Symbol encoder

Predictor

Nearest integer

Compressed image

Fig1 (a): Lossless Predictive Coding Model: Encoder Symbol decoder Compressed image Predictor

_
Decompressed image

Fig1 (b): Lossless Predictive Coding Model: Decoder The system consists of an encoder and a decoder, each containing an identical predictor. As each successive pixel of an input image, denoted n, is introduced to the encoder, the predictor generates the anticipated values that pixel based of some number of past inputs. The output of the predictor is then rounded to the nearest integer, denoted ^n, and used to form the difference or prediction error: en = fn f ^ n which is coded, and not the input image, using a variable length code (by symbol encoder) to generate next element of compressed data stream. The decoder of fig1 (b) reconstructs en from the received variable length code words and performs the inverse operation: Where; m = the order of the linear predictor and round = a function used to denote the rounding or nearest integer operation . the i for i = 1, 2, m are prediction coefficients 3. Lossy Compression: Lossy encoding is based on the concept of compromising the accuracy of reconstructed image in exchange for increased compression. Many lossy encoding techniques are capable of reproducing recognizable monochrome images from data that have been compressed by more then 100:1. The principle difference between lossy and lossless encoding techniques is the presence or absence of the quantizer block. 3.1 Transform Coding: These compression techniques are based on modifying the transform of an image. In transform coding, a reversible, linear transform is used to map image into a set of transform coefficients, which are then quantized and coded.
Symbol encoder Compressed image

fn = en f ^ n

The prediction is performed by a linear combination of m previous pixel. That is,

f ^ n = round[
Input image (NN)

m i =1

ifn i ]
Construct nn subimages Forward transform

Quantizer

Fig2 (a): A Transform Coding System Encoder

745

IET-UK International Conference on Information and Communication Technology in Electrical Sciences


Compressed image Symbol decoder Inverse transform Merge nn subimages Decompressed image

Fig2 (b): A Transform Coding System - Decoder The above Figure shows a typical transform coding system. As can be seen from the above Figure, the encoder performs four relatively straightforward operations, which are explained below: a) Subimage decomposition: Here an NN input image is subdivided into subimages of size nn size. following two factors: the amount of reconstruction error that can be tolerated, and the computational resources available. Subimage size selection: Another significant factor affecting transform coding error and computational complexity is subimage size. Image are subdivided so that the correlation between adjacent subimages is reduced to some acceptable level and so that n is an integer power of 2, where n is the subimage dimension Bit allocation: The retained coefficients are selected on the basis of maximum variants called zonal coding or on the basis of maximum magnitude, called threshold coding. While the zonal coding is based on the information theory concept of viewing the information as uncertainty, the threshold coding is based on the concept that for any subimage, the transform coefficients of largest magnitude make the most significant contribution to the reconstructed subimage quality. The overall process so truncating, quantizing, and coding the coefficients of a transformed subimage is commonly called bit allocation. 3.2 JPEG Compression: The Joint Photographic Experts Group (JPEG) standard is one of the most widely used for lossy image compression. The approach recommended by JPEG is a transform coding approach using the DCT. The JPEG specification consists of several parts, including a specification for both lossless and lossy encoding. The block diagram for JPEG compression algorithm is as shown below: Normalizer/ Quantizer Symbol Encoder Compressed image

b) Transformation: The subimages from the first step are transformed to generate (N/n)2 subimage transform arrays, each of size nn. The goal of the transformation process is to de-correlate the pixels of each subimage, or to pack as much information as possible into the smallest number of transform coefficients. For this purpose, a variety of transformations can be used like Fourier Transform, Discrete Fourier Transform, WalshHadamard Transform.,Discrete Cosine Transform. c) Quantization: This stage selectively eliminates or coarsely quantizes the coefficients that carry the least information. These coefficients have the smallest impact on the reconstructed subimage quality .An important feature is that compression is obtained during quantization and not during transformation.

d) Coding: The encoding process terminates by coding (normally using a variable-length code) the quantized coefficients. Transform selection: The choice of a particular transform in the given application depends on the Input image 88 block extractor DCT

Fig3 (a): JPEG Encoder


Compressed image

Symbol decoder

Inverse DCT

Denormalizer

88 block merger

Reconstructed image

Fig3 (b): JPEG Decode

746

Performance Analysis of Medical Image Compression Techniques with Respect to the Quality of Compression

3. Algorithm for JPEG compression: 1. The first step in JPEG compression process is to subdivide the input image into non-overlapping pixel blocks of size 8 x 8. They are subsequently processed from left to right, top to bottom. As each 8 x 8 block or subimage is processed, its 64 pixels are level shifted by subtracting 2(m-1) , where 2m is the number of gray levels. 4.

Now its discrete cosine transform is computed. The resulting coefficients are then simultaneously normalized and quantized. After each blocks DCT coefficients are quantized, the elements of (u, v) are reordered in accordance with a zig-zag pattern. Now the nonzero AC coefficients are coded using a variable length code.

2.

3.3 Wavelet Coding: Wavelet coding techniques are based on the idea that the coefficient of a transform that decorrealtes the pixels of an image can be coded more efficiently than the original pixels themselves. Symbol encoder Compressed image

Input image

Wavelet transform

Quantizer

Fig4 (a): A Wavelet Coding System Encoder Decompressed image

Compressed image

Symbol decoder

Inverse wavelet transform

Fig4 (b): A Wavelet Coding System Decoder The computed transform converts a large portion of the original image to horizontal, vertical and diagonal decomposition coefficients with zero mean and Laplacianlike distribution. The principal difference between the wavelet-based system and the transform coding system is the omission of the transform coders subimage processing stages. Because wavelet transforms are both computationally efficient and inherently local (i.e., there basis functions are limited in duration), subdivision of the original image is unnecessary. This eliminates the blocking artifact that characterizes DCT-based approximation at high compression ratios. Wavelet selection: The ability of the wavelet to pack information into a small number of transform coefficients determines its compression and reconstruction performance. The wavelets chosen as the basis of the forward and inverse transforms, affect all aspects of wavelet coding system design and performance. They impact directly the computational complexity of the transforms and the systems ability to compress and reconstruct images of acceptable error. The most widely used expansion functions for wavelet-based compression are the Daubechies wavelets and biorthogonal wavelets. Decomposition level selection: Another factor affecting wavelet coding computational complexity and reconstruction error is the number of transform decomposition level. The number of operations, in the computation of the forward and inverse transform increases with the number of decomposition levels. In applications like, searching image databases os transmitting images for progressive reconstruction, the resolution of the stored or transmitted images and the scale of the lowest useful approximations normally determine the number of transform levels. Quantizer design: The largest factor affecting wavelet coding compression and reconstruction error is coefficient quantization. The effectiveness of the quantization can be improved significantly by introducing an enlarged quantization interval around zero, called a dead zone, or adapting the size of the quantization interval from scale to scale.

In either case, the selected quantization intervals must be transmitted to the decoder with the encoded image bit stream. 4. Results and Conclusions: We take CT brain, MRI and X-ray images for the compression test. All these images are compressed by using lossy and lossless techniques. In the first case i.e. lossless compression for CT brain image and MRI, we have got a compression ratio less than 2 shown in table 1 & 2 which shows the quality around 1 i.e no loss in the reconstructed image. We find that the compression

747

IET-UK International Conference on Information and Communication Technology in Electrical Sciences

ratios are far better in the case of lossy compression but the quality is degraded; for this purpose we have tested the x-ray images shown in table 3. The compression ratio and the quality is compared in table1 and the results are plotted in fig5(a),fig5(b). Another convention has also been taken i.e. the quality factor (which is inversely related to quality) and the compression ratio. It is found that higher the quality factor better the reconstructed image but the poor will be the compression, this aspect has been shown in the fig6(a) and fig6(b). From our tested images it is found that at lower compression ratios, the better quality of reconstructed image and the better quality factor nearly 1 but for higher compression ratios up to 105.57 the quality factor degrades and it comes from 1 to 0.02 ( Quality factor 1 is the ideal case) and the quality of reconstructed image also degrades.

Table 1: Comparison of Compression ratio Quality Lossless Compression 2 10 25 50 Quality Factor 1 0.5 0.1 0.04 0.02 Compression Ratio 1-2 11.86 30.33 57.08 105.57

Table 2: Lossless Compression results Image type Image type 1 Image type 2

Original Image

Compressed Image

Compression Ratio

Compression ratio = 1.0631

Compression ratio = 1.3205

Decompressed Image

748

Performance Analysis of Medical Image Compression Techniques with Respect to the Quality of Compression

Table 3: Lossy Compression results Quality Original Image Decompressed Image

Quality 2

Quality 10

Quality 25

Quality 50

Quality Vs Compression ratio Comparision


Quality & Compression ratio--->

Coopression Vs Quality
120 100 80 Quality & 60 Compression 40 20 0 1 2 3 4 5

120 100 80 60 40 20 0 1 2 3 4 5 Image Sequence--------> Compression ratio Quality

Compression ratio Quality

Image Sequence--->

Fig 5(a): Quality and compression comparison

Fig 5(b): Quality of Compression Variation

749

IET-UK International Conference on Information and Communication Technology in Electrical Sciences


Compression ratio Vs Quality factor
120
COm pression ratio--->

Compression ratio and Quality factor variation


120
Com pression Ratio

100 80 60 40 20 0 0 0.2 0.4 0.6 0.8 1 1.2 Quality factor---> Series1

100 80 60 40 20 0 1 2 3 4 5 Quality Factor Compression ratio

Quality factor---->

Fig 6(a): Quality factor and compression ratio comparison Fig 6(b): Compression ratio & Quality factor Variation

5. Acknowledgements: It is my pleasure to express sincere thanks to the management of College of Engineering Roorkee for providing leave for pursuing Ph.D at IITRoorkee and Dr. R.S.Anand, Department of Electrical Engineering, IIT Roorkee for providing his constant support and guidance for my research work. 6. References: [1]. Andras Czh, Guy Cazuguef' , Base1 Solaiman, Christian Roux, Medical Image Compression Using Region-of-Interest Vector Quantization, Proceedings of the 20th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 20, No 3, 1998. [2]. Hwang W.J.,Chine C.F.,Li K.J., Scalable Medical Data Compression and Transmission using Wavelet Transform for Telemedicine Applications, IEEE Trans. on Information Tech. in Biomed.Vol. 7, No. 1, pp 54-63, Mar. 2003. [3]. Sonja Grgic, Mislav Grgic, Branka Zovko-Cihlar, Performance Analysis of Image Compression Using Wavelets, IEEE Transactions on Industrial Electronics, Vol. 48, No. 3, pp 682-695, June 2001. [4]. Guest Editorial, Wavelets in Medical Imaging, IEEE Trans on Medical Imaging, Vol. 22, No. 3, March 2003.

[5]. Yung-Gi Wu, Shen-Chuan Tai,Medical Image Compression by Discrete Cosine Transform Spectral Similarity Strategy, IEEE Transactions on Information Technology in Biomedicine, Vol.5, No.3, September 2001. [6]. S. Tai, Y. Wu, and C. Lin, An adaptive 3-D Discrete Cosine Transform Coder for medical image compression, IEEE Trans. Inform. Technol. Biomed., Vol. 4, pp. 259-263, Sept. 2000. [7]. A. Ramaswamy, and W. B. Mikhael , A Mixed Transform Approach for Efficient Compression of Medical Images, IEEE Transactions On Medical Imaging, Vol. 15, No. 3, June 1996. [8]. Yung-Gi Wu, Medical Image Compression by Sampling DCT Coefficients, IEEE Transactions on Information Technology in Biomedicine, Vol. 6, No. 1, March 2002. [9]. D.A.Karras, S.A.Karkanis and D.E.Maroulis, Efficient Image Compression of Medical Images Using the Wavelet Transform and Fuzzy c-means Clustering on Regions of Interest, University of Piraeus, Dept. of Business Administration, Rodu 2, Ano Iliupolis, Athens, 2002.

750

You might also like