Sei sulla pagina 1di 57

ABSTRACT

Tumours are group of abnormal cells that form bumps growth specifically we
discuss about brain tumours. Early diagnosis of brain tumour plays an important
role in improving treatment and increases rate of survival. In this project, we use
MRI images to identify the tumour. Methods have already been developed to
identify a tumour using MRI images to reduce the time in an automated process.
In this project, we are going to use Machine learning techniques to identify the
tumours as they give accurate results than any other existing methods. Using MRI
and Machine learning methods we classify and identify tumour parts.

5
Table of Contents

1. INTRODUCTION 8-12

1.1 Project overview 9

1.2 Requirements Specification 9-12

1.2.1 Hardware Specification 9

1.2.2 Software Specification 9

1.2.3 Environment setup 10-12

1.2.3.1 Python 10

1.2.3.2 Libraries used 11-12

2. SYSTEM STUDY AND ANALYSIS 13-27

2.1 Existing system 13

2.2 Proposed system 13

2.3 Medical Images 14-27

2.3.1 X-rays 14

2.3.2 Positron emission tomography(PET) 15

2.3.3 Computed tomography(CT) 16-19

2.3.4 Magnetic Resonance Imaging(MRI) 20-22

2.3.5 MRI versus X-ray & CT& PET 23-24

2.3.6 Types of MRI imaging 25-27

2.3.6.1 T1 weighted images 25

6
2.3.6.2 T2 weighted image 26

2.3.6.3 FLAIR images 27

2.3.6.4 PD images 27

3. SYSTEM DESIGN 28-33

3.1 Literature review 28

3.2 System diagram 29-30

3.3 About machine learning techniques 31-33

3.3.1 Supervised learning 31

3.3.1.1 Classification 32

3.3.1.2 Regression 32

3.3.2 Unsupervised learning 32-33

4. CODE 34-51

4.1 Algorithms 34-36

4.2 Pseudo code 37-51

5. TESTING AND DEPLOYMENT 52-58

5.1 Testing 52

5.2 Outputs 53-58

6. CONCLUSION 59

7. FUTURE SCOPE 60

8. REFERENCES 61

7
1. INTRODUCTION

In recent times, the Information Technology and e-health care system in the
medical field helps clinical experts to provide better health care to the patient.
This study addresses the problems of segmentation of abnormal brain tissues and
normal tissues as Gray Matter(GM), White Matter(WM), and CerebroSpinal
Fluid (CSF) from Magnetic Resonance(MR) images using FCM segmentation
and linear regression method as classifier .

The tumour is basically an uncontrolled growth of cancerous cells in any part of


the body, whereas a brain tumour is an uncontrolled growth of cancerous cells in
the brain. A brain tumour can be benign or malignant. The benign tumour has a
uniformity in structure and does not contain active(cancer) cells, whereas
malignant brain tumours have a nonuniformity(heterogeneous)in structure and
contain active cells.

To detect infected tumour tissues from medical imaging modalities, segmentation


is employed. Segmentation is necessary and important step in image analysis.
Brain tumour segmentation involves the process of separating the tumour tissues
such as edema and dead cells from normal brain tissues and solid tumours, such
as WM,GM and CSF with the help pf MR images.

MRI is mostly used because of the non-ionizing radiation that is being used.
Another advantage with MRI is that the investigators can manipulate the amount
of contrast between different biological tissues by changing elements at the time
of image acquisition.

The MRI data consists of T1, T2 and Photon Density (PD) weighted features of
images. Photon MRI records signals arising predominantly from free water, i.e.,
water not bio-chemically bound in complex molecules, and also contains small
contribution of fat from protons. Photon Density (PD) is based on the number of

8
nuclei stimulated and the relaxation times, T1 and T2, which reflect the chemical
environment of the tissue stimulated, each determine in the different ways the
intensity at which different tissues will appear in an acquired image. T 1 is an
exponential time constant which represents the time taken for excited nuclei to
return to equilibrium after the RF (Radio Frequency) pulse has been turned off.
T2 is an exponential time constant describing the time it takes for the excited
nuclei to loose signal (mainly due to dephasing in the transverse plane). The time
between radio frequency pulses (TR) and the amount of time after the pulse at
which the signal is acquired (echo time or TE), determine the influence each of
these parameters (PD, T1 and T2) on the acquired image.

1.1Project overview

The segmentation method is initially carried out by fuzzy c-means clustering


algorithm since in medical images absolute classification is not possible because
of the volume effects where multiple tissues contribute to a pixel or because of
voxel causes intensity blurring across the boundaries. To overcome these
limitations, we have applied the FCM algorithm which is more appropriate.

Further the output of the FCM algorithm is then fed to the linear regression
method.

1.2. Requirements specification

1.2.1 Hardware Specification

Hard-disk : 1TB

9
RAM : 4 GB

Processor : intel CORE i5

1.2.2 Software Specification

Operating System : Windows 10.

Technology used : python

1.2.3 Environment setup

1.2.3.1 Python :
Python is a powerful high-level, object-oriented programming language created
by Guido van Rossum. It has simple easy-to-use syntax, making it the perfect
language for someone trying to learn computer programming for the first time.
Python is a general-purpose language. It has wide range of applications from Web
development (like: Django and Flask), scientific and mathematical computing
(Orange, SymPy, NumPy) to desktop graphical user Interfaces (Pygame,
Panda3D). The syntax of the language is clean and length of the code is relatively
short. Python is considered to be best language used for implementation of
machine learning. The reasons for this would be Ease of learning, Adequate
libraries and tools, Community support. Python has comparatively very less
syntax and the ease of writing a very large program in python is very high.
Libraries like Numpy, Pandas, etc. that are very much essential for doing machine
learning are available for python. Machine learning with python has a very high
community support in the internet so it makes easy to work with python and clear
the hurdles.

1.2.3.2 Libraries used:

NumPy:
NumPy is the fundamental package for scientific computing with Python. It

10
contains among other things like a powerful N-dimensional array object,
sophisticated (broadcasting) functions, tools for integrating C/C++ and Fortran
code, useful linear algebra, Fourier transform, and random number capabilities.
It has functions written in built for higher mathematical calculations required for
the execution of machine learning algorithms.

Installation: pip install numpy

Scikit-image:
Scikit-image is an open source image processing library for
the Python programming language. It includes algorithms for segmentation,
geometric transformations, color space manipulation, analysis, filtering,
morphology, feature detection, and more. It is designed to interoperate with the
Python numerical and scientific libraries NumPy and Scipy.

Installation: pip install scikit-image

Scikit-learn:
Scikit-learn is a free software machine learning library for python programming
language, it features various classification, regression and clustering algorithm

Installation: pip install scikit-learn

