Summary of raster (bitmap) image file format.

## Abstract

Maintaining human healthcare is one of the biggest challenges that most of the increasing population in Asian countries are facing today. There is an unrelenting need in our medical community to develop applications that are low on cost, with high compression, as huge number of patient’s data and images need to be transmitted over the network to be reviewed by the physicians for diagnostic purpose. This implemented work represents discrete wavelet-based threshold approach. Using this approach by applying N-level decomposition on 2D wavelet types like Biorthogonal, Haar, Daubechies, Coiflets, Symlets, Reverse Biorthogonal, and Discrete Meyer, various levels of wavelet coefficients are obtained. The lossless hybrid encoding algorithm, which combines run-length encoder and Huffman encoder, has been used for compression and decompression purpose. This work is proposed to examine the efficiency of different wavelet types and to determine the best. The objective of this research work is to improve compression ratio and compression gain.

### Keywords

- DICOM
- discrete wavelet
- N-level decomposition
- threshold approach
- data hiding algorithms

## 1. Introduction

Digital technology has, in the last few decades, entered in almost every aspect of medicine. There has been a huge development in noninvasive medical imaging equipment. Since there are multiple medical equipment manufacturers, there is a strong need to develop a standard for storage and exchange of medical images. DICOM (Digital Imaging and Communications in Medicine) makes medical image exchange easier and independent of the imaging equipment manufacturer. The DICOM standard has been developed by ACR-NEMA to meet the needs of manufacturers and users of medical imaging equipment for interconnection of devices on standard networks. The DICOM technology is suitable when sending images between different departments within hospitals and/or other hospitals and the consultant. DICOM file contains both a header, which include text information such as patient’s name, modality, image size, etc., and image data in the same file. Hence DICOM standards are widely used in the integration of digital imaging systems in medicine. Figure 1 shows the structure of DICOM image file. It has two main components. The first is header; it consists of 128 bytes of file preamble which is followed by string by 4-byte prefix, and it contains four-character string. The second is data set; it consists of multiple set of data elements. Each data element has four fields; these are tag, value representation, value length, and value field. The third is image pixel intensity data; it contains necessary medical image data display like number of frames, lines, columns, etc.

### 1.1 File format used by DICOM images

There are four major file formats in medical imaging, and they are Neuroimaging Informatics Technology Initiative (NIfTI), Analyze, DICOM, and MINC. The task of the image file format is to provide a standardized way to store the unique data in a much organized and systematic manner and showcase how the pixel data understood the correct loading, visualization, and analysis was derived by the software. The major file format currently useful in medical imaging is DICOM format. The DICOM format includes some information that can be useful for image registration, such as position and orientation of the image with respect to the data acquisition device and patient information with respect to voxel size. DICOM file format design consideration is based on the following concept such as pixel depth, photometric interpretation, metadata, and pixel data. The DICOM file format is created by addition of header size and pixel data. Mathematical equations are as follows:

The more popular formats used in daily practice are the JPEG, JPEG 2000, TIFF, GIF, PNG, and BMP formats. The images saved in these formats can be accessed on any personal computer without the need of specific viewers. File format are designed with the help of image conversion technique and coding schemes.

The rest of the chapter is organized as follows. Section 2 provides an overview of image file format and image standard used for medical image compression, and data hiding methods are described in the Section 3. Section 4 provides proposed work brief explanation. Section 5 discusses regarding results that are obtained after implementation of application. Finally, Section 6 concludes the chapter.

## 2. Related work

The related work is a comprehensive summery of previous research on image file format, standard image compression using transform coding, and patient information integration into image for DICOM images. The more popular formats used in daily practice are the JPEG, JPEG 2000, TIFF, GIF, PNG, and BMP formats. The images saved in these formats can be accessed on any personal computer without the need of specific viewers. File formats are designed with the help of image conversion technique and coding schemes [1, 2, 3]. Figure 2 shows the basic digital image file formats and its classification. The vector images are not commonly used in medical data processing.

