44
Degree Project Vimal Rathinasamy, Iyyappan Dhasarathan, Tang Cui 2011-07-18 Subject: Master Thesis Level: Second Course code: 5ED06E WAVELET BASED SPIHT COMPRESSION FOR DICOM IMAGES Supervisor: Sven Nordebo School of Computer Sciences, Physics and Mathematics Submitted for the degree of Master in Electrical Engineering Specialized in Signal Processing and Wave Propagation

WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Degree Project

Vimal Rathinasamy, Iyyappan Dhasarathan, Tang Cui

2011-07-18

Subject: Master Thesis

Level: Second

Course code: 5ED06E

WAVELET BASED SPIHT COMPRESSION FOR DICOM IMAGES

Supervisor: Sven Nordebo

School of Computer Sciences, Physics and Mathematics

Submitted for the degree of Master in Electrical Engineering Specialized in Signal Processing and Wave Propagation

Page 2: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan
Page 3: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

ACKNOWLEDGEMENTS

It is a great privilege for us to thank our beloved professor and advisor Sven Nordebo first for the

motivation and encouragement he has given us, which led us finish our thesis in a successful

manner. We were very fortunate to work under him as the kind of support he provided us was

exceptional, without which we could not have finished our thesis in appropriate time. So, we are

highly grateful to our beloved Professor and Advisor Sven Nordebo for his support.

It’s our duty to thank the Swedish Educational Department for giving us an opportunity to be here

and make our dream come true. The standard of Education has been fabulous in Sweden and we are

very fortunate to be educated under this high standard. We cordially thank Swedish Government for

this wonderful opportunity.

We thank our dear parents without whom our dream of doing this Master’s degree programme

would not have been possible. So, we pay our heartfelt gratitude to our beloved parents.

We thank all our department faculty for educating us in various courses which led us achieve a great

success in this programme. We have to say that it’s only because of the knowledge gained through

all those Professors in several subjects in this programme, we are able to finish our thesis ultimately.

So, we are grateful to all our professors of our department and we always look for their wishes in

our career.

Finally, we would like to thank all our friends who supported us in some way for successfully

finishing this thesis. Thanks everyone!

Page 4: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Wavelet Based SPIHT Compression for DICOM Images

Vimal Rathinasamy, 860924-T131

Iyyappan Dhasarathan, 850219-3439

Tang Cui, 860124-4497

1

Page 5: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

ABSTRACT

Generally, image viewers do not include the scalability for the image com-pression and e�cient encoding and decoding for easy transmission. They alsonever consider the speci�c requirements of the heterogeneous networks consti-tuted by the Global Packet Radio Service(GPRS), Universal Mobile Telecom-munication System(UMTS), Wireless Local Area Network(WLAN) and DigitalVideo Broadcasting(DVB-H). This work contains the medical application withviewer for the Digital Imaging and Communications in Medicine(DICOM) im-ages as its core content. This application discusses the scalable wavelet-basedcompression, retrival and the decompression of the DICOM images. This pro-posed application is compatible with the mobile phones activated in the hetero-geneous netwoks. This paper also explains about the performance issues whenthis application is used in prototype heterogenous networks.

2

Page 6: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Contents

1 INTRODUCTION 51.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Why Do We Need Compression? . . . . . . . . . . . . . . . . . . 61.3 What are the Principles behind Compression? . . . . . . . . . . . 61.4 Di�erent Classes of Compression Techniques . . . . . . . . . . . . 71.5 Image Compression Process . . . . . . . . . . . . . . . . . . . . . 81.6 Objective of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . 91.7 Thesis Organization . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 WAVELET TRANSFORM OVERVIEW 102.1 Wavelet Transform . . . . . . . . . . . . . . . . . . . . . . . . . . 102.2 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.3 Shifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Scale and Frequency . . . . . . . . . . . . . . . . . . . . . . . . . 122.5 Discrete Wavelet Transform . . . . . . . . . . . . . . . . . . . . . 12

2.5.1 One-Stage Filtering . . . . . . . . . . . . . . . . . . . . . 132.5.2 Multiple-Level Decomposition . . . . . . . . . . . . . . . . 132.5.3 Wavelet Reconstruction . . . . . . . . . . . . . . . . . . . 132.5.4 Reconstructing Approximations and Details . . . . . . . . 142.5.5 1-D Wavelet Transform . . . . . . . . . . . . . . . . . . . 142.5.6 2-D Transform Hierarchy . . . . . . . . . . . . . . . . . . 15

2.6 Line based Wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . 172.6.1 Integer lifting . . . . . . . . . . . . . . . . . . . . . . . . . 18

3 SPIHT (SET PARTITIONING IN HIERARCHICAL TREES) 203.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.1.1 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.1.2 Set Partitioning Algorithm . . . . . . . . . . . . . . . . . 21

3.2 Image Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.3 Progressive Image Transmission . . . . . . . . . . . . . . . . . . . 233.4 Optimized Embedded Coding . . . . . . . . . . . . . . . . . . . . 233.5 Lossless Compression . . . . . . . . . . . . . . . . . . . . . . . . . 243.6 Rate or Distortion Speci�cation . . . . . . . . . . . . . . . . . . . 243.7 Encoding/Decoding Speed . . . . . . . . . . . . . . . . . . . . . . 243.8 Hierarchical Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.9 SPIHT coding algorithm . . . . . . . . . . . . . . . . . . . . . . . 263.10 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.11 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . . . 31

3

Page 7: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

3.12 Error Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4 SIMULATION RESULTS, CONCLUSION AND FUTUREWORK 334.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.2 Conclusion and Future Work . . . . . . . . . . . . . . . . . . . . 38

4

Page 8: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Chapter 1

INTRODUCTION

1.1 Background

The size of a graphics �le can be minimized in bytes without degrading thequality of the image to an unacceptable level using Image compression. So thatmore images can be stored in the given memory space. This also minimizes thesending and receiving time of the images, say for an example: through Internet.

Several methods are there for compressing the images. For Internet, the mostpopular graphic image formats employed for compression are JPEG format andGIF format. JPEG method is used particularly for the photographs whereasthe GIF method is used when the images include line arts and simple geometricshapes.

Fractals and wavelets are the other methods of Image compression. These meth-ods are not widely used for internet images. However, they o�er very good com-pression ratios than GIF and JPEG for some images. PNG format is anothermethod that may replace GIF format.

Compressing raw binary data is signi�cantly di�erent from compressing images.If general-purpose compression programs are used then the result would be lessthan optimal. This is because the statistical properties of the images can beexploited well only by the encoders speci�cally designed for them. Sometimes,some of the �ner details in the image can be sacri�ced for the sake of little morebandwidth or storage space. In other words, lossy compression can be used insuch areas.

