You are on page 1of 52

Breast tumor detection by

watershed and active contour


method

A dissertation Submitted in Partial Fulfilment of Requirement for the Degree of Bachelor in


Electrical and Electronic Engineering

Submitted By:

Arfa Abdouraman 160021180


Yshaga Bouba 160021178
Wirdzerem Usmaila Lanyuy 160021179

Supervised By:

Dr. Md. Taslim Reza


Associate Professor
Department of Electrical and Electronic Engineering
Islamic University of Technology (IUT)
Gazipur-1704, Bangladesh
March 2021

Page | 1
Breast tumor detection by
Watershed and active contour
method
Submitted By:

Arfa Abdouraman 160021180


Yshaga Bouba 160021178
Wirdzerem Usmaila Lanyuy 160021179

Supervised By:

Dr. Md. Taslim Reza


Associate Professor
Department of Electrical and Electronic Engineering
Islamic University of Technology (IUT)
Gazipur-1704, Bangladesh
March 2021

A thesis submitted to Islamic University of Technology in partial fulfilment


of the requirements for the degree of

B.Sc. in Electrical and Electronic Engineering


Department of Electrical and Electronic Engineering
Islamic University of Technology
March 2021
A dissertation on

2 | Page
Breast tumor detection by
Watershed and active contour
method

Approved by:

----------------------------------------------------------------
Prof. Dr. Md. Ruhul Amin
Head of the Department of
Electrical and Electronic Engineering
Islamic University of Technology (IUT)
Gazipur-1704, Bangladesh

Supervised By:

-----------------------------------------------------------

Dr. Md. Taslim Reza


Associate Professor
Department of Electrical and Electronic Engineering
Islamic University of Technology (IUT)
Gazipur-1704, Bangladesh

3 | Page
DECLARATION OF CANDIDATES

It is hereby to declare that this thesis or any part of it has not been submitted elsewhere for the
award of any degree or diploma.

(signature of candidate) (signature of candidate)


Arfa Abdouraman Yshaga Bouba
Student ID: 160021180 student ID: 160021178
Academic: 2017-2021 Academic: 2017-2021

(signature of candidate)
Wirdzerem Usmaila Lanyuy
Student ID: 160021179
Academic: 2017-2021

4 | Page
DEDICATION

We would like to dedicate this thesis to our family and teachers who
supported us through both good and hard times. They always motivate us to move
forward.

5 | Page
Table of Contents

DEDICATION ................................................................................................... 5
LIST OF TABLES .............................................................................................. 8
LIST OF FIGURES ............................................................................................ 8
LIST OF ABBREVIATIONS ............................................................................. 9
ACKNOWLEDGEMENTS ...............................................................................10
ABSTRACT ......................................................................................................11
CHAPTER 1.....................................................................................................12
1.1 Introduction .................................................................................................12
1.2-Significance of the research: ........................................................................13
1.3-Challenges: ..................................................................................................14
1.4-Thesis objective: ..........................................................................................15
CHAPTER 2: ...................................................................................................18
LITERATURE REVIEW ..................................................................................18
2.1- Introduction ................................................................................................18
2.2- Types Of Tumor .........................................................................................18
2.2.1- Cancer Types Based On Cell Genesis ......................................................19
2.2.2- Cancer Grading And Staging ...................................................................19
A- Staging: ........................................................................................................19
B- Grading: ........................................................................................................20
2.3- Image Types And Processing Techniques ...................................................21
2.4- Image Segmentation Methods .....................................................................22
2.5- Software .....................................................................................................23
2.6- Related Works ............................................................................................24
CHAPTER 3: ...................................................................................................26
METHODOLOGY ............................................................................................26
3.1- Introduction ................................................................................................26

6 | Page
3.2- Watershed Method ......................................................................................26
3.3- Watershed Drawback ..................................................................................29
3.4- Active Contour Method ..............................................................................29
3.4.1- Deriving Pattern .......................................................................................30
3.4.2- Convergence Criteria ...............................................................................31
3.4.3- Gradient Vector Flow ..............................................................................31
3.4.4- The Snake Model .....................................................................................33
3.4.5- Balloon Model .........................................................................................34
CHAPTER 4: ...................................................................................................37
IMPLEMENTATION AND RESULT ANALYSIS ..........................................37
4.1- Introduction ................................................................................................37
4.2- Implementation Of Watershed Method .......................................................37
4.2.1- Watershed And Thresholding ..................................................................37
4.2.2- Thresholding ............................................................................................37
4.2.3-Watershed .................................................................................................38
4.2.4- Implementation Of Active Contour Method .............................................40
CHAPTER 5: ...................................................................................................43
CONCLUSION .................................................................................................43
Introduction .......................................................................................................43
Conclusion .........................................................................................................43
Future Work ......................................................................................................44
References .........................................................................................................45
APPENDIX .....................................................................................................48
MATLAB Code (Watershed) .............................................................................48
MATLAB Code (Active Contour) .....................................................................50

7 | Page
LIST OF TABLES
Table 2.1: Stages on Cancer………………………………………………………20

LIST OF FIGURES
Figure 2.1 …………………………….…………………………….………….….22

Figure 3.1 ………………………………………….……………… …………..…27

Figure 3.2 …………………………………………….…………………………..28

Figure 3.3 ……………………………………………….………… ……………..33

Figure 3.4 …………………………………………………..……………….…….34

Figure 3.5 …………………………………………….…………………….……..36

Figure 3.6 …………………………………………….…………………….……..37

Figure 4.1 ………………………………………….…….………………………..39

Figure 4.2 ………..………………………………….…………………………….39

Figure 4.3 ……..………………………………………….……………………….40