OpenCV:
OpenCV (Open Source Computer Vision Library) is released under a BSD
license and hence it’s free for both academic and commercial use. It has C++, C,
Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and
Android. OpenCV was designed for computational efficiency and with a strong
focus on real-time applications. Written in optimized C/C++, the library can take
advantage of multi-core processing. Enabled with OpenCL, it can take advantage
of the hardware acceleration of the underlying heterogeneous compute platform.

11
Installation :Pip install opencv-contrib-python

Matplotlib:

Matplotlib is a Python 2D plotting library which produces publication quality


figures in a variety of hardcopy formats and interactive environments across
platforms. Matplotlib can be used in Python scripts. Matplotlib tries to make easy
things easy and hard things possible. You can generate plots, histograms, power
spectra, bar charts, errorcharts, scatterplots, etc., with just a few lines of code.

Installation: pip install matplotlib

Pandas:
Pandas is an open source, BSD-licensed library providing high-performance,
easy-to-use data structures and data analysis tools for the Python programming
language. This helps in handling large amounts of data with help of data structures
like Series, Data Frames etc. It has inbuilt methods for reading and writing data
in different formats like CSV, xlsx, HTML etc. Different machine learning
algorithms have the compatibility for pandas data structures

Installation: pip install pandas

12
2.SYSTEM STUDY AND ANALYSIS

2.1 Existing system

A tumor is said to be the growth in the abnormal tissue of the brain which causes
damage to the functioning cells. Brain tumor detection is very difficult as there
are many techniques available for it. Magnetic Resonance Imaging (MRI) is the
active resource for detecting brain tumor. It is necessary to use technique which
can give the accurate location and size of the tumor. It has been extended and
modified in many ways in order to solve the image segmentation problem.

However, almost all the extensions require the adjustment of at least one
parameter that depends on the image itself. Image Preprocessing techniques are
applied to improve the quality of image. MR Image segmentation is based on set
of measurable features which are extracted. In this process of brain tumor
detection, pixel intensity based features are extracted. Image Segmentation group
pixels into regions and hence defines the object regions. Segmentation uses the
features extracted from an image.

Although many segmentation algorithms are used like segmentation using


thresholding, kmeans algorithm. In this project we are going to overcome all the
disadvantages of the existing system.

2.2 Proposed System

In this project, MRI image segmentation is done using Fuzzy C-Means clustering
algorithm as it yields better results than any other technique. Then classification
is done using machine learning technique. In this we used linear regression
technique to classify the stage of the tumour.

13
Advantages:

1) Accurate results due to Fuzzy C-Means algorithm .


2) Image processing is fast.
3) Quick identification of tumor is possible .
4) More secure.
5) The proposed system is more reliable.

2.3 Medical Images

2.3.1 X-RAYS

X-rays (radiographs) are the most common and widely available diagnostic
imaging technique. Even if you also need more sophisticated tests, you will
probably get an X-ray first.

The part of your body being pictured is positioned between the X-ray machine
and photographic film. You have to hold still while the machine briefly sends
electromagnetic waves (radiation) through your body, exposing the film to reflect
your internal structure. The level of radiation exposure from X-rays is not
harmful, but your doctor will take special precautions if you are pregnant.

Bones, tumors and other dense matter appear white or light because they absorb
the radiation. Less dense soft tissues and breaks in bone let radiation pass through,
making these parts look darker on the X-ray film. Sometimes, to make certain
organs stand out in the picture, you are asked given barium sulfate or a dye.

X-rays may not show as much detail as an image produced using newer, more
powerful techniques.

14
2.3.2 POSITRON EMISSION TOMOGRAPHY(PET)

PET is a nuclear medical imaging technique that produces a three-dimensional


image or picture of functional processes in the body. The system detects pairs
of gamma rays emitted indirectly by a positron-emitting radionuclide (tracer),
which is introduced into the body on a biologically active molecule. Three-
dimensional images of tracer concentration within the body are then constructed
by computer analysis. In modern scanners, three dimensional imaging is often
accomplished with the aid of a CT X-ray scan performed on the patient during
the same session, in the same machine.

Operation

To conduct the scan, a short-lived radioactive tracer isotope is injected into the
living subject (usually into blood circulation). The tracer is chemically
incorporated into a biologically active molecule. There is a waiting period while
the active molecule becomes concentrated in tissues of interest; then the subject
is placed in the imaging scanner. The molecule most commonly used for this
purpose is fluorodeoxyglucose (FDG), a sugar, for which the waiting period is
typically an hour. During the scan a record of tissue concentration is made as the
tracer decays.

Figure 2.3.2Schema of a PET acquisition process

15
In the Figure 2.3.2, as the radioisotope undergoes positron emission decay (also
known as positive beta decay), it emits a positron, an antiparticle of
the electron with opposite charge. The emitted positron travels in tissue for a
short distance (typically less than 1 mm, but dependent on the isotope), during
which time it loses kinetic energy, until it decelerates to a point where it can
interact with an electron. The encounter annihilates both electron and positron,
producing a pair of annihilation (gamma) photons moving in approximately
opposite directions. These are detected when they reach a scintillator in the
scanning device, creating a burst of light which is detected
by photomultiplier tubes or silicon avalanche photodiodes (Si APD). The
technique depends on simultaneous or coincident detection of the pair of photons
moving in approximately opposite direction (it would be exactly opposite in
their center of mass frame, but the scanner has no way to know this, and so has a
built-in slight direction-error tolerance). Photons that do not arrive in temporal
"pairs" (i.e. within a timing-window of a few nanoseconds) are ignored.

2.3.3 COMPUTED TOMOGRAPHY (CT)

Computed Tomography (CT) is a powerful nondestructive evaluation (NDE)


technique for producing 2-D and 3-D cross-sectional images of an object from
flat X-ray images. Characteristics of the internal structure of an object such as
dimensions, shape, internal defects, and density are readily available from CT
images.

16
Figure 2.3.3(a) Schematic of a CT system.

In Figure 2.3.3(a),the test component is placed on a turntable stage that is between


a radiation source and an imaging system. The turntable and the imaging system
are connected to a computer so that x-ray images collected can be correlated to
the position of the test component. The imaging system produces a 2-dimensional
shadowgraph image of the specimen just like a film radiograph. Specialized
computer software makes it possible to produce cross-sectional images of the test
component as if it was being sliced.

X-ray computed tomography, also computed tomography (CT scan) or computed


axial tomography (CAT scan), is a medical imaging procedure that utilizes
computer-processed X-rays to produce tomographic images or 'slices' of specific
areas of the body. These cross-sectional images are used for diagnostic and
therapeutic purposes in various medical disciplines.Digital geometry
processing is used to generate a three-dimensional image of the inside of an
object from a large series of two-dimensional X-ray images taken around a
single axis of rotation.

17
Figure 2.3.3(b) Schematic representation of CT scanner