Table 1 gives the summary of various parameters of raster image file format [4, 5, 7, 8, 9, 10, 11]. Table 2 gives a characteristic overview of the major file formats currently used in medical imaging, i.e., NIfTI, Analyze, DICOM, and MINC [6, 12, 13].

Sr. no. | File format | Extension | Bit depth | Compression type | Compression performance | Name of supported free image viewer | |
---|---|---|---|---|---|---|---|

Gray | Color | ||||||

1 | BMP | bmp | 1,4,8 | 1,4,8,24 | Lossless | Very low | IrfanView, XnView, Osiris, ImageJ |

2 | DICOM | dcm | 8, 16 | 8, 24, 48 | Lossless | Low | IrfanView, XnView, Osiris, ImageJ |

3 | GIF | gif | 1, 4, 8 | 1, 4, 8 | Lossless | Medium | IrfanView, XnView, Osiris, ImageJ |

4 | JPEG | jpg | 8 | 24 | Lossy | Average | IrfanView, XnView, Osiris, ImageJ |

5 | JPEG 2000 | Jp2 | 8, 16 | 24, 48 | Lossless | High | IrfanView, XnView |

6 | PNG | png | 1, 4, 8, 16 | 1, 4, 8, 24, 48 | Lossless | High | IrfanView, XnView |

7 | TIFF | tiff | 8, 16 | 8, 24, 48 | Lossless or lossy | Very high | IrfanView, XnView |

Sr. no. | File format | Extension | Data type | Header | Compression scheme supported | ||
---|---|---|---|---|---|---|---|

Integer | Float | Complex | |||||

1 | DICOM | .dcm | Signed and unsigned (8 bit, 16 bit, 32 bit) | Not supported | Not supported | Variable length binary format | JPEG, RLE, JPEG-LS, MPEG2/MPEG4, JPEG XR |

2 | NIfTI | .nii | Signed and unsigned (8 bit to 64 bit) | Signed and unsigned (32 bit to 128 bit) | Signed and unsigned (64 bit to 256 bit) | Fixed length (532 byte binary format) | gzip (it is a software application used to store compressed and decompressed file) |

3 | MINC | .mnc | Signed and unsigned (8 bit to 32 bit) | Signed and unsigned (32 bit to 64 bit) | Signed and unsigned (32 bit to 64 bit) | Extended binary format | gzip (it is a software application used to store compressed and decompressed file) |

4 | Analyze | .hdr and .img | Signed (8 bit to 32 bit) and unsigned (8 bit) | Signed (32 bit to 64 bit) | Signed (64 bit) | Fixed length (348 byte binary format) | High dynamic range (HDR) imaging uses sub-band coding technique which is an example of lossy technique |

Two types of compression methods are classified. The lossless image has huge application in archival of medical and digital radiography document, where loss of information in original image could consider improper diagnosis. The medical imaging application required lossless image compression. Thus, medical image compression application development is a challenging problem. The survey paper [14] conveys that compression ratio 4:1 is possible using lossless compression. An increasing volume of data generated by new imaging modality, CT scan and MRI lossy compression technique are used to decrease the cost of storage and increase the efficiency of transmission over networks for teleradiology application [12]. There are two main categories of compression lossless (reversible) and lossy (irreversible). DICOM support lossless compression schemes like run-length encoding, Huffman coding, LZW coding, area coding, and arithmetic coding. The RLE is used for medical image compression in hybrid approach, where gray scale value gives certain interesting fact about the distribution in image. The background pixels of all the medical image are low values, and they differ by +3 or −3. The RLE is based on dynamic array implementation, no need to process whole image [8]. The paper served that the number of repeated zero count which is represented as “RUN” and appends the nonzero coefficients represented as “LEVEL” [15, 16]. The Huffman coding is a lossless compression technique, which is used for medical image compression. This works on variable length encoding principal, which includes calculation of length of unique codes. It generates a binary tree, which is also known as Huffman tree. Huffman algorithm gives higher compression ratio in the case of medical image compression. During the whole process of compression, there should not be any loss of information that will affect proper diagnosis [17, 18]. The Huffman code is designed to integrate the lowest probable symbols, and this integration is repeated until only two probabilities of two symbols are left. In this survey paper, certain improvements are discussed on the existing Huffman technique which will help to preserve any loss of information during compression that will affect proper diagnosis [19]. In lossy compression method, data are rejected during compression and cannot be recovered completely. This method reaches much greater compression performance than lossless compression. Wavelet and higher-level JPEG are the example of lossy compression technique where JPEG 2000 is a progressive lossless-to-lossy compression algorithm [20, 21, 22]. This article uses the concept of data hiding into image for data encryption. In order to enable large capacity of data hiding and maintaining good image quality, the data integration is applied on detail coefficients of high-frequency sub-bands. It works on transform domain of multilevel two-dimensional discrete wavelet transform. The objective of this implementation is to perform image compression as much as possible. It will help to reduce the redundancy of the image and to store or transmit data in an efficient form. As in telemedicine, the medical images are transmitted through advanced hyperlinks; medical image compression without any loss of useful information is of immense importance for the fast transfer of the medical data [23].

