Simply Segmentation Technique for Computed Tomography Images Kalina Serwata Institute of Mathematics Silesian University of Technology Kaszubska 23, 44-100 Gliwice, Poland Email: kalarcika@gmail.com Abstract—Computed tomography is one of the most accurate Not only artificial intelligence, but also mathematical fields studies of every fragment of the human body. Especially com- can be used such as statistics [5], [9], [14]. pared to the X-ray, tomography allows the detection of much In this paper, I propose a segmentation technique that can be smaller, and sometimes even any embryos of the disease that are invisible during other tests. In the case of a doctor, the analysis of used as detection of suspicious elements on images obtained the results from the tomography may be time-consuming due to from a computer tomograph. the number of photos, and for the computer, quite the opposite. The occurrence of such activity, i.e. detection and classification II. S EGMENTATION TECHNIQUE of diseases in photographs obtained from a CT scanner, requires Image segmentation is a process of dividing a picture into segmentation before classification. In this work, I suggest a simple parts defined as areas that are homogeneous in terms of certain combination of various filters that allow segmentation of these selected properties, i.e. they are consistent, i.e. of the same images. Numerous tests were carried out, which allowed for discussion on the advantages and disadvantages of this solution. color and brightness, with a similar texture, without a clear boundary and the criterion is sometimes difficult to determine. The areas are sets of pixels. Properties that are often chosen as I. I NTRODUCTION criteria for homogeneity of areas are: gray level, hue, texture. The image obtained as a result of segmentation is simplified Nowadays, going to the doctor is understood as setting in relation to the image subjected to segmentation – this image yourself in a queue and waiting for a short visit. The next step does not contain many detailed information appearing in the is to do the prescribed tests, although the queue dates again. In original image. A similar situation also occurs when detecting addition, the doctor indicating the test must make a decision edges in an image. not only about his selection, but also the costs associated There is no single segmentation method – only the goal is with it. An additional problem is the aforementioned queue, defined, there are many ways: because often the dates are so remote that from the embryo • they are competing with each other or complementing of the disease until the examination can grow quite quickly. universal and specialized methods, Additionally, making the test does not mean knowing the • two-dimensional and three-dimensional, diagnosis. Measurements are made, which in the next stage • automatic, semi-automatic, not all automatic methods are are analyzed and given back to the patient, who again has to accepted queue up to the doctor who will assess these measurements. • often multi-stage, hybrid methods, Making a test becomes a long-term process that can be • self-learning methods, very disadvantageous to the patient. To make it easier, au- • global and local methods, tomation of these tasks is being introduced. An important It is possible to distinguish two main groups of segmentation aspect is allowing machines to segment and classify found methods. Based on the similarities inside the areas – the result objects on the images obtained from various medical tests. is a set of pixels that do not differ from each other. Based on In this type of solutions, different types of algorithms and the boundaries between areas – the result is a set of edges techniques are used. Especially, artificial intelligence methods across which the pixels are very different. are a basic components of such a support decision system. Segmentation is the method of the simplest division of areas. An interesting approach is to use heuristics to locate embryos We can save the steps of this algorithm in a fairly consistent of various diseases on X-ray images [11]. These types of way. The image is treated as a whole should be a square, the methods can be very burdensome for computers, so there are number of pixels defining the height and width is a multiple of various possibilities for their parallelization [6], [7]. Another 2, if an image that does not meet this criterion has been loaded, well-known solution is artificial neural networks [2], [10], or an error should be returned. Next, the condition of uniformity mathematical models of neuronal activity in the human brain. is checked. The area that does not meet this criterion is divided into four sub-images. In the next step, 4 areas are considered. Copyright held by the author(s). If one of them does not meet the criterion of uniformity – it 44 is divided again into 4 equal subareas, etc. The algorithm is must be set out to handle such cases. The main formula that interrupted at the moment of obtaining a set of areas that meet is used the criterion of uniformity. Gx Here, I propose a technique based on the hierarchical use θ = tan−1 (6) of several filters. A whole process is presented in Fig. 1. Gy It takes place by means of the operation of a two- A. Sobel dimensional discrete plexus of the image matrix with a 3 × 3 Sobel Edge Detection Algorithm [4], [12] uses the derivate matrix characteristic for a given direction called the ker- approximation to find edges. This method returns edges at nel (kernel) of the transformation. These matrices are anti- those points where the gradient of the consider image is symmetrical in relation to the direction of the detected edge. maximum. The Sobel operator performs a 2D spatial gradient The set of 8 matrices allows to determine the direction from measurement on an image and so emphasizes regions of high 0◦ to 315◦ with a 45◦ step. Vertical edges are detected for the spatial frequency that correspond to edges. Each pixel from 0◦ direction, and horizontal edges for 90◦ . The convolution the environmental brings his own contribution – weigh while operation determines in the first case the partial derivative calculating. estimate with respect to the X axis and the second with These weights are saved in the form of a mask. Typical respect to the Y axis. The obtained partial derivative values mask sizes are 3 × 3, 5 × 5, or 7 × 7. Mask sizes are usually define the gradient vector for each point of the image. Another odd because the pixel in the center represents the pixel for simpler way to approach gradient approximation is the so- which the filter transformation operation is performed. Each called "compass method". In this method, the mask giving the pixel from the environmental brings his own contribution maximum value of the derivative determines the module and – weigh while calculating. These weights are saved in the gradient direction with a resolution of 45◦ . form of a mask. Typical mask sizes are 3 × 3, 5 × 5, or The next masks are obtained by rotating the masks given 7 × 7. Mask sizes are usually odd because the pixel in the by 180◦ . It is worth noting that it is enough to calculate the center represents the pixel for which the filter transformation tangles with the first four masks, because the others differ only operation is performed. by the sign Sj + 4 = −Sj . The operator consists of a pair of 3 × 3 convolution kernels   −1 0 +1 smooths the input image to a greater extent and so makes the S1 = −2 0 +2 operator less sensitive to noise and also generally produces −1 0 +1 considerably higher output values for similar edges. They are   significant local changes of intensity in an image and typically 0 +1 +2 occur on the boundary between two different regions in an S2 = −1 0 +1 image. The Sobel algorithm uses two masks filtering horizontal −2 −1 0 Sx and vertical Sy . The Sx component determines the gradient   value in the direction rows, while the Sy component in the +1 +2 +1 direction of the columns. The value of the edge response and S3 =  0 0 0 its the direction is determined in accordance with equations −1 −2 −1   q +2 +1 0 Gmag = (Sx )2 · (Sy )2 (1) S4 = +1 0 −1 0 −1 −2 Sy Gdir = arctan (2) The Sobel operator performs a derivation averaging operation Sx (with weights 1, 2, 1) from three lines parallel to the direction Normally a 3×3 Sobel mask is understood as gradient along of differentiation. The modified method has 6 stages: Convert x-axis and align y-axis by using following equations into Grayscale image, Blurring the image, Find Edges using ∂f (x, y) Sobel operator, Angle Of Gradient, Quantizing the angle, Gx = = f (x + 1, y) − f (x, y) (3) Hysterious Thresholding. ∂x ∂f (x, y) B. Otsu Gy = = f (x, y + 1) − f (x, y) (4) ∂y Otsu’s Thresholding Method [8] is based on a very simple idea – find the threshold that minimizes the weight within- Then the total magnitude or the gradient can be found by class variance. This turns out to be the same as maximizing this formula the between-class variance. Operates directly on the gray level G = Gx + Gy (5) histogram [e.g. 256 numbers, P (i)], so it’s fast (once the To find the edge direction is minor when the gradient in the x histogram is computes). and y direction are known. But it can still create errors when Otsu: Assumptions sum GX is equal to zero. So during implementation a restrain • Histogram (and the image) are bimodal, 45 Figure 1: Visualization of the hierarchical process of segmentation of computed tomography images. • No use of spatial coherence, nor any other notion of 2 object structure, σw (t) = q1 (t)σ12 (t) + q2 (t)σ22 (t) (10) • Assumes stationary statistics, but can be modified to be locally adaptive. (exercises). Where the class probabilities are estimated as • Assumes uniform illumination (implicitly), so the bi- t X modal brightness behavior arises from object appearance q1 (t) = P (i) (11) differences only. i=1 The Otsu method is an optimal prediction, in which the I X found threshold value is optimal in the sense of optimizing q2 (t) = P (i) (12) the given function. In this case, the function is the intra-class i=t+1 variance or inter-class variance. The selected thresholds divide And the class means are given by the image into two classes: the object class and the background class. A feature of the Otsu method is the statistical description t X iP (i) of both classes by two different probability functions, i.e. µ1 (t) = (13) i=1 q1 (t) the distribution of the object class and the distribution of the background class. An image with separated, independent I classes can be described by mean values and variances in X iP (i) µ2 (t) = (14) individual classes. i=t+1 q2 (t) The average values, respectively, of the object class and Finally, the individual class variances are background class are equal to t 2 P (i) X n−1 X σ12 (t) = [i − µ1 (t)] (15) µT = i · pi (7) i=1 q1 (t) i=0 I n−1 2 P (i) X X 2 σ22 (t) = [i − µ2 (t)] (16) σT2 = (i − µT ) · pi (8) q2 (t) i=t+1 i=0 The global variance can be equivalently written as the sum Otsu’s thresholding method involves iterating through all of intra-class variation σW and inter-class variance σB. The the possible threshold values and calculating a measure of global variance within one image is a constant, independent spread for the pixel levels each side of the threshold, i.e. the of the accepted threshold. The threshold influences the values pixels that either fall in foreground or background. The aim is intra- and inter-class variance, the sum of which gives a to find the threshold value where the sum of foreground and global variance. Minimizing intra-class variance is equivalent background spreads is at its minimum. to maximizing inter-class variance. C. Modified binarization As a criterion function, it is usually assumed that the interclass variance requires less computational effort Binarization is the process of converting color or monochrome images (in shades of gray) to a two-level (binary) 2 σB = pob pb (µob − µb ) 2 (9) image. Performing binarization on the image significantly reduces the amount of information in it. It is most often The maximum value of the inter-class variance corresponds implemented by thresholding, consisting in establishing a to the optimal separation of the two classes in the image. The threshold value below which obease’s pixels are classified threshold that makes this separation is the optimal one. The as object pixels, while extraneous pixels are classified as weighted within-class variance is background pixels. 46 Figure 2: Segmentation on an exemplary database. Depending on the image, the object pixel value is the the following condition minimum value, the maximum pixel value (for 8-bit images, ( respectively: 0 and 255). Binarization is widely used as ∆(Ξ) > α remove , (17) a preliminary stage of the process of document analysis, ∆(Ξ) ≤ α leave handwriting, digitalization of maps. The effect of binarization where α is the limit value – usually half the length of the grid, affects the final result of the complex analysis process. The so b k2 c. reduction of the amount of information carried out at the binarization stage reduces the complexity of the recognition III. E XPERIMENTS algorithms and reduces the time complexity of the entire In order to check the operation of the proposed method, document analysis process. The purpose of binarization is to an available database of medical images was used [3] 1 . In reduce unnecessary information and leave information relevant the case of segmentation, it is difficult to analyze the obtained for further processing. data. The best test is to assess the found areas, their quality and usefulness in further classification. Exemplary images Binarization is the simplest method of image segmentation subjected to segmentation are shown on Fig. 2 and 3. All areas – the division of the image into separate regions characterized were intuitively evaluated, and the results can be determined by the homogeneity of pixel values or other features taken into at 75% efficiency. To get a greater value, a classifier should consideration. The purpose of binarization is to significantly be designed that would evaluate these areas. reduce information in the image. The basic problem with binarization is to find the appropriate binarization threshold. IV. C ONCLUSIONS In most cases, an image histogram is created to find the right The described segmentation technique allows detection of threshold value, and then the binarization threshold is set. suspect areas on computed tomography images. It is the first step to model a decision support system for disease detection. Suppose we have an image after applying these filters and The next step is to use these areas to classify and identify binarization process. Binarization allows to remove more than the found areas. The proposed solution enables fast detection a dozen pixels, which are probably unnecessary in the analysis. using classical actions, so it is a kind of hierarchical process This type of simplification should be modified by removing that leaves many areas. By many, it is understood as much as other elements which are expected properties are not very possible to accidentally not remove the embryo of the disease. significant. Suppose that for each white color pixel, we will Unfortunately, this is a naive solution, because during the analyze the area given by the grid of size k × k, where the segmentation could be performed a certain classification of selected pixel is in the center of it. Let ∆(·) be a function that counts the number of white pixels in a given set of points Ξ. 1 The results here are in whole or part based upon data generated by the Then, the decision to remove or leave the pixel is made by TCGA Research Network: http://cancergenome.nih.gov/ 47 the removed pixels which may indicate something worrying. However, this is an approach that has its advantages and disadvantages. In future research, I will consider creating segmentation and classification methods that should be much more effective, efficient and accurate for support decision systems. R EFERENCES [1] F. Bonanno, G. Capizzi, S. Coco, C. Napoli, A. Laudani, and G. L. Sciuto. Optimal thicknesses determination in a multilayer structure to improve the spp efficiency for photovoltaic devices by an hybrid fem—cascade neural network based approach. In Power Electronics, Electrical Drives, Automation and Motion (SPEEDAM), 2014 Interna- tional Symposium on, pages 355–362. IEEE, 2014. [2] G. Capizzi, G. L. Sciuto, M. Woźniak, and R. Damaševicius. A clustering based system for automated oil spill detection by satellite remote sensing. In International Conference on Artificial Intelligence and Soft Computing, pages 613–623. Springer, 2016. [3] K. Clark, B. Vendt, K. Smith, J. Freymann, J. Kirby, P. Koppel, S. Moore, S. Phillips, D. Maffitt, M. Pringle, et al. The cancer imaging archive (tcia): maintaining and operating a public information repository. Journal of digital imaging, 26(6):1045–1057, 2013. [4] N. Kanopoulos, N. Vasanthavada, and R. L. Baker. Design of an image edge detection filter using the sobel operator. IEEE Journal of solid-state circuits, 23(2):358–367, 1988. [5] K. Keerthana, B. Rajeshwari, S. Keerthi, and H. P. Menon. Classification of tooth type from dental x-ray image using projection profile analysis. In Signal Processing and Communication (ICSPC), 2017 International Conference on, pages 394–398. IEEE, 2017. [6] Z. Marszałek. Parallelization of modified merge sort algorithm. Sym- metry, 9(9):176, 2017. [7] D. Połap, K. K˛esik, M. Woźniak, and R. Damaševičius. Parallel technique for the metaheuristic algorithms using devoted local search and manipulating the solutions space. Applied Sciences, 8(2):293, 2018. [8] M. H. J. Vala and A. Baxi. A review on otsu image segmentation algorithm. International Journal of Advanced Research in Computer Engineering & Technology (IJARCET), 2(2):pp–387, 2013. [9] T. Wan, X. Shang, W. Yang, J. Chen, D. Li, and Z. Qin. Automated coronary artery tree segmentation in x-ray angiography using improved hessian based enhancement and statistical region merging. Computer methods and programs in biomedicine, 157:179–190, 2018. [10] M. Wozniak, C. Napoli, E. Tramontana, G. Capizzi, G. L. Sciuto, R. K. Nowicki, and J. T. Starczewski. A multiscale image compressor with rbfnn and discrete wavelet decomposition. pages 1–7, 2015. [11] M. Woźniak and D. Połap. Bio-inspired methods modeled for respiratory disease detection from medical images. Swarm and Evolutionary Computation, 2018. [12] M. Woźniak, D. Połap, M. Gabryel, R. K. Nowicki, C. Napoli, and E. Tramontana. Can we process 2d images using artificial bee colony? In International Conference on Artificial Intelligence and Soft Computing, pages 660–671. Springer, 2015. [13] M. Wózniak, D. Połap, R. K. Nowicki, C. Napoli, G. Pappalardo, and E. Tramontana. Novel approach toward medical signals classifier. In International Joint Conference on Neural Networks (IJCNN), pages 1– 7. IEEE, 2015. [14] O. Ziv, S. N. Goldberg, Y. Nissenbaum, J. Sosna, N. Weiss, and H. Azhari. Optical flow and image segmentation analysis for noninvasive precise mapping of microwave thermal ablation in x-ray ct scans-ex vivo study. International Journal of Hyperthermia, pages 1–12, 2017. 48 Figure 3: Segmentation on an exemplary database. 49