Generally, a text �le can be compressed without the introduction of errors upto a certain extent. This is called lossless compression. But after that extenterrors are unavoidable. In text and program �les it is so important that we uselossless compression because a single error in text or program �le will changethe meaning of the text or cause the program not to run. A small loss in imagecompression is always not noticeable. There is no concern till the critical point.Beyond that it's not possible! The compression factor can be high if there isloss tolerance or else it must be less. So, graphic images can be with highcompression ratio than that of the text �les or program �les.

5

Page 9: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

1.2 Why Do We Need Compression?

E�cient compression is one of the major aspects of image storage. For examplean image of 1024 x 1024 x 24 would require the storage memory of 3MB andneeds 7 minutes for transmitting and utilizing in a high speed ISDN (64 Kbit/s).But if the image is compressed at the ratio of 10:1 the memory required for stor-age would be just 300 KB and the transmission time drops under 6 seconds. Inthe time required for sending an uncompressed �le through Appletalk network,we can transfer compressed seven 1 MB �les to a �oppy [3].

In any kind of environment, the large �les are always a biggest setback in sys-tems. This shows how desperately we need compression for managing transmit-table dimensions. Apart from compression methods, we can also increase thebandwidth but this will not provide e�cient outputs.

The �gures in Table.1 show the qualitative transition from simple text to full-motion video data and the disk space, transmission bandwidth, and transmissiontime needed to store and transmit such uncompressed data.

Multimedia Data Size/Duration Bits/pixel Uncompressed Size Transmission Time

A page of text 11 X 8.5 Varying one 4-8KB 1.1-2.2sec

Telephone Quality 10 sec 8bps 80 KB 22.2sec

Grayscale Image 512 X 512 8bpp 262KB 1 min 13 sec

Color Image 512 X 512 24bpp 786 KB 3 min 39 sec

Medical Image 2048 X 1680 12bpp 5.16MB 23 min 54 sec

SHD Image 2048 X 2048 24bpp 12.58MB 58 min 15 sec

Full-motion Video 640X480,1min(30frames/sec) 24bpp 1.66GB 5 days 8 hrs

Table 1: Multimedia data types and uncompressed storage space, transmissionbandwidth, and transmission time required. The pre�x kilo- denotes a factor

of 1000 rather than 1024[15].

The �gures shown in the table clearly states the need of the su�cient storagespace, wide transmission bandwidth, long transmission time for audio, video,image data. This kind of problems can be easily solved with the help of com-pression. So, the original data is compressed before trasmission and storageand decompressed at the receiving end. For example, if the compression ratio is32:1, the required space, bandwidth and transmission time can be reduced by afactor of 32 with an acceptable quality[15].

1.3 What are the Principles behind Compression?

It's a general fact that most images have their neighboring pixels correlated toeachother. This correlation contains less information. So, our aim is to removethis less correlated representation of the image [5].

Image compression addresses the problem lying behind the reduction of theamount of data that is required for representing a digital image. Removal ofredundant data is the key basis of image compression. In mathematical point,

6

Page 10: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

2-D pixel array is transformed into statistically uncorrelated dataset. This isdone before transmitting or storing the image. Later, the original image can bereproduced or an approximation is set in the decompression process.

The key concepts of the compression are irrelevancy and redundancy reduction.Removing duplication from the original image is carried by redundancy reduc-tion whereas the irrelevancy reduction omits the part of the signal which cannot be noticed by the signal receivers like Human Visual System [5]. The threekinds of redundancy are as follows:

a) Spatial Redundancy or correlation between neighboring pixel values.

b) Spectral Redundancy or correlation between di�erent color planes orspectral bands.

c)Temporal Redundancy or correlation between adjacent frames in asequence of images (in video applications).

Image compression research aims at reducing the number of bits needed torepresent an image by removing the spatial and spectral redundancies as muchas possible.

1.4 Di�erent Classes of Compression Techniques

Two ways of classifying compression techniques are mentioned here.

(a) Lossless vs. Lossy compression: In lossless compression scheme, thereconstructed image is numerically equivalent to the original image. However,only a modest compression could be achieved by this scheme. In lossy compres-sion scheme, the reconstructed image will be with degradation when comparedwith the original image. This is because, this method avoids all redundancies inthe image. However, this method achieves very high compression ratio. Undernormal viewing conditions, no losses are visible. So it is visibly lossless!

Due to the quantization of data there is information loss in lossy coding. Sortingthe data into di�erent bits and representing each bit with a value is called asthe quantization process. The value used for representing each bit is known asthe reconstruction value and each item in the bit has the same reconstructionvalue. This is why there is information loss until there is own bit for each itemin quantization process.

(b) Predictive vs. Transform coding: In predictive coding the future val-ues are predicted by the information that has already been sent or availableand then coded. It is very easy to implement and will easily adapt to the localimage characteristics since this is done in the spatial or image domain. Thegood example for this predictive coding is Di�erential Pulse Code Modulation(DPCM)[16]. Transform coding �rst transforms the image from its spatial do-main to a di�erent representation using a well-known transform and then codesthe transformed values. In the expense of greater computation this methodprovides higher data compression than predictive coding.

7

Page 11: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

1.5 Image Compression Process

A typical lossy image compression system is shown in �gure 1.1. It consistsof three closely connected components namely (a) Source Encoder (b) Quan-tizer, and (c) Entropy Encoder. Compression is accomplished by applying alinear transform to decorrelate the image data and then quantizing the result-ing transform coe�cients and �nally entropy coding the quantized values.

Source Encoder (or Linear Transformer): A signi�cant number of lin-ear transforms have been developed through the years, which include DiscreteFourier Transform (DFT), Discrete Cosine Transform (DCT), Discrete WaveletTransform (DWT) and many more, each with its own positives and negatives.

Quantizer: The Quantizer reduces the precision of the transformed coe�cientvalues to reduc e the number of bits required to store the transformed coef-�cients. Here the main source of compression is the encoder and since it ismany-to-one mapping this is a lossy process. Quantization can be performed oneach individual coe�cient, which is known as Scalar Quantization (SQ). Quan-tization can also be performed on a group of coe�cients together, and this isknown as Vector Quantization (VQ). Both uniform and non-uniform quantizerscan be used depending on the problem at hand[17].

Entropy Encoder: The quantized values are further losslessly compressed bythe encoder to give an overall better compression results. The encoder thenaccuretely determines the probabilities of the quantized values using a modeland then using this it produces an appropriate code such that the resultingoutput code stream will be smaller than the input code stream. The mostcommonly used entropy encoders are the Hu�man encoder and the arithmeticencoder, although for applications requiring fast execution, simple run-lengthencoding (RLE) has proven very e�ective[17].

It is important to note that a properly designed quantizer and entropy encoderare absolutely necessary along with optimum signal transformation to get thebest possible compression.

8

Page 12: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

1.6 Objective of the Thesis

