Huffman Image Compression Incorporating DPCM and DWT

This paper presents a medical image compression approach. In this approach, first the image is pre-processed by Differential Pulse Code Modulator (DPCM), second, the output of the DPCM is wavelet transformed, and finally the Huffman encoding is applied to the resulting coefficients. Therefore, this approach provides theoretically threefold compression. Simulation results are presented to compare the performance of the proposed (DPCM-DWT-Huffman) approach with the performances of the Huffman incorporating DPCM (DPCM-Huffman), the DWT-Huffman and the Huffman encoding alone. Several quantitative indexes are computed to measure the performance of the four algorisms. The results show that the DPCM-DWT-Huffman, the DWT-Huffman, the DPCMHuffman and the Huffman algorisms provide compression ratio (CR) of 6.4837, 4.32, 2.2751 and 1.235, respectively. The results also confirm that while the proposed DPCM-DWT-Huffman approach enhances the CR, it does not deteriorate other performance quantitative measures in comparison with the DWT-Huffman, the DPCM-Huffman and the Huffman algorisms.


Introduction
The main objective of image compression techniques is to reduce the image size for less storage and transmission bandwidth by discarding irrelevance and redundancy of the image data.These techniques can be classified into two categories: lossless and lossy compression techniques.Lossless techniques are applied when data are critical and loss of information is not acceptable.Hence, many medical images should be compressed by lossless techniques [1].Medical image processing and compression have become important to medical field.Nowadays, many hospitals around the world use compression to store routinely-made patient images for follow-up and tracking the patient state.There have been many studies on medical image lossless compression [2]- [6].Several image compression techniques encode transformed image data instead of the original images [7]- [11].This has been motivated by adding primary compression or size reduction, due to transformation, before final encoding.Differential pulse code modulation (DPCM) has been used to add data compression prior to Huffman encoding.In this approach, compression can be theoretically twofold.This DPCM-Huffman compression has been applied to medical images [12].
An efficient compression method for medical images is proposed.The method is based on adding a data size reduction to the DPCM output prior to Huffman encoding.This is done by discreet wavelet transformation (DWT).The DWT is an efficient method to represent data with fewer numbers of coefficients.Then, the expected compression can be threefold.Comparison between the proposed method and other ones to measure the performance has been applied.Other methods have been explained in details in next section.The paper is organized as follows.In Section 2, the main idea of Huffman encoding is presented.The DPCM-Huffman method is discussed in Section 3. In Section 4, The DWT-Huffman is discussed.In Section 5, the proposed method of incorporating the DWT with the DPCM-Huffman compression method is discussed.Section 6 shows and discusses the compression results provided by the four techniques: Huffman, DPCM-Huffman, DWT-Huffman and the proposed DPCM-DWT-Huffman.Finally, Section 7 presents the conclusion.

Huffman
Figure 1 shows a schematic block diagram for image compression using Huffman encoding method.The Huffman encoding starts with calculating the probability of each symbol in the image.The symbols probabilities are arranged in a descending order forming leaf nodes of a tree.When the symbols are coded individually, the Huffman code is designed by merging the lowest probable symbols and this process is repeated until only two probabilities of two compound symbols are left.Thus, a code tree is generated and Huffman codes are obtained from labelling of the code tree.The minimal length binary code for a two-symbol source, of course, is the symbols 0 and 1.The Huffman codes for the symbols are obtained by reading the branch digits sequentially from the root node to the respective terminal node or leaf.Huffman coding is the most popular technique for removing coding redundancy as shown in Figure 2 [13].Huffman code procedure is based on the following two observations.1) More frequently occurred symbols will have shorter code words than symbol that occur less frequently; 2) The two symbols that occur least frequently will have the same length.
The average length of the code is given by the average of the product of probability of the symbol and number of bits used to encode it.More information can found in [14] [15].
And the Huffman code efficiency is calculated as entropy Huffman code efficiency is the average length = Huffman's procedure creates the optimal code for a set of symbols and probabilities subject to the constraint that the symbols be coded one at a time [13].The entropy (H) of the source can be determined from the following Equation (2).The entropy value describes how much compression is possible for that image in the form of bit per pixel.It should be noted that, there cannot be any possible compression ratio smaller than entropy.The entropy of any image is calculated as the average information probability.Entropy indicates the required amount of bits per pixel [12].
( ) ( ) where p k is the probability of intensities, k is the intensity value, and L is the number of intensity values used to present image.