Figure 2.3.3(b),CT produces a volume of data that can be manipulated, through a


process known as "windowing", in order to demonstrate various bodily structures
based on their ability to block the X-ray beam. Although historically the images
generated were in the axial or transverse plane, perpendicular to the long axis of
the body, modern scanners allow this volume of data to be reformatted in various
planes or even as volumetric (3D) representations of structures. Although most
common in medicine, CT is also used in other fields, such as nondestructive
materials testing. Another example is archaeological uses such as imaging the
contents of sarcophagi. Individuals responsible for performing CT exams are
called Radiologic Technologists or Radiographers and are required to be licensed
in most states.

Why It Is Done

CT scans are used to study areas of the body and the arms or legs.

 Chest(thorax). A CT scan of the chest can look for problems with the lungs,

18
heart, esophagus, the major blood vessel (aorta), or the tissues in the center of
the chest. Some common chest problems a CT scan may find include infection,
lungcancer, a pulmonary embolism, and an aneurysm. It also can be used to see
if cancer has spread into the chest from another area of the body.

 Abdomen. A CT scan of the abdomen can find cysts, abscesses, infection,


tumors, an aneurysm, and enlarged lymph nodes, foreign objects, bleeding in the
belly, diverticulitis, inflammatory bowel disease, and appendicitis.
 Urinary tract. A CT scan of the kidneys, ureters, and bladder is called a CT KUB
or CT urogram. This type of scan can find kidney stones, bladder stones, or
blockage of the urinary tract. See a picture of a CT of diseased kidneys . A special
type of CT scan, called a CT intravenous pyelogram (IVP), uses injected dye
(contrast material) to look for kidney stones, blockage, growths, infection, or
other diseases of the urinary tract.
 Liver. A CT scan can find liver tumors, bleeding from the liver and liver diseases.
A CT scan of the liver can help determine the cause of jaundice.
 Pancreas. A CT scan can find a tumor in the pancreas or inflammation of the
pancreas (pancreatitis).
 Gallbladder and bile ducts. A CT scan can be used to check for blockage of
the bile ducts. Gallstones occasionally show up on a CT scan. But other tests,
such as ultrasound, usually are used to find problems with the gallbladder and
bile ducts.
 Adrenal glands. A CT scan can find tumors or enlarged adrenal glands.
 Spleen. A CT scan can be used to check for an injury to the spleen or the size of
the spleen.
 Pelvis. A CT scan can look for problems of organs in the pelvis. For a woman,
these include the uterus, ovaries, and fallopian tubes. For a man, the pelvic organs
include the prostate gland and the seminal vesicles.

19
 Arm or leg. A CT scan can look for problems of the arms or legs, including the
shoulder, elbow, wrist, hand, hip, knee, ankle, or foot.

2.3.4 MAGNETIC RESONANCE IMAGING (MRI)

Magnetic Resonance Imaging (MRI), nuclear magnetic resonance


imaging (NMRI), or magnetic resonance tomography (MRT) is a medical
imaging technique used in radiology to visualize internal structures of the body
in detail. MRI makes use of the property of nuclear magnetic resonance (NMR)
to image nuclei of atoms inside the body.

An MRI scanner is a device in which the patient lies within a large,


powerful magnet where the magnetic field is used to align the magnetization of
some atomic nuclei in the body, and radio frequency magnetic fields are applied
to systematically alter the alignment of this magnetization.This causes the nuclei
to produce a rotating magnetic field detectable by the scanner—and this
information is recorded to construct an image of the scanned area of the body.
Magnetic field gradients cause nuclei at different locations to process at different
speeds, which allows spatial information to be recovered using Fourier
analysis of the measured signal. By using gradients in different directions, 2D
images or 3D volumes can be obtained in any arbitrary orientation. MRI provides
good contrast between the different soft tissues of the body, which makes it
especially useful in imaging the brain, muscles, the heart, and cancers compared
with other medical imaging techniques such as computed tomography (CT) or X-
rays. Unlike CT scans or traditional X-rays, MRI does not use ionizing radiation.

How MRI Works

MRI machines make use of the fact that body tissue contains lots of water, and

20
hence protons(H nuclei), which get aligned in a large magnetic field. Each water
molecule has two hydrogen nuclei or protons. When a person is inside the
powerful magnetic field of the scanner, the average magnetic moment of many
protons becomes aligned with the direction of the field. A radio frequency current
is briefly turned on, producing a varying electromagnetic field. This
electromagnetic field has just the right frequency, known as
the resonance frequency, to be absorbed and flip the spin of the protons in the
magnetic field. After the electromagnetic field is turned off, the spins of the
protons return to thermodynamic equilibrium and the bulk magnetization
becomes re-aligned with the static magnetic field. During this relaxation, a radio
frequency signal (electromagnetic radiation in the RF range) is generated, which
can be measured with receiver coils. Information about the origin of the signal
in 3D space can be learned by applying additional magnetic fields during the
scan. These additional magnetic fields can be used to only generate detectable
signal from specific locations in the body (spatial excitation) and/or to make
magnetization at different spatial locations process at different frequencies, which
enables k-space encoding of spatial information. The 3D images obtained in MRI
can be rotated along arbitrary orientations and manipulated by the doctor to be
better able to detect tiny changes of structures within the body. These fields,
generated by passing electric currents through gradient coils, make the magnetic
field strength vary depending on the position within the magnet. Because this
makes the frequency of the released radio signal also dependent on its origin in a
predictable manner, the distribution of protons in the body can be mathematically
recovered from the signal, typically by the use of the inverse Fourier transform.

Protons in different tissues return to their equilibrium state at different relaxation


rates. Different tissue variables, including spin density, T1 and T2 relaxation
times, and flow and spectral shifts can be used to construct images. By changing

21
the settings on the scanner, this effect is used to create contrast between different
types of body tissue or between other properties, as in fMRI and diffusion
MRI.MRI is used to image every part of the body, and is particularly useful for
tissues with many hydrogen nuclei and little density contrast, such as
the brain, muscle, connective tissue and most tumors.

Magnetic field

MRI scans require a magnetic field with two properties, uniform field
density and strength. The magnetic field cannot vary more than 1/10,000 of 1%
and field strength ranges (depending on the scanner) from 0.2 to 3 tesla in
strength in currently clinically used scanners, with research scanners
investigating higher field strengths such as seven tesla. The lower field strengths
can be achieved with permanent magnets, which are often used in "open" MRI
scanners, for claustrophobic patients. Higher field strengths can be achieved only
with superconducting magnets. An MRI with a 3.0 tesla strength magnet may be
referred to as a "3-T MRI" or "3-tesla MRI". Since the gradient coils are within
the bore of the scanner, there are large forces between them and the main field
coils, producing most of the noise that is heard during operation. Without efforts
to damp this noise, it can approach 130 decibels (dB) with strong fields