Figure 4.4 …………..……………………………………….…………………….41

Figure 4.5 ……………..…………………………………….…………………….42

Figure 4.6 ………………………..…………………………….………………….43

8 | Page
LIST OF ABBREVIATIONS

IUT: Islamic University of Technology

EEE: Electrical and Electronic Engineering

US: Ultrasound

MRI: Magnetic resonance imaging

CT-Scan: computerized tomography (CT) scan

BUS: Breast Ultrasound

9 | Page
ACKNOWLEDGEMENTS
First, we thank Allah (SWT) for enabling and giving the strength to
conduct this research properly. We are highly grateful for having the opportunity to
work out this thesis under the supervision of Dr. Md. Taslim Reza, assistant
professor in the department of EEE at IUT, Gazipur, Bangladesh. We express our
sincere thanks and deepest sense of gratitude to his guidance, constant support and
limitless encouragement. He truly inspired us to be genuine scientists and conduct
this research in a proper constructive way.

Secondly, we would like to thank all the faculty members of EEE Dept,
IUT for their continuous support and encouragement and cooperation.

Finally, Thanks to the fellow members of our group for going through
the entire work as a team.

10 | Page
ABSTRACT
In this study, we made use of the watershed and the active contour model
method to overcome the natural properties of ultrasound (US) images, and tissue-
related textures, to segment the breast tumors precisely. These methods will allow
us to detect even the smallest defects in the ultrasound (US) images. The
determination of the real tumor boundary was done with the help of our written codes
and software simulation tools in MATLAB. Ultrasound (US) images usually have
characteristics; a low signal to ratio, blurry boundary, and low contrast making
Image segmentation a difficult task. The watershed and the active contour model
method were both operated on the B-mode ultrasound (US) images for studying its
characteristics and evaluating its performance. The results demonstrate that the
Image processing technique proposed methods can model the B-mode US images
well, be robust to noise, and segment the B-mode US images accurately and reliably.
Our objective in this study was to determine the boundary of the tumor in a medical
B-mode Ultrasound (US) image using the watershed and Active contour method,
and later analyze the results yielded by both methods and finding their percentage
error of segmentation.

11 | Page
CHAPTER 1
Introduction

1.1-INTRODUCTION
Breast tumor or cancer is the most common sort of cancer among women and
therefore is the second most common cancer within the world (an estimated 1 152
161 new cases per year), with nearly 1.7 million new cases diagnosed in 2012,
representing about 25 percent of all cancers in women [5]. Breast Tumor is described
as abnormal development of tissues in the breast and affects the humans badly
because of the abnormal growth of cells within the breast. Signs of breast tumor may
include a lump in the breast, a change in breast shape, dimpling of the skin, Redness
or flaky skin in the nipple area, Nipple discharge other than breast milk, including
blood etc. and is commonly cause by Ionizing radiation exposure from medical
treatment such as X-rays, particularly during puberty which increases the risk of
breast cancer, even at low doses. The two types of breast tumors have been identified
as Benign (non-cancerous) tumors and Malignant (cancerous) tumors. Benign
tumors are less harmful and slow growing than malignant tumors whereas malignant
tumors are fast developing and harmful. Breast cancer is a form of glandular tissue
cancer that usually starts in the breast's milk duct. It begins with modifications in the
Deoxyribonucleic Acid (DNA). The cell of a mutant acts by splitting without control
and creating a mass of cells abnormally. Earlier, these abnormal changes have cost
lives because they were not detected early enough, but nowadays with the
advancement of computer technologies, people have developed several methods that
deal with it from the early stages of development. To replace the hand drawing

12 | Page
estimation made by radiologists, engineers have tried to bring an automated solution
through image processing techniques. Some preprocessing methods are found to be
useful in order to set the image, among those findings, segmentation techniques
stand out due their results, and easy applicability. Segmentation is a computerized
algorithm applied to separate some pixels of an image from another.

Medical imaging techniques used on B-mode ultrasound images such as


Watershed and Active contour provide a clear visual representation of the interior of
the human body and the detected tumor, for medical purposes. Compared to other
image processing techniques like MRI and CT-scan, B-mode ultrasound images are
relatively easy to handle because of its distinct feature of providing greater contrast
of the tumor portion (infected area) in the images. To these days, several techniques
have found their use, but here we are interested in how Active contour and
Watershed method can be used to further improve the existing models on
Ultrasound images (US).

In the following chapters we will describe in detail the methodology used,


background of identification of breast tumor using image processing (Chapter 3.)
and. Chapter 2 presents the related works.

1.2-Significance of the research:


Tumor detected during the early stages is easier to cure than that detected
during the later stages. Moreover, the effect after cancer treatment like surgery and
chemotherapy really takes a toll on the patient. Therefore, the first crucial step
towards treatment of breast cancer is the early detection of the cancer.

13 | Page
One important factor after an early cancer detection is the determination
of the shape of the cancer which could give us some information that will help to
determine the risk of cancer. In our research, we will be using segmentation
techniques on MRI to detect the shape of the tumor.

1.3-Challenges:
Computers continue to struggle with image segmentation. Because of the
wide range of object shapes and image quality, this is a difficult task. We may
segment a human body in various poses (i.e., walking, jumping, sitting) for a person
or for different populations as an example of shape heterogeneity (i.e., tall ones or
short ones). We should look at medical images as an example of image quality
variations. Noise and sampling items added during the collection process often
corrupt medical images. Furthermore, low contrast between different anatomical
structures, or even worse, when different structures appear similar in the picture,
may pose significant challenges. Traditional edge detection-based segmentation
techniques, in particular, fail to achieve the desired segmentation results. Several
models have been implemented as priors for image segmentation to address these
issues, with the ideal segmentation map limited by the manifold of appropriate
shapes of the object of interest. Segmentation becomes more resilient to noise in this
way, and using the object's global form can also reduce the uncertainty of non-visible
boundaries between different artifacts due to similar tissue properties. Different
models are studied in order to be able to explain differences in the shape of the same
object type. To this end, statistical models for learning prior information from a
training collection of shape instances have been proposed. These models describe
shape variation in a global or local manner, using linear or non-linear