DPCM-Huffman
In [12], a modification of Huffman method has been developed based on DPCM predictor for hardware implementation of lossless medical brain CT image compression.DPCM-Huffman method improves the conventional Huffman method by transforming the input image with DPCM and the transformed data is inputted to the conventional Huffman encoding.The DPCM has been carried out by studying all possible predictors and select the most efficiency one through the calculation of the entropy of each predictor and comparing between them.Therefore a twofold of compression could be obtained.Figure 3 illustrates a schematic diagram for the DPCM-Huffman algorithm.Differential pulse code modulation (DPCM) is an operation of converting a signal into a predicted one.Then the differences between the original signal values and predicted ones are encoded and stored.DPCM compression method can be conducted for intra and inter frame coding.Intra coding exploits spatial redundancy and inter coding exploits temporal redundancy.In the intra-frame coding, is formed by the difference between the neighbouring pixels of the same frame, further, the inter-frame is formed between two consecutive frames for the same value.In both the value of target pixel is predicted by neighbouring pixels.DPCM compression depends on the prediction technique, which leads to good compression rates [16].
DPCM prediction is nonlinear.Its basic idea is to predict the value in every image pixel and make the predicted error entropy less than the original image entropy.Because there is strong correlation among adjacent pixels, current pixel values are predicted by knowledge of its adjacent pixels.Figure 4 shows illustrative example where the predicted value of X, X , is computed based on given values of neighbour pixels A, B, C and D. The predicted error X X − is saved in the position of X.However, when it comes to the image boundary, one or two values among A, B, C and D do not exist For the first pixel in the upper left corner, all of the three values do not exist.Thus, this pixel is not predicted and its value is saved in the header information of the output code stream [17].

DWT-Huffman
Figure 5 shows The Discrete Wavelet Transform (DWT) of a sequence consists of two series expansions, one corresponding to the approximation and the other to the details of the sequence.The formal definition of DWT where, . It is more efficient to implement the 2D DWT using 1D DWT.This arises from the following two issues.1) A lot of 1D wavelet design materials exist in the literature; 2) Fast implementation of 1D DWT is also available.
Here, the 2D discrete wavelet transform has been adopted for image compression.We will, therefore, focus our attention on the implementation of 2D DWT of an image using 1D DWT in a row-column fashion [18].We first filter it row by row by the filter The HL coefficients correspond to highpass in the horizontal direction and lowpass in the vertical direction.Thus, the HL coefficients follow horizontal edges more than vertical edges.The LH coefficients follow vertical edges because they correspond to highpass in the vertical direction and low-pass in the horizontal direction.Finally, the HH coefficients preserve diagonal edges.
Figure 5(b) show the LL, HL, LH, and HH when one level wavelet is applied to Lena image.It is obvious that the LL output preserve all information about the image while the size is quarter of original image size this implies that one level wavelet can provide compression ratio of four.If we ignore the HL, LH, and HH, to reconstruct back the original image from the LL (cA), HL (cD (h) ), LH (cD (v) ), and HH (cD (d) ) coefficients, the inverse 2D DWT is applied as shown in Figure 6 [19].
Figure 7 shows other modification of Huffman method has been developed based on wavelet transform for lossless medical CT images compression.DWT-Huffman method improves the conventional Huffman method by transforming the input image with DWT and the transformed data is inputted to the conventional Huffman encoding.The wavelet transform is applied to input image to obtain the approximation and detailed coefficients   representing the error signal.Then the Huffman encoding is applied to the nonzero coefficients.The wavelet family Haar of level one has been used.

DPCM-DWT-Huffman
To gain more compression we propose to incorporate the DWT within the DPCM-Huffman algorithm explained in Section 5 as shown in Figure 8 which provides lossless compression method.Thus the compression ratio (CR) can be threefold of the Huffman algorithm.Wavelet analysis has been known as an efficient approach to repre- senting data (signal or image) by approximation and detailed coefficients.In one level image analysis, the approximation wavelet coefficient shows the general direction of the pixel value, and three detailed coefficients shows vertical, horizontal and diagonal details.Compression ratio increases when the number of wavelet coefficients that are equal zeroes increases [21].Fortunately, in practice, it has been found that many images can be represented by fewer number of wavelet coefficients.Therefore, our proposed method is to take advantage of wavelet transform.
The DPCM has been carried out by studying all possible predictors and select the most efficiency one through the calculation of the entropy of each predictor and comparing between them, which found B is the best predictor.However, the prediction error (e), which is the difference between the actual value of the current pixel (X) and the predicted one (B) is given by the following equation.
e X B = − (4) Proposed method applies the wavelet transform to the prediction error generated by DPCM to obtain the approximation and detailed coefficients representing the error signal.Then, the Huffman encoding is applied to the nonzero coefficients and to reject other ones.Figure 5 shows a schematic diagram for one level wavelet transform.Therefore, the compression ratio can vary from wavelet type to another depending which one can represented the DPCM error signal in fewer number coefficients.