Our aim is to design an application for compressing the DICOM images usingdiscrete wavelet transform and compress it with SPIHT, for the easy mobileaccess of the DICOM images over heterogeneous networks like UMTS, GPRSand so on.

1.7 Thesis Organization

Chapter 2 discusses the details of wavelets. Chapter 3 discusses the details ofSPIHT algorithm. Chapter 4 discuses the results and �nally concludes the thesisand identify the direction for the future work References.

9

Page 13: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Chapter 2

WAVELET TRANSFORMOVERVIEW

2.1 Wavelet Transform

Wavelets are mathematical functions de�ned over a �nite interval and having anaverage value of zero that transform data into di�erent frequency components,representing each component with a resolution matched to its scale [4].

The basic concept behind the wavelet transform is to represent any arbitraryfunction as a superposition of a set of such wavelets or basis functions. Thesebasis functions are called the baby wavelets and these baby wavelets are ob-tained from a single prototype wavelet known as the mother wavelet by dilationsor contractions (scaling) and translations (shifts)[4]. While analyzing physicalsituations where the signal has discontinuities and sharp spikes, they are e�-cient and advantageous over traditional Fourier methods. Image compression,turbulence, human vision, radar and earthquake prediction are new wavelet ap-plications developed in recent years. In wavelet transform the basis functionsare wavelets. Wavelets tend to be irregular and symmetric. All wavelet func-tions, w(2kt - m), are derived from a single mother wavelet, w(t). This waveletis a small wave or pulse like the one shown in �gure 2.1.

Normally it starts at time t = 0 and ends at t = T. The shifted wavelet w(t -m) starts at t = m and ends at t = m + T. The scaled wavelets w(2kt) startat t = 0 and end at t = T/2k. Their graphs are w(t) compressed by the factor

10

Page 14: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

of 2k as shown in �gure 2.2. For example, when k = 1, the wavelet is shown in�gure 2.2(a). If k = 2 and 3, they are shown in (b) and (c), respectively.

The wavelets are called orthogonal when their inner products are zero. Thesmaller the scaling factor is, the wider the wavelet is. Wide wavelets are com-parable to low-frequency sinusoids and narrow wavelets are comparable to high-frequency sinusoids.

2.2 Scaling

Wavelet analysis produces a time-scale view of a signal. Scaling a wavelet meansstretching (or) compressing it. The scale factor is used to express the compres-sion of wavelets and often denoted by the letter a. If the scale factor is smaller,the more compressed is the wavelet. The scale is inversely related to the fre-quency of the signal in wavelet analysis.

2.3 Shifting

Shifting a wavelet means delaying (or) hastening its onset. Delaying a functionf(t) by k is mathematically represented as; f(t-k) [23] and is shown in �gure 2.3.

11

Page 15: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

2.4 Scale and Frequency

The higher the scales, the more the wavelets are stretched. Therefore, theportion of the signal with which it is being compared is longer and then thesignal features being measured by the wavelet coe�cients are coarser. Therelation between the scale and the frequency is shown in �gure 2.4.Thus, there is a correspondence between wavelet scales and frequency as revealedby wavelet analysis:

Low scale

1) Compressed wavelet

2) Rapidly changing details

3) High frequency.

High scale

1) Stretched wavelet

2) Slowly changing, coarse features

3) Low frequency.

2.5 Discrete Wavelet Transform

Calculating wavelet coe�cients at each possible scale is a work which generatesan awful lot of data. If the scales and positions are chosen based on powers oftwo, the so-called dyadic scales and positions, then calculating wavelet coe�-cients are e�cient and just as accurate. This is obtained from discrete wavelettransform (DWT).

12

Page 16: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

2.5.1 One-Stage Filtering

The low-frequency content is the most important part for many signals. It is theidentity of the signal. The high-frequency content imparts details to the signal.In wavelet analysis, the approximations and details are obtained after �ltering.The approximations are the high-scale and low frequency components of thesignal whereas the details are the low-scale and high frequency components ofthe signal.Two signals are emerged when the original signal passes through two comple-mentary �lters. It may produce doubling of samples and so to prevent thisproblem, downsampling is used. DWT coe�cients re produced by the processon the right which includes downsampling.

2.5.2 Multiple-Level Decomposition

The iteration of the decomposition process by decomposing successive approxi-mations in turn such that one signal is broken down into many lower resolutioncomponents is known as the wavelet decomposition tree and is shown in �gure2.5.

2.5.3 Wavelet Reconstruction

The reconstruction of the image is achieved by the inverse discrete wavelettransform (IDWT). The values are �rst upsampled and then passed to the �lters.Filtering and downsampling are the basis of the wavelet analysis, whereas up-sampling and �ltering are the basis of wavelet reconstruction process. Length-ening a signal component by inserting zeros between samples is known as theupsampling process.

13

Page 17: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

2.5.4 Reconstructing Approximations and Details

It is possible that the original signal can be reconstructed from the coe�cientsof the approximations and details and this process produces a reconstructedapproximation which has the same length as the original signal and which is areal approximation of it.These reconstructed details and approximations are known to be true con-stituents of the original signal. The details and approximations are producedby downsampling process and are only half the length of the original signal.So, they cannot be directly combined to reproduce the signal[24]. Therefore, itis required to reconstruct the approximations and the details before combiningthem. The reconstructed signal is schematically represented as in �g 2.6.

2.5.5 1-D Wavelet Transform

A signal is passed through a low pass and high pass �lter, h and g, respectively,then down sampled by a factor of two, constituting one level of transform.Repeating the �ltering and decimation process on the lowpass branch outputsmake multiple levels or "scales" of the wavelet transform only. The process is

14

Page 18: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

typically carried out for a �nite number of levels K, and the resulting coe�cientsare called wavelet coe�cients.

The one-dimensional forward wavelet transform is de�ned by a pair of �lters sand t that are convolved with the data at either the even or odd locations. The�lters s and t used for the forward transform are called analysis �lters.

li =

nL∑j=−nL

(sjX2i+j) (2.1)

and

hi =

nH∑j=−nH

(tjX2i+1+j). (2.2)

Although l and h are two separate output streams, together they have the sametotal number of coe�cients as the original data. The output stream l, which iscommonly referred to as the low-pass data may then have the identical processapplied again repeatedly. The other output stream, h (or high-pass data), gen-erally remains untouched. The inverse process expands the two separate low-and high-pass data streams by inserting zeros between every other sample, con-volves the resulting data streams with two new synthesis �lters s′ and t′, andadds them together to regenerate the original double size data stream[25].

yi =

nH∑j=−nH

(t′j l′i+j) +

nl∑j=−nH

(s′jh′i+j), (2.3)

where l′2i = li, l′2i+1 = 0, h′2i+1 = hi, h

′2i = 0.

