ÖZET Medikal görüntüler hastanelerde, PACS (Picture Archiving Communication System) ortamlarında arşivlenmek istendiklerinde büyük miktarlarda depolama kapasitelerine ihtiyaç duyulur. PACS ortamlarında, depolama kapasitelerinin en verimli şekilde kullanılması için görüntü verileri sıkıştırılarak saklanır. Görüntüler kayıpsız (lossless) olarak 1,5-3,0 arasındaki oranlarda sıkıştırılabilir. Fakat bu oran genellikle 1,5 'a yakındır. Bu nedenle kayıplı (lossy) sıkıştırma olarak isimlendirilen yöntemlere başvurulur. Kayıplı yöntemlerde 10:1 ve üzerindeki oranlarda sıkıştırmalara erişilebilir. Bunun karşılığında görüntüde bozulma meydana gelir. Tedavi amaçlı kullanılan görüntülerin kayıplı yöntemlerle sıkıştırılması uzmanlar tarafından uygun görülmez. CT (Computed Tomography) gibi cihazların görüntülerinin yaklaşık %80 'i tedaviyle ilgili bölgenin dışındaki görüntüler olduğu için ancak bu tip görüntülerde kayıpsız sıkıştırmaya başvurulmaktadır [1]. Tez çalışmasında önerilen yöntem ise görüntünün uzman tarafından mouse ile tesbit edilen kısmını kayıpsız, diğer bölgelerini kayıplı olarak sıkıştırabilmektedir. Böylece optimum sıkıştırma oranlarına ulaşılabilir. Kayıplı sıkıştırma olarak JPEG standardının ardışık taban çizgisi (sequential baseline) yöntemi uygulandı. JPEG standardı ISO (International Standard Organization) tartından desteklenen bir çalışma grubudur. Bu grup 1986 yılında çalışmalarına başlamış ve 1988 yılında tüm önemli kayıplı sıkıştırma tekniklerinin performanslarını inceledikten sonra DCT (Discrete Cosine Transform) yöntemini kullanmaya karar vermiştir [2]. Kayıpsız sıkıştırma olarak yine JPEG 'in öngörü (predictive) sıkıştırma yöntemi uygulanmıştır. Bu yöntemin performansı en gelişmiş kayıpsız sıkıştırma tekniklerine yakındır [3]. Tez çalışmasında hem sabit hem de adaptif Huffman kodları kullanan öngörü yöntemleri incelenmiş ve adaptif yöntem daha başarılı olmuştur. Tez çalışmasında uygulanan diğer yöntemler ise Huffman entropi yöntemi ve run-length yöntemleridir. Bu yöntemler istenen sıkıştırma oranlarını vermedikleri için kayıpsız sıkıştırma için önerilmemektedirler. Tez çalışmasının sonuç kısmında ise tasarlanan ve uygulanan kayıplı- kayıpsız sıkıştırma yönteminin bir PACS ortamında kullanılabilmesi için gerekli modifikasyonlar açıklanmaktadır. Ayrıca mikro PACS olarak ifade edilen sistemler Türk hastane ve klinikleri için tavsiye edilmektedir. (v) SUMMARY Medical images, in uncompressed form, require a huge amount of storage space. A large hospital with a PACS (Picture Archiving and Communication System) generates multiple terra bytes (1012 bytes) per year of image data. Despite the ever increasing performance of storage technologies, the demands always exceed the capacities. Even as the technology advances, the requirements of resolution, dynamic range and image volume continue to increase. For PACS to be an important alternative to film as an image storage medium, the cost of the equipment which is required for archiving must be minimised. Ideally, lossless (recoverable) image compression could be used to reduce storage costs. Lossless image compression can achieve compression ratios with an upper bound in the neighbourhood of 3:1. More typically the ratio is in the range 1.5-2.0, but probably closer to 1.5. However these ratios are not enough to make PACS sufficiently responsive and attractive. On the other hand, lossy (nonrecoverable) image compression techniques can achieve compression ratios of 10:1 or better, but introduce some distortion to original images. Lossy compressed images generally are not suitable for diagnostic purposes, however, sufficient for referential images. For the outputs of imaging modalities like body CT (Computed Tomography), the share of the diagnostically relevant images is lower than 20% [1]. Thus, in the conventional PACS, lossless compression is applied for selected relevant images and lossy compression for non selected images. In this thesis a new image compression approach which combines lossy and lossless compression techniques in the same image was designed and implemented. In our approach, the image section that would be determined by the radiologist or clinician is compressed as lossless and other sections are compressed as lossy. Since using this method, entire image or some portion of it can be selected for lossless compression, higher compression ratios could be achieved comparing with the conventional method. Lossless image compression techniques already operate close to their theoretical limit. Moreover, the current research on lossy image compression has nearly reached diminishing returns in image quality/compression (vi)performance. Considering these facts, in the thesis the lossless and lossy compression techniques specified in the JPEG (Joint Photographic Experts Group) standard were implemented. This group has been working under the auspices of three major international standards organisations - International Organisations for Standardisation (ISO), International Telegraph and Telephone Consultative Committee (CCITT) and International Electrotechnical Commission (IEC) for the purpose of developing a standard for image compression since 1986. The excellent implementations of all important lossy compression methods including block truncation coding, vector quantization, other transform coding schemes, subband coding, and several predictive coding schemes, were considered by JPEG as candidates for the standard. Discrete cosine transform (DCT) based approach provided best image quality for a given bit rate and JPEG selected the DCT based compression for lossless modes in January 1988 [2]. JPEG DCT based lossy compression has 3 modes of DCT based compression :. Sequential encoding : each image component is encoded in a single left-to-right, top-to-bottom scan,. Progressive encoding : the image is encoded in multiple scans for applications in which transmission time is long, and the viewer prefers to watch the image build up in multiple coarse-to-clear passes,. Hierarchical encoding : the image is encoded at multiple resolutions so that lower resolution versions may be accessed without first having to decompress the image at its full resolution. A particular restricted form of the sequential DCT based mode of operation, called the 'baseline system.', is a rich and sophisticated compression method and sufficient for many applications. The baseline sequential encoder/decoder must be available in all JPEG systems. It is used for the implementation of lossy compression in our method. After its selection of a DCT based method in 1988, JPEG discovered that a DCT based lossless mode was difficult to define. To meet its requirement for a lossless mode of operation, JPEG has chosen a simple predictive method which is wholly independent of the DCT processing described previously. Unlike lossy mode, selection of this method was not the result of the competitive evaluation. Nevertheless, the JPEG lossless method produces results that are surprisingly close to the state of the art lossless image compression systems [3]. Consequently, this lossless mode was selected for implementation in our approach. In this section the DCT based baseline sequential mode of operation will be described. Figure 1 and 2 show the main processing blocks of the (vii)baseline modes which was applied for compression of the 256 grayscale images. 8x8 blocks DCT Based Encoder {^H^^I^s Source Image Data Compressed Image Data ( Table `] CYi (^Specific. J ISpe Table Specific. Figure 1. DCT based encoder simplified diagram DCT Based Encoder Compressed Image Data ^^Deauantize`^-^ ( Table `l ( Table ISpecificJ ^Specific Reconstructed Image Data Figure 2. DCT based decoder simplified diagram At the input to the encoder, source image samples are grouped into 8x8 blocks. Then samples are shifted from unsigned integers with range [0,255] to signed integers with range [-128,127] and each block is transformed by the Forward DCT (FDCT) into a set of 64 values referred to as DCT coefficients. One of these values is referred to as the DC coefficient and other 63 as the AC coefficients. At the output from the decoder, the inverse DCT (I DCT) outputs 8x8 blocks to form the reconstructed image. The following equations are the mathematical definitions of the 8x8 FDCT and IDCT: FDCT : S(u,v):=^^JJs(x,y)co!((2x + l)ui[/16]cos[(2y + l)vit/16] 2 2 x=0y=0 IDCT : s(x,y):=y^^y^^S(u,v)cos[(2x + l)u7i/16]cos[(2y + l)v7i/16] v=0 - u=0 *. where C(u) = l/V2 foru=0 C(u) = 1 for u>0 C(v) = l/V2 forv=0 C(v) = 1 for v>0 s(x,y) 2-D sample value S(u,v) 2-D DCT coefficient (viii)The DCT was first applied to image compression in Ahmed, Natarjan, and Rao's pioneering work in January 1974. In that work they showed that this particular transform was very close to the KLH (Karhunen-Loeve-Hotelling) transform, a transform that produces uncorreleted coefficients. Decorreletion of the coefficients is very important for compression, because each coefficient can then be treated independently without loss of compression efficiency. Thus quantization of DCT coefficients allows us to reduce the accuracy. This can be very important in image compression, as its tends to make many coefficients zero, especially those for high spatial frequencies. Another important aspect of the DCT is the ability to quantize the DCT coefficients using visually-weighted quantization values. This quantization values can be set using criteria based on visibility of basis functions. Therefore, in the quantization stage of the DCT based encoder, each of the 64 coefficients is quantized using one of the 64 corresponding values from a quantization table. In our implementation the table recommended in the JPEG Specification was used. However different applications may require different quantization tables which customise picture quality for their particular image characteristics and display devices. After quantization, the DC coefficient and the 63 AC coefficients are prepared for entropy encoding. The previous quantized DC coefficient is used to predict the current quantized DC coefficient, and the difference is encoded. The 63 quantized AC coefficients undergo no such differential encoding, but are converted into a one-dimensional zig-zag sequence. The lower DCT coefficients tend to be lower indices in the zig-zag sequence. This zig-zag sequence is an important part of the symbols used in the statistical model. The quantized coefficients are then passed to an entropy encoding procedure which compress the data further. In our implementation the fixed Huffman encoding with the tables recommended in the JPEG Specification was used. Figure 2 shows the main procedures for the DCT based decoding process. Each step shown performs essentially the inverse of its corresponding main procedure within the encoder. The entropy decoder decodes the zigzag sequence of quantized DC coefficients. After dequantization the DCT coefficients are transformed to an 8x8 block of samples by the I DCT. In the JPEG lossless mode, a predictor combines the reconstructed values up to three neighbourhood samples to form a prediction of a sample. This prediction then subtracted from the actual value of the sample, and the difference is losslessly entropy-coded by either Huffman or arithmetic coding. In our method Huffman coding with both fixed and adaptive codes were implemented and the performance with adaptive codes gave 5-10% better compression than the fixed tables. Moreover the adaptive predictive gave some results that close to the state-of-the-art lossless compression methods. (ix)Chapter 1 is the introduction chapter of the thesis. Chapter 2 explains the advantages and disadvantages of the PACS. This chapter also gives the minimum configuration for a stand-alone PACS. Chapter 3 explains the basic parts of an image data compression system. Some common lossless and lossy compression methods are also explained. Finally the methods used for compression of the medical images are compared. Chapter 4 gives the theories of the Huffman entropy and run-length methods. Chapter 5 explains the JPEG lossless and lossy compression methods. At the end of the chapter one numerical example is given Chapter 6 explains the algorithm of the lossy-lossles compression program. Chapter 7 presents the results of the lossless methods, i.e. JPEG prediction, run-length, Huffman and Lempel-Ziv. However, the last method is not implemented in the thesis. Also the Mean Squared Error values which come from lossy compression are given in this chapter. Chapter 8 is the conclusion chapter. The results are summarised and the major modifications required for using the lossy-lossless program in a PACS environment are presented. (x) 82