Contrast agents and implants

MRI contrast agents may be injected intravenously to enhance the appearance


of blood vessels, tumors or inflammation. Contrast agents may also be directly
injected into a joint in the case of arteriograms: MRI images of joints. Unlike CT,
MRI uses no ionizing radiation and is generally a very safe procedure.
Nonetheless the strong magnetic fields and radio pulses can affect metal implants,
including cochlear implants and cardiac pacemakers. There are many

22
electronically activated devices that have approval from the US FDA to
permitMRI procedures in patients under highly specific MRI conditions. In the
case of cochlear implants, the US FDA has approved some implants for MRI
compatibility. In the case of cardiac pacemakers, the results can sometimes be
lethal, so patients with such implants are generally not eligible for MRI.

Prepolarized MRI

In 2001, a research team at Stanford invented a new technique which came to be


called "Prepolarized MRI" or PMRI. The team demonstrated that the magnets do
not have to be both uniform and strong, rather two magnets can be used together,
where one is strong and the other one is uniform. The first magnet in a PMRI
scanner is strong, but not uniform. This magnet creates a very strong magnetic
field which varies in uniformity by as much as 40%. This is the "Prepolarized"
component. A second much weaker (only requiring the electric power necessary
to run two hairdryers) but far more precise magnet then creates a homogeneous
magnetic field. These two magnets can be ordinary copper wound magnets,
which greatly lowers the cost of an MRI scanner. Because the magnetic field is
"tuned" by the second magnet, a PMRI scan can be obtained immediately
adjacent to a metal prosthetic, unlike an MRI scan.

2.3.5 MRI VERSUS X-RAY& CT & PET

Although an MRI (magnetic resonance imaging) scan is an expensive


proposition, it has advantages over both X-rays and other types of scans. An MRI
scanner builds up a model of a part of the body from all different angles, giving
a 3-D image, whereas CT (computed tomography) scans operate on just one
plane. An X-ray, though good for taking photographs of bones, is not used for
soft tissue. The MRI can also produce an image in various shades of color,

23
indicating the differing conditions of the tissue under investigation. During an
MRI scan, under the influence of the strong magnetic field, hydrogen atoms in
our body become ordered. The protons in the atoms either point up or down. Most
cancel each other out - the same number point up as down.When the radio
frequency is switched off, the protons release energy, emitting a signal picked up
by wire coils and sent to the MRI machine’s computer system, where the data is
converted to an image. Undergoing an MRI isn’t painful, but it’s also not a
particularly pleasant experience. Before you start, you need to remove all metal
objects such as watches and rings. The nurse will ask you if have any metal inside
your body. You have to lie inside a narrow tube, where you must keep completely
still during the operation of the machine. While the machine is working, there
will be some extremely loud noises; the nurse will give you earplugs. There are
smaller scanners that are less enclosed, but they may not be quite as accurate.PET
scans are increasingly read alongside CT or magnetic resonance imaging(MRI)
scans, with the combination (called "co-registration") giving both anatomic and
metabolic information (i.e., what the structure is, and what it is doing
biochemically). Because PET imaging is most useful in combination with
anatomical imaging, such as CT, modern PET scanners are now available with
integrated high-end multi-detector-row CT scanners (so-called "PET/CT").
Because the two scans can be performed in immediate sequence during the same
session, with the patient not changing position between the two types of scans,
the two sets of images are more-precisely registered, so that areas of abnormality
on the PET imaging can be more perfectly correlated with anatomy on the CT
images. This is very useful in showing detailed views of moving organs or
structures with higher anatomical variation, which is more common outside the
brain.

24
2.3.6 Types of MRI sequences

2.3.6.1. T1 WEIGHTED images

T1 weighted images are produced by using short TR and TE times. The contrast
and brightness of the image are predominantly determined by T1 properties of
tissue.

The dominant signal intensities of different tissues are:

 Fluid(CSF):low signal intensity(black)


 Muscle: intermediate signal intensity(grey)
 Fat: high signal intensity(white)
 brain
o grey matter: intermediate signal intensity(grey)
o white matter: hyper intense compared to grey matter(white-ish)

25
2.3.6.2. T2 WEIGHTED images

T2 weighted images are produced by using longer TE and TR times. The contrast
and brightness of the image are predominantly determined by T2 properties of
tissue.

The dominant signal intensities of different tissues are:

 fluid(CSF): high signal intensity(white)


 muscle: intermediate signal intensity(grey)
 fat: high signal intensity(white)
 brain
o grey matter: intermediate signal intensity(grey)
o white matter: hypointense compared to grey matter(dark-ish)

26
2.3.6.3. Fluid Attenuated Inversion Recovery(FLAIR)images

The flair sequence is similar to a T2 weighted image except that the TR an TE


times are very long.

2.3.6.4. PD images

Proton density images were extensively used for brain imaging, however they
have largely been replaced by FLAIR. PD however continues to offer excellent
signal distinction between fluid, hyaline cartilage and fibrocartilage, which
makes this sequence ideal in the assessment of joints.

The dominant signal intensities of different tissues are:

 fluid (e.g. joint fluid, CSF): high signal intensity (white)

 muscle: intermediate signal intensity (grey)

 fat: high signal intensity (white)

 hyaline cartilage: intermediate signal intensity (grey)

 fibrocartilage: low signal intensity (black)

27
3.SYSTEM DESIGN

3.1 Literature Review

In recent years, the advancements in the computational intelligence named after


machine intelligence have dwelled the medical field in identifying the disease.
We in advance and predict future implications based on the current condition of
the patient. Similarly, the amount of clinical studies on brain tumour
quantification also has been extremely done. Some of these studies rely on
automated methods. Few existing algorithms for brain tumour analysis focus on
segmentation of the glial tumour. Few deals with meningioma and a little deal
with glioma subtypes. However, most of the techniques deal with just classifying
the tumour types or subtypes. The studies done till recent past on tumour
segmentation can be categorized into two broad categories namely generative
probabilistic methods and discriminative approaches.

In generative probabilistic methods, explicit models of both the appearance and


anatomy are combined to attain automated segmentations. The advantage is
cooperating domain specific prior knowledge. Discriminative approaches can
directly learn the relationship between both the segmentation labels and image
intensities without having any domain knowledge. In order to achieve robustness,
they need significant amount of training data. The drawback of this approach is,
due to the explicit depending on intensity features, segmentation should be
confined only to similar kind of images which has been used for training data.
Still the intensity aspects remain a crucial part.

Hence, to minimize the disadvantages of both the generative and discriminative


models, a hybrid model of generative and discriminative models has been adopted

28
where in the generative models are used for pre-processing and thus a stable
input is generated for discriminative model which can then train to predict more
complex labels.

3.2 System diagram