To meet the de�nition of a wavelet transform, the analysis and synthesis �lters s,t, s′ and t′ must be chosen so that the inverse transform perfectly reconstructsthe original data. Since the wavelet transform maintains the same numberof coe�cients as the original data, the transform itself does not provide anycompression[25]. However, the structure provided by the transform and theexpected values of the coe�cients give a form that is much more amenable tocompression than the original data. Since the �lters s, t, s′ and t′ are chosen tobe perfectly invertible, the wavelet transform itself is lossless. Later applicationof the quantization step will cause some data loss and can be used to controlthe degree of compression. A 1-D subband decomposition process is carried outby the forward wavelet-based transform. Here a 1-D set of samples is convertedinto two bands called the low-pass subband (Li) and high-pass subband (Hi).The low-pass subband corresponds to a down sampled low-resolution versionof the original image and the high-pass subband corresponds to the residualinformation of the original image. This residual information is needed for theperfect reconstruction of the original image from the low-pass subband.

2.5.6 2-D Transform Hierarchy

The 1-D wavelet transform can be extended to a two-dimensional (2-D) wavelettransform using separable wavelet �lters using which the 2-D transform can be

15

Page 19: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

obtained by applying a 1-D transform to all the rows of the input signal, andthen repeating it on all of the columns[26].The original image of a one-level (K=1), 2-D wavelet transform, with corre-sponding notation is shown in �gure 2.7. The example is repeated for a three-level (K =3) wavelet expansion in �gure 2.8. In all of the discussion K representsthe highest level of the decomposition of the wavelet transform.

The 2-D subband decomposition is extended method of the 1-D version of de-composition. Here the 1-D method is done twice; �rst in one direction (horizon-tal) and then in the orthogonal (vertical) direction. For instance, the low-passsubbands (Li) resulting from the horizontal direction is further decomposed inthe vertical direction which leads to LLi and LHi subbands.

The high pass subband (Hi) is further decomposed into HLi and HHi in similarmanner. After this process it is possible that the Lli subband can be furtherdecomposed into four subbands with same method. This produces multipletransform levels or multiple decomposition levels. As shown in �gure 2.8. the�rst level of transform or decomposition results in the four subbands; LL1, HL1,LH1 and HH1. In this LL1 is further transformed into four subbands; LL2, HL2,LH2 and HH2 in the second level. And the subband LL2 is used for the thirdlevel of transform or decomposition. In any band, LLi is the low-resolution sub-band and the high-pass subbands LHi, HLi, HHi are the horizontal, vertical anddiagonal subband because they represent the horizontal, vertical, and diagonalresidual information of the original image.To obtain a two-dimensional wavelet transform, the one-dimensional transform

16

Page 20: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

is applied �rst along the rows and then along the columns to produce four sub-bands: low-resolution, horizontal, vertical, and diagonal. (The vertical subbandis created by applying a horizontal high-pass, which yields vertical edges.) Ateach level, the wavelet transform can be reapplied to the low-resolution subbandto further decorrelate the image. Figure 2.9 illustrates the image decomposi-tion, de�ning level and subband conventions used in the AWIC algorithm. The�nal con�guration contains a small low-resolution subband. In addition to thevarious transform levels, the phrase level 0 is used to refer to the original imagedata. When the user requests zero levels of transform, the original image data(level 0) is treated as a low-pass band and processing follows its natural �ow.

On each source image, wavelet transform is performed and then based on fusionrules fusion decision map is generated. Then the fused wavelet co-e�cient mapcan be obtained from the wavelet co-e�cients of the original image accordingto the fusion decision map. Then by inverse wavelet transform the fused imagecan be obtained. From the above �gure it is clear that fusion rules play a vitalrole in fusion process.

2.6 Line based Wavelet

The lifting sheme has some unique properties that is not found in other trans-forms.

17

Page 21: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

The �gure 2.10 shows some of those few properties. The inverse transformcan be applied such that the signs of the scaling factors are changed, replacing"split" by "merge", move from right to left (reverse the data �ow). For thelifting scheme, this invertibility is true. Lifting can be done such that we neverneed the samples other than the previous lifting step. So, we can update the oldstream with the new one at the summation point. When we iterate the �lterbank using the in-place lifted �lters it will result in interlaced co-e�cients. Thisis not immediately clear from the image. We can split the inputs in the even andodd samples and in-place lifting steps are performed. After one complete stepthe high-pass �ltered samples and wavelet coe�cients sit in the odd numberedplaces whereas the low-pass �ltered samples sit in the even numbered places.Now, we will perform the next transform but in low-pass �ltered samples. So,again odd and even samples are obtained in that area. The odd numberedsamples are then transformed into wavelet coe�cients while the even numberedsamples are processed and interlaced with the wavelet coe�cients.

The third important property is not mentioned but from the �gure it is clearthat the lifting is not casual. But we can make it casual by delaying the signalalthough it will never be real time. In some cases we can design the casuallifting transform.

The last important property is the computational complexity. But it is actuallyproven that for long �lters the lifting cuts the computational complexity in ahalf than that of the standard iterated FIR Filter bank algorithm. This wavelettransform already has the complexity of N. In other words, it is much betterthan FFT with its complexity with N log(N) and lifting speeds things up toanother factor of 2. This transform is the fast wavelet transform and thus itcan be referred as fast lifting wavelet transform of FLWT.

2.6.1 Integer lifting

It should be made sure that the wavelet coe�cients are integers and this is thelast stage of the wavelet transform. Generally, in classical transforms that alsoincludes the non-lifted wavelet transforms, the wavelet coe�cients are assumedas the �oating point numbers. This is because the �lte coe�cients used intransform �lters are the �oating point numbers. In the lifting sceme the integerdata maintenance can be easy though the dynamic range of data might increase.This is the easy invertibilityy property of lifting.

By rewriting the basic lifting step, we have from [13],

xnew(z)← x(z) + s(z)y(z), (2.4)

because y(z) signal is not changed in the lifting step and the �lter operationresult can be rounded as follows,

xnew(z)← x(z) + bs(z)y(z)c , (2.5)

x(z)← xnew(z)− bs(z)y(z)c . (2.6)

Thus it is so clear that the lifting operation is reversible irrespective of whichkind of rounding method we use.

18

Page 22: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

However care must be taken that we did not consider the scaling step. Scaling isthe part of lifting transform and it does not yield integer results. The importantpoint is that the transform coe�cients have to be scaled. This is a good solutionfor this problem. This is particularly good in denoising applications. If scalingis ignored, the scaling factor must be as close to 1 as possible. This is madepossible by using non-uniqueness in lifting factorization. One more solution canbe to factor the scaling into lifting steps.

As told earlier, integer lifting transform will not guarantee to preserve thedyanamic range of input signal. There are some schemes that can keep thedynamic range since the dynamic range doubles usually. The two complementrepresentation of integers in a computer and a wrap-around over�ows cause inthe representation are employed by the lifting transform with the so-called pre-cision preservation property. The main problem with this transform is that thehigh coe�cients are represented by the small values and thus it is quite di�cultto take decisions on coe�cient values.