## 3. Proposed work

This proposed compression approach deals with .dcm file of DICOM format. It splits .dcm file into patient data with bmp.txt extension and gray scale image with .bmp extension. Then N-level DWT using various wavelet types is applied to a gray image. Firstly, this splits the image into n number of high-frequency sub-bands (HLn, LHn, HHn) where n = 1, 2, 3…..N and one low-frequency sub-band (LLn) where n = maximum level (N). The high-frequency sub-bands at levels 1, 2, 3, and 4 are threshold and quantized and find detail coefficients are encoded directly through run-length encoding. Secondly, the one low-frequency sub-band is also threshold and quantized and find high-level approximate coefficient. Lastly, both the coefficients (detail coefficients, high-level approximate coefficient) are encoded by Huffman coding.

In a gray scale image, each pixel is represented by 8-bit unsigned integer value. The minimum and maximum value of unsigned integer is 0 to 255. The 0 represented black and 255 represent white. In text file every text file is represented by ASCII value. The ASCII value is run between 0 and 128. The extended ASCII value is 8 bit, and it matched with 8-bit pixel intensity. So, both the entities are treated as normal integer. In this proposed system, we have practiced bitwise XOR approach for text integration into image. The proposed work deals ASCII conversion of patient data and multilevel two-dimensional discrete wavelet transform. Advantages of this work are high data integrity even with large patient data. Accepted levels of imperceptibility, excellent PSNR values, and high CR and good payload capacity are obtained. Figures 3 and 4 represented the block diagram of compression and decompression with data integration scheme. The decompression process is the inverse process of DICOM image compression as shown in block diagram in Figure 4. The DICOM compressed image is recreated with acceptable quality through the abovementioned process.

### 3.1 Algorithm for integration of patient information (text) into image file

Select a proper Greyscale BMP image.

Select patient text file with .txt extension

Execute while loop (Number of Character Count in text file<= Number of pixels in the image)

Convert Character vector and pixel value into an unsigned 16-bit integer using function str2num and unit 16.

Integration of text in to Image Pixel = (Converted 16-bit unsigned pixel value) XORing_Bitwise (Converted 16-bit unsigned character value)

Increment Pixel value until last value.

Increment Character value until last value

Check the Character Count in text file = Character Count +1

End Loop

Rest of Integration of text in Image Pixel = original pixels of image

### 3.2 Extraction of patient information (text) from the image file

Open the original image and Integration of text in to Image Pixel

Execute while loop (Number of Pixel Count in image file ≤ Number of pixels in the image)

Convert pixel value into 16-bit integer value

Integration of text in to Image Pixel = convert to 16-bit integer (Integration of text in to Image Pixel)

A = (Original value of Pixel) XORing_Bitwise (Integration of text in to Image Pixel)

if A = 0 then break, else extracted text file which is equal to A

Extract original Pixel = Next original Pixel in image

Integration of text in to Image Pixel = Next Integration of text in to Image Pixel

End Loop

### 3.3 Multilevel 2D DWT decomposition on wavelet types

