Brain Tumour Analysis Using Image Processsing

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 48

BRAIN TUMOUR ANALYSIS USING IMAGE PROCESSSING

A PROJECT REPORT SUBMITTED IN FULFILLMENT OF THE


REQUIREMENTS FOR THE AWARD OF THE DEGREE OF

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE ENGINEERING

By

V. R. Haritha (16JG1A0592) P. Divya Lakshmi (16JG1A0587)


Y. Deydivya(16JG1A05B7) K. Swarna Lekhana (16JG1A0561)

Under the guidance of

Dr. M. Bhanu Sridhar


Associate Professor

Department of Computer Science Engineering

GAYATRI VIDYA PARISHAD COLLEGE OF ENGINEERING FOR


WOMEN
(Affiliated to Jawaharlal Nehru Technological University, Kakinada)
(2016-2020)
GAYATRI VIDYA PARISHAD COLLEGE OF ENGINEERING FOR
WOMEN

Department of Computer Science Engineering

CERTIFICATE

This is to certify that the project report titled Brain Tumour analysis using image
processing is a bonafide work of following IV/II B. Tech students in the Department of
Computer Science Engineering, Gayatri Vidya Parishad College of Engineering for
Women affiliated to JNT University, Kakinada during the academic year 2016-2020, in
fulfillment of the requirement for the award of the degree of Bachelor of Technology of
this university.

V. R. Haritha (16JG1A0592) P. Divya sri (16JG1A0587)


Y. Deydivya(16JG1A05B7) K. Swarna lekhana(16JG1A0561)

Dr. M. Bhanu Sridhar Dr. P. V. S. L. Jagadamba


Associate Professor Professor
(Internal Guide) (Head of department)
ACKNOWLEDGEMENT

We take the opportunity to one and all who have helped in making the project
possible. We are thankful to Gayatri Vidya Parishad College of Engineering for
Women, for giving us the opportunity to work on a project as part of the curriculum.

Our sincere thanks to our guide Dr. M. Bhanu Sridhar, Associate Professor in
Department of Computer Science Engineering for his simulating guidance and assistance
from the beginning of the project.

We are very much thankful to our Head of Computer Science Engineering Prof.
P. V. S. L. Jagadamba. Head of the Department for her help and encouragement and
also for providing the lab facility to complete the project work.

Our sincere thanks to our beloved Vice-Principal Prof. G. Sudheer for providing
the best faculty and lab facility throughout these academic years.

Our sincere thanks to our beloved principal Prof. K. Subba Rao for providing the
best faculty and lab facility throughout these academic years.

Our sincere thanks to our beloved Director Prof. Dr. E. V. Prasad for providing
the best faculty and lab facility throughout these academic years.

Finally, we are thankful to our entire faculty and our lab technicians for their good
wishes and constructive criticism, which led to the successful completion of the project.
TABLE OF CONTENTS

TOPICS PAGE NO

ABSTRACT

1. INTRODUCTION
1.1 Motivation of the Project
1.2 Problem Definition
1.3 Objective of project
1.4 Limitations of project
1.5 Organization of documentation

2. LITERATURE SURVEY

3. ANALYSIS
3.1 Introduction
3.2 Software Requirement Specification
3.2.1 User requirements
3.2.2 Software requirements
3.2.3 Hardware requirements
3.3 Content diagram of project
3.4 Flowchart
3.5 Conclusion

4. DESIGN
4.1 Introduction
4.2 Basic Building blocks of UML
4.2.1 UML diagrams
4.2.1.1 Class diagram
4.2.1.2 Use case diagram
4.2.1.3 State chart diagram

i
4.2.1.4 Sequence diagram
4.2.1.5 Activity diagram
4.3 Module design and organization
4.3.1 Main module
4.3.2 Admin module
4.3.3 Donator module
4.3.4 Agent module
4.4 Conclusion

5. IMPLEMENTATION AND RESULT

6. TESTING AND VALIDATION


6.1 Introduction
1. Scope
2. Defects and Failures
3. Compatibility
4. Input Combinations and Preconditions
5. Static vs. Dynamic Testing
6. Software Verification and Validation
6.2 Design Of Test Cases And scenarios
6.3 Validation
6.3.1 Unit Testing
6.3.1.1 White box Testing
6.3.1.2 Black box Testing
6.3.2 Integration Testing
6.3.3 System Testing

7 CONCLUSION
8 REFERENCES

ii
ABSTRACT

Medical science in image processing is an emerging field which has proposed a lot of
advanced techniques in detection and analysis of a particular disease. Treatment of brain
tumors in recent years is getting more and more challenging due to complex structure,
shape and texture of the tumor. Therefore, this project intends to implement different
methodologies to segment a tumor from an MRI image and perform normalized cross-
correlation in order to determine if the tumor extracted is accurately determined as tumor.
Using the best segmentation technique classification is performed to determine whether
the tumor is Benign or Malignant.

iii
1. INTRODUCTION:

1.1 MOTIVATIONS OF THE PROJECT