19

Page 23: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Chapter 3

SPIHT (SETPARTITIONING INHIERARCHICAL TREES)

3.1 Introduction

In [1], a wavelet-based still image coding algorithm known as set partitioning inhierarchical trees (SPIHT) is developed that generates a continuously scalablebit stream. This means that a single encoded bit stream can be used to produceimages at various bit-rates and quality, without any drop in compression. Thedecoder simply stops decoding when a target rate or reconstruction quality hasbeen reached. In the SPIHT algorithm, the image is �rst decomposed into anumber of sub bands using hierarchical wavelet decomposition. The sub bandsobtained for a two-level decomposition are shown in �gure 3.1. The sub bandcoe�cients are then grouped into sets known as spatial-orientation trees, whiche�ciently exploit the correlation between the frequency bands. The coe�cientsin each spatial orientation tree are then progressively coded bit-plane by bit-plane, starting with the coe�cients with highest magnitude and at the lowestpyramid levels. Arithmetic coding can also be used to give further compression.

In general, increasing the number of levels gives better compression althoughthe improvement becomes negligible beyond 5 levels. In practice the numberof possible levels can be limited by the image dimensions since the wavelet de-composition can only be applied to images with even dimensions. The use ofarithmetic coding only results in a slight improvement for a 5 level decomposi-tion.

The embedded zerotree wavelet (EZW) coding was �rst introduced by J.MShapiro and has since become a much studied topic in image coding. TheEZW coding technique is a fairly simple and e�cient technique for compressingthe information in an image. Our focus in this project is to analyze the SetPartition in Hierarchical Tree algorithm in the EZW technique and to obtainobservations by implementing the structure and testing it.

In order to compress a binary �le, some prior information must be known about

20

Page 24: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

the properties and structure of the �le in order to exploit the abnormalities andassume the consistencies. The information that we know about the image �lethat is produced from wavelet transformation is that it can be represented in abinary tree format with the root of the tree having a much larger probably ofcontaining a greater pixel magnitude level than that of the branches of the root.The algorithm that takes advantage of this information is the Set Partition inHierarchical Tree (SPHT) algorithm.

This project has been preformed previously but has produced an ine�cient ex-planation of the implementation of the algorithm and some of its di�culties.In this project, we hope to be able to identify the problems and give more in-sight to the development and implementation of this algorithm than in previousprojects.

3.1.1 Approach

Matlab o�ers a set of wavelet tools to be able to produce an image with theneeded properties. The concept of wavelet transformation was not our focusin this project but in order to understand how the SPHT algorithm works, theproperties of wavelet transformation would need to be identi�ed. Matlab wasable to create adequate testing pictures for this project.

To adequately comprehend the advantages of the SPHT algorithm, a top levelunderstanding will be needed to identify its characteristics and di�erences fromother algorithms.

3.1.2 Set Partitioning Algorithm

The SPHT algorithm is unique in that it does not directly transmit the contentsof the sets, the pixel values, or the pixel coordinates. What it does transmit isthe decisions made in each step of the progression of the trees that de�ne thestructure of the image. Because only decisions are being transmitted, the pixelvalue is de�ned by what points the decisions are made and their outcomes, whilethe coordinates of the pixels are de�ned by which tree and what part of thattree the decision is being made on. The advantage to this is that the decodercan have an identical algorithm to be able to identify with each of the decisionsand create identical sets along with the encoder.

21

Page 25: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

The part of the SPIHT that designates the pixel values is the comparison ofeach pixel value to 2n ≤ |ci,j | < 2n+1 with each pass of the algorithm havinga decreasing value of n. In this way, the decoding algorithm will not need topassed the pixel values of the sets but can get that bit value from a single valueof n per bit depth level. This is also the way in which the magnitude of thecompression can be controlled. By having an adequate number for n, there willbe many loops of information being passed but the error will be small, andlikewise if n is small, the more variation in pixel value will be tolerated for agiven �nal pixel value. A pixel value that is 2n ≤ |ci,j | is said to be signi�cantfor that pass.

By sorting through the pixel values, certain coordinates can be tagged at "sig-ni�cant" or "insigni�cant" and then set into partitions of sets. The trouble withtraversing through all pixel values multiple times to decide on the contents ofeach set is an idea that is ine�cient and would take a large amount of time.Therefore the SPIHT algorithm is able to make judgments by simulating a treesort and by being able to only traverse into the tree as much as needed on eachpass. This works exceptionally well because the wavelet transform produces animage with properties that this algorithm can take advantage of. This "tree"can be de�ned as having the root at the very upper left most pixel values andextending down into the image with each node having four (2 x 2 pixel group)o�spring nodes(See �gure 3.1).The SPIHT method is not an extension from the traditional methods of imagecompression, and it represents an important advance in the �eld. The SPIHT(set partitioning in hierarchical trees) is an e�cient image coding method usingthe wavelet transform. Recently, image-coding using the wavelet transform hasattracted great attention. Among the many coding algorithms, the embeddedzero tree wavelet coding by Shapiro and its improved version, the set partitioningin hierarchical trees (SPIHT) by Said and Pearlman have been very successful.Compared with JPEG which is the current standard for still image compression,the EZW and the SPIHT methods are more e�cient and are able to reduce theblocking artifact[14].

The method provides the following which requires special attention:

1) Good image quality and high PSNR especially for the color images

2) It is optimized for progressive image transmission

3) Produces a fully embedded coded �le

4) Simple quantization algorithm

5) Can be used for lossless compression

6) Can code to exact bit rate or distortion

7) Fast coding/decoding (nearly symmetric)

8) Has wide applications, completely adaptive

9) E�cient combination with error protection

These properties[19] are discussed in the following. Generally, di�erent compres-sion methods were developed that has at least one of the following propertiesbut SPIHT really is outstanding since it has all those qualities simultaneously.

22

Page 26: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

3.2 Image Quality

SPHIT has the very good ability when tested to �nd the minimum rate inreproducing the image that is indistinguishable with the original. SPHIT is evenmore perfect to encode the color images as it allocates the bits automatically forthe local optimality for the color components. Basically other algorithms encodethe color components seperately following the global statistics of the individualcomponents. But SPIHT is di�erent from this. The compression that is visuallylossless can be obtained in some color images with the compression ratios from100-200:1.

3.3 Progressive Image Transmission

Systems like WWW servers which has progressive image transmissions, havethe quality of dispaying images which are ine�cient. This is because thesewidely used schemes use very primitive progressive image transmission method.On the other hand we have SPHIT which is the state-of-the-art method thatis designed for optimal pregressive transmission which still beats most non-progressive transmission methods. SPHIT makes it possible by producing fullyembedded coded �le such that the quality of the displayed image �le, at anymoment is the best available for the number of bits received upto the moment.Thus SPHIT can be used in applications where the user can go through theimage so quickly and decide if it should really be downloaded or is it enough tobe saved or need re�nement.

