# INTRODUCTION pinal cord [1] resides inside the spine of a human body (Fig. 1). The Central Nervous System consists of the brain and the spinal cord [2]. The role of the central nervous system is to control the majority of the functions of both the body and the mind. The spinal cord has tubular bundle of long and thin nervous tissue. It also have other support cells which extends to the lumbar region of the vertebral column from the medulla. It's around 45 cm (18 inches) in men and approximately 43 cm (17 inches) long in women. Thirty one pairs of spinal nerves rise because of that [7]. A spinal cord tumor [3] is an abnormal mass of tissue within or on the surface of the spinal cord or spinal column (Fig. 2). Spinal cord tumors generally develop slowly and worsen over time. But the symptoms are visible at a very early stage because spinal cord controls the many functions of the body like movements and senses. In most cases, an affected spinal cord becomes bent or distorted, that causes loss of bodily functions. It is essential to detect spinal cord tumors at an early stage. An automated system for this purpose can reduce the time and effort required to diagnose the tumors and thus help the treatment process. Following are some facts [6] about spinal cord tumors around the world: -0.74 of the population in 100,000 are affected per year by spinal cord tumors. -This rate becomes 1.80 for the 75-84 age group. -Only 64% among these people survives for ten years if they are able to detect spinal cord tumors at a primary stage. # Fig. 2: Spinal cord tumor The spinal cord tumors can be either cancerous or non-cancerous. Another classification can be as follows: -Extradural -outside the dura mater lining (most common) -Intradural -part of the dura -Intramedullary -inside the spinal cord -Extramedullary-inside the dura, but outside the spinal cord Spinal tumors may occur in the areas like cervical, thoracic, lumbar, and sacrum. # b) Spinal Cord Tumor Diagnostics: MRI One of the most common diagnosis processes for Spinal Cord tumor is MRI. The full form of MRI [8] is -"Magnetic Resonance Imaging." It is considered to be a better diagnostics method than X-ray, ultrasound, or computerized tomography (CT) scan because it gives more information about the structures of the body. According to Wikipedia, there are many medical imaging techniques like MRI (Magnetic Resonance Imaging), NMRI (Nuclear Magnetic Resonance Imaging), or MRT (Magnetic Resonance Tomography) to visualize the structure and the physiological processes of the body. Using strong magnetic fields, radio waves, and field gradients, MRI scanners form the images of the body. Use of MRI images (Fig. 3) in the detection process of spinal tumors gives better results in terms of accuracy. That is why, in this research, MRI scans of the spinal cord are used to detect the anomaly. # Fig. 3: MRI image of the cervical spine c) Medical Image Processing Medical Image Processing is an extended version of image processing. By using medical images, it is possible to diagnosis the human organs automatically. The main challenge behind medical image processing is that the images need to have a very high level of accuracy along with sufficient details in each case of use, as it is directly related to human health. Medical image processing techniques are improving rapidly day by day, and many automated applications are being available in medical diagnostics. These are reducing the time required for finding diseases and batch processing of images and thus accelerating the treatment process along with the chances of survival. # II. # RELATED WORKS In the paper titled "Diagnosis of Disc Herniation Based on Classifiers and Features Generated from Spine MR Images" [10], Jaehan Koh, Vipin Chaudhary, and Gurmeet Dhillon discussed using perceptron, SVM, and Least-mean-square after segmentation and feature generation of lumbar vertebrae to identify disk herniation. They gained 97% accuracy. E. Lopez Arce-Vivas, Francisco Javier Cisneros, Rq Fuentes, Alejandro García-González, J. Gonzalez-Cruz, and Jose Maria Jiménez-Avila also worked on disk herniation using semiautomatic approach. But their accuracy rate was low. They published their word with the title-"Application of a semiautomatic classifier for Modic and disk hernia changes in magnetic resonance" [11]. It is not that much effective to use for clinical diagnosis. The outcome of the research shows that it has only 60-65% and 58-61% certainty for the MODIC classification and herniated discs respectively as compared with clinical experience. This inspired us to develop a semiautomatic classifier with effectiveness of diagnostic reliability as doctors. In their paper "Computer-Aided Diagnosis of Lumbar Disc Herniation" [12], Khaled Alawneh, Mays Aldwiekat, Mohammad Alsmirat and Mahmoud Al-Ayyoub proposed methods based on ROI Extraction, ROI Enhancement, Feature Extraction, Classification Algorithms or Classifiers to auto-diagnose lumbar disk herniation. Their method shows 100 % accuracy rate. B. Karl?k and S. Kul show 95% accuracy in the detection of disk herniation using Artificial Neural Net. They described their work in the paper "Diagnosis of Lumbar Disc Hernia Using Wavelet Transform and Neural Network" [13]. In the paper titled "Computer-Aided Detection of Brain Tumor in Magnetic Resonance Images" [14], Abhishek Raj, Alankrita, Akansha Srivastava and Vikrant Bhateja worked on the automated diagnosis of brain tumor using Wavelet Transform, Multi-scale Analysis, Morphological filtering, Wavelet-Based Sub-band Coding, Non-linear Enhancement Operator. None of these scholarly works try to identify spinal cord tumor from MRI images. They mostly deal with a brain tumor or herniation of protective disks in the spinal column. # III. # PROPOSED SYSTEM The proposed system has three major modules. The first module involves image retrieval of images and their normalization to make all images of the same width (Fig. 4). The second module enhances the images by blurring noises, detects edges for finding out the ROI (Region of Interest) and then applies segmentation to isolate the ROIs. The final module analyzes the ROIs and makes a final decision based on the novel Simple Average Deviation (SAD) algorithm. The first step in image processing is the retrieval of images. We have implemented the retrieval process for a single picture only. # Fig. 5: The image retrieval and normalization The retrieved images are converted to grayscale to simplify the processing with only two colors -black and white. It also makes it easier to generate binary images later on or analyze the color histogram. The picture also normalized so that all have a standard width of 294 pixels. To reshape the image and calculate the area based on the width only, we keep the height of the pictures relative to the original aspect ratio. This approach gives the optimum result in an application. # b) Image Enhancements In the enhancement stage, a blurring filter is applied to reduce noises in the image. We have used the Gaussian filter [17] for this purpose. To implement Gaussian blur (mainly used as a smoothing operator) needs to be careful. # Fig. 7: Image after enhancement As it can hide some crucial details of the image in the process of blurring noises from the image (Fig. 6 and Fig. 7). # c) Thresholding A thresholding process usually applies a fixed level threshold to the whole image. It takes a threshold pixel range through its parameters and creates a binary version of the image (black and white) depending on the threshold. # Fig. 8: An MRI image after thresholding In our system, we have used the Adaptive Threshold [19] technique, which is a better version of the original threshold. # d) ROI and Edge Detection In this stage Region of Interest (ROI), the spinal cord is determined. Another reason for indentifying ROI is that some parts of the spinal cord lie in line with the boundary edges. It makes the edge detection difficult. On the other hand, grabbing the ROI helps us to get a fixed height of the spinal cord, which is very useful in the segmentation of a spinal cord (Fig. 9). After determining the ROI, the Canny algorithm for edge detection is used to find the connected spinal cord. After detecting edges for the connected regions, segments were separated (Figure 10) by filtering them according to their area and height. # f) The SAD Algorithm The Simple Average Deviation (SAD) algorithm is the contribution of this paper. It's developed to find any irregular deviation of the curves in the spinal cord boundary. We have applied a prototype of the algorithm which can determine whether a spinal cord is normal or not. If a spinal cord doesn't exist in the list of contours found in the segmentation stage, then we can say that the spinal cord has tumors or another type of abnormalities. Our prototype can also detect tumors at a primary stage if they are present at the edge of the spinal cord itself. The technical specification of this algorithm is as follows- The spinal cord has two balanced curves on both sides. By those, we mean the curves that don't have small waves having wavelength less than a threshold. There will have small waves if the body of the spinal cord has tumors attached to it. We have implemented the algorithm by a simple function named simple Average Deviation (). This function needs some values captured at the segmentation stage. We have saved the coordinates of the edges from the respective region which we got by filtering them. Then we have passed the dynamic array of X coordinates, the minimum value among the Y indexes, and the maximum value among the Y indexes. The minimum and maximum Y index value is required to ensure top to bottom traversing of the coordinate values and also to analyze both sides of the spinal cord. In the core of the implementation, we divide the X coordinates into different sequential blocks of 10 values each. -Let, denote the first block of 10 coordinates = block1 -Let, the total number of blocks = n -Let, the first value among the X coordinates inside block1 = x1 As there are ten coordinates in each block, we can represent the sum of X coordinates inside block1 as x1+x2+????+x10. So, the equation will be, -sumBlock1 = x1 + x2 + ???? + x10, where sumBlock1 is the sum of all values inside block1. Now we can say, -avgBlock1 = sumBlock1 / 10, where avgBlock1 is the average of all x coordinates inside block1. Similarly, sumBlock2 and avgBlock2 are representing the sum and the average of all values inside block2 respectively. The respective equations can be represented as, -sumblock2 = x11 + x12 + ???? + x20 -avgBlock2 = sumBlock2 / 10 Once we have all the averages, we can easily find the differences among them. We can then consider these differences as the deviations and compare against a threshold. We figured out that it can find abnormalities if the threshold is ranging from -16 (minus 16) to 16.5. The reason behind setting a positive and a negative limit for the range is that the waves caused by tumors can deviate either on the left edge or the right edge of the spinal cord or even both. We also found out that a single instance of abnormally didn't point out to the existence of tumors in any of our test cases. It might simply indicate that the segment we are dealing with isn't smooth in all edge points. So, we can presume that there have to be at least two instances where we find average differences not following the thresholds as mentioned above. Let, the positive threshold limit = p t , the negative threshold = n t and the difference between the first block average and the second block average = diff1. Then, diff1 = avgBlock1 -avgBlock2 Similarly, diff2 = avgBlock2 -avgBlock3 and so on. According to the findings above, if diff1 < n t or diff1 > p t then we can say that the first abnormal deviation, abn1 resides in either block1 or block2 (the first two blocks) or both. If we find another abnormal deviation for the average values then we can assume that a tumor might be present in the current segment. Otherwise, we can assume that there are none in this segment. We have used the Y coordinate values in the actual implementation from the contours for distinguishing between the left edge and the right edge separately as that increases the \chance of proper detection of tumors. # Global Journal of Computer Science and Technology Volume XVIII Issue I Version I # EXPERIMENTATION METHODS OVERVIEW Here, we used a data set of 33 cervical MRI images. We collected those from different medical archives and via google search. The images are of different dimensions. One common aspect of those is that all of them consist of a part of the spinal cord, which is directly attached to the brain. Ten of those images are of spinal cords with no abnormality, which means that there is no tumor visible on them. The other 23 either have tumors or have another type of abnormalities like distortion, too many noises, a very few details and so on. Images were used for academic purpose only as permitted by the authors. Thus, they preserve the copyrights. We gather the images in a single folder from the dataset. Each of these images was opened one by one and tested using the system. Fig. 12 shows the results collected from these tests. Here in Fig. 12, the spreadsheet has some labels that we used for different purposes. We used the "data name" label for storing test image names. The "Original Condition" label for storing the information about those test images whether they have a spinal tumor in or not. The "Test Result" label for storing the feedback from our application prototype (whether the system found out tumor or not). The "Result type" label for storing a single color for each image-either green or red. 'Green' specifies an accurate identification and 'red' specifies a wrong indication by the application etc. the labels named "Type color" and "Type name" describe the result types. V. # RESULTS AND DISCUSSIONS Our system identifies a spinal cord as normal if and only if it finds a single instance of the spinal cord after applying the SAD algorithm. We used a dataset consisting of 33 cervical MRI images (10 without abnormality and 23 affected with tumors or distorted), and our system acquired up to 90.91% accuracy. # a) True Positives We have used the term "true positive" whenever we found the case where the original image has a spinal cord without abnormality and the application also states it as the same. We have found out eight true positives in total from the experiment. # b) True Negatives We have used the term "true negative" whenever we found the case where the original image has a spinal cord with some abnormalities or tumors associated with it, and the application also states that the spinal cord is not normal. By the end of the experiment, we have found out twenty two such cases. # c) False Positives We have used the term "false positive" whenever we found the case that the original image has an abnormal spinal cord, but our application says that the spinal cord is normal. We found one false positive in our experiment. # d) False Negatives We have used the term "false negatives" whenever we found the case that the original image represents the spinal cord as normal, but the application denotes that it has an abnormal or defective spinal cord. We found two false negatives in our experiment. # e) Result Analysis The "true positives" and the "true negatives" yield the total number of accurate detection, which is 30 in total and 90.91 in percentage. The "false positives" and the "false negatives" shows the total number of errors in the detection process, which is 3 in total and 9.09%. We can conclude that our system has 90.91% accuracy, which is a decent one as the research topic is unique. The following Figure (Fig. 13) shows the result statistics- # LIMITATIONS OF THE SYSTEM The proposed system has the following weaknesses: -Unable to detect tumors adjacent to the spinal canal wall. -Unable to detect if there is too much noise around the spinal cord. -The system was tested only on the sagittal view of the cervical spine region as generated by an MRI scan. -The accuracy level (90.91%) needs to be improved. The system can't identify any characteristics of the tumor other than its location; it can't distinguish between a malignant and a benign tumor. # VII. # CONCLUSION The main objective of this research was to develop an automated way of finding tumors in Spinal Cords by computer vision tools like OpenCV and using various image processing techniques. We have developed an algorithm (Simple Average Deviation or SAD) to find irregularities in the shape of the Spinal Cord. The algorithm shows 90.91% accuracy in detecting tumor/abnormalities. Currently, the algorithm only works on sagittal MRI images and also suffers several other limitations. We will work on those in the future. 1![Fig. 1: The spine of a human body](image-2.png "Fig. 1 :") 4![Fig. 4: System Processes for Spinal Tumor Detection System](image-3.png "Fig. 4 :") 96![Figure 9: Image after edge detectionThe Canny algorithm has less error rate and has a localization meaning that the distance between edge pixels are easily detected. It works best in our system as we compared it to other edge detection methods like Sobel[20].](image-4.png "Figure 9 :Fig. 6 :") 10![Fig. 10: Segmentation result of a spinal MRI image Then the whole connected region was calculated, and we preserved the X and Y coordinated of the spinal column for later use by the tumor detection algorithm called Simple Average Deviation (SAD) algorithm.](image-5.png "Fig. 10 :") 11![Fig. 11: The spinal tumor detection result](image-6.png "Fig. 11 :") 12![Fig. 12: The spreadsheet for collecting experimentation results](image-7.png "Fig. 12 :") 13![Fig. 13: The Statistics of the Result Derived from the Experimentation VI.](image-8.png "Fig. 13 :") © 2018 Global Journals © 2018 Global Journals 1 * Spinal cord Wikipedia 2015. Accessed Mar. 2019 * Central nervous system Wikipedia 2015. Accessed Mar. 2019 * Overview -Spinal cord tumor -Mayo Clinic Mayoclinic Org 2015. Accessed Mar. 2019 * OpenCV Wikipedia 2015. Accessed Mar. 2019 * Descriptive epidemiology of primary spinal cord tumors. PubMed -NCBI KASchellinger 2008. Accessed Mar. 2019 * Survival rates for selected adult brain and spinal cord tumors Cancer.org 2015. Accessed Mar. 2019 * Innerbody 2015. Accessed Mar. 2019 * Magnetic resonance imaging Wikipedia 2015. Accessed Mar. 2019 * What is OpenCV? OpenCV vs. MATLAB -An insight KThakkar 2012. Accessed Mar. 2019 * Diagnosis of disc herniation based on classifiers and features generated from spine MR images JKoh VChaudhary GDhillon Computer-Aided Diagnosis 2010. Accessed Mar. 2019 2010 online] 7624(6243O), pp.1-8. Available at * Application of a semiautomatic classifier for modic and disk hernia changes in magnetic resonance. Coluna/Columna EVivas FOliva RAguilar AGonzález JCruz JÁvila 2015. Accessed Mar. 2019 online] 14(1) * Computer-aided diagnosis of lumbar disc herniation KAlawneh MAl-Dwiekat MAlsmirat MAl-Ayyoub 6th International Conference on Information and Communication Systems (ICICS) 2015. 2015. Accessed Mar. 2019 online] Available at * Diagnosis of Lumbar Disc Hernia Using Wavelet Transform and Neural Network BKarl?k SKul 2009. Accessed Mar. 2019 * Computer Aided Detection of Brain Tumor in Magnetic Resonance Images ARaj Alankrita ASrivastava VBhateja 2011 IJET * Reading and Writing Images and Video -OpenCV 2.4.12.0 documentation Docs.opencv.org 2015. Accessed Mar. 2019 * Geometric Image Transformations -OpenCV 2 Docs.opencv.org 2015 4.12.0 documentation * Gaussian filter Wikipedia 2015. Accessed Mar. 2019 * Image Filtering -OpenCV 2.4.12.0 documentation Docs.opencv.org 2015. Accessed Mar. 2019 * Miscellaneous Image Transformations -OpenCV 2.4.12.0 documentation Docs.opencv.org 2015. Accessed Mar. 2019 * Image Filtering -OpenCV 2.4.12.0 documentation Docs.opencv.org 2015. Accessed Mar. 2019