Pre-processing:
The purpose of preprocessing is to discard irrelevant information in the input data,
that can negatively affect the recognition. This concerns speed and accuracy.
Preprocessing usually consists of binarization, normalization, sampling,
smoothing and denoising. This project concentrates majorly on this part of the
digit recognition procedure.

29
Skull stripping:

Skull stripping is an important process in biomedical image analysis, and it is


required for the effective examination of brain tumor from the MR images . Skull
stripping is the process of eliminating all nonbrain tissues in the brain images. By
skull stripping, it is possible to remove additional cerebral tissues such as fat,
skin, and skull in the brain images.

Segmentation:

Segmentation is the process of automatic or semi-automatic detection of


boundaries within a 2D or 3D image. A major difficulty of medical image
segmentation is the high variability in medical images. First and foremost, the
human anatomy itself shows major modes of variation. Furthermore many
different modalities (X-ray, CT, MRI, microscopy, PET, SPECT, Endoscopy,
OCT, and many more) are used to create medical images. The result of the
segmentation can then be used to obtain further diagnostic insights.

Feature extraction:

It is the process of collecting higher-level information of an image such as shape,


texture, color, and contrast. In fact, texture analysis is an important parameter of
human visual perception and machine learning system. It is used effectively to
improve the accuracy of diagnosis system by selecting prominent features.

In this project we used FUZZY C MEANS clustering algorithm, using this we


are able to find the affected area and the actual tumour that caused it.

Classification:

Random decision forests perform classification by constructing a series of


independent decision trees and voting between their predictions to obtain the
classification output. Here, implementation of random forests classifier is used
30
with 100 estimators. Tenfold cross validation across subjects was used to validate
the performance of the classifiers. The spatial WMH probability maps, average
intensities, and PWMH and PH were also calculated through the cross-validation
to avoid overfitting.
Linear regression
• A linear regression classifier with thresholding due to its low variance, high
accuracy and lower computation time compared with other classifiers.
• Intensity-based methods (including thresholding, region growing,
classification, and clustering).

3.3. About machine learning techniques

There are mainly two types of Machine Learning algorithms which are mentioned
below:
• Supervised Machine Learning

• Unsupervised Machine Learning

3.3.1 Supervised Learning:

Supervised machine learning builds a model that makes predictions based on


evidence in the presence of uncertainty. A supervised learning algorithm takes a
known set of input data and known responses to the data (output) and trains a
model to generate reasonable predictions for the response to new data. Use
supervised learning if you have known data for the output you are trying to
predict.Supervised learning uses classification and regression techniques to
develop predictive models.

31
3.3.1.1 Classification:

Classification is the problem of identifying to which of a set of categories (sub-


populations) a new observation belongs, on the basis of a training set of data
containing observations (or instances) whose category membership is known.

Common algorithms for performing classification include support vector


machine(SVM), boosted and bagged decisiontrees, k-nearest neighbour, N aive
Bayes, discriminant analysis, logistic regression, and neural networks.

3.3.1.2 Regression:

Regression predictive modeling is the task of approximating a mapping function


(f) from input variables (X) to a continuous output variable (y). A continuous
output variable is a real-value, such as an integer or floating point value.

Common regression algorithms include linear model, nonlinear model, neural


networks, regularization, stepwise regression, adaptive neuro fuzzy-learning.

3.3.2 Unsupervised Learning:

Unsupervised machine learning is the machine learning task of inferring a


function to describe hidden structure from "unlabeled" data (a classification or
categorization is not included in the observations). Since the examples given to
the learner are unlabeled, there is no evaluation of the accuracy of the structure
that is output by the relevant algorithm.

Clustering is the most common unsupervised learning technique. It is used for


exploratory data analysis to find hidden patterns or groupings in data.
Applications for cluster analysis include gene sequence analysis, market
research, and object recognition.

32
For example, if a cell phone company wants optimize the locations where they
build cell phone towers, they can use machine learning to estimate the number of
clusters of people relying on their towers. A phone can only talk to one tower at
a time, so the team uses clustering algorithms to design the best placement of cell
towers to optimize signal reception for groups, or clusters, of their customers.

Common algorithms for performing clustering include k-means and k-


medoids, hierarchical clustering, Gaussian mixture models, hidden Markov
models, self-organizing maps, fuzzy c-means clustering, and subtractive
clustering.

33
4. CODE

4.1 ALGORITHM:

FUZZY C-MEANS ALGORITHM:

Fuzzy c-means (FCM) is a method of clustering which allows one piece of data
to belong to two or more clusters.

It is based on minimization of the following objective function:

where m is any real number greater than 1, uij is the degree of membership of xi in
the cluster j, xi is the ith of d-dimensional measured data, cj is the d-dimension
center of the cluster, and ||*|| is any norm expressing the similarity between any
measured data and the center.

Fuzzy partitioning is carried out through an iterative optimization of the objective


function shown above, with the update of membership uij and the cluster
centers cj by:

This iteration will stop when , where is a termination


criterion between 0 and 1, whereas k are the iteration steps. This procedure
converges to a local minimum or a saddle point of Jm.

34
The algorithm is composed of the following steps:

1. Initialize U=[uij] matrix, U(0)


2. At k-step: calculate the centers vectors C(k)=[cj]
with U(k)

3. Update U(k) , U(k+1)

4. If || U(k+1) - U(k)||< then STOP; otherwise return to


step 2.

LINEAR REGRESSION CLASSIFIER:

A linear regression classifier with thresholding due to its low variance, high
accuracy and lower computation time compared with other classifiers. A linear
regression classifier with thresholding due to its low variance, high accuracy and
lower computation time compared with other classifiers. The value of the
threshold can determine the sensitivity and specificity of the segmentations; i.e.
choosing lower threshold values can increase the sensitivity of the segmentations
with the price of decreasing the specificity, and vice versa. A linear regression

35
line has an equation of the form Y = a + bX, where X is the explanatory variable
and Y is the dependent variable. The slope of the line is b, and a is the intercept
(the value of y when x = 0).

However, the proposed LRC approach, for the first time, simply uses the down
sampled images in combination with the linear regression classification to
achieve superior results compared to the benchmark techniques.

36
4.2 Pseudo code:

1) import wx
2) import argparse
3) import cv2
4) import matplotlib.pyplot as plt
5) import cv2
6) import numpy as np
7) import time
8) import os
9) import itertools
10) from PIL import Image
11) from numpy import average, linalg, dot
12) from skimage.segmentation import slic
13) from skimage.segmentation import mark_boundaries
14) from skimage.util import img_as_float
15) import matplotlib.pyplot as plt
16) import numpy as np
17) import argparse
18) from PIL import Image, ImageStat
19) from scipy.stats import kurtosis, skew
20) import math
21) import argparse
22) import imutils
23) import pywt
24) import pywt.data
25) import matplotlib.pyplot as plt
26) import math

