Download as pdf or txt
Download as pdf or txt
You are on page 1of 60

PROJECT REVIEW -3

CSE4019-IMAGE PROCESSING
Detection of Brain Tumor Using Digital Image Processing

FALL SEMESTER 2022-2023


B.Tech 3rd YEAR

SUBMITTED BY:
1. Manvi Aggarwal-20BCE0766
2. Jatin Fulwani-20BCE0273
3. Petamsetty Sai Harshita-20BCE0839

SUBMITTED TO:
Dr. Balaji GN
ABSTRACT
The human brain is the major controller of the humanoid system. The abnormal growth
and division of cells in the brain lead to a brain tumor, and the further growth of brain
tumors leads to brain cancer.Hence we aim to develop an image processing-based
efficient system for quick and accurate detection of Brain tumours based on the
information gained from the analysis of morphology and colour-based pixel
discrimination technique using convolution neural network classification.

KEYWORDS: Brain tumor, Magnetic resonance imaging, morphology, Convolution


Neural Network.

INTRODUCTION
Medical imaging is the technique and process of creating visual representations of the
interior of a body for clinical analysis and medical intervention, as well as visual
representation of the function of some organs or tissues. Medical imaging seeks to reveal
internal structures hidden by the skin and bones, as well as to diagnose and treat disease.
Medical imaging also establishes a database of normal anatomy and physiology to make
it possible to identify abnormalities. Medical imaging processing refers to handling
images by using a computer. This processing includes many types of techniques and
operations such as image gaining, storage, presentation, and communication. This process
pursues disorder identification and management. This process creates a data bank of the
regular structure and function of the organs to make it easy to recognize the anomalies.
This process includes both organic and radiological imaging which used electromagnetic
energies (X-rays and gamma), sonography, magnetic, scopes, and thermal and isotope
imaging. There are many other technologies used to record information about the location
and function of the body. Those techniques have many limitations compared to those
modulates which produce images. An image processing technique is the usage of a
computer to manipulate a digital image. This technique has many benefits such as
elasticity, adaptability, data storage, and communication. With the growth of different
image resizing techniques, the images can be kept efficiently.

A brain tumor is defined as an abnormal growth of cells within the brain or central spinal
canal. Some tumors can be cancerous thus they need to be detected and cured in time.
The exact cause of brain tumors is not clear and neither is the exact set of symptoms
defined, thus, people may be suffering from it without realizing the danger. Primary brain
tumors can be either malignant (contain cancer cells) or benign (do not contain cancer
cells). Brain tumors occurred when the cells were dividing and growing abnormally. It is
appearing to be a solid mass when it is diagnosed with diagnostic medical imaging
techniques. There are two types of brain tumors which is primary brain tumors and
metastatic brain tumor. A primary brain tumor is a condition when the tumor is formed in
the brain and tended to stay there while a metastatic brain tumor is a tumor that is formed
elsewhere in the body and spread through the brain. The symptom having of brain tumor
depends on the location, size and type of the tumor. It occurs when the tumor
compressing the surrounding cells and gives out pressure. Besides, it is also occurring
when the tumor blocks the fluid that flows throughout the brain. The common symptoms
are having headache, nausea and vomiting, and having problem in balancing and
walking. Brain tumor can be detected by the diagnostic imaging modalities such as CT
scan and MRI. Both of the modalities have advantages in detecting depending on the
location type and the purpose of examination needed. In this paper, we prefer to use the
MRI images because it is easy to examine and gives out accurate calcification and foreign
mass location. The MRI is the most regularly utilized strategy for imaging brain tumors
and the identification of its vicinity. The conventional technique for CT and MR image
classification and detection of tumor cells remains largely supported for the human
reviewing apart from different other methods. MR images are mainly used because there
are non-destructive and non-ionizing. MR imaging offers high-definition pictures that are
extensively utilized in discovering brain tumors. MRI has diverse schemes such as flair,
T1-weighted, T2-weighted images. There are many image processing techniques such as
pre-processing, segmentation of images, image improvements, feature extraction, and
classifiers.

Our study deals with automated brain tumor detection and classification. Normally the
anatomy of the brain is analyzed by MRI scans or CT scans. The aim of the paper is
tumor identification in brain MR images. The main reason for detection of brain tumors
is to provide aid to clinical diagnosis. The aim is to provide an algorithm that guarantees
the presence of a tumor by combining several procedures to provide a foolproof method
of tumor detection in MR brain images. The methods utilized are filtering, erosion,
dilation, threshold, and outlining of the tumor such as edge detection. The focus of this
project is MR brain images tumor extraction and its representation in simpler form such
that it is understandable by everyone. The objective of this work is to bring some useful
information in simpler form in front of the users, especially for the medical staff treating
the patient. The aim of this work is to define an algorithm that will result in the extracted
image of the tumor from the MR brain image. The resultant image will be able to provide
information like size, dimension and position of the tumor, and its boundary provides us
with information related to the tumor that can prove useful for various cases, which will
provide a better base for the staff to decide the curing procedure. Finally, we detect
whether the given MR brain image has a tumor or not using Convolution Neural
Network.

In the past, relevant works have been done in brain tumor detection using Artificial
Intelligence, Machine Learning, and image processing techniques. We need to obtain a
good dataset that is capable so that we can perform operations on images with more
details. So we use MRI images for our implementation.
We train the data set using Convolution Neural Networks. We use image pre-processing
techniques like Gaussian Blur after converting the color image to a grayscale image for
noise removal and use morphological operations to make the image ready for further
processing. As per segmentation, we use basic thresholding methods. We use TensorFlow
as the backend to classify images to Detected and No Tumor.

Dataset Details:
Brain MRI Images for Brain Tumor Detection
Dataset URL

Split the data


80% for training
15% testing
5% validation
//70-30
LITERATURE SURVEY

Brain Tumour Segmentation Using Convolutional Neural Networks in MRI


