Professional Documents
Culture Documents
PDF1
PDF1
CHAPTER 1
INTRODUCTION
Before dealing with the brain tumors and MR Images, the basic structure of human brain must be
understood well. Following are the main parts of human brain.
The human brain is the central organ of the human nervous system, and with the spinal cord makes up
the central nervous system. The brain consists of the cerebrum, the brainstem and the cerebellum as
shown in Figure 1.1. It controls most of the activities of the body, processing, integrating, and
coordinating the information it receives from the sense organs, and making decisions as to the
instructions sent to the rest of the body.
Frontal Lobe - It is the front part of the brain and is involved in planning, organizing, problem solving,
selective attention, personality and a variety of "higher cognitive functions" including behavior and
emotions.
Occipital Lobe - It is the region in the back of the brain which processes visual information. It also
contains association areas that help in the visual recognition of shapes and colors.
1
Brain Tumor Detection
Parietal Lobe - One of the two parietal lobes of the brain located behind the frontal lobe at the top of
the brain.
Temporal Lobe - There are two temporal lobes, one on each side of the brain located at about the level
of the ears. These lobes allow a person to tell one smell from another and one sound from another.
They also help in sorting new information and are believed to be responsible for short-term memory.
2
Brain Tumor Detection
1.4 SYMPTOMS
Most common symptoms of brain tumors are headaches, nausea and vomiting, change in speech,
vision, or hearing, mood, personality problems, memory, balancing or walking, ability to concentrate,
muscle jerking or twitching and numbness or tingling in the arms and legs.
3
Brain Tumor Detection
Image acquisition:
Image acquisition is the first process in Image Processing. The image acquisition stage involves
preprocessing steps such as scaling and sampling.
Image Enhancement:
Image enhancement is the simplest and most appealing areas of digital image processing. The idea
behind enhancement techniques is to simply highlight certain features of interest in an image. An
example of enhancement is increasing the contrast of an image because “it looks better.” Image
Enhancement is a very subjective area of image processing. Image Enhancement is based on human
subjective preferences regarding what constitutes a good enhancement result. Enhancement of an
image can be implemented by using different operations of brightness increment, sharpening, blurring
or noise removal as shown in Figure 1.2.
Image Restoration:
Image restoration is an area that also deals with improving the appearance of an image. However,
unlike enhancement, which is subjective, image restoration is objective in the sense that restoration
techniques tend to be based on mathematical or probabilistic models of image degradation.
Morphological processing:
Morphological processing deals with tools for extracting image components that are useful in the
representation and description of shape.
Image Segmentation:
Image segmentation procedures partition an image into its constituent parts or objects. In general,
autonomous segmentation is one of the most difficult tasks in digital image processing.
Representation and description always follow the output of a segmentation stage, which usually is raw
pixel data, constituting either the boundary of a region (i.e., the set of pixels separating one image
region from another) or all the points in the region itself. The first decision that must be made is whether
the data should be represented as a boundary or as a complete region. Boundary representation mainly
focuses on external shape characteristics such as corners and inflections.
4
Brain Tumor Detection
Regional representation is appropriate when the focus is on internal properties such as texture or
skeletal shape.
Image Compression:
Compression deals with techniques reducing the storage required to save an image or the bandwidth
required to transmit the image.
Color image processing is an area that has been gaining its importance because of the significant
increase in the use of digital images over the Internet.
1.7 HISTOGRAM
The histogram plots the number of pixels in the image (vertical axis) with a particular brightness value
(horizontal axis). Algorithms in the digital editor allow the user to visually adjust the brightness value
of each pixel and to dynamically display the results. Improvements in picture brightness and contrast
can thus be obtained.
The histogram of a digital image with gray levels in the range [0,L-1] is a discrete function ℎ(𝑟𝑘) =
𝑛𝑘where rk is the 𝑘𝑡ℎ gray level and 𝑛𝑘 is the number of pixels in the image having gray level𝑟𝑘. It is
used to normalize a histogram by dividing each of its values by the total number of pixels in the image,
denoted by n.Thus, a normalized histogram is given by 𝑝(𝑟𝑘) = 𝑛𝑘/𝑛 , for k=0,1,p,L- 1.Loosely
speaking,𝑝(𝑟𝑘)gives an estimate of the probability of occurrence of gray level𝑟𝑘. The sum of all
components of a normalized histogram is equal to 1.
Histograms are the basis for numerous spatial domain processing techniques. Histogram manipulation
can be used effectively for image enhancement, as shown in the Figure 1.3.In addition to providing
useful image statistics, we shall see that the information inherent in histograms also is quite useful in
other image processing applications, such as image compression and segmentation.
5
Brain Tumor Detection
Histograms are simple to calculate in software and also lend themselves to economic hardware
implementations, thus making them a popular tool for real-time image processing.
Contrast enhancement techniques in the second subgroup modify the image through some pixel
mapping such that the histogram of the processed image is more spread than that of the original image.
If a single mapping derived from the image is used then it is a global method, if the neighborhood of
each pixel is used to obtain a local mapping function then it is a local method. Using a single global
mapping cannot enhance the local contrast. One of the most popular global contrast enhancement
techniques is Histogram Equalization (HE).
The histogram in the context of image processing is the operation by which the occurrence of each
intensity value. Normally, the histogram is a graph showing the number of pixels in an image at each
different intensity value found in that image. Histogram Equalization is the technique by which the
dynamic range of the histogram of an image is increased. HE assigns the intensity values of pixels in
the input image such that the output image contains a uniform distribution of intensities. It improves
contrast and the goal of HE is to obtain a uniform histogram. This technique can be used on a whole
image or just on a part of an image. This method usually increases the global contrast of many images,
especially when the usable data of the image is represented by close contrast values. Through this
adjustment, the intensities can be better distributed on the histogram. This allows for
6
Brain Tumor Detection
areas of lower local contrast to gain a higher contrast without affecting the global contrast. Histogram
equalization accomplishes this by effectively spreading out the most frequent intensity values. The
method is useful in images with backgrounds and foregrounds that are both bright or both dark. In
particular, the method can lead to better views of bone structure in x-ray images, and to better detail
in photographs that are over or under-exposed.
Consider for a moment continuous functions, and let the variable r represent the gray levels of the
image to be enhanced. In the initial part of our discussion we assume that r has been normalized to the
interval [0, 1], with r=0 representing black and r=1 representing white. We consider a discrete
formulation and allow pixel values to be in the interval [0, L-1].
S = T(r) where 0 ≤ r ≤ 1
Histogram equalization is a specific case of the more general class of histogram remapping methods.
These methods seek to adjust the image to make it easier to analyze or improve visual quality. The
above example describes histogram equalization on a grey-scale image. However it can also be used
on color images by applying the same method separately to the Red, Green and Blue components of
the RGB color values of the image. Still, it should be noted that applying the same method on the Red,
Green, and Blue components of an RGB image may yield dramatic changes in the image's color
balance since the relative distributions of the color channels change as a result of applying the
algorithm.
Advantages:
The advantage of the method is that it is a fairly straightforward technique and an invertible operator.
So in theory, if the histogram equalization function is known, then the original histogram can be
recovered.
Disadvantages:
A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background
noise, while decreasing the usable signal.
1.8 SEGMENTATION
Image segmentation is the division of an image into regions or categories, which correspond to
different objects or parts of objects. Segmentation is often the critical step in image analysis: the point
at which we move from considering each pixel as a unit of observation to working with objects (or
parts of objects) in the image, composed of many pixels. If segmentation is done well then all
7
Brain Tumor Detection
other stages in image analysis are made simpler, but as we shall see, success is often only partial when
automatic segmentation algorithms are used. However, manual intervention can usually overcome
these problems, and by this stage the computer should already have done most of the work. There are
three general approaches to segmentation termed Thresholding, edge-based methods and region-based
methods.
1.8.1 DIFFERENT APPROACHES FOR SEGMENTATION
Based on the properties of an image, the segmentation process can be categorized into these two types.
Digital Image Segmentation can be classified as follows:
8
Brain Tumor Detection
figure 1.5. It detects and outlines of an object and boundaries among various objects and the
background in the image. It detects significant discontinuities in intensity values of an image. Essential
information regarding the shapes of objects in the scene is retained even though the edge representation
of an image significantly reduces the quantity of data to be processed. Edge detection facilitates higher
level image analysis therefore is an active area of research. Basically, three different types of
discontinuities occur in the grey level like point, line and edges and spatial masks can be used to detect
these discontinuities in an image.
1.8.1(c) Thresholding
In Thresholding, pixels are allocated to categories according to the range of values in which a pixel
lies. It shows boundaries which were obtained by Thresholding the muscle fibers image. Pixels with
values less than threshold value have been placed in one category, and the rest have been placed in the
other category. The boundaries between adjacent pixels in diff erent categories have been
superimposed in white on the original image as shown in Figure 1.6.
9
Brain Tumor Detection
Thresholding is the simplest and most commonly used method of segmentation. Given a single
threshold, t, the pixel located at lattice position (i,j), with grayscale value fij, is allocated to zero (Black)
if fij ≤ t. Otherwise, the pixel is allocated to one (White). In many cases, by trying a range of values of
t and seeing which one works best at identifying the objects of interest.
10
Brain Tumor Detection
CHAPTER 2
functional Magnetic Resonance Imaging, or fMRI, is a technique for measuring brain activity. It works
by detecting the changes in blood oxygenation and flow that occur in response to neural activity –
when a brain area is more active it consumes more oxygen and to meet this increased demand blood
flow increases to the active area. fMRI can be used to produce activation maps showing which parts
of the brain are involved in a particular mental process as shown in Figure 2.1.
The fMRI is a series of MRIs that measures both the structure and the functional activity of the brain
through computer adaptation of multiple images. Specifically, the fMRI measures signal changes in
the brain that are due to changing neural activity. In an fMRI, a patient can perform mental tasks and
the area of action can be detected through blood flow from one part of the brain to another by taking
pictures less than a second apart and showing where the brain “lights up.” For example, when a person
processes visual information, blood rushes to the back of the brain, which is where the occipital lobe
is located. fMRIs make it possible to show when things happen, how brain areas change with
experience, and which brain areas work together. They have been used to study a wide range of
psychological phenomena, including the neural activity of telling a lie, the differences between novices
and experts when playing a musical instrument, and what happens inside our heads when we dream.
11
Brain Tumor Detection
Computed Tomography (CT) scanning builds up a picture of the brain based on the differential
absorption of X-rays. During a CT scan the subject lies on a table that slides in and out of a hollow,
cylindrical apparatus. An x-ray source rides on a ring around the inside of the tube, with its beam aimed
at the subjects head. After passing through the head, the beam is sampled by one of the many detectors
that line the machine’s circumference. Images made using x-rays depend on the absorption of the beam
by the tissue it passes through. Bone and hard tissue absorb x-rays well, air and water absorb very little
and soft tissue is somewhere in between. Thus, CT scans reveal the gross features of the brain but do
not resolve its structure well.There is always a slight chance of cancer from excessive exposure to
radiation as shown in Figure 2.2.
Positron Emission Tomography (PET) uses trace amounts of short-lived radioactive material to map
functional processes in the brain. When the material undergoes radioactive decay a positron is emitted,
which can be picked up by the detector. Areas of high radioactivity are associated with brain activity.
Positron emission tomography (PET) scans measure levels of the sugar glucose in the brain in order to
illustrate where neural firing is taking place as shown in Figure 2.3. This works because active neurons
use glucose as fuel. As part of the scan, a tracer substance attached to radioactive isotopes is injected
into the blood. When parts of the brain become active, blood (which contains the tracer) is sent to
deliver oxygen. This creates visible spots, which are then picked up by detectors and used to create a
video image of the brain while performing a particular task. However, with PET scans, we can only
locate generalized areas of brain activity and not specific locations. In addition, PET scans are costly
and invasive, making their use limited. However, they can be used in some forms of medical diagnosis,
including for Alzheimer’s.
12
Brain Tumor Detection
Electroencephalography (EEG) is the measurement of the electrical activity of the brain by recording
from electrodes placed on the scalp. The resulting traces are known as an electroencephalogram (EEG)
and represent an electrical signal from a large number of neurons as shown in Figure 2.4.
EEGs are frequently used in experimentation because the process is non-invasive to the research
subject. The EEG is capable of detecting changes in electrical activity in the brain on a millisecond-
level. It is one of the few techniques available that has such high temporal resolution.Electro
Encephalography (EEG) is used to show brain activity in certain psychological reactions such as
alertness or drowsiness. It is useful in the diagnosis of seizures and other medical problems that involve
an overabundance or lack of activity in certain parts of the brain.
To prepare for an EEG, electrodes are placed on the face and scalp. After placing each electrode in the
right position, the electrical potential of each electrode can be measured. According to a person’s state
(waking, sleeping, etc.), both the frequency and the form of the EEG signal differ. Patients who suffer
from epilepsy show an increase of the amplitude of firing visible on the EEG record. The disadvantage
of EEG is that the electric conductivity and therefore the measured electrical potentials—may vary
widely from person to person and also over time, due to the natural conductivities of other tissues such
as brain matter, blood, and bones. Because of this, it is sometimes unclear exactly which region of the
brain is emitting a signal.
13
Brain Tumor Detection
Near infrared spectroscopy is an optical technique for measuring blood oxygenation in the brain. It
works by shining light in the near infrared part of the spectrum (700-900nm) through the skull and
detecting how much the remerging light is attenuated as shown in Figure 2.5. How much the light is
attenuated depends on blood oxygenation and thus NIRS can provide an indirect measure of brain
activity.
Magneto Encephalography (MEG) is an imaging technique used to measure the magnetic fields
produced by electrical activity in the brain via extremely sensitive devices known as SQUIDs. These
measurements are commonly used in both research and clinical settings. There are many uses for the
MEG, including assisting surgeons in localizing pathology, assisting researchers in determining the
function of various parts of the brain, neuro feedback, and others. This can be applied in a clinical
setting to find locations of abnormalities as well as in an experimental setting to simply measure brain
activity as shown in Figure 2.6.
14
Brain Tumor Detection
15
Brain Tumor Detection
16
Brain Tumor Detection
17
Brain Tumor Detection
CHAPTER 3
LITERATURE SURVEY
18
Brain Tumor Detection
19
Brain Tumor Detection
CHAPTER 4
METHODOLOGY
Optimization is the process of making something better. In any process, we have a set of inputs
and a set of outputs as shown in the following figure 4.2.
20
Brain Tumor Detection
Optimization refers to finding the values of inputs in such a way that we get the “best” output
values. The definition of “best” varies from problem to problem, but in mathematical terms, it
refers to maximizing or minimizing one or more objective functions, by varying the input
parameters.
The set of all possible solutions or values which the inputs can take make up the search space. In
this search space, lies a point or a set of points which gives the optimal solution. The aim of
optimization is to find that point or set of points in the search space.
4.3.1 Introduction
Genetic Algorithm (GA) is a search-based optimization technique based on the principles of
Genetics and Natural Selection. It is frequently used to find optimal or near-optimal solutions to
difficult problems which otherwise would take a lifetime to solve. It is frequently used to solve
optimization problems, in research, and in machine learning.
Nature has always been a great source of inspiration to all mankind. Genetic Algorithms (GAs)
are search based algorithms based on the concepts of natural selection and genetics. GAs are a
subset of a much larger branch of computation known as Evolutionary Computation.
GAs were developed by John Holland and his students and colleagues at the University of
Michigan, most notably David E. Goldberg and has since been tried on various optimization
problems with a high degree of success.
21
Brain Tumor Detection
In GAs, we have a pool or a population of possible solutions to the given problem. These solutions
then undergo recombination and mutation (like in natural genetics), producing new children, and
the process is repeated over various generations. Each individual (or candidate solution) is
assigned a fitness value (based on its objective function value) and the fitter individuals are given
a higher chance to mate and yield more “fitter” individuals. This is in line with the Darwinian
Theory of “Survival of the Fittest”.
In this way we keep “evolving” better individuals or solutions over generations, till we reach a
stopping criterion.
Genetic Algorithms are sufficiently randomized in nature, but they perform much better than
random local search (in which we just try various random solutions, keeping track of the best so
far), as they exploit historical information as well.
Population − It is a subset of all the possible (encoded) solutions to the given problem. The
population for a GA is analogous to the population for human beings except that instead of human
beings, we have Candidate Solutions representing human beings.
22
Brain Tumor Detection
Genotype − Genotype is the population in the computation space. In the computation space, the
solutions are represented in a way which can be easily understood and manipulated using a
computing system.
Phenotype − Phenotype is the population in the actual real world solution space in which solutions
are represented in a way they are represented in real world situations.
Decoding and Encoding − For simple problems, the phenotype and genotype spaces are the
same. However, in most of the cases, the phenotype and genotype spaces are different. Decoding
is a process of transforming a solution from the genotype to the phenotype space, while encoding
is a process of transforming from the phenotype to genotype space. Decoding should be fast as it
is carried out repeatedly in a GA during the fitness value calculation.
For example, consider the 0/1 Knapsack Problem. The Phenotype space consists of solutions
which just contain the item numbers of the items to be picked.
However, in the genotype space it can be represented as a binary string of length n (where n is the
number of items). A 0 at position x represents that xth item is picked while a 1 represents the
reverse. This is a case where genotype and phenotype spaces are different.
23
Brain Tumor Detection
Fitness Function − A fitness function simply defined is a function which takes the solution as
input and produces the suitability of the solution as the output. In some cases, the fitness function
and the objective function may be the same, while in others it might be different based on the
problem.
Genetic Operators −These alter the genetic composition of the offspring. These include
crossover, mutation, selection, etc.
We start with an initial population (which may be generated at random or seeded by other
heuristics), select parents from this population for mating. Apply crossover and mutation operators
on the parents to generate new off-springs. And finally these offspring’s replace the existing
individuals in the population and the process repeats. In this way genetic algorithms actually try
to mimic the human evolution to some extent. Each of the following steps are covered as a separate
chapter later in this tutorial.
24
Brain Tumor Detection
initialize population
parent selection
survivor selection
find best
return best
The diversity of the population should be maintained otherwise it might lead to premature
convergence.
The population size should not be kept very large as it can cause a GA to slow down, while
a smaller population might not be enough for a good mating pool. Therefore, an optimal
population size needs to be decided by trial and error.
The population is usually defined as a two dimensional array of – size population, size x,
chromosome size.
Population Initialization
There are two primary methods to initialize a population in a GA. They are
Random Initialization − Populate the initial population with completely random solutions.
25
Brain Tumor Detection
Heuristic initialization − Populate the initial population using a known heuristic for the
problem.
It has been observed that the entire population should not be initialized using a heuristic, as it can
result in the population having similar solutions and very little diversity. It has been
experimentally observed that the random solutions are the ones to drive the population to
optimality. Therefore, with heuristic initialization, we just seed the population with a couple of
good solutions, filling up the rest with random solutions rather than filling the entire population
with heuristic based solutions.
It has also been observed that heuristic initialization in some cases, only effects the initial fitness
of the population, but in the end, it is the diversity of the solutions which lead to optimality.
Population Models
There are two population models widely in use
Steady State
In steady state GA, we generate one or two off-springs in each iteration and they replace one or
two individuals from the population. A steady state GA is also known as Incremental GA.
Generational
In a generational model, we generate ‘n’ off-springs, where n is the population size, and the entire
population is replaced by the new one at the end of the iteration.
Calculation of fitness value is done repeatedly in a GA and therefore it should be sufficiently fast.
A slow computation of the fitness value can adversely affect a GA and make it exceptionally slow.
In most cases the fitness function and the objective function are the same as the objective is to
either maximize or minimize the given objective function. However, for more complex problems
26
Brain Tumor Detection
with multiple objectives and constraints, an Algorithm Designer might choose to have a different
fitness function.
In some cases, calculating the fitness function directly might not be possible due to the inherent
complexities of the problem at hand. In such cases, we do fitness approximation to suit our needs.
The following image shows the fitness calculation for a solution of the 0/1 Knapsack. It is a simple
fitness function which just sums the profit values of the items being picked (which have a 1),
scanning the elements from left to right till the knapsack is full.
However, care should be taken to prevent one extremely fit solution from taking over the entire
population in a few generations, as this leads to the solutions being close to one another in the
solution space thereby leading to a loss of diversity. Maintaining good diversity in the population
is extremely crucial for the success of a GA. This taking up of the entire population by one
extremely fit solution is known as premature convergence and is an undesirable condition in a
GA.
27
Brain Tumor Detection
Consider a circular wheel. The wheel is divided into n pies, where n is the number of individuals
in the population. Each individual gets a portion of the circle which is proportional to its fitness
value.
It is clear that a fitter individual has a greater pie on the wheel and therefore a greater chance of
landing in front of the fixed point when the wheel is rotated. Therefore, the probability of choosing
an individual depends directly on its fitness.
28
Brain Tumor Detection
It is to be noted that fitness proportionate selection methods don’t work for cases where the fitness
can take a negative value.
Tournament Selection
In K-Way tournament selection, we select K individuals from the population at random and select
the best out of these to become a parent. The same process is repeated for selecting the next parent.
Tournament Selection is also extremely popular in literature as it can even work with negative
fitness values.
29
Brain Tumor Detection
Rank Selection
Rank Selection also works with negative fitness values and is mostly used when the individuals
in the population have very close fitness values (this happens usually at the end of the run). This
leads to each individual having an almost equal share of the pie (like in case of fitness
proportionate selection) as shown in the following image and hence each individual no matter how
fit relative to each other has an approximately same probability of getting selected as a parent.
This in turn leads to a loss in the selection pressure towards fitter individuals, making the GA to
make poor parent selections in such situations.
30
Brain Tumor Detection
In this, we remove the concept of a fitness value while selecting a parent. However, every
individual in the population is ranked according to their fitness. The selection of the parents
depends on the rank of each individual and not the fitness. The higher ranked individuals are
preferred more than the lower ranked ones.
Fitness
Chromosome Rank
Value
A 8.1 1
B 8.0 4
C 8.05 2
D 7.95 6
E 8.02 3
F 7.99 5
Random Selection
In this strategy we randomly select parents from the existing population. There is no selection
pressure towards fitter individuals and therefore this strategy is usually avoided.
4.3.7 Crossover
In this chapter, we will discuss about what a Crossover Operator is along with its other modules,
their uses and benefits.
Introduction to Crossover
The crossover operator is analogous to reproduction and biological crossover. In this more than
one parent is selected and one or more off-springs are produced using the genetic material of the
parents. Crossover is usually applied in a GA with a high probability – pc .
31
Brain Tumor Detection
Crossover Operators
In this section we will discuss some of the most popularly used crossover operators. It is to be
noted that these crossover operators are very generic and the GA Designer might choose to
implement a problem-specific crossover operator as well.
Uniform Crossover:
In a uniform crossover, we don’t divide the chromosome into segments, rather we treat each gene
separately. In this, we essentially flip a coin for each chromosome to decide whether or not it’ll
be included in the off-spring. We can also bias the coin to one parent, to have more genetic material
in the child from that parent.
32
Brain Tumor Detection
• Create two random crossover points in the parent and copy the segment between them from
the first parent to the first offspring.
• Now, starting from the second crossover point in the second parent, copy the remaining
unused numbers from the second parent to the first child, wrapping around the list.
• Repeat for the second child with the parent’s role reversed
There exist a lot of other crossovers like Partially Mapped Crossover (PMX), Order based
crossover (OX2), Shuffle Crossover, Ring Crossover, etc.
33
Brain Tumor Detection
4.3.8 Mutation
Introduction to Mutation
In simple terms, mutation may be defined as a small random tweak in the chromosome, to get a
new solution. It is used to maintain and introduce diversity in the genetic population and is usually
applied with a low probability (Pm). If the probability is very high, the GA gets reduced to a
random search.
Mutation is the part of the GA which is related to the “exploration” of the search space. It has been
observed that mutation is essential to the convergence of the GA while crossover is not.
Mutation Operators
In this section, we describe some of the most commonly used mutation operators. Like the
crossover operators, this is not an exhaustive list and the GA designer might find a combination
of these approaches or a problem-specific mutation operator more useful.
Random Resetting:
Random Resetting is an extension of the bit flip for the integer representation. In this, a random
value from the set of permissible values is assigned to a randomly chosen gene.
34
Brain Tumor Detection
Swap Mutation:
In swap mutation, we select two positions on the chromosome at random, and interchange the
values. This is common in permutation-based encodings.
Scramble Mutation:
Scramble mutation is also popular with permutation representations. In this, from the entire
chromosome, a subset of genes is chosen, and their values are scrambled or shuffled randomly.
Inversion Mutation:
In inversion mutation, we select a subset of genes like in scramble mutation, but instead of
shuffling the subset, we merely invert the entire string in the subset.
Some GAs employ Elitism. In simple terms, it means the current fittest member of the population
is always propagated to the next generation. Therefore, under no circumstance can the fittest
member of the current population be replaced.
The easiest policy is to kick random members out of the population, but such an approach
frequently has convergence issues, therefore the following strategies are widely used.
35
Brain Tumor Detection
For instance, in the following example, the age is the number of generations for which the
individual has been in the population. The oldest members of the population i.e. P4 and P7 are
kicked out of the population and the ages of the rest of the members are incremented by one.
For example, in the following image, the children replace the least fit individuals P1 and P10 of
the population. It is to be noted that since P1 and P9 have the same fitness value, the decision to
remove which individual from the population is arbitrary.
36
Brain Tumor Detection
For example, in a genetic algorithm we keep a counter which keeps track of the generations for
which there has been no improvement in the population. Initially, we set this counter to zero. Each
time we don’t generate off-springs which are better than the individuals in the population, we
increment the counter.
However, if the fitness any of the off-springs is better, then we reset the counter to zero. The
algorithm terminates when the counter reaches a predetermined value.
37
Brain Tumor Detection
Like other parameters of a GA, the termination condition is also highly problem specific and the
GA designer should try out various options to see what suits his particular problem the best.
Advantages of GAs
GAs have various advantages which have made them immensely popular. These include
• Does not require any derivative information (which may not be available for many real-
world problems).
• Is faster and more efficient as compared to the traditional methods.
• Has very good parallel capabilities.
• Optimizes both continuous and discrete functions and also multi-objective problems.
• Provides a list of “good” solutions and not just a single solution.
• Always gets an answer to the problem, which gets better over the time.
• Useful when the search space is very large and there are a large number of parameters
involved.
Limitations of GAs
Like any technique, GAs also suffer from a few limitations. These include −
• GAs are not suited for all problems, especially problems which are simple and for which
derivative information is available.
• Fitness value is calculated repeatedly which might be computationally expensive for some
problems.
• Being stochastic, there are no guarantees on the optimality or the quality of the solution.
• If not implemented properly, the GA may not converge to the optimal solution.
38
Brain Tumor Detection
In this section, we list some of the areas in which Genetic Algorithms are frequently used. These
are
39
Brain Tumor Detection
4.5.1PSO algorithm
As stated before, PSO simulates the behaviors of bird flocking. Suppose the following scenario:
40
Brain Tumor Detection
a group of birds are randomly searching food in an area. There is only one piece of food in the
area being searched. All the birds do not know where the food is. But they know how far the
food is in each iteration. So what's the best strategy to find the food? The effective one is to
follow the bird which is nearest to the food.
PSO learned from the scenario and used it to solve the optimization problems. In PSO, each
single solution is a "bird" in the search space. We call it "particle". All of particles have fitness
values which are evaluated by the fitness function to be optimized, and have velocities which
direct the flying of the particles. The particles fly through the problem space by following the
current optimum particles.
PSO is initialized with a group of random particles (solutions) and then searches for optima by
updating generations. In every iteration, each particle is updated by following two "best" values.
The first one is the best solution (fitness) it has achieved so far. (The fitness value is also stored.)
This value is called pbest. Another "best" value that is tracked by the particle swarm optimizer is
the best value, obtained so far by any particle in the population. This best value is a global best
and called gbest. When a particle takes part of the population as its topological neighbors, the
best value is a local best and is called lbest.
After finding the two best values, the particle updates its velocity and positions with following
equation (4.3) and (4.4).
41
Brain Tumor Detection
Choose the particle with the best fitness value of all the particles as the gBest
For each particle
Calculate particle velocity according equation (a)
Update particle position according equation (b)
End
While maximum iterations or minimum error criteria is not attained
Particles' velocities on each dimension are clamped to a maximum velocity Vmax. If the sum of
accelerations would cause the velocity on that dimension to exceed Vmax, which is a parameter
specified by the user. Then the velocity on that dimension is limited to Vmax.
From the procedure, we can learn that PSO shares many common points with GA. Both
algorithms start with a group of a randomly generated population, both have fitness values to
evaluate the population. Both update the population and search for the optimium with random
techniques. Both systems do not guarantee success.
However, PSO does not have genetic operators like crossover and mutation. Particles update
themselves with the internal velocity. They also have memory, which is important to the
algorithm.
43
Brain Tumor Detection
Compared with genetic algorithms (GAs), the information sharing mechanism in PSO is
significantly different. In GAs, chromosomes share information with each other. So the whole
population moves like a one group towards an optimal area. In PSO, only gBest (or lBest) gives
out the information to others. It is a one -way information sharing mechanism. The evolution
only looks for the best solution. Compared with GA, all the particles tend to converge to the best
solution quickly even in the local version in most cases.
There are not many parameter need to be tuned in PSO. Here is a list of the parameters and their
typical values.
The number of particles: the typical range is 20 - 40. Actually for most of the problems 10
particles is large enough to get good results. For some difficult or special problems, one can try
100 or 200 particles as well.
Range of particles: It is also determined by the problem to be optimized, you can specify
different ranges for different dimension of particles.
Vmax: it determines the maximum change one particle can take during one iteration. Usually we
44
Brain Tumor Detection
set the range of the particle as the Vmax for example, the particle (x1, x2, x3)
X1 belongs [-10, 10], then Vmax = 20
Learning factors: c1 and c2 usually equal to 2. However, other settings were also used in different
papers. But usually c1 equals to c2 and ranges from [0, 4]
The stop condition: the maximum number of iterations the PSO execute and the minimum error
requirement. for example, for ANN training in previous section, we can set the minimum error
requirement is one mis-classified pattern. the maximum number of iterations is set to 2000. this
stop condition depends on the problem to be optimized.
Disadvantages
46
Brain Tumor Detection
4.7.1 Introduction
SOS is an evolutionary searching method developed by Cheng and Prayogo in 2014. SOS is an
optimization technique which has been inspired from symbiotic organisms that use to survive in the
ecosystem. The proposed SOS algorithm simulates symbiotic interactive behavior among the paired
organism relationship in the ecosystem and tries to seek for fitness organism. In SOS, the individuals in
the population are named as organism and each organism represent a point in the search space, hence
seeking the possible optimal global solution to the problem is promised. A fitness for each organism shows
the degree of adaption to the requested goal. SOS is designed for continuous search space. There is a
main advantage of the SOS algorithm over other nature inspired algorithms; SOS requires no specific
algorithm parameters to be set at the beginning. Similar to other algorithms SOS has operators that
update the position of organisms in each iteration. These operators which resemble the biological
interaction model are introduced as Mutualism/Commensalism/Parasitism. They have been originated
from the most common symbiotic relationships found in nature. Mutualism which benefits both
organisms mimics the relationship between like bees and flowers. Commensalism models the relationship
between remora fish and sharks. The remora is receiving benefits and shark is unaffected (it means neither
benefits nor suffers) from the relationship. And the parasitism is seen in the anopheles mosquito relation
with humans that mosquito benefits and human is harmed and may die. In each phase, the position of
the organisms is updated if the relationship causes a better fitness value for organisms i or j.
47
Brain Tumor Detection
48
Brain Tumor Detection
end while
49
Brain Tumor Detection
Mutual_Vector=(Xi+Xj)/2 Eq(4.7)
rand(0,1) in Eqs(1) and (2)is a vector of random numbers. The role of BF1and BF2is explained as
follows. In nature, some mutualism relationships might give a greater beneficial advantage for just
one organism than another organism. In other words, organism A might receive a huge benefit
when interacting with organism B. Meanwhile, organism B might only get adequate or not so
significant benefit when interacting with organism A. Here, benefit factors (BF1and BF2) are
determined randomly as either 1or 2. These factors represent level of benefit to each organisms,i.e
whether an organism partially or fully benefits from the interaction.
Eq.(3) shows a vector called ‘‘Mutual_Vector’’ that represents the relationship characteristic
between organism Xi and Xj. The part of equation, (Xbest – Mutual_Vector*BF1), is reflecting the
mutualistic effort to achieve their goal in increasing their survival advantage. According to the
Darwin’s evolution theory, ‘‘only the fittest organisms will prevail’’, all creatures are forced to
increase their degree of adaptation to their ecosystem. Some of them use symbiotic relationship
with others to increase their survival adaptation. The Xbest is needed here because Xbest is
representing the highest degree of adaptation. Therefore, we use Xbest/global solution to model the
50
Brain Tumor Detection
highest degree of adaptation as the target point for the fitness increment of both organisms. Finally,
organisms are updated only if their new fitness is better than their preinteraction fitness.
The part of equation, (Xbest – Xj), is reflecting as the beneficial advantage provided by Xj to help
Xi increasing its survival advantage in ecosystem to the highest degree in current organism
(represented by Xbest).
51
Brain Tumor Detection
c) Because of randomization, the solutions are widely spread in the solution space.
52
Brain Tumor Detection
population change, which it is called evolution. There is a fact underlying in this theory. If an organism has
a better genetic structure that leads to have better features, it will have better survival chances in the
ecosystem. This could lead to better interaction with other organisms gratefully in increasing survival
opportunity and transfer these experiences and features to their children. Considering this fact in HPG-
SOS, GA creates the offspring which has inherited better genetic structure from parents (best fitness and
experience’s). This helps PSO to get a better experience for each organisms and these experience helps
the SOS to catch a better survival opportunity in the symbiotic interaction. Since the main actions in the
natural selection perform successively then it needs to be run the GA, PSO and SOS algorithms
consecutively to simulate this process. In each operating cycle, the process is begun with GA algorithm
with the initial population (Lifecycle) and initial size (Lifecyclesize). Selection operator is applied to the
combination of population created by GA Mutation/Crossover operators (Lifecyclem, Lifecyclec) and
previous survived population. The selection operator selects the best population with the previous size
and Obest (global best) is also chosen from a selected population. Then GA output is the population
compound of successful parents and their offspring that inherit their parent’s experiences. Each offspring
consists of five parameters with name of velocity, position, cost, best experience (which itself consists of
two fields position and cost). Next step is the time of gaining a better experiences by PSO phase. In this
phase, if moving cause a greater position for the organism, updating best experience is applied for it,
otherwise nothing change. If the best experience for organisms is better than Obest, then Obest is also
updated. So PSO checks the area by using the velocity equation and store the best experiences for each
organism and update the global best. Since the best experience has gained for each organism, now it is
time to use it in having better symbiotic interaction (Mutualism, Commensalism, Parasitism) which causes
survival and benefit in SOS algorithm. In SOS phase, if the specific interaction causes better fitness value,
Organism position is updated by SOS interaction phases otherwise position does not change. It can be say
that only SOS and GA modify the position and PSO just updates the best experiences (personal best) and
Obest. The mutualism phase has been modified to use in some problems which are explained in following
subsection. The iteration best is Obest and the algorithm stops if the criterion is acceptable otherwise,
the next iteration starts for generating offspring and passing another cycle. Fig. 1 depicts the schematic
view of the proposed hybrid GA-PSO-SOS (HPG-SOS). As it can be seen, this method consists of 3 main
phases (GA, PSO and SOS) which are executed in consecutive form.
53
Brain Tumor Detection
1: Input: objective function f, constraints and the dimensions of the problem (D)
2: \\Initialization
6: Assign random real number between [varmin , varmax] to the organism position
8: Set velocity = 0
9: Set calculated position and cost as best experience (Op) position and cost too.
11: \\iterations
54
Brain Tumor Detection
13: Apply crossover and create Lifecyclec with size of [Pc . Lifecyclesize] Eq. (14)
14: Apply mutation and create Lifecyclem with size of [Pm . Lifecyclesize] Eq. (3)
15: Combine Lifecyclec, Lifecyclem and Lifecycle and select best population
16: Check experiences for any new minimum solution and set as best organism (Obest)
18: Calculate Oinewfor Oi with PSO update operator Eqs. (4) and (5)
23: end if
24: end if
27: Mutualism: Calculate Ojnew & Ornew (Or is randomly selected) Eqs. (11) and (12)
30: end if
33: end if
37: end if
41: end if
55
Brain Tumor Detection
56
Brain Tumor Detection
Two of the error metrics used to compare the various image compression techniques are the Mean
Square Error (MSE) and the Peak Signal to Noise Ratio (PSNR). The MSE is the cumulative
squared error between the compressed and the original image, whereas PSNR is a measure of the
peak error. The mathematical formulae for the two are
𝑀
1 𝑁
MSE = 𝑀𝑁 ∑ ∑𝑥=0[I(x, y) − I′(x, y)]2
𝑦=1
where I(x,y) is the original image, I'(x,y) is the approximated version (which is actually the
decompressed image) and M,N are the dimensions of the images. A lower value for MSE means
lesser error, and as seen from the inverse relation between the MSE and PSNR, this translates to a
high value of PSNR. Logically, a higher value of PSNR is good because it means that the ratio of
Signal to Noise is higher. Here, the 'signal' is the original image, and the 'noise' is the error in
reconstruction. So, if you find a compression scheme having a lower MSE (and a high PSNR), you
can recognize that it is a better one.
57