3.4 Optimized Embedded Coding

Embedded coding scheme is de�ned as: when the two �les produced by theencoder have the size M and N bits such that if M>N then the �le with the sizeN is identical to the �rst N bits of the M-size �le.

In practice, if you need to compress an image for thee remote users who requirethe same image with di�erent reproduction quality and you �nd that thosequalities can be obtained from the images that are compressed to at least 8 Kb,30 Kb and 800 Kb. If you use non-embedded encoder like JPEG inorder to

23

Page 27: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

avoid transmission cost or time then you must prepare one �le for each user. Inthe other hand if you use embedded encoder like SPHIT then you can compressthe image �le to single 80 Kb �le, then send the �rst 8 Kb of the �le to the �rstuser, then �rst 30 Kb to the second user and the full �le to the next user.

Surprisingly in SPHIT, all the three users would get an image quality for thesame �le size, superior to the sophisticated non-embedded encoders availabletoday. This is possible in SPHIT because it optimizes the embedded codingprocess and codes the most important information �rst.

3.5 Lossless Compression

SPIHT codes the individual bits of transform image wavelet coe�cients followinga bit-plane sequence and thus it is possible to reproduce full image perfectly byeach bit since it codes all bits of transform. However, only if the numbers arestored as in�nite-precision numbers, the wavelet transform can yield perfect re-construction. In practice, rounding recovery approach is followed to reconstructthe image perfectly but this method is not encouraged due to its ine�ciency.

The codec that uses the transformation to produce e�cient progressive trans-mission till the lossless recovery is among the SPHIT. The surprising resultsproduced can show that for lossless compression this codec used is as e�cientas the most e�ective lossless encoders which de�nitely does not include losslessJPEG. The property in SPIHT that produces progressive transmission withpractically no reduction in compression e�ciency applies to the lossless com-pression too.

3.6 Rate or Distortion Speci�cation

Most of the image compression methods developed today has no precise ratecontrol. For some methods, the user sets the target rate and the program triesto give the result ina rate that is not too far away from what you have speci�ed.In certain methods, the user gives the "quality factor" and waits for the resultsto look if the size suits your needs.

The embedded property of SPIHT has the exact bitrate control which does nota�ect at all the image quality or performance since no bits are wasted in paddingor whatsoever. It also provides the Mean Square-Error (MSE) distortion control.Though this is not the best measure for image quality it provides far superiorquality speci�cation than other criteria.

3.7 Encoding/Decoding Speed

The more the compression simplicity the high the encoding/decoding speed.The SPIHT algorithm is so symmetric such that the encoding time is almostsame as the decoding time unlike complex compression algorithms where theencode time will be signi�cantly more than the decode time.

24

Page 28: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

3.8 Hierarchical Tree

In this subsection, we will describe the proposed algorithm to code the waveletcoe�cients. In general, a wavelet decomposed image typically has non-uniformdistribution of energy within and across subbands. This motivates us to par-tition each subband into di�erent regions depending on their signi�cance andthen assign these regions with di�erent quantization levels.

The proposed coding algorithm is based on the set partitioning in hierarchicaltrees (SPIHT) algorithm, which is an elegant bit-plane encoding method thatgenerates M embedded bit sequence through M stages of successive quantization.Let s0, s1, ..sM−1 denote the encoder's output bit sequence of each stage. Thesebit sequences are ordered in such a way that s0 consists of the most signi�cantbit, s1 consists of the next most signi�cant bit, and so on.

The SPIHT algorithm forms a hierarchical quadtree data structure for thewavelet transformed coe�cients. A spatial orientation tree (SOT) is shownin �gure 3.3 that the set of root node and corresponding descendents are knownas a spatial orientation tree (SOT). In the tree, each node has either no leaves orfour o�spring, that are from 2 x 2 adjacent pixels. In the highest decompositionlevel, the pixels on the LL subimage are the tree roots and they are also groupedin 2 x 2 adjacent pixels. But, the upper-left pixel in 2 x 2 adjacent pixels has nodescendant as shown in �gure.3.3. Other three pixels have four children each.

The real implementation of SPIHT is illustrated below. To make it simple, thefollowing sets of coordinates are de�ned.

(1) O(i, j): set of coordinates of all o�spring of node (i, j);

(2) D(i, j): set of coordinates of all descendants of the node (i, j);

(3) H: set of coordinates of all spatial orientation tree roots (nodes in the highestpyramid level);

(4) L(i, j)=D(i, j)-O(i, j).

Thus, except at the highest and lowest levels, we have

O(i, j)=(2i, 2j), (2i, 2j+1), (2i+1, 2j), (2i+1, 2j+1).

De�ne the following function.

Sn(τ) =

{1, max(i,j)eτ{|ci,j |} ≥ 2n,0, otherwise

25

Page 29: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Sn(τ) denotes the signi�cance of a set of coordinates τ , where the preset signif-icant threshold used in the nth stage is denoted by T(n). The SPIHT codingalgorithm is described as follows.

First, T(0) is assumed to be 2M−1. Here M is chosen such that the largestcoe�cient magnitude cmax, satis�es 2M−1 ≤ cmax < 2M . In the coe�cientmagnitude, the encoding is progressive to successfully use a sequence of thresh-olds T(n)=2(M−1)−n, n=0,1,2,...M-1. These thresholds are of the powe of '2',so that the encoding can be taken as the bit plane encoding of the wavelet co-e�cients. All the coe�cients with the magnitudes between T(n) and 2T(n), atstage n are signi�cant and their positions and the sign bits are encoded. This iscalled sorting pass process. Then each coe�cient with the magnitude at least2T(n) is re�ned by encoding the 'n'th most signi�cant bit. This is known asre�nement pass. The signi�cant coe�cient encoding position and the signi�-cant coe�cient scanning can be achieved by the three lists: (LSP) the list ofsigni�cant pixels , (LIP) the list of insigni�cant pixels, and (LIS) the list ofinsigni�cant set. Any entry into the LSP and LIP is an individual pixel whichis represented or indicated by the coordinates (i,j). Each entry into the LIS isregarded as the set: either D(i,j) or L(i,j), such that LIS is indicated as type Aif it is D(i,j) and type B if it is L(i,j) [19].

3.9 SPIHT coding algorithm

Step 1: (Initialization)

Output, blog2(maxi,j{|Ci,j |})c set the LSP as an empty list,

add the coordinates (i, j) ∈ H to the LIP,

add the coordinates (i, j) ∈ H with descendants to the list LIS, as type Aentries,

Step 2: (Sorting Pass)

2.1) for each entry (i, j) in the LIP do:

output Sn(i, j),

if Sn(i, j)=1

move (i, j) to the LSP,

output the sign of ci,j ,