Images M. Mohammed Thaha, B. S. Murugan et.al ,July 2019
This paper proposed loss function optimization by BAT algorithm for automatic segmentation
method. it presents optimization-based MRIs image segmentation. Tiny kernels were used to
achieve a deep architecture. It had a positive effect on overfitting. Skull stripping and image
enhancement algorithms were used for pre-processing. results showed better performance
compared to existing methods. The drawbacks were , different selection schemes can be
adopted to improve the accuracy.
Quick Detection of Brain Tumour using a Combination of E-M and Level set
Method S. U. Aswathy, Glan Devadhas, KumarSS ,December 2015
This paper proposed an algorithm framework consisted of three stages. .Pre-processing used
for background separation of brain ,Abnormal regions in brain and detected using Expectation
Maximization algorithm.Model effictively made use of the local image intensities described by
gaussian distribution and the proposed method works well in noisy images having intensity in
homogeneity.The drawbacks were , the speed function fails to work on a noisy image or when
the boundary of the desired objects is not distinct.
Brain tumour detection using optimisation classification based on rough set
theory T. Rajesh, R. Suja Mani Malar, M. R. Geetha ,November 2019
The proposed system consisted of feature extraction and tumour classification. In feature
extraction, Rough set theory was used for classification task particle swam optimization neural
network was trained and tested in order to classify the MRI brain images into normal and
abnormal.MRI brain image classification using RST and PSONN was done and the features
were extracted from MRI brain images using RST and image classification was done using
PSONN .performance was compared with RSTFSVM and RST-FFNN and showed good
accuracy when comparetively. The drawbacks were ,The searching process becomes very slow
near to the global optimum.

Classification of Brain Cancer Detection by using Magnetic Resonance


Imaging Vishal Shirsat, Seema S Kawathekar,February 2014
The algorithm performs pre-processing operations on brain MRI images to remove noise from
MRI images with the help of median filter,logarithmic transform and then applys segmentation
for detecting tumour from brain MRI image by using thresholding also calculates the tumour
area. Proposed algorithm was developed with the help of mat lab and image processing
techniques and for result analysis receiver operating characteristic curve was used and this
algorithm achieved sensitivity of 80 % and specificity equal of 23 % and accuracy is 0.9902.
The drawbacks were , A larger database would have given more accuracy.

Hybrid Approaches for Brain Tumor Detection in MR Images Prabhjot Kaur


Chahal, Shreelekha Pandey, Shivani Goel,August 2020
The paper covered concepts of medical image processing, particularly on MR images, to
automate the core steps, i.e. extraction, segmentation, classification for proximate detection of
tumor. It was more inclined towards MR for its non-invasive imaging properties and also focused
on past works of many researchers under medical image processing and soft computing and
focused on segmentation as well as classification and their combinations.various brain tumor
detection techniques for MR images were reviewed along with the strengths and difficulties. The
current segmentation, classification and detection techniques was conferred emphasizing on the
pros and cons of the medical imaging approaches in each modality. It covered most relevant
strategies, methods, their working rules, preferences and constraints.The Drawaback are :
difficulties emerged in each imaging modality, data source, environment, pathological settings,
and searching experts .less cost effective.

Brain Tumor Detection Using Depth-First Search Tree Segmentation


.S.Janardhana Prabhu 30 May 2019.
This paper uses Depth-First Search(DFS) segmentation algorithm based on graph theory
The SVM classifier offers better.performance than ANFIS classifier by 0.5%. DFS-tree
segmentation delivers accuracy of 99.8%.drawbacks are:.Sometimes the segmentation and
classification yields error, which may fail to detect abnormalities or detect the normal tissues as
abnormal one by mistake. These errors are measured by true positive (TP), true negative (TN),
false positive (FP) and false negative (FN).
Enhanced Brain Tumor Detection on MRI images Prajakta Rathod ,08 June
2018
Novel filtration technique is applied EM (Expectation Maximization) algorithm Watershed
Technique.Watershed algorithm is applied through these results we get maximum accuracy to
detect brain Tumor.drawbacks are ,The most well-known disadvantage of filtration is that it
removes useful minerals that are present in the liquid. On the contrary, it doesn't remove all the
harmful particles present in the liquid.

Brain Tumour Classification for MR Imaging Using Support Vector Machine


Monika, Rajneesh Rani, Aman Kamboj
The paper proposes , Support Vector Machine Image segmentation based on intensity and
textual features than processing them with PCA and SVM.Efficiently detects the tumor region
with the actual type of tumor.The computation time is relatively low than any other techniques
Drawbacks , Does not detect brain stroke.

Efficient Algorithm for the Detection of a Brain Tumor from an MRI Images
Ammar al-saffar,July 2017
The paper proposes ,Computer aided system. Systematic application of morphological
reconstruction operations . Histogram thresholding.PCAnd SVM is used than we Compare our
proposed algorithm with fuzzy c-means, k-means, and KIFCM. We get the accuracy of 95.45 in
DS2 and computation time.. We can also extend our work for diagnoses and identify brain
stroke that happens due to blockage of blood vessels. Drwabacks were The results are
compared with Fuzzy C-Means and K-Means techniques and it shows that the proposed system
is far better than existing ones.

Brain Tumour Detection and Segmentation by Intensity Adjustment Sundar


Chinnasamy June 2019
The paper proposes ,K-means clustering, integrated with Fuzzy C-Means (KMFCM) and active
contour by level set for tumour segmentation.Fuzzy C-means algorithm is faster than K-means
algorithm in effective tumor detection. Among various imaging techniques MRI is an effective
image model for examination of tumor. Also, MRI scan is better than CT scan for tumor
diagnosis.drawaback were ,inhomogeneous intensity levels can be a problem.

BRAIN TISSUE SEGMENTATION IN MRI IMAGES USING GMM


The paper proposes ,Mean Filtering, Gaussian Mixture Model which uses Expectation
maximization.The proposed method performs well in removing the noise present in the brain
MRI image using median filter and in segmenting the white matter, gray matter and
cerebrospinal fluid using EM and GMM. The proposed method can be used for automating the
detection and diagnosis of diseases like tumors in brain MRI images. In the future segmentation
of brain tumors can be automated. Drawbacks were ,Provides only with efficient preprocessing
techniques, still have to pave the way.
IDENTIFIED CHALLENGES
From the above papers, we identify that the major challenge faced is the identification of
a tumor. The location, shape, and structure of tumors vary significantly from patient to
patient which makes the segmentation a very challenging task. To make it worse, the
shape and the intra-tumoral structure can also be different. In fact, there can be more than
one region of the tumor as well. This indeed reflects the complexity of automatic
segmentation. so the issue that's being focused on is to increase the accuracy in brain
tumor detection, irrespective of their anomalies in shape, size, or location.