1.2PROBLEM DEFINITION
1.3OBJECTIVE OF PROJECT
1.4 LIMITATIONS OF PROJECT
1.5 ORGANIZATION OF THE PROJECT
Concise overview of rest of the documentation work is explained below. Definitions
of few terms which are involved in building this software were reviewed.

Chapter 1: Introduction describes the motivation of this project and objective of the
developed project.

Chapter 2: Literature survey describes the primary terms involved in the development of
this software. It discusses about some key concepts of android and databases which is an
important step in developing android app.

Chapter 3: Analysis deals with detail analysis of the project. Software Requirement
specification which further contain user requirements analysis, software requirement analysis
and hardware requirement analysis. It also includes Algorithms and Flowcharts.

Chapter 4: Design includes UML diagrams along with explanation of the system design and
the organization.

Chapter 5: Contains implementation of the project and screenshots of the outputs.

Chapter 6: Gives the testing and validation details with design of test cases and scenarios
along with validation screenshots.

Chapter 7: Contains project conclusion and future enhancements.

Chapter 8: Contains references.

4
2. LITERATURE SURVEY

2.1 INTRODUCTION
2.2 EXISTING SYSTEM
2.3 DISADVANTAGES OF EXISTING SYSTEMS
2.4 PROPOSED SYSTEM
2.5 CONCLUSION

2.1 Introduction:
Brain tumor is caused due to uncontrolled growth of cells. These cells might affect normal
brain activities. Two main groups of brain tumor are: Primary and Metastatic. Primary or
Benign tumor are non-cancerous originating from the tissues of the brain. Metastatic or
malignant are cancerous which begin in other parts of the body (breast or lungs) and spread to
the brain. As per Globocon, 2019 report, issued by the International Association of Cancer
Registries (IACR) associated with WHO revealed that 28,142 brain tumor cases are annually
reported in India, while there are as many as 24,003 deaths.

2.2 Existing system:

The existing system are:

• Threshold
• K-means clustering
• Fuzzy c mean segmentation

THRESHOLD:

Separation of dark and light regions using fixed threshold values

Drawbacks:

• Threshold values depend on the quality of the image.


• Percentage of accuracy using the standard threshold values is not specified to
determine the accuracy of the methodology.

K-MEANS CLUSTERING:

K-means algorithm is implemented using fixed k value.

Drawbacks:

• k value depends on the quality of the image.


• Better results can be obtained for better k values.

FUZZY C MEAN SEGMENTATION:

5
Fuzzy C mean algorithm is implemented where C is the number of clusters to be formed.

Drawbacks:

• Though it gives accurate prediction compared to k-means, it is comparatively slower


than k-means.

2.3 Proposed system:

Apply Otsu’s Segmentation, Histogram based segmentation, Watershed Segmentation and


MSER (Maximally Stable Extremal Regions) segmentation. Perform Morphological
operations (opening, closing, dilation & erosion). Display the segmented tumour for each of
the methods. Compute normalized cross-correlation. Classify the identified tumours into
Benign and Malignant tumours using Random forest classification technique.

2.4 Conclusion:

3.ANALYSIS

3.1 INTRODUCTION:

IMAGE PROCESSING:

In computer science, digital image processing is the use of a digital computer to process
digital images through an algorithm. As a subcategory or field of digital signal processing,
digital image processing has many advantages over analog image processing. It allows a
much wider range of algorithms to be applied to the input data and can avoid problems such
as the build-up of noise and distortion during processing. Since images are defined over two
dimensions (perhaps more) digital image processing may be modelled in the form of multi-
dimensional systems. The generation and development of digital image processing are mainly
affected by three factors: 1.the development of computers; 2.the development of mathematics
(especially the creation and improvement of discrete mathematics theory); 3. The demand for
a wide range of applications in environment, agriculture, military, industry and medical
science has increased.

6
ADVANTAGES OF IMAGE PROCESSING:

1.Digital image processing made digital image can be noise free.

2.It can be made available in any desired format. (X-rays, photo negatives, improved image
etc.,)

3.Digital imaging is the ability of the operator to post-process the image. It means manipulate
the pixel shades to correct image density and contrast.

4.Images can be stored in the computer memory and easily retrieved on the same computer
screen.

5.Digital imaging allows the electronic transmission of images to third-party providers.

DISADVANTAGES OF IMAGE PROCESSING:

1.The initial cost can be high depending on the system used.

2.If computer is crashes then pics that have not been printed and filled into Book Albums that
are lost.

3.Digital cameras which are used for digital image processing have some disadvantages like:

• Memory card problems


• Higher cost
• Battery consumption

3.2 SOFTWARE REQUIREMENT SPECIFICATION

Requirement Determination is the process, by which analyst gains the knowledge of


the organization and apply it in selecting the right technology for a particular application.

A Software requirement specification (SRS) is a complete description of the behavior of the