2.2) for each entry (i, j) in the LIS do:

2.2.1) if the entry is of type A then

output Sn(D(i, j)),

if Sn(D(i, j)) = 1 then

*for each (k, 1) ∈ O(i, j) do:

output Sn(k, l),

if Sn(k, l) = 1 then

add (k, l) to the LSP,

output the sign of ck,l ,

if Sn(k, l)=0 then

add (k, l) to the end of the LIP,

26

Page 30: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

*if L(i, j) 6= 0 then

move (i, j) to the end of the LIS, as an entry of type B,

go to Step 2.2.2).

otherwise

remove entry (i, j) from the LIS,

2.2.2) if the entry is of type B

output Sn(L(i, j)),

if Sn(L(i, j)) = 1 then

*add each (k, 1) ∈ O(i, j) to the end of the LIS as an entry of type A,

*remove (i,j) from the LIS,

Step 3: (Re�nement Pass)

For each entry (i, j) in the LSP, except those included in the last sorting pass(i.e., with the same n), output the nth most signi�cant bit of |ci,j |,Step 4: (Quantization-Step Update)

Decrement n by 1 and go to Step 2 [21].

3.10 Algorithm

O(i,j): set of coordinates of all o�spring of node (i,j); children only

D (i,j): set of coordinates of all descendants of node (i,j); children, grandchildren,great-grand, etc.

H (i,j): set of all tree roots (nodes in the highest pyramid level); parents

L (i,j): D (i,j) - O(i,j) (all descendents except the o�spring); grandchildren,great-grand, etc.

27

Page 31: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

28

Page 32: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

29

Page 33: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

30

Page 34: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

3.11 Performance Evaluation

Compression e�ciency is measured by the compression ratio and is estimatedby the ratio of the original image size over the compressed data size. Thecomplexity of an image compression algorithm is calculated by the number ofdata operations required to perform both encoding and decoding processes.Practically, it is sometimes expressed by the number of operations. For a lossycompression scheme, a distortion measurement is a criterion for determining howmuch information has been lost when the reconstructed image is produced fromthe compressed data. The most often used measurement is the mean squareerror (MSE).

In the MSE measurement the total squared di�erence between the original signaland the reconstructed one is averaged over the entire signal. Mathematically,

MSE = (1

N)

N−1∑i=0

(x′i − xi)2, (3.1)

where x′i is the reconstructed value of xi. N is the number of pixels. The meansquare error is commonly used because of its convenience. A measurementof MSE in decibels on a logarithmic scale is the Peak Signal-to-Noise Ratio(PSNR), which is a popular standard objective measure of the lossy codec.We use the PSNR as the objective measurement for compression algorithmsthroughout this thesis. It is de�ned as follows,

PSNR = 10 log10MAX2

1w∗h

∑wi=1

∑hj=1(o(i, j)− c(i, j))2

, (3.2)

where w and h are the width and height of the image respectively, o is theoriginal image data, and c is the compressed image data. MAX is the maximumvalue that a pixel can have, 255.

Compressing raw binary data is signi�cantly di�erent from comressing images.If general-purpose compression programs are used then the result would be lessthan optimal. This is because the statistical proper ties of the images can beexploited well only by the encoders speci�cally designed for them. Sometimes,some of the �ner details in the image can be sacri�ced for the sake of little morebandwidth or storage space. In other words, lossy compression can be used insuch areas.

Lossless compression is about compressed data, when decompressed is the exactreplica of the original data. This is the case when documents and programs arecompressed. Because they need to be exactly reproduced when decompressedunlike music and images that need not be exactly reproduced on decompression.Most of the time an approximation to the original image is enough as long asthe losses between the original image and the compressed image are tolerable.

31

Page 35: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

3.12 Error Metrics

There are two error metrics that are used to compare di�erent image compres-sion methods. They are Mean Square-Error (MSE) and Peak Signal-to-NoiseRatio (PSNR). The cumulative squared error between the original and the com-pressed image is shown by MSE and the peak error is shown by the PSNR[18].Mathematically, they are written as follows,

MSE =1

MN

N∑y=1

M∑x=1

[I(x, y)− I ′(x, y)]2. (3.3)

PSNR = 20 ∗ log10(225

sqrt(MSE)). (3.4)

where I(x, y) denotes the original image and I ′(x, y) denotes the approximationto the original image which is also called as the decompressed image. M, N arethe image dimensions. The lower value of MSE says that the errors are less.Due to inverse relation of MSE and PSNR, the errors will be less when thePSNR is high. Logically, signal is the image and noise is the errors produced inthe reconstructed image. So, if signal to noise ratio is peak and MSE is less foran image when comparison then one can make a con�rmation that this is thebetter one!

The term PSNR is an engineering term for the ratio of the maximum possiblepower of the signal to the power of corrupting noise that a�ects the �delity ofits representation. Since many signals have a wide dynamic range, PSNR isexpressed in logarithmic decibel scale.

PSNR is the measure of the quality of reconstruction of the compressed image.It can be easily de�ned through the MSE which for two m X n monochromeimages I and K where one of them is assumed as the noisy approximation tothe other and is de�ned as,

MSE =1

mn

m−1∑i=0

n−1∑j=0

‖I(i, j)−K(i, j)‖2 . (3.5)

The PSNR is de�ned as:

PSNR = 10 log10(MAX2

I

MSE) = 20 log10(

MAXI√MSE

). (3.6)

The maximum possible pixel value is de�ned by MAXi. When the pixels are 8bits per sample then it is 255. (i.e) if the pixels are represented by PCM withB bits per sample then MAXI is 2

B − 1.

The color images have three RGB values per pixel, for which the PSNR is de�nedas the same except the Mean Square-Error (MSE) is the sum over all squaredvalue di�erences divided by image size and by three.

Typically, in lossy image and video compression, the PSNR values are from 30to 50 dB, where higher is always better for PSNR!

32

Page 36: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Chapter 4

SIMULATION RESULTS,CONCLUSION ANDFUTURE WORK

4.1 Simulation

Here comes the simulation part to see how the outputs look like. After writingthe codes for Discrete Wavelet Transform followed by SPIHT coding using Mat-lab, the original image is passed through it for decomposing it by seperatinghigh frequency and low frequency signals. Then the resulting image is SPHITencoded and sent through the decompressing section which includes SPIHT de-coding and Inverse Discrete Wavelet Transform to get the reconstructed imageor the approximation to the original image.

The steps of execution of the program code is explained below with the sim-ulation results. When the code is executed, a GUI(Graphical User Interface)window opens as shown in the �gure 4.1.

33

Page 37: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

34

Page 38: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

When we browse for a DICOM image or any other image, the chosen image willget displayed in the GUI, as shown in the �gure 4.2.