METHODOLOGIES
MODULE DIVISON
This provides the architecture of the system. It consists of six steps where the execution
starts from taking an input image from the data set followed by image/data augmentation,
data pre-processing, image enhancement, Image segmentation, and brain tumor
classification using a Convolutional Neural Network. Finally, the output is observed after
all the above mentioned steps are completed. Each module is unique in its own way.
Every step has its importance. This architecture also includes testing and training data set.
The data set used has been downloaded from Kaggle which consists of nearly 253 images
which got increased to 2065 images after performing data augmentation and they were
used to test and train the system. The input images were pre-processed by using noise
filters like Median Filter. Other morphological operations like erosion, dilation, and edge
detection were also performed. Then the obtained image was segmented. Finally, the
image classification is done using the Convolutional
Neural Network to predict whether the tumor is present or not.
BLOCK DIAGRAM

MODULAR DESCRIPTION

Data Augmentation
Due to the limited size of the dataset, it was not possible to properly train a neural
network. The data imbalance problem was also successfully addressed through the use of
data augmentation.
The original dataset included 155 positive and 98 negative examples, for a total of 253
images.Now that the dataset has been augmented with additional information, it contains
a total of 2065 images: 1085 positive and 980 negative.

Note: these 2065 examples contain also the 253 original images.

Data Preprocessing:
Pre-processing is an essential and initial step in improving the quality of the brain MRI
Image. The critical steps in pre-processing are the reduction of impulsive noises and
image resizing. In the initial phase, we convert the brain MRI image into its
corresponding gray-scale image. The removal of unwanted noise is also done. This
improves the diagnosis and also increases the classification accuracy rate. The varied
dimensions of the images in the dataset are resized to the dimension of (240,
240,3)=(image width, image height, number of channels). Therefore, the input to the
neural network shall now be imaged with the same shape and size.There are more than
150 color-space conversion methods available in OpenCV. For color conversion, we use
the function cv2.cvtColor(input_image, flag) where the flag determines the type of
conversion. In our work, we convert the input image into a gray-scale image.
Normalization is then applied to bring pixel values into the range of 0-1 for display.

Image Segmentation:
Image segmentation is a technique of segregating the image into many parts. The basic
aim of this segregation is to make the images easy to analyze and interpret with
preserving the quality. This technique is also used to trace the objects’ borders within the
images. The image segmentation technique is used to create contours of the body for
clinical purposes.
Edge detection is a segmentation technique that uses border recognition of strictly linked
objects or regions. This technique identifies the discontinuity of the objects. This
technique is used mainly in image study and to recognize the parts of the image where a
huge variation in intensity arises.

Thresholding:
Thresholding is the simplest method of image segmentation. It is a non-linear operation
that converts a grey-scale image into a binary image where the two levels are assigned to
pixels that are below or above the specified threshold value. In Open CV, we use
cv2.threshold() function: cv2.threshold(src, thresh, maxval, type[dst]) This function
applies fixed-level thresholding to a single-channel array. The function is typically used
to get a bi-level (binary) image out of a grayscale image for removing noise, that is,
filtering out pixels with too small or too large values.
The function returns the computed threshold value and thresholded image.
1. src - input array (single-channel, 8-bit, or 32-bit floating point). This is the source
image, which should be a grayscale image.
2. thresh - threshold value, and it is used to classify the pixel values. 24
3. maxval - maximum value to use with the THRESH_BINARY and
THRESH_BINARY_INV thresholding types. It represents the value to be given if the
pixel value is more than (sometimes less than) the threshold value.
4. type - thresholding type:
cv2.THRESH_BINARY
cv2.THRESH_BINARY_INVY
Neural Network Architecture And Working :
Classification is the best approach for the identification of images like any kind of
medical imaging. All classification algorithms are based on the prediction of the image,
where one or more features and that each of these features belongs to one of several
classes. An automatic and reliable classification method Convolutional Neural Network
will be used since it is robust in structure which helps in identifying every minute detail.
A Convolutional Neural Network is a Deep Learning algorithm that can take in an input
image, assign importance to various aspects/objects in the image and be able to
differentiate one from the other. The preprocessing required in a ConvNet is much lower
as compared to other classification algorithms. While in primitive methods filters are
hand-engineered, with enough training, ConvNet has the ability to learn these
filters/characteristics.

For performing all this we need to Import the following packages:

Convolution2D- is used to make the convolutional network that deals with the images.
MaxPooling2D- layer is used to add the pooling layers.
Flatten- is the function that converts the pooled feature map to a single column that is
passed to the fully connected layer.
Dense- adds the fully connected layer to the neural network.

STEPS /ARCHITECTURE:
1. A Zero Padding layer with a pool size of (2, 2).
2. A convolutional layer with 32 filters, with a filter size of (7, 7) and a stride
equal to 1.
3. A batch normalization layer to normalize pixel values to speed up
computation.
4. A ReLU activation layer.
5. A Max Pooling layer with f=4 and s=4.
6. A Max Pooling layer with f=4 and s=4, same as before.
7. A flattened layer in order to flatten the 3-dimensional matrix into a
one-dimensional vector.
8. A Dense (output unit) fully connected layer with one neuron with a sigmoid
activation (since this is a binary classification task).
PSUEDOCODE

Begin

1. Data Augmentation
1.1 Declare a function to augment data and pass the string containing directory of images, and
the directory to save augmented images and number of samples.
1.2 use Image Data Generating functions with required parameters to to get generated data.
1.3 Use a for loop to traverse all filenames in directory, reshape and rename them.
1.4 Save each file till generated_Sample required reached.

2. Data Segmentation
2.1 Convert RGB images to grayscale images.
2.2 Apply Gaussian Blur.
2.3 Use Threshold to get Black and White images.
2.4 Erode the image upto 2 iterations.
2.5 Dilate the image upto 2 iterations.
2.6 Find contours in image.
2.7 Pick the largest contour.
2.8 Find the extreme top, left, right and bottommost points.
2.9 Create an image using coordinates in 2.8.
2.10. Plot the figure of old and new image for visualization.

3. Deep Learning Techniques


3.1 Split the augmented dataset to train, test and validate data.
3.2 Build the model using CNN.
3.3 Train the model.
3.4 Check for accuracy.
3.5 Print the results.

End
CODE:
Data Augmentation Code

Image Segmentation and Preprocessing Code


Plotting Sample Images
Splitting Data