We implement an N-level 2D DWT decomposition. At each level of decomposition, the LL sub-band from the previous level is obtained, and each previous level is replaced with four new sub-bands. Each new sub-band is half the width and half the height of the LL sub-band from its parent sub-bands. The formula to calculate the total number of sub-bands depends on the number of level n. The number of sub-bands is therefore 3n + 1, where HHn represent high-frequency band, LLn is low-frequency band, and LHn and HLn are middle-frequency bands. The coefficients in LL are dominant. If any of the coefficients in LLn frequency band are changed, observer can observe that the corresponding spatial domain image has been modified.

Figure 5 shows the process of character integration in LHn sub-band, and it generates wavelet coefficients. It shows the scale and orientation selectivity of the DWT. Greatest energy is contained in the LLn sub-band, and the least energy is in the HHn sub-band. The HLn sub-band contains the vertical edges, and the LHn sub-band contains the horizontal edges. In this proposed work, we focus on data integration in LHn sub-bands because this band has high energy distribution as compared to other bands like HLn and HHn. The finest wavelet type and the appropriate coefficient selection method using threshold and quantization.

### 3.4 Apply thresholding and quantization technique on generated coefficients

#### 3.4.1 Thresholding

Let n × n be matrix of an original image; noise observation can be written as

If

where y (i) is the input and noise wavelet coefficients, λ is the Threshold Valu, *Threshold output.*

We define the PCDZ parameter; this parameter is required to calculate the percentage of nonzero DWT coefficients.

where NBz = number of zeros in DWT coefficients.

Ly = Number of Coefficients in DWT.

The proposed method used in the global threshold value that is derived by Donoho [19, 20] is given by the equation below. It is known to have a universal threshold.

where Ly is the number of pixels in the medical image and σ is the noise variance.

#### 3.4.2 DWT coefficient quantization

The quantization of each level permits to collect the set of nearest values. The uniform quantization on thresholded DWT coefficients in sub-bands will be transformed and to be contained in the interval width for quantization is between 0

### 3.5 Encoding of wavelet coefficients using run-length encoder and Huffman encoder

In this implementation, hierarchical relationship of wavelet structure is explored to arrange wavelet coefficients into odd rows and even rows. The wavelet coefficients odd rows contain an ordering of wavelet coefficient that acts as approximate (smooth) value, and even rows contain different sign data that act as detail values. After evaluated many zeros in different orders of wavelets, by applying hard thresholding condition Eqs. (4), (5) on wavelet coefficients. In this whole process, separated approximate coefficients contain best information, while detail coefficients contain information like shapes and edges of image. The threshold condition chooses fixed threshold value to obtain desired quality of reconstructed image. After classifying threshold coefficients, need to transmit those coefficients using lossless method which will further be used for decompression purpose. Now encoded detail coefficients with run-length encoding excluding the highest approximate coefficient LL3 sub-bands, because LL3 sub-band does not have much long run of zeros. To convert repetitive data into bit stream, Huffman encoder has been used in this implementation. Huffman code is an example of optimum prefix code; these codes are generated using variable code length where a number of bits are essential. This will be helpful in average code length calculations, and thus the data compression is taking place where sometimes compressed image is smaller than original image.

## 4. Results and discussion

The performances of implemented method are based on few essential criteria: the obtained compression ratio (CR), compression gain, and the quality of the reconstructed image using PSNR, MSE (mean squared error), and SNR. Data compression equations are given below.

Data compression ratio = Uncompressed size/Compressed size

Space saving (%) determines performance of transformation efficiency over storage of data bits for original bit size to unprocessed bit size. It is like compression ratio; however it reflects percentage of how much data space is saved following compression [21]. It is given by the following equation:

Percentage of Compression Gain = 1 – Compressed size/Uncompressed Size

The calculated peak signal to noise ratio between maximum values is power of signal and power of distorting noise which affects the quality of its representation. The PSNR is generally expressed in terms of logarithmic decibel scale [22].

where the MSE

where f is the matrix data of our original image. g is the matrix data of our degraded image. m is the numbers of rows of pixels of the images. i is the index of that row. n is the number of columns of pixels of the image. j is the index of that column.

