LIVER CANCER DETECTION IN IMAGE PROCESSING USING OPENCV AND MATLAB
Cancer is one of the most increasing diseases among the living things. There are various types of cancer which affects the different parts of the body in living things. Liver cancer is the increasing disease due to the harmful activities of human as well as animals. The proposed work consists of detection of liver cancer using deep learning methods. Two domains have been compared to find out the best prediction rate of liver cancer.
One method is based on the extraction of the tumor using morphological operations and they can be classified using convolutional neural network using Matlab software. Another method is to detect the tumor part using morphological operations and classify them using convolutional neural network in opencv using python software. The accuracy of the tumor detection in python increases as compared with the Matlab execution. Thus, the accuracy of the prediction is best in python software and they would have the lesser execution time.
It is useful in the early stage of prediction of liver cancer. The accuracy level of prediction in python software will be 97% as compared with the Matlab execution.
KEYWORDS: Morphological operations, Opencv, MATLAB, Convolutional Neural Network
One of the most common tumor spreading among the human beings is a malignant tumor. This is the third wide spreading disease which causes deaths in the world. The most common type of cancer which cause chronic liver damage is about 20% spread in our population. It has many causes – viral infections (Hepatitis B and C), toxins, genetic, metabolic and autoimmune diseases . It is most difficult to identify liver cancer in the final stage. So, it is better to find out liver cancer at an early stage. By detecting cancer at an early stage, various treatments can be proceeding for curing the cancer at an early stage. The survival rate of the patient can be increased in the early detection of liver cancer. Prediction and diagnosis of liver cancer at an early stage is very important. Automatic detection of liver cancer consists of various stages which include Data pre-processing, image segmentation, feature extraction, selection, and final classification. The first step is pre-processing, which perform different quantization and sampling rate for digitizing the image signal . The cancer cells can identify from the CT-scan, MRI scan and Ultrasound scan as discussed in  which is cannot be identified with the naked eye of the doctors. The major stage in the liver cancer detection is the liver segmentation. Liver segmentation is carried out using the watershed algorithm in the proposed work. Liver segmentation is a difficult task in medical applications because inter-patient variability in size, shape and disease .The doctors has consider Magnetic Resonance Imaging (MRI) is an important tool to diagnose the liver cancer for decays. Day by day the survival rate of liver cancer patients can be increased gradually by an early diagnosis. In this paper, we present a computer aided kernel based support vector machine (SVM) algorithm for diagnosing liver cancer in an early stage by applying our
proposed method to the patients magnetic resonance (MR) images. We apply the histogram-based feature extraction method to extract feature information from each raw MR image acquired .Thus, the proposed method consists of ultrasound, CT scans and MRI images of liver cancer patients.The segmentation process is affected by the improper images and the complex background elimination. So, it is necessary to find out the good segmentation process in the best images. In the proposed work, the deep learning method is carried out in python software to show that the accuracy of the segmentation and classification is more in the python as compared to the implementation of the proposed work in the Matlab. The proposed work consists of the following sections. Section I includes Matlab implementation, Section II indicates the Python implementation and the Section III consists of a comparison of the Matlab implementation and the Python implementation. The conclusion had been made in the Section IV.
The Matlab implementation consists of following block diagram as shown in the figure 1.1
Figure 1.1 BLOCK DIAGRAM
Database images are collected from the cancer imaging Archive which consists of both normal as well as abnormal images. The database images consist of MRI images, CT-scan images as well as Ultrasound scan images. These images are the collection of both normal lung as well as abnormal lung. The proposed work consists of around 300 images which consists of both MRI,CT scan and Ultrasound images. The input images are shown in the figure 1.2
Figure1.2 (a) CT scan (b) MRI scan (c) Ultrasound images.
Pre-processing stage consists of various procedures which is classified as Color conversion and Filtering process. Color conversion process consists of conversion of rgb to gray scale images and the filtering stages consists of removal of unwanted noise within the input images using wiener and mean filters..The process is carried out as shown in the Figure1.3
Figure1.3 (a) CT scan (b) MRI scan
(c) Ultrasound images
Morphological operations consists of following categories such as close, erosion, dilation, mask and mark. These procedures are carried out to smoothen the dilated area and to remove the unwanted particles within the converted rgb image. These processes are the structural and morphological operations may separate the required lung region from the outer covered membrane in the filtered image. The output results of this process in MRI scan, CT scan and Ultra sound scan is shown in the following figures.
Figure1.4 (a1)(a2) CT scan (b1)(b2) MRI scan (c1)(c2) Ultrasound images
The segmentation process is based on watershed algorithm and sobel edge detection technique. The watershed algorithm is a mathematical morphology method founded on topology conception, and may just belong to the region-founded segmentation approaches. Its intuitive proposal originates from the topography, that is, photos are viewed as a topology remedy within the topography, the grayscale value of each pixel on images stands for the elevation at this point. For the watershed algorithm, there are numerous calculation approaches, an effective algorithm  headquartered on immersion simulation proposed by Vincent and soille is a milestone of the watershed algorithm study, for it improves an order of magnitude in calculation when put next with the long-established watershed algorithms, for this reason, the watershed algorithm has been applied largely.Thus the results of watershed segmentation is shown in the figure.
Figure 1.5(a) CT scan (b)MRI scan (c)Ultrasound images
The classification process is done under the method of Convolutional Neural Network.Convolutional neural network consists of many layers which would gives the certain rate of classification in the three categoried database images.This would help the patient and the practicesoners to identify the early stage of liver cancerand help in the diagnosis purposes.
Figure 1.6 (a) CT scan (b)MRI scan (c)Ultrasound images
The python implementation consists of same procedure as followed in the matlab. The output images of the python implementation is as follows. The Synthetic neural networks (ANN) are the average computational algorithms which are stimulated by the network of the organic neuron to unravel the obstacle of laptop imaginative and prescient and computing device studying. A convolutional neural network (CNN) is one kind of man-made neural network with more than three layers and the outputs of the neuron are applied iteratively to their own inputs. The algorithm inherently performs the classification and straight builds the determination-making function. In this unique work, we developed a CNN utilising the Keras that makes use of Tensorflow library and python the proposed python is as follows. programming language . The architecture of our proposed CNN is presented in determine 2. We have constructed our CNN mannequin empirically after performing more than a few experiments. Throughout every experiment, we now have manually constructed a CNN with the aid of enhancing the subsequent parameters just like the number of hidden layers, the learning steps for each and every hidden layer, the activation function and the total number of neurons needed to construct the layer. During each and every handbook configuration, we divided the dataset into training and testing set.Thus,the output of execution time of python may vary as compared with th e matlab and the process carried out using tensorflow which is used for deep learning technique. The deep finding out architecture has been applied to quite a lot of classification issues and has yielded satisfactory classification efficiency [8-12].
Figure 2.1(a) Original image(b)rgb image(c)Filtered image
ACCU SENS SPECIFI FPR PPV NPV
CT1 93.36848 100 99.35712 26.33125 73.66875 100
CT2 91.3963 100 99.38447 23.89629 76.10371 100
CT3 90.35506 100 99.34252 25.27013 74.72987 100
CT4 93.37441 100 99.36253 25.13465 74.86535 100
CT5 95.33381 100 99.32114 26.30273 73.69727 100
CT6 93.34468 100 99.33146 24.88874 75.11126 100
CT7 94.28268 100 99.269 27.70199 72.29801 100
CT8 90.29426 100 99.28084 27.43989 72.56011 100
CT9 89.38905 100 99.37741 24.63181 75.36819 100
CT10 91.28128 100 99.26796 28.30803 71.69197 100
CT11 87.28019 100 99.26686 28.37335 71.62665 100
CT12 88.29318 100 99.27968 27.39286 72.60714 100
CT13 86.26658 100 99.25222 27.63433 72.36567 100
CT14 90.25569 100 99.24097 27.79909 72.25494 100
CT15 99.257 100 99.24238 27.79909 72.20091 100
CT1 99.28919 100 99.27504 26.69522 73.30478 100
CT2 99.42793 100 99.41669 22.8866 77.1134 100
CT3 99.17108 100 99.15489 30.21232 69.78768 100
CT4 99.13311 100 99.1153 30.09321 69.90679 100
CT5 99.07229 100 99.05211 30.35376 69.64624 100
CT7 99.26252 100 99.24729 26.70654 73.29346 100
CT8 93.36848 100 99.35712 26.33125 73.66875 100
CT9 91.3963 100 99.38447 23.89629 76.10371 100
CT10 90.35506 100 99.34252 25.27013 74.72987 100
CT11 93.37441 100 99.36253 25.13465 74.86535 100
CT12 95.33381 100 99.32114 26.30273 73.69727 100
CT13 93.34468 100 99.33146 24.88874 75.11126 100
CT14 94.28268 100 99.269 27.70199 72.29801 100
CT15 90.29426 100 99.28084 27.43989 72.56011 100
(d)(e)(f) morphological operations(g)segmentation(h)sobel edge detector(i)classification
COMPARISON OF PYTHON AND MATLAB
The comparison chart of python and matlab consists of various performance measure. Different performance matrix like True Positive (TP) rate, False Positive (FP) rate, Precision, Recall, F measure and Receiver Operative Curve (ROC) area are presented in numeric value during training and testing phase. The performance measure of images implemented in matlab and python is as follows in Table 1.1 and 1.2
Thus the implementation shows that the python have the higher accuracy value and the execution time can be less in terms of detection and classification process. It would the patient and the doctors to identify the disease at an early stage and they can take necessary steps at an early stage.
 A. Nasser Esgiar, R.N.G. Naguib, B.S. Sharif, M.K. Bennett, and A. Murray, Microscopic Image Analysis for Quantitative Measurement and Feature Identification of Normal and Cancerous Colonic Mucosa, IEEE Transactions on Information Technology in Biomedicine, vol. 2, no. 3, pp.197-203, Sep. 1998.
 Metin N. Gurcan, Tony Pan, Hiro Shimada, and Joel Saltz, “Image Analysis for Neuroblastoma Classification: Segmentation of Cell Nuclei,” Proceedings of the 28th IEEE EMBS Annual International Conference, New York City, USA, Aug 30-Sept 3, 2006.
 Chia-Kai Chang and Sheng-Lung Huang, Nucleus and Cytoplasm Segmentation using Full-Field Optical Coherence Tomography, Microscopy Histopathology and Analytics. Hollywood, Florida United States, Apr. 3-6, 2018.
 Eiji Hase, Takeo Minamikawa, Takahiko Mizuno, Shuji Miyamoto, Ryuji Ichikawa, Yi-Da Hsieh, Kyuki Shibuya, Katsuya Sato, Yoshiaki Nakajima, Akifumi Asahara, Kaoru Minoshima, Yasuhiro Mizutani, Tetsuo Iwata, Hirotsugu Yamamoto, and Takeshi Yasui, Scan-less Confocal Phase Imaging based on Dualcomb Microscopy, OSA Publishing Optica, vol. 5, no. 5, pp. 634-643, May, 2018.
 Kelvin C. M. Lee, Maolin Wang, and Hayden L. Tsia, Ultra-largescale single-cell Quantitative Phase Imaging, Microscopy Hisopathology and Analytics, Hoolywood, Florida United States, Apr. 3-6, 2018.
 M. Y. Jabarulla and H. N. Lee, Computer aided diagnostic system for ultrasound liver images: A systematic review, Optik (Stuttg)., vol. 140, pp. 11141126, 2017.
 J. W. Goodman, Some fundamental properties of speckle, J. Opt. Soc. Am., vol. 66, no. 11, p. 1145, 1976.
 H. Yoshida, D. D. Casalino, B. Keserci, A. Coskun, O. Ozturk, and A. Savranlar, Waveletpacket-based texture analysis for differentiation between benign and malignant liver tumours in ultrasound images., Phys. Med. Biol., vol. 48, no. 22, pp. 373553, Nov. 2003.