Build Model

Train Model
Accuracy and F1 Score

Result Interpretation
Training The Model
The model was trained for 24 epochs and these are the loss & accuracy
plots:

The best validation accuracy was achieved on the 23rd iteration.


RESULTS AND DISCUSSION
The best model (the one with the best validation accuracy) detects brain tumor with:

88.7% accuracy on the test set


0.88 f1 score on the test set

These results are very good considering that the data is balanced.

Performance table of the best model:

Validation set Test Set

Accuracy 91% 89%

F1 Score 0.91 0.88

CONCLUSION AND FUTURE SCOPE

CONCLUSION
The paper lists out the major challenges involved in the detection of a brain tumor, the
chances of false detection due to human error are high which majorly occur due to the
presence of a higher number of artifacts and poor image quality. our project focuses on
avoiding this issue and helps in achieving higher accuracy in detecting brain tumors using
digital image processing methods. In the project, the first step was applying
preprocessing techniques such as RGB to grayscale conversion and enhancing them by
using a filtering algorithm to remove the noise from the image and performing various
other morphological operations. Then we went on to detect the edges in images using
edge detection methods and segmenting the images. After segmentation, it converts each
image into a set of features by using some feature extraction technique. Then we used
Convolution neural network to build the classification algorithm based on extracted
features. Finally, the performance and accuracy of the proposed system were evaluated
and we achieved an accuracy of 88.7 %.
FUTURE SCOPE
It is observed on extermination that the proposed approach needs a vast training set for
better accurate results; in the field of medical image processing, the gathering of medical
data is a tedious job, and, in few cases, the datasets might not be available. In all such
cases, the proposed algorithm must be robust enough for accurate recognition of tumor
regions from MR Images. The proposed approach can be further improvised through in
cooperating weakly trained algorithms that can identify the abnormalities with a
minimum training data and also self-learning algorithms would aid in enhancing the
accuracy of the algorithm and reduce the computational time

REFERENCES
[1] A. Sivaramakrishnan And Dr.M.Karnan “A Novel Based Approach For
Extraction Of Brain Tumor In MRI Images Using Soft Computing
Techniques,” International Journal Of Advanced Research In Computer And
Communication Engineering, Vol. 2, Issue 4, April 2013.

[2] Asra Aslam, Ekram Khan, M.M. Sufyan Beg, Improved Edge Detection
Algorithm for Brain Tumor Segmentation, Procedia Computer Science,
Volume 58,2015, Pp 430-437, ISSN 1877-0509.

[3] B.Sathya and R.Manavalan, Image Segmentation by Clustering Methods:


Performance Analysis, International Journal of Computer Applications (0975
– 8887) Volume 29– No.11, September 2011. [4] Devkota, B. & Alsadoon,
Abeer & Prasad, P.W.C. & Singh, A.K. & Elchouemi, A.. (2018). Image
Segmentation for Early Stage Brain Tumor Detection using Mathematical
Morphological Reconstruction. Procedia Computer Science. 125. 115- 123.
10.1016/j.procs.2017.12.017.

[5] K. Sudharani, T. C. Sarma and K. Satya Rasad, "Intelligent Brain Tumor


lesion classification and identification from MRI images using k-NN
technique," 2015 International Conference on Control, Instrumentation,
Communication and Computational Technologies (ICCICCT), Kumaracoil,
2015, pp. 777-780. DOI: 10.1109/ICCICCT.2015.7475384

[6] Kaur, Jaskirat & Agrawal, Sunil & Renu, Vig. (2012). A Comparative
Analysis of Thresholding and Edge Detection Segmentation Techniques.
International Journal of Computer Applications.vol. 39.pp. 29-34.
10.5120/4898-7432.
GITHUB REPOSITORY LINK:

https://github.com/Jatin887/Brain-Tumor
PLAG-IMAGE-REPORT
by Virtual Research Cooperative

Submission date: 16-Nov-2022 2:38AM (UTC+0530)


Submission ID: 1935126959
File name: ImageProcessing_final Doc.pdf (712.43K)
Word count: 2012
Character count: 10881
PROJECT REVIEW -3

CSE4019-IMAGE PROCESSING
Detection of Brain Tumor Using Digital Image Processing

FALL SEMESTER 2022-2023


B.Tech 3rd YEAR

SUBMITTED BY:
1. Manvi Aggarwal-20BCE0766
2. Jatin Fulwani-20BCE0273
3. Petamsetty Sai Harshita-20BCE0839

SUBMITTED TO:
Dr. Balaji GN
ABSTRACT
The human brain is the major controller of the humanoid system. The abnormal growth
and division of cells in the brain lead to a brain tumor, and the further growth of brain
tumors leads to brain cancer.Hence we aim to develop an image processing-based
efficient system for quick and accurate detection of Brain tumours based on the
information gained from the analysis of morphology and colour-based pixel
discrimination technique using convolution neural network classification.

KEYWORDS: Brain tumor, Magnetic resonance imaging, morphology, Convolution


Neural Network.

INTRODUCTION
Medical imaging is the technique and process of creating visual representations of the
interior of a body for clinical analysis and medical intervention, as well as visual
representation of the function of some organs or tissues. Medical imaging seeks to reveal
internal structures hidden by the skin and bones, as well as to diagnose and treat disease.
Medical imaging also establishes a database of normal anatomy and physiology to make
it possible to identify abnormalities. Medical imaging processing refers to handling
images by using a computer. This processing includes many types of techniques and
operations such as image gaining, storage, presentation, and communication. This process
pursues disorder identification and management. This process creates a data bank of the
regular structure and function of the organs to make it easy to recognize the anomalies.
This process includes both organic and radiological imaging which used electromagnetic
energies (X-rays and gamma), sonography, magnetic, scopes, and thermal and isotope
imaging. There are many other technologies used to record information about the location
and function of the body. Those techniques have many limitations compared to those
modulates which produce images. An image processing technique is the usage of a
computer to manipulate a digital image. This technique has many benefits such as
elasticity, adaptability, data storage, and communication. With the growth of different
image resizing techniques, the images can be kept efficiently.