14 | Page
representations. One of the most widely used statistical models in the computer
vision community is the active form model (ASM) / point distribution model (PDM).
It has seen a lot of use in image segmentation. As a linear model, however, it is
unable to capture non-linear shape variations, such as those found in articulated
objects. Furthermore, this global model is lacking in versatility.

Segmentation can be formulated as estimating the model parameters in an


observed image, where visual support and shape priors are combined in a cost
function, given the statistical shape model. Another problem is the inference method,
which aims to find the best solution, since the quality of the solution is determined
by the optimization algorithm. For the optimization of continuous objective
functions, variational methods and their derivative-driven minimization are among
the current optimization methods. These methods, on the other hand, tend to
converge to local minima since the derivative must be computed, which limits their
application to differentiable objective functions. On the other hand, discrete Markov
random field (MRF) optimization approaches have made substantial progress in
achieving global minimums under certain constraints. However, since these
approaches are focused on local interactions, incorporating global shape priors is
difficult.

1.4-Thesis objective:
Digital images are becoming increasingly relevant in our lives as a result
of major advancements in imaging devices and technologies. A picture is a numeric
representation of a real-world scene that can be saved, distributed, and analyzed
later. The old adage "a picture is worth a thousand words" refers to an image's ability

15 | Page
to convey a lot of details in a short amount of time. Images are used in computer
vision to perform perception tasks such as object detection (tumor), tracking, and
recognition. Photos are obtained in the medical field using different modalities such
as ultrasound, MRI, and CT scans. Allowing doctors to make more precise diagnoses
by having vital access to the interior of the human body. The extraction of valuable
information from photographs has become a critical activity in both domains. While
humans can do this task naturally and easily (at least in the case of 2D natural scene
interpretation), it is still difficult for a computer to do so. A fundamental low to mid-
level vision task for interpreting an image or understanding a scene is partitioning
the image into a variety of meaningful bits, which can provide clues to questions
like: what and where are the tumor's components? This leads us to image
segmentation, which is one of the most important tasks in computer vision. Since an
image is made up of pixels, the segmentation problem can be thought of as a labeling
problem in which each pixel is assigned a label representing a specific component
in the scene. Alternatively, the process of segmentation can be thought of as
removing the boundaries between different objects, and then partitioning the image
into useful regions based on the boundaries. Object detection (e.g., pedestrian
detection, object localization in satellite images), recognition (e.g., face recognition),
occlusion boundary estimation within motion or stereo systems, image compression,
image editing, and image retrieval are all examples of tasks where segmentation has
been used. In summary, image segmentation is now widely used in a variety of
clinical settings, including anatomical structure analysis, pathology localization,
tissue volume quantification, diagnosis/treatment preparation, and computer-
assisted surgery. As can be shown, the precision of the segmentation is critical in
these applications. The more precise the segmentation, the more dependable and
effective the vision or medical analytical task would be. Manual segmentation by
experts can provide the best and most accurate results in the majority of cases, but it
16 | Page
is time-consuming and repetitive. Manual segmentation is often subject to operator
variation. These facts inspire researchers to build automated segmentation methods
that can handle large datasets while maintaining manual segmentation accuracy.

17 | Page
CHAPTER 2:
LITERATURE REVIEW

2.1- INTRODUCTION
In this section, a detail review is provided on the topics listed below

i. Types of tumors (Breast tumor precisely)


ii. Image types and Processing techniques
iii. Image Segmentation methods
iv. Software
v. Related works

In the following paragraph, we will list out some important review points regarding
the topics listed above related to our study.

2.2- TYPES OF TUMOR


Benign tumors:
Benign tumors are abnormal growths that are no longer under normal
regulation. They grow slowly, resemble normal cells, and are not cancerous. They
grow only in one place and cannot spread or invade other parts of the body. They
can however become harmful if they go on vital organs. Examples of benign tumors
include skin moles, lipomas, hepatic adenomas.

Page | 18
Malignant Tumors:
These tumors are composed of embryonic, primitive, or poorly differentiated
cells. They grow in an exceedingly rapid, disorganized manner that is harmful to
the body. They can also invade surrounding tissues and are become metastatic,
initiating the growth of comparable tumors in distant organs.

2.2.1- Cancer Types Based on Cell Genesis


Cancers can be classified based on cell origin.
• Carcinomas, the most common types of cancer, arise from the cells that cover
external and internal body surfaces. Lung, breast, and colon are the most
commonly found cancers in the World.

• Sarcomas are cancers arising from cells found in the supporting tissues of the
body such as bone, cartilage, fat, connective tissue, and muscle.

• Lymphomas are cancers that arise in the lymph nodes and tissues of the body's
immune system.

• Leukemias are cancers of the immature blood cells that grow in the bone marrow
and tend to accumulate in large numbers in the bloodstream.

2.2.2- Cancer Grading and Staging


A- Staging:
Cancer staging describes the extent of an individual's cancer based on:
1. The site of the primary tumor.
2. Its size
3. How far it has invaded into local tissues and structures

19 | Page
4. Whether it has spread to regional lymph nodes.
5. Whether it has metastasized to other regions of the body.

Table 2.1: Stages of Cancer