37
27) from matplotlib.figure import Figure
28) from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
as FigureCanvas
29) class Example(wx.Frame):
30) def __init__(self, *args, **kw):
31) super(Example, self).__init__(*args, **kw)
32) self.InitUI()
33) def InitUI(self):
34) pnl = wx.Panel(self)
35) font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)
36) heading = wx.StaticText(self, label='Brain Tumour Detection on MRI
IMages ',
1. pos=(100,50), size=(200, -1))
37) heading.SetFont(font)
38) wx.StaticText(self, label='Upload Image', pos=(25, 100))
39) , self.OnClose1)
40) self.SetSize((600, 400))
41) self.SetTitle('CBIR')
42) self.Centre()
43) def OnClose(self, e):
44) frame = wx.Frame(None, -1, 'win.py')
45) frame.SetDimensions(0,0,200,50)
46) openFileDialog = wx.FileDialog(frame, "Open", "", "",
a. "",
b. wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
47) openFileDialog.ShowModal()
48) self.st=wx.TextCtrl(self, -1, openFileDialog.GetPath(), pos=(140, 100))
49) query = cv2.imread(openFileDialog.GetPath())
38
50) cv2.imshow("Input MRi Image", query)
51) def fcm(self,e):
52) import numpy as np
53) import matplotlib.pyplot as plt
54) import skfuzzy as fuzz
55) import os
56) import cv2
57) import numpy as np
58) from time import time
59) def change_color_fuzzycmeans(cluster_membership, clusters):
a. img = []
b. for pix in cluster_membership.T:
i. img.append(clusters[np.argmax(pix)])
c. return img
60) def readimage():
a. folder =self.st.GetLabelText()
b. img = cv2.imread(folder)
c. list_img=[]
d. print img
e. print(img.shape)
f. rgb_img = img.reshape((img.shape[0] * img.shape[1], 3))
g. list_img.append(rgb_img)
h. return list_img
61) def bwarea(img):
a. row = img.shape[0]
b. col = img.shape[1]
c. total = 0.0
d. for r in range(row-1):
39
i. for c in range(col-1):
ii. sub_total = img[r:r+2, c:c+2].mean()
iii. if sub_total == 255:
iv. total += 1
v. elif sub_total == (255.0/3.0):
vi. total += (7.0/8.0)
vii. elif sub_total == (255.0/4.0):
viii. total += 0.25
ix. elif sub_total == 0:
x. total += 0
xi. else:
xii. r1c1 = img[r,c]
xiii. r1c2 = img[r,c+1]
xiv. r2c1 = img[r+1,c]
xv. r2c2 = img[r+1,c+1]
xvi. if (((r1c1 == r2c2) & (r1c2 == r2c1)) & (r1c1 != r2c1)):
xvii. total += 0.75
xviii. else:
xix. total += 0.5
e. return total
62) def imclearborder(imgBW):
a. radius = 2
b. imgBWcopy = imgBW.copy()
c. image, contours,hierarchy = cv2.findContours(imgBWcopy.copy(),
cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
d. imgRows = imgBW.shape[0]
e. imgCols = imgBW.shape[1]
f. contourList = []
40
g. for idx in np.arange(len(contours)):
i. cnt = contours[idx]
ii. for pt in cnt:
iii. rowCnt = pt[0][1]
iv. colCnt = pt[0][0]
v. check1 = (rowCnt >= 0 and rowCnt < radius) or (rowCnt >=
imgRows-1-radius and rowCnt < imgRows)
vi. check2 = (colCnt >= 0 and colCnt < radius) or (colCnt >=
imgCols-1-radius and colCnt < imgCols)
vii. if check1 or check2:
viii. contourList.append(idx)
ix. break
h. for idx in contourList:
i. cv2.drawContours(imgBWcopy, contours, idx, (0,0,0), -1)
i. return imgBWcopy
63) def bwareaopen(imgBW, areaPixels):
a. imgBWcopy = imgBW.copy()
b. image, contours,hierarchy = cv2.findContours(imgBWcopy.copy(),
cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
c. for idx in np.arange(len(contours)):
i. area = cv2.contourArea(contours[idx])
ii. if (area >= 0 and area <= areaPixels):
iii. cv2.drawContours(imgBWcopy, contours, idx, (0,0,0), -1)
iv. return imgBWcopy
64) def imfill(im_th):
a. im_floodfill = im_th.copy()
b. h, w = im_th.shape[:2]
c. mask = np.zeros((h+2, w+2), np.uint8)
41
65) cv2.floodFill(im_floodfill, mask, (0,0), 255);
66) im_floodfill_inv = cv2.bitwise_not(im_floodfill)
67) im_out = im_th | im_floodfill_inv
a. return im_out
68) list_img = readimage()
69) n_data = len(list_img)
70) clusters = [2,3,6]
71) for index,rgb_img in enumerate(list_img):
a. img = np.reshape(rgb_img, (240,240,3)).astype(np.uint8)
b. shape = np.shape(img)
c. plt.figure(figsize=(20,20))
d. plt.subplot(1,4,1)
e. plt.imshow(img)
f. print('Image '+str(index+1))
g. for i,cluster in enumerate(clusters):
h. new_time = time()
i. cntr, u, u0, d, jm, p, fpc = fuzz.cluster.cmeans(rgb_img.T, cluster, 2,
error=0.005, maxiter=1000, init=None,seed=42)
i. new_img = change_color_fuzzycmeans(u,cntr)
ii. fuzzy_img = np.reshape(new_img,shape).astype(np.uint8)
iii. ret, seg_img = cv2.threshold(fuzzy_img,np.max(fuzzy_img)-
1,255,cv2.THRESH_BINARY)
iv. print('Fuzzy time for cluster',cluster)
v. print(time() - new_time,'seconds')
vi. seg_img_1d = seg_img[:,:,1]
vii. bwfim1 = bwareaopen(seg_img_1d, 100)
viii. bwfim2 = imclearborder(bwfim1)
ix. bwfim3 = imfill(bwfim2)
42
x. print('Bwarea : '+str(bwarea(bwfim3)))
xi. print()
xii. if i==0:
xiii. plt.subplot(1,4,i+2)
xiv. if i==2:
xv. plt.subplot(1,4,i+1)
xvi. plt.imshow(bwfim3)
xvii. name = 'Cluster'+str(cluster)
xviii. if i==1:
xix. plt.title('affected area')
xx. if i==2:
xxi. plt.title('actual tumour')
xxii. name = 'segmented'+str(index)+'.png'
xxiii. print()
72) plt.show(name)
73) def OnClose1(self, e):
74) query = cv2.imread(self.st.GetLabelText())
75) original = query
76) titles = ['Approximation', ' Horizontal detail',
i. 'Vertical detail', 'Diagonal detail']
b. coeffs2 = pywt.dwt2(original, 'bior1.3')
c. LL, (LH, HL, HH) = coeffs2
d. fig = plt.figure(figsize=(12, 3))
e. for i, a in enumerate([LL, LH, HL, HH]):
i. ax = fig.add_subplot(1, 4, i + 1)
ii. ax.set_title(titles[i], fontsize=10)
iii. ax.set_xticks([])
iv. ax.set_yticks([])
43
f. fig.tight_layout()
g. file = self.st.GetLabelText()
h. superpixel(file)
i. feature ( file )
j. existingcall(file , 0, type='rect')
k. o1 = ertcall(file , 0, type='rect')
l. ij =0
m. fi= load_images("data/")
n. tr= loadtrain ("Train/")
o. sv= savefile("dataset/")
p. for trf in tr :
i. ii= image_similarity_vectors_via_numpy(file ,trf )
ii. ij += ii
q. avgval = ij /len (tr)
r. print 'Affected Area '
s. lev=1-avgval
t. lev=lev/2
u. lev=lev*100
v. print lev
w. if avgval >.7:
i. print ' Highlevel Tumour '
ii. img=cv2.imread(file)
iii. print file
iv. cv2.imwrite( 'Result/High/Dataset/'+file, img)
x. elif avgval >.5:
i. print ' Intermediate Tumour '
ii. img = cv2.imread(file)
iii. print file
44
y. cv2.imwrite('Result/Intermediate/Dataset/' + file, img)
z. else:
i. print 'begining '
ii. img = cv2.imread(file)
iii. print file
iv. cv2.imwrite('Result/High/'+file, img)
v. cv2.imwrite('Result/Begining/Dataset/' + file, img)
vi. cv2.waitKey(0)
77) def feature ( filename ):
78) img = Image.open(filename)
79) stat = ImageStat.Stat(img)
80) stat = ImageStat.Stat(img)
81) imageFile = filename
82) im1 = Image.open('2.jpg')
83) rgbHistogram = im1.histogram()
84) for rgb in range(3):
85) totalPixels = sum(rgbHistogram[rgb * 256 : (rgb + 1) * 256])
86) ent = 0.0
87) for col in range(rgb * 256, (rgb + 1) * 256):
a. freq = float(rgbHistogram[col]) / totalPixels
b. if freq > 0:
i. ent = ent + freq * math.log(freq, 2)
88) ent = -ent
89) im = Image.open(filename)
90) im_grey = im.convert('LA')
91) width,height = im.size
92) total=0
93) for i in range(0,width):
45
94) for j in range(0,height):
a. total += im_grey.getpixel((i,j))[0]
95) mean = total / (width * height)
96) image = cv2.imread(filename)
97) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
98) blurred = cv2.GaussianBlur(gray, (5 , 5), 0)
99) thresh = cv2.threshold(blurred, 60, 255, cv2.THRESH_BINARY)[1]
100) g_kernel = cv2.getGaborKernel((21, 21), 8.0, np.pi/4, 10.0, 0.5, 0,
ktype=cv2.CV_32F)
101) img = cv2.imread(filename)
102) img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
103) filtered_img = cv2.filter2D(img, cv2.CV_8UC3, g_kernel)
104) img = cv2.imread(filename,0)
105) ret,thresh1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
106) ret,thresh2 =
cv2.threshold(img,127,255,cv2.THRESH_BINARY_INV)
107) ret,thresh3 = cv2.threshold(img,127,255,cv2.THRESH_TRUNC)
108) ret,thresh4 = cv2.threshold(img,127,255,cv2.THRESH_TOZERO)
109) ret,thresh5 =
cv2.threshold(img,127,255,cv2.THRESH_TOZERO_INV)
110) titles = ['Original
Image','BINARY','BINARY_INV','TRUNC','TOZERO','TOZERO_INV']
111) images = [img, thresh1, thresh2, thresh3, thresh4, thresh5]
112) for i in xrange(6):
113) plt.subplot(2,3,i+1),plt.imshow(images[i],'gray')
114) plt.title(titles[i])
115) plt.xticks([]),plt.yticks([])
116) img = img
46
117) edges = cv2.Canny(img,100,200)
118) plt.subplot(121)
119) segments = slic(img_as_float(image), n_segments = 100, sigma = 5)
120) fig = plt.figure("Superpixels")
121) ax = fig.add_subplot(1, 1, 1)
122) ax.imshow(mark_boundaries(img_as_float(cv2.cvtColor(image,
cv2.COLOR_BGR2RGB)), segments))
123) plt.axis("off")
124) img = image
125) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
126) gray = np.float32(gray)
127) dst = cv2.cornerHarris(gray,2,3,0.04)
128) dst = cv2.dilate(dst,None)
129) img[dst>0.01*dst.max()]=[0,0,255]
130) def enhance(img):
131) kernel = np.array([[-1, 0, 1], [-2, 0, 2], [1, 0, 1]])
132) return cv2.filter2D(img, -1, kernel)
133) def load_images(folder):
134) images = []
135) for filename in os.listdir(folder):
136) img = os.path.join(folder, filename)
137) if img is not None:
a. images.append(img)
138) return images
139) def loadtrain(folder):
140) images = []
141) for filename in os.listdir(folder):
142) img = os.path.join(folder, filename)
47
143) if img is not None:
a. images.append(img)
144) return images
145) def savefile(folder):
146) images = []
147) for filename in os.listdir(folder):
148) img = filename
149) if img is not None:
a. images.append(img)
150) return images
151) def image_similarity_vectors_via_numpy(filepath1, filepath2):
152) image1 = Image.open(filepath1)
153) image2 = Image.open(filepath2)
154) vectors = []
155) norms = []
156) for image in images:
157) vector = []
158) for pixel_tuple in image.getdata():
159) vector.append(average(pixel_tuple))
160) vectors.append(vector)
161) norms.append(linalg.norm(vector, 2))
162) a, b = vectors
163) a_norm, b_norm = norms
164) res = dot(a / a_norm, b / b_norm)
165) return res
166) def get_thumbnail(image, size=(128,128), greyscale=False):
167) image = image.resize(size, Image.ANTIALIAS)
168) if greyscale:
48
169) image = image.convert('L')
170) return image
171) def existingcall(name, debug, type=None, **options):
172) se_shape = (16, 4)
173) if type == 'rect':
174) se_shape = (17, 4)
175) elif type == 'square':
176) se_shape = (7, 6)
177) raw_image = cv2.imread(name, 1)
178) input_image = np.copy(raw_image)
179) gray = cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)
180) gray = enhance(gray)
181) exist=gray
182) gray_blur = cv2.GaussianBlur(gray, (15, 15), 0)
183) thresh = cv2.adaptiveThreshold(gray_blur, 255,
cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_IN
V, 11, 1)
184) kernel = np.ones((3, 3), np.uint8)
185) closing = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE,kernel,
iterations=4)
186) input_image1=input_image
187) im = input_image
188) im1 = input_image
189) sure_bg = cv2.dilate(closing, kernel, iterations=3)
190) dist_transform = cv2.distanceTransform(closing, cv2.DIST_L2, 5)
191) ret, sure_fg = cv2.threshold(dist_transform, 0.7 *
dist_transform.max(), 255, 0)
192) markers[unknown == 255] = 0
49
193) imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
194) ret, thresh = cv2.threshold(imgray, 110, 255, 0)
195) _, contours, _ = cv2.findContours(thresh, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
196) cv2.drawContours(im1, contours, -1, (255, 0, 0), 1)
197) return input_image
198) def ertcall(name, debug, type=None, **options):
199) se_shape = (16, 4)
200) if type == 'rect':
201) se_shape = (17, 4)
202) elif type == 'square':
203) se_shape = (7, 6)
204) raw_image = cv2.imread(name, 1)
205) input_image = np.copy(raw_image)
206) thresh = cv2.adaptiveThreshold(gray_blur, 255,
cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_IN
V, 11, 1)
207) kernel = np.ones((3, 3), np.uint8)
208) closing = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE,kernel,
iterations=4)
209) input_image1=input_image
210) im = input_image
211) im1 = input_image
212) unknown = cv2.subtract(sure_bg, sure_fg)
213) ret, markers = cv2.connectedComponents(sure_fg)
214) markers = markers + 1
215) markers[unknown == 255] = 0
216) imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
50
217) ret, thresh = cv2.threshold(imgray, 127, 255, 0)
218) _, contours, _ = cv2.findContours(thresh, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
219) cv2.drawContours(im1, contours, -1, (0, 255, 0), 1)
220) return input_image
221) def main():
222) app = wx.App()
223) ex = Example(None)
224) ex.Show()
225) app.MainLoop()
226) if __name__ == '__main__':
227) main()