A brain tumor is defined as an abnormal growth of cells within the brain or central spinal
canal. Some tumors can be cancerous thus they need to be detected and cured in time.
The exact cause of brain tumors is not clear and neither is the exact set of symptoms
defined, thus, people may be suffering from it without realizing the danger. Primary brain
tumors can be either malignant (contain cancer cells) or benign (do not contain cancer
cells). Brain tumors occurred when the cells were dividing and growing abnormally. It is
appearing to be a solid mass when it is diagnosed with diagnostic medical imaging
techniques. There are two types of brain tumors which is primary brain tumors and
metastatic brain tumor. A primary brain tumor is a condition when the tumor is formed in
the brain and tended to stay there while a metastatic brain tumor is a tumor that is formed
elsewhere in the body and spread through the brain. The symptom having of brain tumor
depends on the location, size and type of the tumor. It occurs when the tumor
compressing the surrounding cells and gives out pressure. Besides, it is also occurring
when the tumor blocks the fluid that flows throughout the brain. The common symptoms
are having headache, nausea and vomiting, and having problem in balancing and
walking. Brain tumor can be detected by the diagnostic imaging modalities such as CT
scan and MRI. Both of the modalities have advantages in detecting depending on the
location type and the purpose of examination needed. In this paper, we prefer to use the
MRI images because it is easy to examine and gives out accurate calcification and foreign
mass location. The MRI is the most regularly utilized strategy for imaging brain tumors
and the identification of its vicinity. The conventional technique for CT and MR image
classification and detection of tumor cells remains largely supported for the human
reviewing apart from different other methods. MR images are mainly used because there
are non-destructive and non-ionizing. MR imaging offers high-definition pictures that are
extensively utilized in discovering brain tumors. MRI has diverse schemes such as flair,
T1-weighted, T2-weighted images. There are many image processing techniques such as
pre-processing, segmentation of images, image improvements, feature extraction, and
classifiers.

Our study deals with automated brain tumor detection and classification. Normally the
anatomy of the brain is analyzed by MRI scans or CT scans. The aim of the paper is
tumor identification in brain MR images. The main reason for detection of brain tumors
is to provide aid to clinical diagnosis. The aim is to provide an algorithm that guarantees
the presence of a tumor by combining several procedures to provide a foolproof method
of tumor detection in MR brain images. The methods utilized are filtering, erosion,
dilation, threshold, and outlining of the tumor such as edge detection. The focus of this
project is MR brain images tumor extraction and its representation in simpler form such
that it is understandable by everyone. The objective of this work is to bring some useful
information in simpler form in front of the users, especially for the medical staff treating
the patient. The aim of this work is to define an algorithm that will result in the extracted
image of the tumor from the MR brain image. The resultant image will be able to provide
information like size, dimension and position of the tumor, and its boundary provides us
with information related to the tumor that can prove useful for various cases, which will
provide a better base for the staff to decide the curing procedure. Finally, we detect
whether the given MR brain image has a tumor or not using Convolution Neural
Network.

In the past, relevant works have been done in brain tumor detection using Artificial
Intelligence, Machine Learning, and image processing techniques. We need to obtain a
good dataset that is capable so that we can perform operations on images with more
details. So we use MRI images for our implementation.
We train the data set using Convolution Neural Networks. We use image pre-processing
techniques like Gaussian Blur after converting the color image to a grayscale image for
noise removal and use morphological operations to make the image ready for further
processing. As per segmentation, we use basic thresholding methods. We use TensorFlow
as the backend to classify images to Detected and No Tumor.

Dataset Details:
Brain MRI Images for Brain Tumor Detection
Dataset URL

Split the data


80% for training
15% testing
5% validation
//70-30
LITERATURE SURVEY

Brain Tumour Segmentation Using Convolutional Neural Networks in MRI


Images M. Mohammed Thaha, B. S. Murugan et.al ,July 2019
This paper proposed loss function optimization by BAT algorithm for automatic segmentation
method. it presents optimization-based MRIs image segmentation. Tiny kernels were used to
achieve a deep architecture. It had a positive effect on overfitting. Skull stripping and image
enhancement algorithms were used for pre-processing. results showed better performance
compared to existing methods. The drawbacks were , different selection schemes can be
adopted to improve the accuracy.

Quick Detection of Brain Tumour using a Combination of E-M and Level set
Method S. U. Aswathy, Glan Devadhas, KumarSS ,December 2015
This paper proposed an algorithm framework consisted of three stages. .Pre-processing used
for background separation of brain ,Abnormal regions in brain and detected using Expectation
Maximization algorithm.Model effictively made use of the local image intensities described by
gaussian distribution and the proposed method works well in noisy images having intensity in
homogeneity.The drawbacks were , the speed function fails to work on a noisy image or when
the boundary of the desired objects is not distinct.
Brain tumour detection using optimisation classification based on rough set
theory T. Rajesh, R. Suja Mani Malar, M. R. Geetha ,November 2019
The proposed system consisted of feature extraction and tumour classification. In feature
extraction, Rough set theory was used for classification task particle swam optimization neural
network was trained and tested in order to classify the MRI brain images into normal and
abnormal.MRI brain image classification using RST and PSONN was done and the features
were extracted from MRI brain images using RST and image classification was done using
PSONN .performance was compared with RSTFSVM and RST-FFNN and showed good
accuracy when comparetively. The drawbacks were ,The searching process becomes very slow
near to the global optimum.

Classification of Brain Cancer Detection by using Magnetic Resonance


Imaging Vishal Shirsat, Seema S Kawathekar,February 2014
The algorithm performs pre-processing operations on brain MRI images to remove noise from
MRI images with the help of median filter,logarithmic transform and then applys segmentation
for detecting tumour from brain MRI image by using thresholding also calculates the tumour
area. Proposed algorithm was developed with the help of mat lab and image processing
techniques and for result analysis receiver operating characteristic curve was used and this
algorithm achieved sensitivity of 80 % and specificity equal of 23 % and accuracy is 0.9902.
The drawbacks were , A larger database would have given more accuracy.

Hybrid Approaches for Brain Tumor Detection in MR Images Prabhjot Kaur


Chahal, Shreelekha Pandey, Shivani Goel,August 2020
The paper covered concepts of medical image processing, particularly on MR images, to
automate the core steps, i.e. extraction, segmentation, classification for proximate detection of
tumor. It was more inclined towards MR for its non-invasive imaging properties and also focused
on past works of many researchers under medical image processing and soft computing and
focused on segmentation as well as classification and their combinations.various brain tumor
detection techniques for MR images were reviewed along with the strengths and difficulties. The
current segmentation, classification and detection techniques was conferred emphasizing on the
pros and cons of the medical imaging approaches in each modality. It covered most relevant
strategies, methods, their working rules, preferences and constraints.The Drawaback are :
difficulties emerged in each imaging modality, data source, environment, pathological settings,
and searching experts .less cost effective.