system to be developed. It includes a set of use cases that describe all the interactions the
users will have with the software. Use case is also known as functional requirements. In
addition to use cases, the SRS also contains non-functional (or supplementary requirements
Non-functional requirements are requirements which impose constraints on the design and
implementation (such as performance engineering requirements, quality standards, or design
constraints).

7
FUNCTIONAL REQUIREMENTS

In software engineering, a functional requirement defines a function of a software


system or its component. A function is described as a set of inputs, the behavior and outputs.
Functional requirements may be calculation, technical details, data manipulation and
processing and other specific functionality that define what a system is supposed to
accomplish. Behavioral requirements describing all the cases where the system uses the
functional requirements are captured in use cases. Functional requirements are supported by
non-functional requirements (also known as quality requirements), which impose constraints
the design or implementation such as performance requirements, reliability and security. How
a system implements functional requirements is detailed in the system design. In some cases,
a requirements analyst generates use cases after gathering and validating a set of functional
requirements. Often though, an analyst will begin by selecting a set of use cases, from which
the analyst can derive the functional requirements that must be implemented to allow a user
to perform each use case.

NON-FUNCTIONAL REQUIREMENTS

In systems engineering and requirements engineering a non-functional requirement is


a requirement that specifies criteria that can be used to judge the operation of a system, rather
than specific behaviours. This should be contrasted with functional requirements that define
specific behavior or functions. In general, functional requirements define what a system is
supposed to do whereas non-functional requirements are often called qualities of a system.
Other terms for non-functional requirements are “constraints”, “quality goals” and “quality of
service requirements”, and “non-behavioral requirements”. Quality that is non-functional
requirements can be divided into two main categories.

3.2.1 USER REQUIREMENTS

3.2.1.1 SOFTWARE REQUIREMENTS

Software Requirements deal with defining software resource requirements and pre-
requisites that need to be installed on a computer to provide optimal functioning of an

8
application. These requirements or pre-requisites are generally not included in the software
installation package and need to be installed separately before the software is installed.

Operating System : Windows (XP, 8.1, 10)

3.2.1.2 HARDWARE REQUIREMENTS


The most common set of requirements defined by any operating system or software
application is the physical computer resources also known as hardware. A hardware
requirements list is often accompanied by a hardware compatibility list (HCL), especially in
case of operating systems. An HCL lists tested, compatible hardware devices for a particular
operating system or application. The following subsections discuss the various aspects of
hardware requirements.

CPU type : Intel Core i5

RAM : 4GB

System Type : 64 bit Operating System

3.3 CONTENT DIAGRAM OF THE PROJECT:


3.4 FLOW CHART:
A flowchart is a type of diagram that represents an algorithm, workflow or process.
The flowchart shows the steps as boxes of various kinds, and their order by connecting the
boxes with arrows. This diagrammatic representation illustrates a solution model to a given
problem.

BRAIN TUMOR SEGMENTATION:

 Brain tumor segmentation plays an important role in medical image processing.

 It is a process of separating different tumor tissues (solid or active tumour, edema and
necrosis) from normal brain tissues: Gray matter, White matter and cerebrospinal
Fluid.

9
3.5 CONCLUSION
This chapter starts with the introduction of analysis in general followed by Software
Requirement Specification which contains software requirements and hardware requirements
i.e. what are the software’s required to implement and run the system and hardware
requirements required for establishing and running the project.

4.DESIGN

4.1 INTRODUCTION

Software Design is a process of planning the new or modified system. The design step
produces the understanding and procedural details necessary for implementing the system
recommended in the feasibility study. Analysis specifies what a new or modified system
does. Design specifies how to accomplish the same. Design is essentially a bridge between
requirement specification and the final solution satisfying the requirement. It is a blue print or
a solution for the system. The design step produces a data design, an architectural design and
procedural design.

10
The design process for a software system has two levels. At first level the focus is on
depending in which modules are needed for the system, the specification of these modules
and how the modules should be interconnected. This is what is called system designing of top
level design. In the second level, the internal design of the modules, or how the specification
should be interconnected.

Top Level Design

It is the first level of the design which produces the system design, which defines the
components needed for the system, and how the components interact with each other. It focus
is on depending in which the modules are needed for the system, the specification of these
module should be interconnected.

Logic Design

The logic design of this application shows the major features and how they are related
to one another. The detailed specifications are drawn on the bases of user requirements. The
outputs, inputs and relationship between the variables are designed in this phase.

Input Design

The input design is the bridge between users and information system. It specifies the
manner in which the data enters the system for processing. It can ensure the reliability of the
system and produces reports from accurate data or it may result in the output of error
information. While designing the following points have to be taken into consideration:

 Input Formats are designed as per user requirements.


 Interaction with the user is maintained in simple dialogues.
 Appropriate fields are designed with validations there by allowing valid inputs.

Output Design

Each and every presented in the system is result-oriented. The most important feature of
this application for users is the output. Efficient output design improves the usability and
acceptability of the system and also helps in decision making. Thus the following points are
considered during the output design:

 What information to be present?

11
 How to arrange the information in acceptable manner?
 How the status has to be maintained each and every time?
 How to distribute the output to different recipients?

The system being user friendly in nature is served to fulfill the requirements of the users.

Data Design

Data design is the first of the three design activities that are conducted during software
engineering. The Impact of data structure on program structure and procedural complexity
causes data design to have a profound influence on software quality.

Architectural Design

The architectural design defines the relationship among major structural components into
a procedural description of the software.

 The use cases are the functions that are to be performed in the module.
 An actor could be end-user of the system or an external system.

System Design

System design is the process of defining the architecture, components, modules,


interfaces and data for a system to satisfy the specified requirements. System design could
see its application of systems theory to product development. There is an overlap with the
disciplines of system analysis, system architecture and system engineering.

Grady Booch, James Raumbaugh and Ivor Jacobson have collaborated to combine the
best features of their individual object-oriented analysis and design methods into a unified
method the unified modeling language, the version 1.0 for the Unified modeling was released
in January 1997 the main parts of UML are based on the Brooch, OMT and OOSE methods.

The goals of UML are:

 To model systems using object-oriented concepts


 To establish an explicit coupling between conceptual as well as executable
 To address the issues of scale inherent in complex, mission critical system

12
 To create a modeling language usable by both humans and machines

4.2 BASIC BUILDING BLOCKS OF UML


The basic building blocks in UML are things and relationships; these are combined in
different ways following different rules to create different types of diagrams. In UML there
are 8 types of diagrams, below is a list and brief description of them. The more in depth
descriptions in the document, will focus on the first five diagrams in the list, which can be
seen as the most general, sometimes also referred to as the UML core diagrams.

 Use Case Diagrams: it shows a set of use cases, and how actors can use them.
 Class Diagrams: describes the structure of the system , divided in classes with different
connections and relationships.
 Sequence Diagrams: it shows the interaction between a set of objects, through the
messages that may be dispatched between them.
 State Chart Diagram: state machines, consisting of states, transitions, events and
activities.
 Activity Diagrams: shows the flow through a program from a defined start point to an
end point.
 Object Diagrams: A set of objects and their relationships, this is a snapshot of instances
of the things found in the class objects.
 Collaboration Diagrams: shows organizations and dependencies among a set of
components. These diagrams address the static implementation view of the system.
 Deployment Diagrams: show the configuration of run-time processing nodes and
components that live on them.

4.2.1 UML DIAGRAMS


These are the artifacts of a software-intensive system. The abbreviation for UML is
Unified Modeling Language and is being brought of a designed to make sure that the existing
ER Diagrams which do not serve the purpose will be replaced by this UML Diagrams where
in these language as its own set of Diagrams.

13
Some of the Diagrams that help for the Diagrammatic Approach for the Object-Oriented
Software Engineering are

 Class Diagrams

 Use Case Diagrams

 Sequence Diagrams

 State Chart Diagrams

 Activity Diagrams

Using these mentioned diagrams, we can show the entire system regarding the working of the
system or the flow of control and sequence of flow the state of the system and the activities
involved in the system.

4.2.1.1 CLASS DIAGRAM


A Class is a category or group of things that has similar attributes and common behavior. A
Rectangle is the icon that represents the class it is divided into three areas. The upper most
area contains name, the middle area contains the attributes and the lowest areas show the
operation. Class diagrams provides the representation that developers work from.
The classes in a Class diagram represent both the main objects, interactions in the
application and the classes to be programmed.

In the diagram, classes are represented with boxes which contain three parts:

1. The top part contains the name of the class. It is printed in bold and cantered, and the
first letter is capitalized.

2. The middle part contains the attributes of the class. They are left-aligned and the first
letter is lowercase.

3. The bottom part contains the methods the class can execute. They are also left-aligned
and the first letter is lower case. In the design of a system, a number of classes are
identified and grouped together in a class diagram which helps to determine the static
relations between those objects. With detailed modeling, the classes of the conceptual
design are often split into a number of subclasses.

14
Relationships: A relationship is general terms covering the specific types of logical
connections found on class and object diagrams. UML shows the following relationships:

1. Links: A Link is the basic relationship among objects.

2. Association: An association represents a family of links. An association can be


named and the ends of an association can be adorned with role names, ownership indicators,
Multiplicity, visibility, and other properties.

3. Aggregation: Aggregation is a variant of the "has a" association relationship;


aggregation is more specific than association. It is an association that represents a part whole
or part-of relationship. As a type of association, an aggregation can be named and have the
same adornments that an association can. In UML, it is graphically represented as a hollow
diamond shape on the containing class with a single line that connects it to the contained
class. The aggregate is semantically an extended object that is treated as a unit in many
operations, although physically it is made of several lesser objects.

4. Composition: Composition is a stronger variant of the "has a" association


relationship; composition is more specific than aggregation. Composition usually has a strong
lifecycle dependency between instances of the container class and instances of the contained
classes. The UML graphical representation of a composition relationship is a filled diamond
shape on the containing class end of the tree of lines that connect contained class(es) to the
containing class.

5. Generalization: The Generalization relationship ("is a") indicates that one of the two
related classes (the subclass) is considered to be a specialized form of the other (the super
type) and the super class is considered a 'Generalization' of the subclass. The UML graphical
representation of a Generalization is a hollow triangle shape on the super class end of the line
(or tree of lines) that connects it to one or more subtypes. The generalization relationship is

15
also known as the inheritance or "is a" relationship. Generalization can only be shown on
class diagrams and on Use case diagrams.

6. Realization: In UML modeling, a realization relationship is a relationship between


two model elements, in which one model element realizes (implements or executes) the
behavior that the other model element specifies. The UML graphical representation of a
Realization is a hollow triangle shape on the interface end of the dashed line (or tree of lines)
that connects it to one or more implementers. A plain arrow head is used on the interface end
of the dashed line that connects it to its users. Realizations can only be shown on class or
component

7. Dependency: Dependency is a weaker form of bond which indicates that one class
depends on another because it uses it at some point in time. One class depends on another if
the independent class is a parameter variable or local variable of a method of the dependent
class.

4.2.1.2 USE-CASE DIAGRAM

A Use-Case is a description of systems behavior from a understand point. For system


developer this is a valuable tool: it’s a tried-and-true technique for gathering system
requirements from a user’s point of view. That is important if the goal is to build a system
that real people can use. A little stick figure is used to identify an actor the ellipse represents
use-case.

Use cases
A use case describes a sequence of actions that provide something of measurable
value to an actor and is drawn as a horizontal ellipse.

16
Actors
An actor is a person, Organization, or external system that plays a role in one or more
interactions with your system. Actors are drawn as stick figures.

Associations
Associations between actors and use case are indicated in use case diagrams by solid
lines. An association exists whenever an actor is involved with an interaction described by a
use case. Associations are modeled as lines connecting use cases and actors to one another,
with an optional arrowhead on one end of the line. The arrowhead is often used to indicating
the direction of the initial invocation of the relationship or to indicate the primary actor
within the use case.

Use Case Relationships


Three relationships among use cases are used often in practice.

1. Include
2. Extend
3. Generalization
1.Include
In one form of interaction, a given use case may include another. Include is a directed
relationship between two use cases, implying that the behavior of the included use case is
inserted into the behavior of the including use case.
2. Extend:

In another form of interaction, a given use case (the extension) may extend another. This
relationship indicates that the behavior of the extension use case may be inserted in the
extended use case under some conditions. The notation is a dashed arrow from the extension
to the extended use case, with the label<<extend>>.

3. Generalization:

In the third form of relationship among use cases, generalization/specialization


relationship exists. A given use case may have common behaviors, constraints and
assumptions to the general use case. The notation is a solid line ending in a hollow triangle
drawn from the specialized to the more general use case.

17
4.2.1.3 STATE CHART DIAGRAM
At any given time, an object is in particular state. One way to characterize change in a
system is to say that its objects change the state in response to events and to time. The UML
State Diagram captures these kinds of changes it presents the states an object can be in along
with the transitions between the states, and shows the starting point and end point of a
sequence of state changes.

A Rounded Rectangle represents a state, along with the solid line and arrow head that
represents a transition. The arrow head points to the state being transition into. The solid
circle symbolizes starting point and the pulls eye that symbolizes the end point.

Donator will login to the app and provide food details like quantity, food prepared date and
time and then sends a request to the admin.

4.2.1.4 SEQUENCE DIAGRAM


In a functioning system objects interacts with one another and these interactions occur
over time. The UML Sequence Diagrams shows the time-based dynamics of the interaction.
The sequence diagrams consist of objects represented in the use always named rectangles (If
the name underlined), messages represented as solid line arrows and time represented as a
vertical progression.
Sequence diagrams describe interactions among classes in terms of an exchange of
messages overtime. It is an interaction diagram that emphasizes the time ordering of
messages. A narrow rectangle on an object lifetime represents activation an exchange of one
of that object operations. Messages are arrows that connect one.

4.2.1.5 ACTIVITY DIAGRAM


The state diagram shows the states of an object and represents activities as arrows
connecting the states. The Activity Diagram highlights the activities. Each activity is
represented by a rounded rectangle-narrower and more oval-shaped than the state icon. An
arrow represents the transition from the one activity to the next. The activity diagram has a
starting point represented by filled-in circle, and an end point represented by bull’s eye.

18
Activity diagram illustrates the dynamic nature of a system by modeling the flow of
control from activity to activity. An activity represents an operation on some class in the
system that results a change in the state of the system. Typically, activity diagram are used to
model workflow or business processes and internal operation. It is a special kind of statement
diagram that shows the flow from activity to activity within the system. Activity diagram
address the dynamic view of the system. The easiest way to visualize an Activity diagram is
to think of a flowchart of a code.

The flowchart is used to depict the business logic flow and the events that cause decisions
and actions in the code to take place. An Activity diagram represents the business and
operational workflow of a system.

An Activity diagram shows the overall flow of control.

• Initial node

• Activity final node

• Activity

• Flow/edge

• Fork

• Join

• Condition

• Decision

• Merge

• Partition

• Flow final

Action States and Activity States

Executable, atomic computations are called action states. An action state is represented using
a lozenge shape. Inside that state you may write any expression. Action states can’t be
decomposed. Furthermore, action states are atomic, meaning that events may occur, but the
work of the action states is not interrupted. Furthermore, activity states are not atomic,

19
meaning that may be interrupted. They take some duration to complete. However, there is no
notational distinction between action and activity state.

Graphical Representation

Transitions

When the action or activity of a state completes, flow of control passes immediately to the
next action or activity state. A transition is represented as a simple directed line.

Graphical Representation

Object

An object has state, behavior and identity. The structure and behavior of similar objects are
defined in their common class. Each object icon that is not named is referred to as a class
instance. The object icon is similar to a class icon except that the name is underlined.

Activity diagram can be used for:

 Modeling work flow by using activities.


 Modeling business requirements.
 High level understanding of the system’s functionalities.
 Investigating business requirements at a larger stage.
 Activity diagrams are used as the flowchart that consists of activities performed by
the system.
 It is used to visualize the flow of controls in a system, this is prepared to have an idea
of how the system will work when executed.

20
UML Diagrams:

a. Usecase Diagram:

21
b. Class Diagram:

c. State-chart Diagram:

22
5.IMPLEMENTATION AND RESULT

OTSUS THRESHOLDING:

In Computer vision and image processing, OTSU’S method, named after Nobuyuki otsu, is
used to perform automatic image thresholding. In the simplest form, the algorithm returns a
single intensity threshold that separate pixels into two classes, foreground and background.
This threshold is determined by minimizing intra-class intensity variance, or equivalently, by
maximizing inter-class variance. OTSU’s method is a one-dimensional discrete analog of
Fishers Discriminant Analysis, is related Jenks Optimization Method, and is equivalent to a
globally optimal K-means performed on the intensity histogram.

In Otsus Thresholding we convert an image into binary image by choosing an optimal


threshold. Here, the pixel values that are greater than the optimal threshold are converted to
white (255) whereas the pixel values that are less than the optimal threshold are converted to
black (0).

Optimal threshold is calculated as follows: The first step is to consider histogram of the
image. Histogram represents the intensities of all the pixels. Now we need to choose a
threshold value whose intra class variance is minimum or equivalently whose inter class
variance is maximum. Intra class variance is the variance between the pixels of the same
class. Whereas inter class variance is the variance between the classes. So, we need to
minimize intra class variance and maximize inter class variance.

Now we compute within class variance for all the threshold values. Threshold 2 implies that
out of all the thresholds bars present here, first 2 bars are put in the background class and rest
of all are placed in the foreground class. So, all the pixels with these 2 intensities are made
black and the rest are made white. Let us consider an example for threshold value 3. In order
to calculate within class variance, we need to compute weight, mean and variance for the
foreground class and background class. Weight is calculated as sum of the frequencies of the
intensities divided by total number of pixels.

23
That is how these are computed and within class variance is calculated as the weighted sum
of background and foreground variances

Advantages and disadvantages:

24
Water-shed segmentation:

It is the study of image processing, a water-shed is a transformation defined on a grayscale


image. The name refers metaphorically to a geological water-shed or drainage divide, which
separates adjacent drainage basins. The water-shed transformation treats the image it operates
upon like a topographic map, with the brightness of each point representing its height and
finds the lines that run along the tops of ridges. The image segmentation algorithms are
generally based on the two basic characteristics of the luminance: discontinuity and
similarity. Edge detection algorithms are based on the discontinuity. Similarly, the threshold
processing, region growing, regional separation and polymerization are based on similarity.
Watershed algorithm which is a mathematics morphological method for image segmentation
based on region processing, has many advantages. The result of watershed algorithm is global
segmentation, border closure and high accuracy. It can achieve one-pixel wide, connected,
closed and exact location of outline.

There are different technical definitions of a water-shed. In graphs, water-shed lines


may be defined on the nodes, on the edges, or hybrid lines on both nodes and edges. Water-
shed may also defined in the continuous domain. There are also many different algorithms to
compute water-sheds. Water-shed algorithm is used in image processing primarily for
segmentation purposes. The basic concept of watershed is based on visualizing a gray level
image into its topographical representation, which includes three basic notions: minima,
catchment basins and watershed lines.

1.Advantages and disadvantages:

25
Maximally Stable Extremal Region:

In computer vision, maximally stable extremal regions (MSER) are used as a method of


blob detection in images. This technique was proposed by Matas to find out correspondences
between image elements from two images with different viewpoints. This method of
extracting a comprehensive number of corresponding image elements contributes to the wide-
baseline matching, and it has led to better stereo matching and object recognition algorithms.

The concept more simply can be explained by thresholding. All the pixels below a given
threshold are 'black' and all those above or equal are 'white'. Given a source image, if a
sequence of thresholded result images  is generated where each image  corresponds to an
increasing threshold t, first a white image would be seen, then 'black' spots corresponding to
local intensity minima will appear then grow larger. These 'black' spots will eventually
merge, until the whole image is black. The set of all connected components in the sequence is
the set of all extremal regions. In that sense, the concept of MSER is linked to the one of
component tree of the image. The component tree indeed provides an easy way for
implementing MSER.

• MSER regions are connected areas characterized by almost uniform intensity,


surrounded by contrasting background.
• They are constructed through a process of trying multiple thresholds.
• The selected regions are those that maintain unchanged shapes over a large set of
thresholds.
• For each threshold, compute the connected binary regions.
• Compute a function, area A(i), at each threshold value i.
• Analyse this function for each potential region to determine those that persist with
similar function value over multiple thresholds.

Connected components:

Connected components, in a 2D image, are clusters of pixels with the same value, which are
connected to each other through either 4-pixel, or 8-pixel connectivity.

8- Connectivity:

8-connected pixels are neighbors to every pixel that touches one of their edges or corners.
These pixels are connected horizontally, vertically, and diagonally. In addition to 4-connected
pixels, each pixel with coordinates (x + or – 1, y + or – 1) is connected to the pixel at (x, y).

Extremal regions:
Extremal regions in this context have two important properties, that the set is closed under,

• Continuous transformation of image coordinates. This means it is affine invariant and


it doesn’t matter if the image is warped or skewed.

26
• Monotonic transformation of image intensities. The approach is of course sensitive to
natural lighting effects as change of day light or moving shadows.

Advantages of MSER:

• Covariance to adjacency preserving (continuous)transformation T: D->D on the


image domain
• Stability: only regions whose support is nearly the same over a range of thresholds is
selected.
• Multi-scale detection without any smoothing involved, both fine and large structure is
detected.
Note, however, that detection of MSERs in a scale pyramid improves repeatability,
and number of correspondences across scale changes.
• It is able to accurately detect text in different sizes, styles, colors.
• It can detect text independent of perspective and rotation.
• Good performance is obtained.

Disadvantages of MSER:

• It is Sensible against blur.


• No binary image as an output (thresholding for OCR still needed).

Applications:

27
Code:

28
29
30
31
32
33
34
35
36
6.Feature extraction
What is feature extraction?
In machine learning, pattern recognition and in image processing, feature extraction starts
from an initial set of measured data and builds derived values (features) intended to be
informative and non-redundant, facilitating the subsequent learning and generalization steps,
and in some cases leading to better human interpretations. Feature extraction is related to
dimensionality reduction.
When the input data to an algorithm is too large to be processed and it is suspected to be
redundant, then it can be transformed into a reduced set of features (also called as feature
factor). Determining a subset of the initial features is called feature selection. The selected
features are expected to contain the relevant information from the input data, so that the
desired task can be performed by using this reduced representation instead of the complete
initial data.

Feature extraction using SURF:


In computer vision, speed up robust features (SURF) is a patented local feature detector and
descriptor. It can be used for tasks such as object recognition, image registration,
classification, or 3D reconstruction. It is partly inspired by the scale-invariant feature
transform (SIFT) descriptor. The standard version of SURF is several times faster than SIFT
and claimed by its author to be more robust against different image transformations than
SIFT.
To detect interest points, SURF uses an integer approximation of the determinant of
Hessian Blob detector, which can be computed with 3 integer operations using a precomputed
integral image.
SURF descriptors have been used to locate and recognize objects, people or faces, to
reconstruct 3D scenes, to track objects and to extract points of interest.
SURF was first published by Herbert Bay, Tinne Tuytelaars, and Luc Van Gool, and
presented at the 2006 European Conference on computer vision. An application of the
algorithm is patented in the United States. An “upright” version of SURF (called U-SURF) is
not invariant to image rotation and therefore faster to compute and better suited for
application where the camera remains more or less horizontal.
The image is transformed into coordinates, using the multi-resolution pyramid technique,
to copy the original image with pyramidal Gaussian or Laplacian pyramid shape to obtain an
image with the same size but with reduced bandwidth. This achieves a special blurring effect
on the original image, called Scale-Space and ensures that the points of interest are scale
invariant.

Algorithm:
The SURF algorithm is based on the same principles and steps as SIFT but details in each
step are different. The algorithm has three main parts: interest point detection, local,
neighborhood description, and matching.

37
1.Detection:
SURF uses square shaped filters as an approximation of gaussian smoothing (SIFT
approach uses cascaded filters to detect Scale-invariant characteristic points, where the
difference of gaussians (DoG) is calculated on rescaled images progressively). Filtering the
image with a square is much faster if the integral image is used:
x y
S (x, y) =∑ ∑ I (i , j)
i=0 j=0

The sum of the original image with in a rectangle can be evaluated quickly using the integral
image, requiring evaluation at the rectangles four corners.
SURF uses a blob detector based on the Hessian matrix to find points of interest. The
determinant of the Hessian matrix is used as a measure of local change around the point and
points are chosen where this determinant is maximal. In contrast to the Hessian-Laplacian
detector by Mikolajczyk and Schmid, SURF also uses the determinant of the Hessian for
selecting the scale, as is also done by Lindeberg. Given a point p= (x, y) in an image I, the
Hessian matrix H(p, σ) at point p and scale σ, is:

H(p,σ )= ( LLyxxx (( pp ,, σ)σ ) Lyy ( p,σ) )


L xy ( p , σ )

where Lxx etc. is the convolution of the second-order derivative of gaussian with the


image I(x, y) at the point p.
The box filter of size 9×9 is an approximation of a Gaussian with σ=1.2 and represents the
lowest level (highest spatial resolution) for blob-response maps.
2.Scale-space representation and location of points of interest
Interest points can be found at different scales, partly because the search for correspondences
often requires comparison images where they are seen at different scales. In other feature
detection algorithms, the scale space is usually realized as an image pyramid. Images are
repeatedly smoothed with a Gaussian filter, then they are subsampled to get the next higher
level of the pyramid. Therefore, several floors or stairs with various measures of the masks
are calculated:
𝞼approx. = current filter size *(base filter scale / base filter size)

The scale space is divided into a number of octaves, where an octave refers to a series of
response maps of covering a doubling of scale. In SURF, the lowest level of the scale space is
obtained from the output of the 9×9 filters.
Hence, unlike previous methods, scale spaces in SURF are implemented by applying box
filters of different sizes. Accordingly, the scale space is analyzed by up-scaling the filter size
rather than iteratively reducing the image size. The output of the above 9×9 filter is
considered as the initial scale layer at scale s =1.2 (corresponding to Gaussian derivatives

38
with σ = 1.2). The following layers are obtained by filtering the image with gradually bigger
masks, taking into account the discrete nature of integral images and the specific filter
structure. This results in filters of size 9×9, 15×15, 21×21, 27×27,.... Non-maximum
suppression in a 3×3×3 neighborhood is applied to localize interest points in the image and
over scales. The maxima of the determinant of the Hessian matrix are then interpolated in
scale and image space with the method proposed by Brown, et al. Scale space interpolation is
especially important in this case, as the difference in scale between the first layers of every
octave is relatively large.

3.Descriptor
The goal of a descriptor is to provide a unique and robust description of an image feature,
e.g., by describing the intensity distribution of the pixels within the neighbourhood of the
point of interest. Most descriptors are thus computed in a local manner, hence a description is
obtained for every point of interest identified previously.
The dimensionality of the descriptor has direct impact on both its computational complexity
and point-matching robustness/accuracy. A short descriptor may be more robust against
appearance variations, but may not offer sufficient discrimination and thus give too many
false positives.
The first step consists of fixing a reproducible orientation based on information from a
circular region around the interest point. Then we construct a square region aligned to the
selected orientation, and extract the SURF descriptor from it.

4.Orientation assignment
In order to achieve rotational invariance, the orientation of the point of interest needs to be
found. The Haar wavelet responses in both x- and y-directions within a circular
neighbourhood of radius 6s around the point of interest are computed, where s is the scale at
which the point of interest was detected. The obtained responses are weighted by a Gaussian
function centered at the point of interest, then plotted as points in a two-dimensional space,
with the horizontal response in the abscissa and the vertical response in the ordinate. The
dominant orientation is estimated by calculating the sum of all responses within a sliding
orientation window of size π/3. The horizontal and vertical responses within the window are
summed. The two summed responses then yield a local orientation vector. The longest such
vector overall defines the orientation of the point of interest. The size of the sliding window
is a parameter that has to be chosen carefully to achieve a desired balance between robustness
and angular resolution.

5.Descriptor based on the sum of Haar wavelet responses:


To describe the region around the point, a square region is extracted, centered on the interest
point and oriented along the orientation as selected above. The size of this window is 20s.
The interest region is split into smaller 4x4 square sub-regions, and for each one, the Haar
wavelet responses are extracted at 5x5 regularly spaced sample points. The responses are
weighted with a Gaussian (to offer more robustness for deformations, noise and translation).

39
6.Matching
By comparing the descriptors obtained from different images, matching pairs can be found.

40
7.Testing and validation

41
42
Conclusion
From the results shown above, the given input resulted in accurate results for all of the three
methods. The main motive of all the three segmentation methods i.e., Otsu's thresholding,
Watershed segmentation and MSER is to segment the image and display the tumor region.
The foreground region which is being depicted on the resultant image is the tumor portion
that we are trying to extract. Then, Normalized cross-correlation is computed between the
resultant segmented image and the original MRI image. If the value is close to 1, then we can
conclude that the tumor is extracted efficiently.
After evaluating the normalized cross-correlation values for all of the three methods, MSER
is proved to be the best segmentation method with a value of 0.91. Now, feature extraction is
done to extract the relevant features from the image. The method that is used is Speeded Up
Robust Features (SURF) which extracts the useful information from the image and returns
features in the form of descriptors and these descriptors are used as features. Feature
extraction is followed by classification where feature set is given as the input to the classifier
to predict whether the extracted tumor is benign or malignant. Now, the feature set is passed
to the Random Forest Classifier which constructs a model consisting of 100 decision trees by
selecting random samples with replacement. If the classifier predicts the class as -1, then the
tumor is a benign tumor or if the class is +1, then the tumor is a malignant tumor. The
accuracy that is obtained by using Random Forest Classification is 95 percent which resulted
in one false prediction out of 20 testing samples.

43
44
45

You might also like