Performance Measures
The most common objective performance measures used are Maximum Absolute Error (MAE), Mean Square Error (MSE), Root Mean Square Error (RMSE), Signal-to-Noise Ratio (SNR), Peak Signal-to-Noise Ratio (PSNR), Compression Ratio (CR).The error function between the reconstructed and original images is given by where ( ) , f i j is the original image and ( ) * , f i j is the reconstructed image generated form the compressed image data.The MAE is given by The MSE is the second moment of the error function between the reconstructed and original images, given by [22].

( ) (
) where, M × N is the image size.The RMSE is simply the square root of the MSE given by (3).
The SNR in dB is given by ( ) ( ) ( ) where the numerator is the power of the original image and denominator is the additive noise corrupting the reconstructed image.The PSNR measure the ratio the maximum pixel intensity 2 1 B − (where B is number of bits) to MSE given by [22].
Therefore, a higher value of PSNR offers better performance.The CR is often computed by dividing the size of the original image in bits over the size of the compressed image data.Thus it is given by [23].
Size of original image data Size of compressed image data CR = The three methods, Huffman, DPCM-Huffman and the proposed DPCM-DWT-Huffman, have been applied to three CT medical images with different sizes.

Simulation Result
To show the rational of incorporating the wavelet transform between the DPCM and Huffman coding, we have executed the following simulation.For an exemplary image shown in Figure 9

Conclusion
In this paper, we have presented a new image compression technique consisting of the association of the DPCM, the DWT and the Huffman coding.In this technique, first the image is passed through the DPCM transformation, second the wavelet transformation is applied to the DPCM output, and finally the wavelet coefficients are encoded by the Huffman coding.So, the wavelet transformation reduces the redundancy and spatial reputation in the image data, which makes the compression more efficiently.Simulation results have shown that the proposed DPCM-DWT-Huffman outperforms the DWT-Huffman, DPCM-Huffman and Huffman methods.The four methods provide CR of 6.48, 4.32, 2.27 and 1.2 respectively.

Figure 1 .
Figure 1.Schematic diagram of image compression using Huffman encoding.

Figure 3 .
Figure 3. Schematic diagram of the image compression algorithm using DPCM-Huffman encoding.

Figure 4 .
Figure 4. Prediction model of DPCM system. of an N-point sequence x [n], 0 ≤ n ≤ N − 1 is given by as shown in Figure 5(a), and retain every other sample at the filter outputs.This gives a set of two DWT coefficients each of size N × N/2.Next, the DWT coefficients of the filter ( ) 0 h n − are filtered again along each column by the same two filters and subsampled by 2 to yield two other sets of DWT coefficients of each size N/2 × N/2.Finally, the DWT coefficients due to ( ) 0 h n − are filtered along the columns by the same two filters and subsampled to give two other sets of DWT coefficients of each size N/2 × N/2.The LL coefficients correspond to lowpass in the horizontal direction and lowpass in the vertical direction.

Figure 7 .
Figure 7. Schematic diagram for the image compression algorithm using DWT-Huffman encoding.

Figure 8 .
Figure 8. Schematic diagram for the image compression algorithm using DPCM-DWT-Huffman encoding.
(a), we have computed the histogram of an exemplary image, Figure 9(b), histogram of wavelet transform (approximation and details coefficient) as shown in Figure 9(c) and Figure 9(d) respectively.We have computed the DPCM of the image shown in Figure 9(e), its histogram, shown in Figure 9(f), and the histogram of wavelet transform (approximation and details coefficient) of DPCM image shown in Figure 9(g) and Figure 9(h) respectively.It is apparent that the wavelet transform after the DPCM provides denser histogram than the histogram of wavelet transform directly of the image.This dense in the distribution leads to small number of Huffman coding.In this example, the Huffman coding of the approximation coefficient associated with the wavelet transform of the image provides 312 codes (final coded size = 121,325 bit), while on the approximation coefficient associated with the DPCM image provides 119 code in the codebook (final coded size = 80,863 bit).The Haar wavelet of level one has been used in this example.It is worthwhile to mention that while the Huffman codding of DPCM image provides 46 code number the data to be coded is full size of the image (final coded size = 230,443 bit).

Table 1 .
Comparison between our method and other ones.

Table 2 .
Comparison between our method and other ones.

Table 3 .
Comparison between our method and other ones.