Brain Tumor Detection Using Depth-First Search Tree Segmentation


.S.Janardhana Prabhu 30 May 2019.
This paper uses Depth-First Search(DFS) segmentation algorithm based on graph theory
The SVM classifier offers better.performance than ANFIS classifier by 0.5%. DFS-tree
segmentation delivers accuracy of 99.8%.drawbacks are:.Sometimes the segmentation and
classification yields error, which may fail to detect abnormalities or detect the normal tissues as
abnormal one by mistake. These errors are measured by true positive (TP), true negative (TN),
false positive (FP) and false negative (FN).
Enhanced Brain Tumor Detection on MRI images Prajakta Rathod ,08 June
2018
Novel filtration technique is applied EM (Expectation Maximization) algorithm Watershed
Technique.Watershed algorithm is applied through these results we get maximum accuracy to
detect brain Tumor.drawbacks are ,The most well-known disadvantage of filtration is that it
removes useful minerals that are present in the liquid. On the contrary, it doesn't remove all the
harmful particles present in the liquid.

Brain Tumour Classification for MR Imaging Using Support Vector Machine


Monika, Rajneesh Rani, Aman Kamboj
The paper proposes , Support Vector Machine Image segmentation based on intensity and
textual features than processing them with PCA and SVM.Efficiently detects the tumor region
with the actual type of tumor.The computation time is relatively low than any other techniques
Drawbacks , Does not detect brain stroke.

Efficient Algorithm for the Detection of a Brain Tumor from an MRI Images
Ammar al-saffar,July 2017
The paper proposes ,Computer aided system. Systematic application of morphological
reconstruction operations . Histogram thresholding.PCAnd SVM is used than we Compare our
proposed algorithm with fuzzy c-means, k-means, and KIFCM. We get the accuracy of 95.45 in
DS2 and computation time.. We can also extend our work for diagnoses and identify brain
stroke that happens due to blockage of blood vessels. Drwabacks were The results are
compared with Fuzzy C-Means and K-Means techniques and it shows that the proposed system
is far better than existing ones.

Brain Tumour Detection and Segmentation by Intensity Adjustment Sundar


Chinnasamy June 2019
The paper proposes ,K-means clustering, integrated with Fuzzy C-Means (KMFCM) and active
contour by level set for tumour segmentation.Fuzzy C-means algorithm is faster than K-means
algorithm in effective tumor detection. Among various imaging techniques MRI is an effective
image model for examination of tumor. Also, MRI scan is better than CT scan for tumor
diagnosis.drawaback were ,inhomogeneous intensity levels can be a problem.

BRAIN TISSUE SEGMENTATION IN MRI IMAGES USING GMM


The paper proposes ,Mean Filtering, Gaussian Mixture Model which uses Expectation
maximization.The proposed method performs well in removing the noise present in the brain
MRI image using median filter and in segmenting the white matter, gray matter and
cerebrospinal fluid using EM and GMM. The proposed method can be used for automating the
detection and diagnosis of diseases like tumors in brain MRI images. In the future segmentation
of brain tumors can be automated. Drawbacks were ,Provides only with efficient preprocessing
techniques, still have to pave the way.
IDENTIFIED CHALLENGES
From the above papers, we identify that the major challenge faced is the identification of
a tumor. The location, shape, and structure of tumors vary significantly from patient to
patient which makes the segmentation a very challenging task. To make it worse, the
shape and the intra-tumoral structure can also be different. In fact, there can be more than
one region of the tumor as well. This indeed reflects the complexity of automatic
segmentation. so the issue that's being focused on is to increase the accuracy in brain
tumor detection, irrespective of their anomalies in shape, size, or location.

METHODOLOGIES
MODULE DIVISON
This provides the architecture of the system. It consists of six steps where the execution
starts from taking an input image from the data set followed by image/data augmentation,
data pre-processing, image enhancement, Image segmentation, and brain tumor
classification using a Convolutional Neural Network. Finally, the output is observed after
all the above-mentioned steps are completed. Each module is unique in its own way.
Every step has its importance. This architecture also includes testing and training data set.
The data set used has been downloaded from Kaggle which consists of nearly 253 images
which got increased to 2065 images after performing data augmentation and they were
used to test and train the system. The input images were pre-processed by using noise
filters like Median Filter. Other morphological operations like erosion, dilation, and edge
detection were also performed. Then the obtained image was segmented. Finally, the
image classification is done using the Convolutional
Neural Network to predict whether the tumor is present or not.
ARCHITECTURAL DIAGRAM

MODULAR DESCRIPTION

Data Augmentation
Due to the limited size of the dataset, it was not possible to properly train a neural
network. The data imbalance problem was also successfully addressed through the use of
data augmentation.
The original dataset included 155 positive and 98 negative examples, for a total of 253
images.Now that the dataset has been augmented with additional information, it contains
a total of 2065 images: 1085 positive and 980 negative.

Note: these 2065 examples contain also the 253 original images.

Data Preprocessing:
Pre-processing is an essential and initial step in improving the quality of the brain MRI
Image. The critical steps in pre-processing are the reduction of impulsive noises and
image resizing. In the initial phase, we convert the brain MRI image into its
corresponding gray-scale image. The removal of unwanted noise is also done. This
improves the diagnosis and also increases the classification accuracy rate. The varied
dimensions of the images in the dataset are resized to the dimension of (240,
240,3)=(image width, image height, number of channels). Therefore, the input to the
neural network shall now be imaged with the same shape and size.There are more than
150 color-space conversion methods available in OpenCV. For color conversion, we use
the function cv2.cvtColor(input_image, flag) where the flag determines the type of
conversion. In our work, we convert the input image into a gray-scale image.
Normalization is then applied to bring pixel values into the range of 0-1 for display.

Image Segmentation:
Image segmentation is a technique of segregating the image into many parts. The basic
aim of this segregation is to make the images easy to analyze and interpret with
preserving the quality. This technique is also used to trace the objects’ borders within the
images. The image segmentation technique is used to create contours of the body for
clinical purposes.
Edge detection is a segmentation technique that uses border recognition of strictly linked
objects or regions. This technique identifies the discontinuity of the objects. This
technique is used mainly in image study and to recognize the parts of the image where a
huge variation in intensity arises.