51
5. TESTING AND DEPLOYMENT

5.1 TESTING

TYPES OF TESTING

• SYSTEM TESTING
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable
results. An example of system testing is the configuration oriented system
integration test. System testing is based on process descriptions and flows,
emphasizing pre-driven process links and integration points.

• WHITE BOX TESTING


White Box Testing is a testing in which the software tester has knowledge
of the inner workings, structure and language of the software, or at least its
purpose. It is used to test areas that cannot be reached from a black box level.

• BLACK BOX TESTING


Black Box Testing is testing the software without any knowledge of the
inner workings, structure or language of the module being tested. Black box
tests, as most other kinds of tests, must be written from a definitive source
document, such as specification or requirements document, such as
specification or requirements document. It is a testing in which the software
under test is treated, as a black box .you cannot “see” into it. The test provides
inputs and responds to outputs without considering how the software works.
This system has undergone:
 Functionality Testing

 Environment Testing

 Performance Testing

52
TEST CASES:

1.If the user click on process without uploading the image then an error occurs
stating that the image is not read.

Error message for not uploading image

53
2. The image shape we are taking is (240,240,3) when user gives an image which
has different dimensions then error occurs.

Error message occurred:

54
3. When the user uploads the image and when there is an error in import statement

Error message:

55
5.2 OUTPUTS:

User-interface:

Uploading image:

56
Processing:

Tumour part after segmentation using FCM :

57
Final output after classification:

58
6.CONCLUSION

Several segmentation algorithms are developed for diversified fields such as


Robotics, Bioinformatics, Satellite Imaging, Statistical data analysis and pattern
recognition. In image segmentation, model based segmentation techniques are
more superior compared to non-parametric models. In any segmentation
technique, the role of segmentation includes quantification of tissue bodies,
diagnose of the affected parts, location of the pathology along with identification
and estimation. In identification, it is very important that one has to ascribe a
suitable probability density function to the pixel intensity inside the image
regions, otherwise the errors associated with the segmentation models will be
high and image analysis and the retrieval may not serve the purpose. In any
medical image, in particular to the anatomical structure the shape of the body
structures, brain are not uniform and differ from human to human and hence the
pixel intensities may not be similar and bell shaped. In these cases, the pixel
intensities are distributed asymmetrically. Hence to effectively segment such
medical images, this project proposed and successfully implemented a novel
approach for brain MR image segmentation technique using FCM clustering
algorithm. The results yielded were more effective and accurate for diagnosis.

59
7.FUTURE SCOPE

Though the project gives highest accuracy in identifying the tumour part in brain
magnetic resonance image and predict the stage in which the tumour is, this
project still had gaps which may be considered as the future scope of the project.

As it is evident that remote areas lack in having availability of expert neurologist


the project can be extended facilitating the classification of tumour into benign
and malignant.

Further the project can be extended, for submission of magnetic resonance image
through a mobile application to the expert system and get the diagnostic
recommendations from the remote location

60
8.REFERENCES

[1] S R Kannan, Segmentation of MRI Using New Unsupervised Fuzzy C


Mean Algorithm, ICGST-GVIP Journal, Volume 5, Issue2, Jan. 2005.

[2] Pal S.K. and Pal N.R, “A Review on Image Segmentation Techniques”,
Pattern Recognition, Vol.26, N0.9, Pp. 1277-1294. 1993.
[3] Palvidis.T, “Structural Pattern Recognition”, Springer, New York, 1977.
[4] Parikh J.A, “A Comparative Study Of Cloud Classification Techniques”,
Remote Sensing Of Environment, Vol.6, Pp. 67-81, 1977.
[5] Davis L.S, “Image Texture Analysis Techniques- A Survey”, Digital
Image Processing, Simon and R.M. Haralick (Eds.) Pp 189-201, 1981.
[6] Fu.K.S and Mui J.K, “A Survey On Image Segmentation “, Pattern
Recognition, Vol.12, Pp. 3-16, 1981.
[7] Sahoo P.K etal, “A Survey Of Thresholding Techniques”, Computer
Vision, Graphics and Image Processing, Vol.41, Pp. 233-260, 1988.
[8] Rahman Farnoosh et al, “Image Segmentation Using Gaussian Mixture
Models”, 2000
[9] Nagesh Vadaparthi, SrinivasYarramalle, Suresh Varma.P,
“Unsupervised medical Image Segmentation on Brain MRI images
using Skew Gaussian Distribution”, IEEE-International Conference on
Recent Trends in Information Technology, 2011, pp.1293-1297.
[10] McCallum, A.; Nigam, K.; and Ungar L.H. (2000) "Efficient Clustering
of High Dimensional Data Sets with Application to Reference
Matching", Proceedings of the sixth ACM SIGKDD international
conference on Knowledge discovery and data mining, 169-178.

61

Potrebbero piacerti anche