Stage Meaning
Abnormal cells are present but have not spread to
Stage 0 nearby tissue. Also called carcinoma in situ
(CIS). CIS is not cancer, but it may become
cancer
Cancer is present. The higher the number, the
Stage I, II, and III larger the cancer tumor and the more it has
spread into nearby tissues.
Stage IV The cancer has spread to distant parts of the
body.

B- Grading:
The microscopic appearance of cancer indicates its likely behavior and its
responsiveness to treatment.
• Poorly differentiated cancers have highly abnormal cell appearance and large
numbers of dividing cells and tend to grow more quickly, spread to other organs
more frequently, and be less responsive to therapy than cancers whose cells have a
more normal appearance.

• Based on these differences in microscopic appearance, doctors assign a numerical


"grade" to most cancers.

20 | Page
• A low number grade (grade I or II) refers to cancers with fewer cell abnormalities
than those with higher numbers (grade III, IV).

2.3- IMAGE TYPES AND PROCESSING TECHNIQUES


Image processing is a method to perform some operations on an image, in
order to get an enhanced image or to extract some useful information from it. It is a
type of signal processing in which input is an image and output may be image or
characteristics/features associated with that image. Nowadays, image processing is
among rapidly growing technologies. It forms a core research area within
engineering and computer science disciplines too.

Image processing basically includes the following three steps:

● Importing the image via image acquisition tools;


● Analyzing and manipulating the image;
● Output in which result can be altered image or report that is based on image
analysis.

There are two types of methods used for image processing namely, analogue
and digital image processing. Analogue image processing can be used for the hard
copies like printouts and photographs. This study mostly focuses on the digital
Image processing techniques. Digital image processing techniques help in
manipulation of the digital images by using computers. The three general phases that
all types of data have to undergo while using digital technique are pre-processing,
enhancement, and display, information extraction.

21 | Page
2.4- IMAGE SEGMENTATION METHODS
Image Segmentation is the process by which a digital image is partitioned
into various subgroups (of pixels) called Image Objects, which can reduce the
complexity of the image, and thus analyzing the image becomes simpler.

Figure 2.1: Image Segmentation process [25].

There are many different methods when it comes to Image segmentation.


Image Segmentations methods include.

1. Threshold Method
2. Edge Based Segmentation
3. Region Based Segmentation
4. Clustering Based Segmentation
5. Active Contour Method
6. Watershed Based Method
7. Artificial Neural Network Based Segmentation

22 | Page
In the following paragraphs a brief review will be provided on the
Watershed and Active Contour Method relating to our works.

2.5- SOFTWARE
The software used in this thesis project was MATLAB.

MATLAB is a high-performance language for technical computing. It


integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include:

● Math and computation


● Algorithm development
● Modeling, simulation, and prototyping
● Data analysis, exploration, and visualization
● Scientific and engineering graphics
● Application development, including Graphical User Interface building

MATLAB is an interactive system whose basic data element is an array that


does not require dimensioning. This allows you to solve many technical computing
problems, especially those with matrix and vector formulations, in a fraction of the
time it would take to write a program in a scalar noninteractive language such as C
or Fortran. The name MATLAB stands for matrix laboratory.

MATLAB is widely used as a computational tool in Image and Video


Processing.

23 | Page
In MATLAB a digital image is represented as:

𝑓(1, 1) 𝑓 (1, 2) … 𝑓(1, 𝑁)


𝑓(2, 1) 𝑓 (2, 2) … 𝑓(2, 𝑁)
𝑓 (𝑥, 𝑦) = [ ]
⋮ ⋮ ⋮
𝑓 (𝑀, 1) 𝑓 (𝑀, 2) … 𝑓 (𝑀, 𝑁)
Image can be read by using the “Imread” command, displayed with the
“imshow” command.

MATALB contains a vast variety of functions to compute, analyze and


process inputs images to obtain the desired results. It is widely used in Image
processing of digital Images such as Ultrasound Images making use of their pixel
value in order to detect tumor or infected area.

2.6- RELATED WORKS


Many researches have been carried out in the past using different methods of
Image Processing such as Threshold Method, Edge Based Segmentation, Region
Based Segmentation, Clustering Based Segmentation etc. Some of these researches
where;

● Watershed Segmentation For Breast Tumor In 2-D Sonography By Yu-


Len Huang And Dar-Ren Chen

24 | Page
Department of Computer Science and Information Engineering, Tunghai University,
Taichung, Taiwan; and Department of General Surgery, China Medical College &
Hospital, Taichung, Taiwan
(Received 13 August 2003; revised 27 November 2003; in final form 9 December
2003)
● 3-D Breast Ultrasound Segmentation Using Active Contour Model By
Dar-Ren Chen, Ruey-Feng Chang, Wen-Jie Wu, Woo Kyung Moon And
Wen-Lin Wu

Department of Computer Science and Information Engineering, National Chung


Cheng University, Chiayi, Taiwan; Department of General Surgery, China Medical
College & Hospital, Taichung, Taiwan; and Department of Diagnostic Radiology,
College of Medicine, Seoul National University Hospital, Seoul, Korea

(Received 5 July 2002; revised 23 January 2003; in final form 12 February 2003)

25 | Page
CHAPTER 3:
METHODOLOGY

3.1- INTRODUCTION
This thesis is entirely based on watershed method and active contour method.
Watershed is defined as a region that assists in draining water (mostly rainwater)
into a river or a creek. It is an area of high ground through which water flows into
the river or creek. In image processing watershed is the technique of transforming
the image as a topographic map, with the intensity of each pixel represented as a
height. For example, dark areas can be intuitively considered to be ‘lower’ in height,
and bright areas can be considered to be ‘higher’, acting as hills or as a mountain
ridge. On the other hand, Active contour is a type of segmentation technique which
can be defined as use of energy forces and constraints for segregation of the pixels
of interest from the image for further processing and analysis. Contour is a collection
of points that undergoes an interpolation process. The interpolation process can be
linear, splines and polynomial which describes the curve in the image.