Thresholding:
Thresholding is the simplest method of image segmentation. It is a non-linear operation
that converts a grey-scale image into a binary image where the two levels are assigned to
pixels that are below or above the specified threshold value. In Open CV, we use
cv2.threshold() function: cv2.threshold(src, thresh, maxval, type[dst]) This function
applies fixed-level thresholding to a single-channel array. The function is typically used
to get a bi-level (binary) image out of a grayscale image for removing noise, that is,
filtering out pixels with too small or too large values.
The function returns the computed threshold value and thresholded image.
1. src - input array (single-channel, 8-bit, or 32-bit floating point). This is the source
image, which should be a grayscale image.
2. thresh - threshold value, and it is used to classify the pixel values. 24
3. maxval - maximum value to use with the THRESH_BINARY and
THRESH_BINARY_INV thresholding types. It represents the value to be given if the
pixel value is more than (sometimes less than) the threshold value.
4. type - thresholding type:
cv2.THRESH_BINARY
cv2.THRESH_BINARY_INVY
Neural Network Architecture And Working :
Classification is the best approach for the identification of images like any kind of
medical imaging. All classification algorithms are based on the prediction of the image,
where one or more features and that each of these features belongs to one of several
classes. An automatic and reliable classification method Convolutional Neural Network
will be used since it is robust in structure which helps in identifying every minute detail.
A Convolutional Neural Network is a Deep Learning algorithm that can take in an input
image, assign importance to various aspects/objects in the image and be able to
differentiate one from the other. The preprocessing required in a ConvNet is much lower
as compared to other classification algorithms. While in primitive methods filters are
hand-engineered, with enough training, ConvNet has the ability to learn these
filters/characteristics.

For performing all this we need to Import the following packages:

Convolution2D- is used to make the convolutional network that deals with the images.
MaxPooling2D- layer is used to add the pooling layers.
Flatten- is the function that converts the pooled feature map to a single column that is
passed to the fully connected layer.
Dense- adds the fully connected layer to the neural network.

STEPS /ARCHITECTURE:
1. A Zero Padding layer with a pool size of (2, 2).
2. A convolutional layer with 32 filters, with a filter size of (7, 7) and a stride
equal to 1.
3. A batch normalization layer to normalize pixel values to speed up
computation.
4. A ReLU activation layer.
5. A Max Pooling layer with f=4 and s=4.
6. A Max Pooling layer with f=4 and s=4, same as before.
7. A flattened layer in order to flatten the 3-dimensional matrix into a
one-dimensional vector.
8. A Dense (output unit) fully connected layer with one neuron with a sigmoid
activation (since this is a binary classification task).
PSUEDOCODE

Begin

1. Data Augmentation
1.1 Declare a function to augment data and pass the string containing directory of images, and
the directory to save augmented images and number of samples.
1.2 use Image Data Generating functions with required parameters to to get generated data.
1.3 Use a for loop to traverse all filenames in directory, reshape and rename them.
1.4 Save each file till generated_Sample required reached.

2. Data Segmentation
2.1 Convert RGB images to grayscale images.
2.2 Apply Gaussian Blur.
2.3 Use Threshold to get Black and White images.
2.4 Erode the image upto 2 iterations.
2.5 Dilate the image upto 2 iterations.
2.6 Find contours in image.
2.7 Pick the largest contour.
2.8 Find the extreme top, left, right and bottommost points.
2.9 Create an image using coordinates in 2.8.
2.10. Plot the figure of old and new image for visualization.

3. Deep Learning Techniques


3.1 Split the augmented dataset to train, test and validate data.
3.2 Build the model using CNN.
3.3 Train the model.
3.4 Check for accuracy.
3.5 Print the results.

End
CODE:
Data Augmentation Code

Image Segmentation and Preprocessing Code


Plotting Sample Images
Splitting Data

Build Model

Train Model
Accuracy and F1 Score

Result Interpretation
ScreenShot Of The Application
Training The Model
The model was trained for 24 epochs and these are the loss & accuracy
plots:

The best validation accuracy was achieved on the 23rd iteration.


RESULTS AND DISCUSSION
The best model (the one with the best validation accuracy) detects brain tumor with:

88.7% accuracy on the test set


0.88 f1 score on the test set

These results are very good considering that the data is balanced.

Performance table of the best model:

Validation set Test Set

Accuracy 91% 89%

F1 Score 0.91 0.88

CONCLUSION AND FUTURE SCOPE

CONCLUSION
The paper lists out the major challenges involved in the detection of a brain tumor, the
chances of false detection due to human error are high which majorly occur due to the
presence of a higher number of artifacts and poor image quality. our project focuses on
avoiding this issue and helps in achieving higher accuracy in detecting brain tumors using
digital image processing methods. In the project, the first step was applying
preprocessing techniques such as RGB to grayscale conversion and enhancing them by
using a filtering algorithm to remove the noise from the image and performing various
other morphological operations. Then we went on to detect the edges in images using
edge detection methods and segmenting the images. After segmentation, it converts each
image into a set of features by using some feature extraction technique. Then we used
Convolution neural network to build the classification algorithm based on extracted
features. Finally, the performance and accuracy of the proposed system were evaluated
and we achieved an accuracy of 88.7 %.
FUTURE SCOPE
It is observed on extermination that the proposed approach needs a vast training set for
better accurate results; in the field of medical image processing, the gathering of medical
data is a tedious job, and, in few cases, the datasets might not be available. In all such
cases, the proposed algorithm must be robust enough for accurate recognition of tumor
regions from MR Images. The proposed approach can be further improvised through in
cooperating weakly trained algorithms that can identify the abnormalities with a
minimum training data and also self-learning algorithms would aid in enhancing the
accuracy of the algorithm and reduce the computational time.

SOURCE CODE LINK

https://github.com/Jatin887/Brain-Tumor

REFERENCES
[1] A. Sivaramakrishnan And Dr.M.Karnan “A Novel Based Approach For
Extraction Of Brain Tumor In MRI Images Using Soft Computing
Techniques,” International Journal Of Advanced Research In Computer And
Communication Engineering, Vol. 2, Issue 4, April 2013.