Vincent L, Soille P. Watersheds in digital spaces: an efficient algorithm based on immersion simulations. IEEE Trans. Patt. Anal, Mach. Intell, 1991, pp. 583-598  SALEMBIER P. Morphological multiscale segmentation for image coding. Signal Processing, 1994, pp. 359-386
 Rafael C. Gonzalez. Digital Image Processing (second edition).Beijing: Electronics Industry Press, 2007, pp. 470-489
 Kwon Oh Kyu, Sim Dong Gyu, Park Rae Hong. Robust Hausdorf distance matching algorithms using pyramidal structure. Pattern Recognition, 2001, pp.2005-2013
 Otsu,N., A Threshold Selection Method from Gray-Level Histograms, IEEE Transactions on Systems, Man, and Cybernetics,Vol.9, No.1, 1979, pp.62-66.  Ge, Q., Xiao, L., Zhang, J. & Wei, Z.H. (2012). An improved region-based model with local statistical features for image segmentation. Pattern Recognition, 45(4), 1578-1590. 28.
 Du-Buf J.M, Kardan H, Spann M, Texture feature performance for image segmentation. Pattern Recognition, 1990; 23(3-4): 291-309.
. Sannino, G. & Pietro, G.D. (2018). A deep learning approach for ECG-based heartbeat classification for arrhythmia detection. Future Generation Computer Systems, 86, 446-455.
. Cao, C., Liu, F., Tan, H., Song, D., Shu, W., Li, W., Zhou, Y., Bo, X. & Xie, Z. (2018). Deep Learning and Its Applications in Biomedicine. Genomics Proteomics Bioinformatics, 16, 17 32. 31. Mathews, S.M., Kambhamettu, C. & Barner, K.E. (2018).