3.2- WATERSHED METHOD


Watershed is a ridge approach, also a region-based method, which follows the
concept of topological interpretation. Based on this 3D representation which is
usually followed for Earth landscapes, the watershed transform decomposes an

26 | Page
image into regions that are called “catchment basins”. For each local minimum, a
catchment basin comprises all pixels whose path of steepest descent of gray values
terminates at this minimum.

In a simple way of understanding, the algorithm considers the pixels as a


“local topography” (elevation), often initializing itself from user-defined markers.
Then, the algorithm defines something called “basins” which are the minima points
and hence, basins are flooded from the markers until basins meet on watershed lines.
The watersheds that are so formed here, they separate basins from each other. Hence
the picture gets decomposed because we have pixels assigned to each such region or
watershed.

Figure 3.1: watershed concept [25]

27 | Page
The watershed segmentation converts the 2D images into 3D images based
on darkness of the images. So, after that we will get a 3D topographical image which
will have a certain depth which will be called Catchment Basins. This process will
flood the catchment basins according to the deepness. when the flooding will reach
on edge of a catchment basin there will be a line on edge of the basin. The process
will continue and each time a separate boundary will be created automatically.
Figure 4.1 shows the flooding of the catchment basin.

Here is the flow chart of the whole process:

Figure 3.2: Flow chart of watershed method

28 | Page
Firstly, if the given image is in RGB, we need to convert it to Grayscale image.
Then we will use a median filter. The median filter estimates the gray-level value,
with particular success in the presence of long-tailed noise. After using the median
filter, we need to enhance the contrast as we will need it in future steps. The obtained
Grayscale image will be converted to a binary image. Then we transport the image
into distance form, that is called distance transform. At this moment we will select
automatically the more rigid areas of the image which are usually dark. This process
will sort out the biggest connected regions and extract it from the image and we will
get our desired area.

3.3- WATERSHED DRAWBACK


The main drawback of this method is the over-segmentation due to the
presence of many local minima. To decrease the effect of severe over-segmentation,
marker-controlled by the watershed transformations have been proposed. These are
robust and flexible methods for segmenting objects with closed contours. If the
boundaries don’t look clearly the ridges between locate and marker are differentiated
by this method.

3.4- ACTIVE CONTOUR METHOD


For the segmentation technique in image processing, different models of
active contours have been adopted, those are: the snake model, Balloon model
Gradient Vector Flow, Geodesic contours, etc.

29 | Page
3.4.1- DERIVING PATTERN
Active contour in an energy-driven process. There is an internal energy force which
is a weighted sum of first, and second order derivative along the line of the curve to
be fitted. It was written as [1] (Toennies)

𝟏 𝝏𝒓(𝒔) 𝝏𝟐 𝒓(𝒔)
𝑬𝒊𝒏𝒕𝒆𝒓𝒏𝒂𝒍 (𝒓(𝒔)) = 𝒘𝟏 ( ) + 𝒘𝟐
𝝏𝒔 𝝏𝒔 𝝏𝒔𝟐
[2]

The first derivative (elasticity) is like we have a rubber that we have to put around
some pins, it is happening due to the elastic force applied. The second derivative
term shows the range of force being applied on the rubber. In addition, we have
something called as external energy written as:

𝐸𝑒𝑥𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠 )) = −‖∇𝑓(𝑟(𝑠))‖


[2]

This energy is the first derivative of the intensity of the image. Overall, the
standard gradient of the image is used to develop this energy. So, to fulfill the
objective of alignment both internal and external energy are summed then integrated
over the whole length of the curve. This total equation is written as:

1
∫ 𝐸𝑖𝑛𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠 )) + 𝐸𝑒𝑥𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠 ))𝑑𝑠
0
[1]

30 | Page
3.4.2- CONVERGENCE CRITERIA
Given some initial points the main objective is to minimize internal and
external so they help minimizing the total energy which in turn help fit the
boundaries. To minimize the whole equation, they [2] have established the following
equation

𝟏 𝝏𝒓(𝒔) 𝟏 𝝏𝟐 𝒓(𝒔)
𝒘𝟏 ( ) + 𝒘𝟐 𝟐 ( ) + 𝛁𝑬𝒆𝒙𝒕𝒆𝒓𝒏𝒂𝒍 (𝒓(𝒔)) = 𝟎
𝝏𝒔 𝝏𝒔 𝒅𝒔 𝝏𝒔𝟐
[1]

3.4.3- GRADIENT VECTOR FLOW


Xu and Prince developed the Gradient Vector Flow (GVF) model to expand
the image force's capture range, and they applied it to subjective contours without
overwhelming the contours. A gradient vector field v(x) = v (x1, x2) = [u (x1, x2)
v(x1, x2)] [1] (Toennies) in a 2D image with locations x = (x1, x2) is computed by
minimizing [1]. Mathematically it is written as:

𝝏𝒖 𝟐 𝝏𝒖 𝟐 𝝏𝒗 𝟐 𝝏𝒗 𝟐
∬ 𝝀 [( ) + (( ) + ( ) + ( ) )] + ‖𝛁𝒇‖𝟐 ‖𝒗 − 𝛁𝒇‖𝟐 𝒅𝒙𝟏 𝒅𝒙𝟐
𝝏𝒙𝟏 𝝏𝒙𝟐 𝝏𝒙𝟏 𝝏𝒙𝟏
[1] Total energy
If ∇f(x) is large, the GVF function which minimizes and produces values v(x)
become closer to ∇f(x). Here f is the image function and ∇f(x) is the desired image
function. The particular advantage of GVF is the ability to move into boundary
concavities ((Xu & Prince) Centered on the minimum of the energy equation, the
gradient vector flow model can be used in all higher dimensions. For solving the
Euler equations in two-dimensional image regions, a time variable t is added. Via

31 | Page
iteration towards a steady state value, the Euler equation can be used to describe the
entire target object as a deformable contour. In the conventional snake model, the
equations obtained are used instead of the external force. The edge mapping function
and gradient vector flow field are used to define the contour of the target object from
the image. In contrast to the snake model, the gradient vector flow model is used to
segment the exact target area.

Figure 3.3: gradient vector flow (Xu and Prince 1998) drives a contour from
everywhere in the image to the segment boundary [1]

For all types of images obtained from various imaging modalities, the gradient
vector flow (GVF) model is used. In all medical image processing applications, an
extended version of the snake in the form of a gradient vector field is used.

32 | Page
3.4.4- THE SNAKE MODEL
The snake model is a segmentation algorithm that can be used to solve a wide
range of problems, although it possesses some limitations as compared to the GVF
above. The segmentation target object's primary function is to be described and
illustrated by the model. It allows use of prior knowledge of the contour of the target
object, which is particularly useful for complex objects. The active snake model is
typically configured by using spline focused on minimizing energy, followed by
various forces that govern the image. A spline is a mathematical expression used to
derive geometric figures such as curves from a set of polynomials. The constraint
forces are guided by a spline of minimizing energy, which is pulled by internal and
external image forces based on contour features (R.J. Hemalatha)[4]. Higher order
polynomials can be incorporated into this model, but they are usually avoided due
to several undesirable local properties to contend with. Snake breaks down complex
target objects into smaller targets to make them easier to work with. The snake model
is intended to shift shape and location when looking for the lowest energy state.
Snake propagates through the image's domain to low the energy feature and aims to
achieve the local minimum dynamically.

33 | Page
Figure 3.4: A snake is a deformable curve r(s) with points 0 <= s < = 1 that is
placed into an image.[1]

3.4.5- BALLOON MODEL


Cohen and Cohen presented two types of balloon in 1991 (2D), and 1993 (3D)
((Xu & Prince). A snake model isn't drawn to edges that are too far away. If no major
picture forces are operating on the snake model, the inner side will shrink. A snake
that is larger than the minima contour will gradually shrink, but a snake that is
smaller will not find the minima and will instead continue to shrink. To address the
limitations of the snake model, the balloon model was developed, which introduces
an inflation term into the forces acting on the snake. A balloon force is an additional
force for a closed active contour that drives the contour outward or inward. The
inflation force is included as additional external force (1993))
34 | Page
∇𝐸𝑒𝑥𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠))
𝑓𝑒𝑥𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠)) = 𝑘1 𝑛(𝑠) − 𝑘2
‖∇𝐸𝑒𝑥𝑡𝑒𝑟𝑛𝑎𝑙 (𝑟(𝑠))‖
[2]

The vector n(s) is normal to the curve r(s) at a point s. The two external
influences are weighted with respect to each other by k1 and k2 using application-
specific weights. In a nutshell, this algorithm can locate a region in the volume and
then position an icosahedron in that area with no points. To approximate the volume,
enlarge (or) subdivide the icosahedron. As a consequence, the algorithm begins
within the object with a small icosahedron (R.J. Hemalatha) [4]. Springs attach each
vertex to its neighbors, inflating each triangle or section along the usual in response
to inflation pressure within the sphere. Start with range images, where the images
are stitched together to form a single point cloud. The contour is formed by
subdividing triangles such that no T-shaped junctions occur. Triangles that were
once long and skinny are now big and short. When a triangle hits the point cloud's
surface, it becomes anchored. This is calculated by looking for vertex normal
intersections with the point set. When a triangle is anchored, it can no longer move
because all of its vertices are fixed [4].

35 | Page
Figure 3.5: In this example, an inward driving force was chosen that lets the
contour move toward the boundary when placed around the structure of interest
(Cohen)[1]

Here is the flow chart of active contour:

Figure3.6: Active contour flow chart.


36 | Page
CHAPTER 4:
IMPLEMENTATION AND RESULT ANALYSIS

4.1- INTRODUCTION
In this section we apply watershed and active contour methods on our
experimental MRI images.

4.2- IMPLEMENTATION OF WATERSHED METHOD

4.2.1- WATERSHED AND THRESHOLDING


The watershed and thresholding algorithm techniques are useful for the
segmentation of breast tumors. Image segmentation is based on the division of the
image into regions. Similarities are separated out into groups. The basic purpose of
segmentation is the extraction of important features from the image, from which
information can easily be perceived.

4.2.2- THRESHOLDING
Thresholding is considered as the first step in this segmentation method.
Thresholding is used to segment the foreground from the background by selecting a
threshold value, that Any pixel with a value less than or equal to the threshold value
is selected as part of the foreground, whereas any value higher than or equal to the
threshold value is considered in the background. The threshold value is selected by
observing the histograms of the original images. Here we have used a gray scale
37 | Page
image shown in figure 4.1 as input and the output binary image obtained is shown
in figure 4.2.

FIGURE 4.1 Original image1 and image2

4.2.3-WATERSHED

Figure 4.2: watershed transformation concept.

The purpose of watershed transform is to segment the threshold image into