where SNR is given as the ratio of the mean value of the signal and the standard deviation of the noise.

To analyze the performance of our proposed method, we take Table 3 as an input MR image for evaluation of various parameters, and their information are as follows:

Image name | Input size (in KB) | Level of decomposition (N) | Noise variance ( | The size of the DWT coefficient arrays (Ly) | Threshold value ( |
---|---|---|---|---|---|

1.2.840.113619.2.5.1762583153.215519.978957063.122.dcm | 522 | 3,4 | σ = 1 | 266,539 | 3.29416477 |

Figure 6 shows that pop-up message is generated after compression of DICOM input image, and it displayed warning dialog that image is compressed successfully, and then after pressing the ok button, compressed image is stored in image folder with. Hdwt extension (Figure 7).

Figure 8 shows that if input image size is 522 KB, then Biorthogonal DWT give highest compressed size, and Reverse Biorthogonal DWT gives lowest compressed size. The decomposition level = 4 gives better result than N = 3.

Figure 9 plot shows comparison of compression ratio when decomposition level is 3 or 4 for various wavelet types where size of input MRI is 522 KB. Biorthogonal DWT gives higher compression ratio, and Discrete Meyer DWT and Reverse Biorthogonal DWT give lower compression size. N = 4 gives better compression ratio (15:1 for Biorthogonal DWT and 10:1 Daubechies DWT) than N = 3.

In Figure 10, figure graph shows comparison of compression gain when decomposition level is 3 or 4 for various wavelet types where size of input MRI is 522 KB. Biorthogonal DWT gives higher compression gain, and Discrete Meyer DWT and Reverse Biorthogonal DWT give lower compression gain. N = 4 gives better compression gain (93.6781% for Biorthogonal DWT and 90.6130% for Daubechies DWT) than N = 3 (Figure 11).

Table 4 shows comparison of image quality parameters when application run at decomposition levels 3 and 4 for various wavelet types where size of input MRI is 522 KB. Daubechies DWT gives higher PSNR (42.0998db) where MSE is (35.2626db) and SNR is (28.3993 db). So, picture quality is good for N = 3. When we consider N = 4 decomposition level, we can choose Daubechies DWT for compression to achieve higher quality of medical image. This tool does not work on Haar DWT; there is no output for Haar wavelet type.

Initial size of image: 522 KB (image name: 1.2.840.113619.2.5.1762583153.215519.978957063.122.dcm) | Image quality parameter for N = 3 (in decibels) | Image quality parameter for N = 4 (in decibels) | ||||
---|---|---|---|---|---|---|

Wavelet types | PSNR | MSE | SNR | PSNR | MSE | SNR |

Biorthogonal DWT | 35.3358 | 35.2626 | 21.6352 | 30.7777 | 35.3626 | 17.0771 |

Haar DWT | ||||||

Daubechies DWT | 42.0998 | 35.2626 | 28.3993 | 39.6729 | 35.3626 | 25.9723 |

Symlets DWT | 39.0696 | 35.3626 | 25.3691 | 36.6956 | 35.3626 | 22.995 |

Coiflets DWT | 40.4769 | 35.3626 | 26.7763 | 36.1026 | 35.3626 | 22.402 |

Reverse Biorthogonal DWT | 32.0256 | 35.3626 | 18.325 | 26.3603 | 35.3626 | 12.6597 |

Discrete Meyer DWT | 40.6572 | 35.3626 | 26.9566 | 32.5428 | 35.3626 | 18.8423 |

Table 5 indicates that Daubechies, Symlets, and Coiflets DWT give higher compressed image size (9 KB) and highest compression ratio (4) and gain (75%). Decompression is working in this input size (36 KB). So, when the small-size input .dcm file, image reconstruction is required, this implementation work will be applicable. This application gives good PSNR (45.1486) and better MSE (29.88) and SNR (30.0124) for Daubechies DWT.

Sr. no. | Wavelet type | Size of compressed image (in KB) | CR | % of CG | PSNR (in db) | MSE (in db) | SNR (in db) |
---|---|---|---|---|---|---|---|

1 | Biorthogonal DWT | 15 | 2.4 | 58.33333 | 35.2407 | 19.9722 | 39.0124 |

2 | Haar DWT | 11 | 3.272727 | 69.44444 | 44.8457 | 29.5771 | 30.0124 |

3 | Daubechies DWT | 9 | 4 | 75 | 45.1486 | 29.88 | 30.0124 |

4 | Symlets DWT | 9 | 4 | 75 | 44.9406 | 29.6721 | 39.0124 |

5 | Coiflets DWT | 9 | 4 | 75 | 38.9493 | 23.6808 | 39.0124 |

6 | Reverse Biorthogonal DWT | 18 | 2 | 50 | 35.7811 | 20.5126 | 39.0124 |

7 | Discrete Meyer DWT | 15 | 2.4 | 58.33333 | 44.6503 | 29.3818 | 39.0124 |

Table 6 indicates that Biorthogonal DWT gives higher compressed image size (2 KB) and highest compression ratio (18:1) for threshold value = 50. But image quality is degraded due to PSNR value = 32.7496.

Parameters | λ =3 | λ =10 | λ = 20 | λ = 30 | λ = 50 |
---|---|---|---|---|---|

Compressed image in KB | 9 | 5 | 4 | 3 | 2 |

Compression ratio | 4 | 7.2 | 9 | 12 | 18 |

PSNR | 35.1707 | 34.5081 | 33.673 | 33.1783 | 32.7496 |

MSE | 19.9022 | 19.2396 | 18.4 | 17.9098 | 17.9098 |

SNR | 39.0124 | 39.0124 | 39.0124 | 39.0124 | 39.0124 |

Table 7 shows that CT0081 gives good compression result for implemented method, but other input CT images give less compression ratio than .jpg file format. The obtained result shows that.

Sr. no. | Image ID | Dimension | Depth in bit | Input file size in KB | DICOM size in KB | .jpg file size in KB | Implemented method .hdwt size in KB |
---|---|---|---|---|---|---|---|

1 | CT0014 | 512 × 512 | 24 | 1030 | 769 | 25 | 29 |

2 | CT0051 | 512 × 200 | 24 | 204 | 301 | 17 | 22 |

3 | CT0052 | 250 × 512 | 24 | 254 | 376 | 17 | 26 |

4 | CT0059 | 350 × 512 | 24 | 353 | 526 | 23 | 46 |

5 | CT0074 | 512 × 512 | 24 | 5130 | 769 | 61 | 67 |

6 | CT0081 | 888 × 733 | 24 | 2547 | 1908 | 167 | 165 |

7 | CT0090 | 512 × 512 | 24 | 3591 | 769 | 93 | 152 |

8 | CT0101 | 512 × 512 | 24 | 516 | 769 | 92 | 71 |

9 | CT102 | 512 × 605 | 24 | 609 | 909 | 153 | 162 |

10 | CT110 | 512 × 512 | 24 | 4616 | 769 | 61 | 68 |

## 5. Conclusions

Compression and decompression are necessary tasks in medical imaging applications. This implementation provides patient data integration within the medical image. It is very important to maintain the patient data security. This implementation work is very helpful to hide and recover patient information within the medical image and follow compression/decompression without any data loss. In this implanted work, 2D DWT and N-level decomposition are applied on medical image, and then the extracted detail coefficients are firstly encoded by RLE. Secondly, the extracted approximate coefficient and encoded detailed coefficients are encoded by Huffman encoder. The generated result shown that Biorthogonal DWT gives better compression size, compression ratio, and compression gain for higher decomposition level (N = 4), but image quality parameters like PSNR and MSE are degraded. After comparison with JPEG file format and implemented work, this work gives less compression size. We conclude that for medical image compression, we can select N = 3, decomposition level with λ = 3, threshold value, and Biorthogonal DWT for good image quality.

## Acknowledgments

Authors thank Dr. S.V. Dudal, HOD, Department of Applied Electronics, SGBA University, Amravati, India, for providing all kind of facilities and support.

## Conflict of interest

The authors declare that there is no conflict of interests, financial, potential, or otherwise associated with this manuscript.