So, if we encode it using the 'Encode' tab, the chosen DICOM image �rst gets itstrasformation by Discrete Wavelet Transform and as a result four subbands areproduced which are the seperation between low and high-pass signals. Then, thetransformed image is encoded using SPIHT algorithm to produce the bitstreamfor the image signal. This process is shown in the �gure 4.3.

35

Page 39: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

After the encoding process, the bitstream is sent to the receiving end, such thatthe user in the receiving end needs to decode it before the he/she can see thereconstructed image. The window, how it looks like after decoding the image isshown in the �gure 4.5.

36

Page 40: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

37

Page 41: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

The reconstructed image or decompressed image is shown in the �gure 4.6, whichis almost the replica of the original image. Also, it had been discussed alreadythat the more the compression ratio, the more the losses in the reconstructedimage, although it is called as the Lossless compression!

4.2 Conclusion and Future Work

In this thesis we have developed a technique for line based wavelet transforms.We pointed out that this s transform can be assigned to the encoder or thedecoder and that it can hold compressed data. We provided an analysis for thecase where both encoder and decoder are symmetric in terms of memory needsand complexity. We described highly scalable SPIHT coding algorithm thatcan work with very low memory in combination with the line-based transform,and showed that its performance can be competitive with state of the art imagecoders, at a fraction of their memory utilization. To the best of our knowledge,our work is �rst to propose a detailed implementation of a low memory waveletimage coder by making it attractive both in terms of speed and memory needs.Further improvements of our system especially in terms of speed can be achievedby introducing a lattice factorization of the wavelet kernel or by using the lift-ing steps. This will reduce the computational complexity and complement thememory reductions mentioned in this work.

38

Page 42: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

Bibliography

[1] J. Z. Wang, "Wavelets and imaging informatics: A review of the literature"

J. Biomed. Inf., vol. 34, no. 2, pp. 129-141, Apr. 2001.

[2] I.Maglogiannis, C.Doukas and G.Kormentzas, "Wavelet-Based Compression

with ROI Coding Support for Mobile Access to DICOM Images Over Hetero-

geneous Radio Networks," IEEE Transactions on Information Technology inBiomedicine, vol. 13, no. 4, july 2009.

[3] Ho Weng Leong, Umi Kalthum Ngah, P.A.Venkatachalam, Noor ElizaAbd.Khalid, "Image Compression Software Analysis and Design," Proc.ROVPIA 1999. pp.385-392, Malaysia, 16-18 July 1999.

[4] Anoop Mathew, Member, IEEE and Bensiker Raja Singh D, "Image Com-pression using Lifting Based DWT," International Journal of Computers,Information Technology and Engineering January-June 2009.

[5] Parvinder Kaur, "Compression Using Fractional Fourier Transform," AThesis Submitted in the partial ful�llment of requirement for the awardof the degree of Master of Engineering In Electronics and Communication.

[6] Burrus, C.S. and Gopinath, R.A. and Guo, H., "Introduction to Wavelets

and Wavelet Transforms: A Primer.," Prentice-Hall, (1988).

[7] J.M. Shapiro, "Embedded Image Coding Using Zero trees of Wavelet Coef-

�cients," IEEE Trans. Signal Processing, vol. 41, pp. 3445-3462, December1993.

[8] Rafael C.Gonzalez, Richard E.Woods, Steven l.Eddins, "Digital Image Pro-cessing Using MATLAB," Prentice-Hall, 2004.

[9] A. M. Tekalp, "Digital Video Processing," Englewood Cli�s, NJ: Prentice-Hall, 1995.

[10] M. Antonini, M. Barlaud, P. Mathieu, and I. Daubechies, "Image coding

using wavelet transform," IEEE Trans. Image Processing, vol. 1, pp. 205-220, Apr. 1992.

[11] D. Taubman and A. Zakhor, "Multirate 3-D subband coding of video," IEEETrans. Image Processing, vol. 3, pp. 572-588, Sept. 1994.

[12] habibollah danyoli and Alfred mertins, "Highly scalable image compressionbased on spiht for network applications."

39

Page 43: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

[13] C. Valens, "The Fast Lifting Wavelet Transform," 1999-2004.

[14] J. Malý, P. Rajmic, "DWT-SPIHT IMAGE CODEC IMPLEMENTA-

TION," Department of Telecommunications, Brno University of Technology,Brno, Czech Republic.

[15] David salomon, "Data Compression, The Complete Reference," 2nd Edi-tion Springer-Verlag 1998.

[16] "Digital Compression and coding of Continuous-tone still images, part 1,

requirements and Guidelines," ISO/IEC JTC 1 Draft International Standard10918-1, Nov, 1991.

[17] R.M.Gray, D.L.Neuho� "Quantization," IEEE Trans.Inform, theory, Vol.44, No 6, 1998.

[18] Mallat, S.G. "A Thory of Multiresolution Signal Decomposition:The

Wavelet Representation," IEEE Trans.PAMI, Vol.11, No.7, PP.674-693, July1989.

[19] A.Said, W.A.Pearlman, "A new, fast and e�cient image codec based on set

partitioning in hierarchical trees," IEEE Trans. Circuits Syst. Video Tech-nol., 1996, 6:3, pp.243250.

[20] Khalid Sayood, "Introduction to data compression," 2nd edition, San Fran-cisco, Calif.: Morgan Kaufmann, cop. 2000.

[21] R.D.Dony and S.Haykin, "Neutral network approaches to image Compres-

sion," Proceedings of the IEEE, Vol.83, No.2.

[22] Tianhe Yang, Sarah McGee, Taylor Johnson, Robert Ortman, "ExploringHigh Dynamic Range Imaging: S5.2 Wavelets and HDR," The ConnexionsProject.

[23] A.H.Siddiqi, S.Khan, S.Rehman, "Wind Speed Simulation Using Wavelets,"

Department of Mathematical Sciences, King Fahd University of Petroleumand Minerals, Dhanran-31261, Saudi Arabia.

[24] Myint Myint Yi, Khin Sandar Linn, and Marlar Kyaw, "Implementationof Neural Network Based Electricity Load Forecasting," World Academy ofScience, Engineering and Technology 42 2008.

[25] Margaret A. Lepley, Richard D.Forkert "AWIC: Adaptive Wavelet Image

Compression", MITRE TECHNICAL REPORT, September 1997.

[26] Prarthana Shrestha "MIPS Augmented with Wavelet Transform: Perfor-

mance Analysis", Computer Engineering Laboratory, Faculty of InformationTechnology and Systems, Delft University of Technology, The Netherlands,July 2002.

40

Page 44: WAVELET BASED SPIHT COMPRESSION FOR …lnu.diva-portal.org/smash/get/diva2:431463/FULLTEXT01.pdfWavelet Based SPIHT Compression for DICOM Images Vimal Rathinasamy, 860924-T131 Iyyappan

SE-351 95 Växjö / SE-391 82 Kalmar

Tel +46-772-28 80 00

[email protected]

Lnu.se