regions by using the watershed lines. The watershed transform is a morphological
38 | Page
gradient-based segmentation technique. The basic ideology of the watershed
segmentation is that any grayscale image can be modeled as a relief map in which
different gradient values correspond to different heights. If we continue pouring
water, the water level will rise over the catchment basins. When two different bodies
of water meet, a dam is built between them. The progress continues until all the
points in the map are immersed. Finally, the whole image is segmented by the dams
which are then called watersheds and the segmented regions are referred to as
catchment basins. A catchment basin is the geographical area draining into a river
or reservoir. This is shown in figure 4.3.

Figure 4.3: image1 and image2 Segmented in regions

The watershed output is shown in figure 4. From this figure we can see many
isolated areas, among which one is the tumor. Watershed algorithm segmented the
image into several regions based on the principle explained above, but this technique
39 | Page
does not extract the tumor from the image. However, we have developed an approach
that utilize tissue properties such as density and solidity of the watershed image to
extract the tumor region from that image. This procedure is based on the fact that
abnormal tissues have higher density than normal tissues. Therefore, if we eliminate
all lower density regions, the high-density region will be left and that is the tumor.
The isolated tumor is shown in Figure 5.

Figure 4.4: The detected tumor on image1 and image2

4.2.4- IMPLEMENTATION OF ACTIVE CONTOUR


METHOD
The model of the active contour, more commonly known as the snake, is a
common form of segmentation for US images. It helps separating the foreground
from the background. The idea here is to segment using some kinds of curve but not
pixels. It is an iterative process which requires some computational power to give a
suitable output. Thus, as a model-driven process, active contour is specifically a
40 | Page
fitting process. Incidentally, this is a fascinating technique in that the contour over
there is simply something that can pass through the various viewpoints on the image
itself and then it comes down to a convergence and it gets its name named as an
active contour from this particular movement of the contour around the region of
interest (ROI). The Contours here are sets of points which form boundaries specified
in a picture for the area of interest that undergo the process of interpolation. The
interpolation process can be linear, splines and polynomial which describes the curve
in the image.

From a script written on MATLAB an ultrasound image was uploaded then


we proceeded by preprocessing the image. We first have to make sure that
irrespective of the color of the image it is converted into grayscale image, and set
the number of iterations. A mask of black color is passed on the image to just
separate the breast. After that, the Chan-Vese MATLAB function was applied onto
the image for active contour.

Figure 4.5: detected tumor

41 | Page
Figure 4.6: detected tumor

42 | Page
CHAPTER 5:
Conclusion

5.1 Introduction
This thesis showed several approaches for breast tumor detection and segmentation
using Ultrasound Images. By studying the ultrasound Image cases, we found that
most of those cases are caused by a shadow with similar intensity of the lesion and
right below the lesion.

5.2 Conclusion
In the thesis we suggested two methods of image segmentation on ultrasound
images: watershed and active contour. By changing the threshold value, the
watershed algorithm automatically produces the contour of the tumor with high
accuracy. The Active contour on the other hand was done by selecting the suspected
region of tumor on the input image and after processing the tumor was detected with
high accuracy.

Many techniques in image processing have been developed a long time ago just for
the sake of reducing cancer by detecting early enough to be taken care by specialists.
In this section active contour method was used in MATLAB to detect a malignant
cell on an Ultrasound image. The proposed method is also used as a preprocessing
for other methods.

43 | Page
Finally, this work is another step forward toward an automated breast cancer
diagnosis, with a potential to save costs incurred from thousands of medical fees
paid to interpret results from expert pathologists for every follow-up checkup.

5.3 future work


The future work will focus on generating the threshold value automatically for
watershed algorithms and also the automatic selection of the tumor in case of the
active contour method.

44 | Page
References
[1]. Klaus D. Tonnies, “Guide to Medical Image Analysis Methods and
Algorithms”
[2]. YouTube, “Active Contours for Segmentation”
[3]. “Gradient vector flow: a new external force for snakes | IEEE
Conference Publication” | IEEE Xplore
[4]. “Active Contour Based Segmentation Techniques for Medical Image
Analysis” | IntechOpen
[5]. Wikipedia, “https://en.wikipedia.org/wiki/Breast_cancer”
[6]. International Journal on Image Processing Techniques
“https://www.hindawi.com/journals/ijbi/”
[7]. World Cancer Research Funds, “https://www.wcrf.org/dietandcancer”
[8]. Y. L. Huang and D. R. Chen, "Watershed segmentation for breast
tumor in 2-D sonography," Ultrasound in Medicine & Biology, vol. 30,
pp. 625-32, 2004

[9]. Vincent, L., Soille, “Watersheds in Digital Spaces: An Efficient


Algorithm based on Immersion Simulation”. IEEE Trans. PAMI 13(6),
583–598 (1991)

[10]. International Research Journal of computer Science and Technology


“http://www.computerscijournal.org/”

[11]. MATHWORKS
“https://blogs.mathworks.com/steve/2013/11/19/watershed-transform-
question-from-tech-support/”

[12]. International Journal of Emerging Trends & technology in Computer


Science
45 | Page
[13]. “Image Processing Techniques for Breast Tumor Detection: A
Review”, in International Journal of Emerging Trends & Technology in
Computer Science

[14]. Image Processing Using MATLAB: Basic Operations


“https://www.electronicsforu.com/”

[15]. Mahmut Sinecen, “Digital Image Processing with MATLAB”


Submitted: September 25th 2015Reviewed: March 11th 2016 Published:
July 7th 2016

[16]. World Health Organization, “National Cancer Control Programs.


Policies and managerial guidelines”, 2nd. ed. Geneva, 2002.

[17]. Mammogram Breast Cancer Image Detection Using Image Processing


Functions “https://scialert.net/”

[18]. Breast cancer detection using image enhancement and segmentation


