{'fraction_non_alphanumeric': 0.02904857749007235, 'fraction_numerical': 0.014905075341347985, 'mean_word_length': 4.679332715477294, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
MRI image compression using multiple wavelets at different levels of discrete wavelets transform

Medicine is benefited in large amount with the utilization of imaging. Magnetic Resonance Imaging (MRI) is an important imaging modality that is used for better diagnosis. Since the number of images generated by MRI is in large number per patient, the requirement for storage space and transmission bandwidth will be larger. In the area of image processing, image compression finds an important application that reduces storage space and transmission bandwidth. One way to compress the image is by using transform based techniques. In this work, we have used DWT (Discrete Wavelet Transform) with multiple wavelets at different levels to transform the MRI images. In the first few levels CDF (Cohen–Daubechies–Feauveau) 9/7 wavelet is used for transformation and Haar wavelet is used for remaining levels. After transformation SPIHT (Set Partitioning In Hierarchical Trees) algorithm is used for compression of the images. We have observed better compression in terms of MSE (Mean squared Error) and PSNR (Peak Signal to Noise Ratio) with the proposed method in comparison with the single wavelet transformation.


Introduction
Images in medicine provide a great advantage by providing visual appearance of internal organs of the body. Magnetic resonance imaging (MRI) is one of the imaging modality that produces images to aid the diagnosis [1]. MRI is safe technique to obtain better images without radiation as compared with other modalities [1] [2]. The images generated by MRI are in large numbers [3]. To store these images on a storage device, large storage space is required or to transmit these images on a network there is a requirement of larger bandwidth [4]. To overcome these limitations, the image compression technique is used [5] [6].
Image compression is the technique that reduces the storage space and bandwidth requirements by reducing the redundancies in the image [7]. Images are compressed either in lossy or lossless manner. Transform based lossy compression is widely used image compression [8] [9]. DWT is one of the transforms that is used to obtain better compression. The advantage of DWT is that it provides simultaneous space and frequency representation. The wavelet transformation is done using functions called wavelets [10]. DWT application to the image results in four subbands. These subbands can be transformed further using DWT. The multiple application of DWT to a single image is called multilevel wavelet transformation and the subbands are denoted along with the level [9]. After transformation, the transformed coefficients are quantized using appropriate quantization methods. The compression algorithm is applied to these quantized coefficients to get the compressed bitstream. Further, a lossless compression can be applied to enhance the compression ratio.
For discrete wavelet transformation, there exists a verity of wavelets. Wavelets are broadly classified as orthogonal and biorthogonal wavelets. Haar is an orthogonal wavelet formulated by Alfred Haar in 1910 is used in DWT [11]. Haar is the simplest wavelet and faster for implementation [12]. CDF  [13]. These wavelets provide better reconstruction. CDF9/7 is a wavelet of the CDF wavelet family results in better compression [14] [15].
In this work, we have compressed different MRI images using wavelet transform. Two different wavelets namely CDF 9/7 and Haar are used for transformation. As per the literature, CDF9/7 provides better compression [14][15] [16]. Haar wavelet has several advantages but provides less compression [17] [18]. We have investigated the usage of CDF 9/7 and Haar wavelet at different levels of DWT. The first part of the experiment determines the best combination of these wavelets at different levels. In the second part of the experiment, the best combination from the first part is used to transform different images. After transformation, SPIHT (Set Partitioning In Hierarchical Trees) algorithm is applied to compress the images [19]. The results of the proposed method are compared with the results obtained from the compression with CDF 9/7 transformation alone and the SPIHT algorithm.

Image Compression overview
The image is represented by the group of pixels in row and column directions [20]. The pixels of the images are correlated which leads to redundancy in the image. As redundancy increases, there will be an unnecessary increase in the requirement for storage space or transmission bandwidth [9]. Image compression reduces the redundancy in the image thereby reducing the storage or transmission bandwidth requirements. The amount of compression is measured in terms of compression ratio (CR) which is the ratio of original image size to the compressed image size. If the original image is of the size 100kB and in compressed representation, if its compressed representation is 10kB then CR is 10. There are two types of image compression methods namely lossless and lossy [21]:

Lossless
The lossless compression method reproduces the same original image from its compressed version [3] [5]. The limitation with the lossless method is CR obtained is very small. The maximum attainable compression ratio will be in the range 2:1 to 4:1.

Lossy
The lossy compression produces a large amount of compression by losing a small amount of the data in the image [7] [22]. The amount of lost data is small so that the loss can be neglected or it is ignored by the human visual system. The images reconstructed from the compressed version will be similar to the original image in the appearance and they can be used for further processing.

Transform based compression
The block diagram of the image compression system is shown in Figure 1 [9]. The compression process majorly includes transformation, quantization, and entropy encoding.

Transformation
The process of transformation converts the image from the spatial domain to a new domain called transformed domain [8] [10]. The transformation process reduces the correlation and makes the process of compression easier. In the transformed domain, the major amount of energy in the image is concentrated mainly in few coefficients. The remaining coefficients contain nil values or very small energy corresponding to the image. By properly handling these lower energy coefficients, the image can be compressed.

Quantization
The transformed coefficients are subjected to the process of quantization in which the coefficients with lower energy contribution or lower significance of visual appearance are discarded or their values are coarsely reduced [23]. The coefficients with larger contributions are finely quantized. Quantization is a lossy process due to which the lossy compression method cannot reproduce the original image mathematically from the compressed bitstream. Even though the reproduced image is not mathematically equal to the original image, the image will be visually the same as the original image providing a large value of compression ratio.

Entropy coding
Entropy encoding is used to enhance the performance of lossy compression [24]. The entropy encoding is a lossless method of compression. The use of lossless compression after the lossy section allows the data to be represented efficiently and increases the compression ratio without making any distortion to the data.
To recover the image from compressed data, the inverse operation of compression is done. Compressed data is entropy decoded and dequantized to get the coefficients. These coefficients are inverse transformed to get the recovered image.
The performance measure of the compression is given by compression ratio (CR), mean square error (MSE) and peak signal to noise ratio (PSNR) [25]. Equation (1), (2), and (3) are the equations for CR, MSE, and PSNR respectively.
In equation (2) f(x,y) and f'(x,y) represents the original and reconstructed images respectively.

DWT (Discrete Wavelet Transform)
Discrete wavelet transform (DWT) is one of the important transform used in transform based compression due to its energy compaction in lower subbands [10]. The application of DWT on image results in four subbands namely approximation, vertical, horizontal and diagonal subbands [11]. The approximation subband contains low frequency coefficients and remaining subbands contain high frequency coefficients. A particular wavelet contains two functions namely scalar and wavelet functions. Lower frequency components are extracted using scalar function and high frequency components are extracted using wavelet function. One way of applying DWT is using the filter banks as shown in Figure 2 [16].  signal in its original dimension. To obtain the signal back, the reconstruction/synthesis filters g 0 and g 1 are used after upsampling the coefficients by 2. For images, low pass and high pass filtering are done in row and column direction or vice versa to perform DWT. Figure 3 and Figure 4 show the DWT structure and inverse DWT structure for the image.   Figure 4 : Inverse DWT structure for images. Figure 5 shows the subbands obtained from one level of DWT application to the image. Each subband is represented with the type of filter used to obtain it. Approximation, horizontal, vertical and diagonal subbands are represented as LL, LH, HL and HH respectively. The subbands obtained in Figure 5 can be further transformed to split them into 4 subbands each. A common practice followed in DWT analysis where the approximation (LL) subband is subjected to further transformation. For an image with NXN size, the possible number of levels is 2 . Figure 6 shows the 3 level DWT application to the image and each subband is represented with the type of filter used to obtain it along with the level number. In the reconstruction/synthesis process, the subbands are upsampled and filtered using synthesis low pass and high pass filters g 0 and g 1 respectively. For a particular wavelet, there will be four specific filter banks h 0 , h 1 , g 0 and g 1 .

Wavelets
Wavelets are the functions of limited energy and finite duration signals [11]. The wavelets are classified as orthogonal and biorthogonal. In orthogonal wavelets, scalar and wavelet functions in decomposition and reconstruction are the same whereas they differ in the case of biorthogonal [26].

Haar
This is a wavelet that is having rectangular nature and it is the only wavelet that is both symmetrical and orthogonal [25]. It has only one vanishing moment [26]. The structure of the Haar wavelet is shown in Figure 7. The filter coefficients to obtain Haar wavelet are shown in the Table 1.  This is a biorthogonal wavelet containing 9 coefficients in low pass filter bank and 7 coefficients in high pass filter bank in the analysis section [13]. The wavelet is also termed as biorthogonal 9/7, biorthogonal(9,7), bior4.4 [15]. In the analysis section, there are 9 coefficients in the low pass and 7 in high pass filters respectively. The CDF 9/7 wavelet has 4 vanishing moments [14]. The structure of the CDF 9/7 wavelet is shown in Figure 8 and the filter coefficients of CDF9/7 DWT is shown in Table 2.

The proposed compression method
In the proposed compression method, the image is transformed using the discrete wavelet transform. DWT is applied to the image for different levels. Application of DWT on the image gives LL, LH, HL and HH subbands and each LL subband are further transformed. The process of transformation is done until the chosen number of levels. In the transformation stage, the images are transformed with CDF 9/7 wavelet in the initial levels and the Haar wavelet is used for transformation in the remaining levels.
After transformation, the SPIHT compression algorithm is applied to get the compressed bit stream [19]. SPIHT algorithm is a progressive coding in which coding can be stopped when the target bit rate is achieved. SPIHT is in place coding scheme that produces a binary stream of compressed data straightaway. Further the compressed bitstream is subjected to Huffman encoding to enhance the compression performance.

SPIHT (Set Partitioning In Hierarchical Trees)
SPIHT algorithm is a progressive coding used for wavelet based image compression [19]. SPIHT encoding is done using sorting and refinement pass. A variable n=⌊log 2 (max (i,j) {|c i,j |}⌋ is used to control the algorithm flow. n is decremented after completing both sorting and refinement pass. In each sorting pass, the coefficient is selected such that 2 n ≤ |c (i,j) | < 2 n+1 . For n, if |c (i,j) | ≥ 2 n then the coefficient is significant; otherwise insignificant. The most significant bit (MSB) of coefficients with the magnitude greater than the threshold in previous sorting passes is the output of refinement pass. Refinement pass output starts only from 2 nd pass.
The wavelet coefficients for SPIHT coding are listed in the following four coordinates [19]. LIP and LSP represent individual pixels whereas LIS represents either D (i, j) or L (i, j). The pixels which are termed significant in sorting pass are immediately moved to LSP. LIP contains pixels that were insignificant in previous passes. The sets represented by LIS are evaluated in order and significant pixels are moved to LSP whereas insignificant are moved to LIP.  Figure 9: Sorting pass of the SPIHT algorithm.
The algorithm flow of SPIHT is given below [19]: 1) Initialization: output n = ⎣log'2 (max (i,j) {|c (i,j) |})⎦; Set the LSP as an empty list, and add the coordinates (i, j)∈ H to the LIP, and only those with descendants also to the LIS, as type A entries. 2) Sorting Pass: Sorting pass code flow is shown in Figure 9 3) Refinement Pass: for each entry (i, j) in the LSP, except those included in the last sorting pass (i.e., with same n), output the nth most significant bit of | , | ; 4) Quantization-Step Update: decrement n by 1 and go to Step 2.
Sn is the compressed bitstream of the image. The LSP, LIP, and LIS are used only to generate the Sn and they are not part of the compressed data. The same algorithm used to reconstruct the coefficients except the term output in the algorithm must be replaced by input.
In this section, the result of the application of compression on MRI images is presented. The test images used are 256x256x8-bpp (bit per pixel) brain MRI images. The experiment is divided into two parts. The wavelets used in both parts are CDF9/7 and Haar. In the first part, we fix the number of levels of wavelet transformation and vary the CDF9/7 and Haar wavelet levels to match the total number of levels. Table 3 shows the values of MSE and PSNR with Haar wavelet in initial levels and CDF9/7 in remaining levels. Table 4 shows the values of MSE and PSNR with CDF9/7 in initial levels and Haar in remaining levels. By observing the results in Table 3 and Table 4 it is clear that Table 4 shows better results than and there is a large deviation. Thus the experiment is carried with CDF9/7 for initial levels and Haar in later levels. The values of MSE and PSNR are measured by keeping the compression ratio constant. Table 5 and Table 6 show the values of MSE and PSNR versus CR for 6. Results and discussion:  Figure 10, Figure 11 and Figure 12 show the corresponding graphical representations of Table 4, Table 5 and Table 6 respectively.     Figure 11: MSE and PSNR vs CR for total level=6.  Figure 12: MSE and PSNR vs CR for total level=8.
The experiment is carried for the total number of levels = 5,6 and 8. In the experiment, it is observed that irrespective of the number of total levels, a combination of CDF 9/7 wavelet for initial 3 levels + remaining levels with Haar wavelet = total levels provided the best results. At this combination the observed value for MSE is minimum and the PSNR is maximum.  10 In the second part of the experiment, we tested different images using the better case from the first part. We fixed the total number of levels 5 and the initial 3 levels are transformed using the CDF 9/7 wavelet. Thus remaining 2 levels are transformed using Haar wavelet. A comparison is made between the proposed method and the transformation with CDF 9/7 alone. In both cases except using multiple wavelets in the proposed scheme, remaining portions remain the same. Table 7 and Table 8 show the measured values of MSE and PSNR of different images. Figure 13, Figure 14, Figure 18, and Figure  19 are the plots of MSE and PSNR in Table 7 and Table 8.   Image 1, its reconstructed image with CDF 9/7 alone compression and reconstructed image with the proposed method are shown in Figure 15, Figure 16 and Figure 17 respectively. Figure 15: original image. Figure 16: CDF 9/7 alone. Figure 17: Proposed method.  Figure 19: PSNR vs CR for image 2.
The values obtained for various MSE and PSNR against compression ratios show that the proposed method provides better compression. Haar is a wavelet that cannot recognize abrupt changes and is not preferred for better compression results. But it provides better results when low frequency contents are more in the image. We used this feature to better the compression. Since the CDF9/7 wavelet removes major high frequency contents of the image, after 3 levels of transformation LL subband contains low frequency contents in the majority. Using this feature we proposed the above compression method which provides better performance.
In this work, MRI images are compressed using the DWT as a transformation tool. In the transformation, we used CDF 9/7 wavelet and Haar wavelet at different levels. After transformation, the image is compressed using the SPIHT algorithm. The usage of Haar wavelet in the initial levels of transformation gave worse results in terms of MSE and PSNR. The tested results of MSE and PSNR at constant CR indicates the usage of the CDF 9/7 for initial 3 levels and Haar in the remaining levels of transformation provides better results. Since CDF 9/7 separates high frequency contents in the initial levels of dyadic partition, the contents of LL subband are in low frequency. Haar is the simplest wavelet and efficient in handling the low frequency contents of the image. Using the CDF 9/7 for the first 3 levels and Haar wavelet for remaining levels gave better performance compared to CDF 9/7 transformation alone. The observed values of MSE and PSNR for various images are better in the proposed method.