[2] Asra Aslam, Ekram Khan, M.M. Sufyan Beg, Improved Edge Detection
Algorithm for Brain Tumor Segmentation, Procedia Computer Science,
Volume 58,2015, Pp 430-437, ISSN 1877-0509.

[3] B.Sathya and R.Manavalan, Image Segmentation by Clustering Methods:


Performance Analysis, International Journal of Computer Applications (0975
– 8887) Volume 29– No.11, September 2011. [4] Devkota, B. & Alsadoon,
Abeer & Prasad, P.W.C. & Singh, A.K. & Elchouemi, A.. (2018). Image
Segmentation for Early Stage Brain Tumor Detection using Mathematical
Morphological Reconstruction. Procedia Computer Science. 125. 115- 123.
10.1016/j.procs.2017.12.017.
[5] K. Sudharani, T. C. Sarma and K. Satya Rasad, "Intelligent Brain Tumor
lesion classification and identification from MRI images using k-NN
technique," 2015 International Conference on Control, Instrumentation,
Communication and Computational Technologies (ICCICCT), Kumaracoil,
2015, pp. 777-780. DOI: 10.1109/ICCICCT.2015.7475384

[6] Kaur, Jaskirat & Agrawal, Sunil & Renu, Vig. (2012). A Comparative
Analysis of Thresholding and Edge Detection Segmentation Techniques.
International Journal of Computer Applications.vol. 39.pp. 29-34.
10.5120/4898-7432.
Detection of Brain Tumor Using
Digital Image Processing
J COMPONENT PROJECT REVIEW
CSE4019-IMAGE PROCESSING
Detection of Brain Tumor Using Digital Image
Processing
FALL SEMESTER 2022-2023
B.Tech 3rd YEAR

SUBMITTED BY:
1. Manvi Aggarwal-20BCE0766
2. Jatin Fulwani-20BCE0273
3. Petamsetty Sai Harshita-20BCE0839
SUBMITTED TO:
Prof. Balaji
ABSTRACT
We have done thorough work on the topic ‘Using Image processing methods
to detect ‘Brain tumor’. It is responsible for nearly one million deaths each
year Therefore the accurate detection of brain tumors in the blood is an
important aspect of the medical field. We have done a thorough study of all
the 11 research papers and compared them based on their methods, matrix,
etc. We identified that the main challenge was accuracy. So we aim to
develop an image processing-based efficient system for quick and accurate
detection of Brain tumour based on the information gained from the analysis
of morphology and colour-based pixel discrimination technique.
INTRODUCTION
In the past relevant works have been done in brain tumor detection using
Artificial Intelligence, Machine Learning, and image processing techniques.
We need to obtain a good dataset that is capable, so that we can perform
operations on images with more details. So we use MRI images for our
implementation.
We train the data-set using Convolution Neural Networks. We use the image
pre-processing techniques like Gaussian Blur after converting the color image
to a grayscale image for noise removal and use morphological operations to
make the image ready for further processing. As per segmentation we use
basic thresholding methods. We use tensorflow as backend to classify images
to Detected and No Tumor.
Dataset Details:
Brain MRI Images for Brain Tumor
Detection
Dataset URL
The dataset contains 2 folders: yes
and no which contains 253 Brain MRI
Images. The folder yes contains 155
Brain MRI Images that are tumorous
and
the folder no contains 98 Brain MRI
Images that are non-tumorous.
Split the data
70% for training
15% testing
15% validation
METHODOLOGIES
1. Data Augmentation
Due to the limited size of the dataset, it was not possible to properly
train a neural network. The data imbalance problem was also
successfully addressed through the use of data augmentation.
The notebook titled "Data Augmentation" provides additional details.
The original dataset included 155 positive and 98 negative examples,
for a total of 253 images.
Now that the dataset has been augmented with additional information,
it contains a total of 2065 images: 1085 positive and 980 negative.
Note: these 2065 examples contain also the 253 original images.
They are found in a folder named 'augmented data'.
2. Data Preprocessing
Various levels of preprocessing were applied to each image:
1. Removing everything from the picture except the brain (which is
the most important part of the image).
2. Due to the varied dimensions of the images in the training set, the
image should be resized to have the dimensions (240,
240,3)=(image width, image height, number of channels).
Therefore, the input to the neural network shall now be images
with the same shape.
3. Normalization is then applied to bring pixel values into the range
of 0-1 for display.
3. Neural Network Architecture
Understanding the architecture
Each input image x having shape of (240, 240, 3) is fed into the neural
network and it goes through the following layers:
1. A Zero Padding layer with a pool size of (2, 2).
2. A convolutional layer with 32 filters, with a filter size of (7, 7)
and a stride equal to 1.
3. A batch normalization layer to normalize pixel values to speed up
computation.
4. A ReLU activation layer.
5. A Max Pooling layer with f=4 and s=4.
6. A Max Pooling layer with f=4 and s=4, same as before.
7. A flatten layer in order to flatten the 3-dimensional matrix into a
one-dimensional vector.
8. A Dense (output unit) fully connected layer with one neuron with
a sigmoid activation (since this is a binary classification task).
4. Training The Model
The model was trained for 24 epochs and these are the loss & accuracy
plots:
The best validation accuracy was achieved on the 23rd iteration
RESULTS AND DISCUSSION
The best model (the one with the best validation accuracy) detects
brain tumor with:
88.7% accuracy on the test set
0.88 f1 score on the test set
These results are very good considering that the data is balanced.
Performance table of the best model:
CONCLUSION
After doing a thorough study we have listed out the major challenges in the
detection of a brain tumor, the chances of false detection due to human error
are high which majorly occur due to the presence of a higher number of
artifacts and poor image quality. Our project focuses on avoiding this issue
and helps in achieving higher accuracy in detecting brain tumors using digital
image processing methods. In the project, the first step was applying data
augmentation and preprocessing techniques like dimensionality reduction ,
normalization conversion of images from RGB to grayscale and enhancing
them by using a filtering algorithm to remove the noise from the image and
performing various other morphological operations. Then we went on to
detecting the edges in images using edge detection methods and segmenting
the images. After segmentation, it converts each image into a set of features
by using some feature extraction technique. Then we used a Convolution
neural network to build the classification algorithm based on extracted
features. Finally, the performance and accuracy of the proposed system was
evaluated and we achieved an accuracy of 88.7%
Thankyou!

You might also like