algorithms “https://www.alliedacademies.org/”

[19]. Detection of malignant tissue in mammography image using


morphology-based-segmentation-technique
“https://ijmrr.medresearch.in/”

[20]. American Cancer Society. Breast Cancer Facts & Figs. American
Cancer Society, Inc, 2013. Available online at:
“http://www.cancer.org/acs/groups/content/@epidemiologysurveilance/
documents/document/acspc-036845.pdf”. cited on 23th March 2016.

[21]. Breast Cance r Detection Based on Watershed Transformation


“https://www.semanticscholar.org/”

46 | Page
[22]. Comparison of Two Segmentation Methods for Mammographic Image
“https://www.semanticscholar.org/”

[23]. Detection and Shape Feature Extraction of Breast Tumor in


Mammograms “https://www.semanticscholar.org/ “

[24]. Development algorithm- computer program of digital mammograms


Segmentation for detection of masses breast using Marker-Controlled
Watershed-in-MATLAB-environment
“https://www.semanticscholar.org/”

[25]. Analytixs Labs Image Visualisation “https://www.analytixlabs.co.in/”

47 | Page
Appendix
Matlab code (watershed)
% The Codes below was used for the watershed image processing method in
% which the threshold value of each Image is manually Inserted.

% The section below works as to clear, close and read the workspace and any variable available
close all;
clear all;
clc;
img=imread('input_image_name');

% The section below works as to converts the image for further use.
bw=im2bw(img,input_threshold_value); % we threshold the image with its threshold value
which is white when the
% value is above and black when below the threshold value.
c= ~bw;
D= -bwdist(c);
D(c)= -Inf;
L= watershed(D);
Wi= label2rgb(L,'jet','c');%for purpose of visualizing label region.

% The section below works as to measure, segment and segregate the Image in
% order to obtain the desired output.

label=bwlabel(L);
stats=regionprops(label,'Solidity','Area'); % returns measurements for the
% set of properties specified by properties for each 8-connected component (object) in the binary
image, BW
% since the solidity of the tumor is greater than the breast solidity,
density=[stats.Solidity];
area=[stats.Area];
high_dense_area=density>0.5; %which means the area that has 50% Solidity than the breast is
needed.
max_area=max(area(high_dense_area)); %returns maximum area
tumor_label=find(area==max_area);
tumor=ismember(label,tumor_label);%returns an array containing logical 1 (true).
%Elsewhere, the array contains logical 0 (false)
se=strel('square',5); %essential for dilation

48 | Page
tumor=imdilate(tumor,se); %for dilation i.e. making sure the tumor is filled with same value like
1 or white

% The section below is Subplot which displays the results in and organize
% manner.

figure(3);
subplot(2,3,1);
imshow(img,[]);
title('Ultrasound Breast Image');

subplot(2,3,2);
imshow(bw,[]);
title('Black&White');

subplot(2,3,3);
imshow(Wi,[]);
title('label2rgb');

subplot(2,3,4);
imshow(L,[]);
title('Watershed');

subplot(2,3,5);
imshow(tumor,[]);
title('Tumor Alone');
[B,L]=bwboundaries(tumor,'noholes'); %draw boundaries around the tumor and no holes needed.
subplot(2,3,6);
imshow(img,[]);
hold on
for i=1:length(B)
plot(B{i}(:,2),B{i}(:,1), 'y' ,'linewidth',1.45);

end

title('Detected Tumor');
hold off;

49 | Page
Matlab code (Active Contour)
%% This section mentions about Active Contour Method.
close all
clear all
clc
%% The image preprocessing and set-up is done in this section
[path, user_cancel]= imgetfile();
iter=input('Enter number of iteration: ');
im = imread(path);
img=rgb2gray(im);
image=img;
%% create a mask for the breast
B=roipoly(img);
%% brain segmentation
bw=activecontour(img,B,iter,'Chan-Vese');
hold on
figure(3)
imshowpair(B,bw,'montage')
title('breastSeg','color','b')
%% Tumor mask
B0=roipoly(img);
hold on
title('Tumor mask','color','b')
%% tumor-segmentation
bw1=activecontour(img,B0,iter,'Chan-Vese');
% visboundaries(bw1,'Color','r');
%% How the output sould look like
figure(4)
subplot(121)

50 | Page
imshow(bw1)
title('non filtered bw1')
hold on
visboundaries(bw1,'Color','r');
hold on
%filter some noise points around the segmented figure
bw2 = medfilt2(bw1,[10 10]);
subplot(122)
imshow(bw2)
title('filtered image')
hold on
visboundaries(bw2,'Color','b');
hold off
%% This is responsible of maing the boundary around the image
[B L] = bwboundaries(bw2,'noholes');
% A=imshow(bw2)
hold on
for i= 1:length(B)
plot(B{i}(:,2),B{i}(:,1),'r','linewidth',2);
end
hold off
%% Processing: The extraction of the Tumor from the image
bw=bw-bw2;
img(~bw)=0;
image(~bw2)=0;
%trying to filter the img
D = medfilt2(image,[15 15]);
image=D;
figure(6)
imshow(image)

51 | Page
hold on
visboundaries(image,'Color','y');
hold off
%% Detected tumor plus pair where it was located
big_area=sum(sum(img));
tumor_detected=sum(sum(im));
figure(7)
imshowpair(img,image,'montage')
hold on
visboundaries(image,'Color','r');
hold off
%% Beautificaton of how the image should look like.
figure(9)
subplot(121)
imshow(im)
title('original image','color','r');
hold on
subplot(122)
imshow(im)
title('isolated tumor image ','color','m');
hold on
visboundaries(bw2,'Color','r');
hold off

52 | Page

You might also like