Empirical Edge Detection and Extraction of Lesion using Image Processing Technique
1. Empirical Edge Detection and Extraction of Lesion
using Image Processing Technique
Mustafah Maarof N. F., Zofkoffeli N. E.
Faculty of Health Science
University Technology Mara
Puncak Alam, Selangor
muslimah_farahuda@yahoo.com, zevidiana@gmail.com
Abstract— Medical image processing is the most challenging
and are still among the growing researches. This paper is
empirical study which involves the trial and error of image
processing techniques. The image processing technique
incorporates with noise removal functions, image sharpening,
extraction of the object of interest and edge detection algorithms
which are the basic concepts of the image processing. Detection
and extraction of lesion from the MRI images are done by using
MATLAB software version R2013a. Problem statement: The
images contain noise and the edge of the tumor or lesion is ill-
defined. Possible extensions of lesion are needed to be determined
to produce better image of the tumor or lesion that can aid in
characterization of tumor or lesion. Objective: To detect the type
of noise present, to remove the noise present in the MRI image
using appropriate filter, to sharpen blurred image resulting from
smoothing filter, to segment tumor or lesion from the MRI image
and to detect the edge of the tumor or lesion extracted. Method:
Four smoothing filters are applied on the three selected MRI
images respectively. One image is selected carefully for further
image processing step which is sharpening of image. Sharpening
filters which are the Laplacian and unsharp masking are applied
on the selected images. The image that is enhanced the most is
selected for the next step which is the intensity thresholding to
extract the tumor or lesion. Five edge detection algorithms are
then applied on extracted tumor or lesion image to detect the edge.
Results: For the images selected in this study, median filter is the
most appropriate smoothing filter when compared to other
average, adaptive (Wiener) and Gaussian filters as the image
produced is less blur and appropriately smoothed. Roberts edge
detection algorithm is found to have the nearest ability to Canny
algorithm in detecting the edge of the lesion extracted from the
selected MRI images of the brain and breast. Conclusion: Image
processing technique that can be applied on medical images
comprised of many steps that are important for the image to aid it
becomes more valuable in helping the diagnosis.
Keywords—MRI; noise removal, segmentation, MATLAB
I. INTRODUCTION
Image segmentation is a fundamental process that is used to
partition the image into separate regions, which ideally
correspond to different real-world object. There are many
segmentation methods that are available; however, there are no
such the algorithms that can be used as a standard algorithm for
all the type of situation. Segmentation processes can be divided
into several types, such as the edge-based segmentation, region-
based segmentation as well as intensity thresholding.
Segmentation is a process that should stop when the object that
is of interest has been isolated from the image. Edge-based
segmentation is usually used for the purposes of detecting the
lesion and the extension of the lesion.
Magnetic Resonance Imaging (MRI) is an advanced medical
imaging modality that is widely used for diagnosing the
diseases; especially diseases related the soft tissues for example
cancerous tissues or tumor. It is has already known to have a
better delineation of the soft tissue and are excellent in detecting
the lesion related soft tissue of the body. Besides providing the
details of the soft tissue of the body, MRI is able to providing
detail information of the anatomical and functional information
of the body with the high quality of the images. Besides, the
MRI is the chosen diagnosis modality as it provides zero
radiation towards the patient compared to other diagnostic
modalities such as Computed Tomography. From these high
resolution images, the anatomical information details are
derived for the purpose of evaluate the structure of the organs
and discovery any abnormalities of the organ.
A lesion is any abnormality change that happens in the
tissue, which may be caused by the disease or trauma while the
tumor or cancerous tissue is an abnormal growth of the soft
tissues. It is may be types of benign or malignant. Benign lesion
not giving harm to the human body but this type of lesion can
sometime progressed to malignant type of lesion. Malignant
lesion give harm to the human body and are too dangerous. The
discovery of the disease either it is benign or malignant are
importance as it will helps to extend the life of patient and the
treatment purposes.
The images included in this paper are MRI images of brain
and breast tissue. Two MRI images of the brain and one MRI
image of the breast tissue are selected. These images are images
of body parts that contain lesion or tumor. The problems with
the images are the noise present within the images, and the
edges of the lesions cannot be well seen or can be further
clarified, thus, segmentation of the lesion using proper
segmentation operator is needed. As proposed by Swati, Deepa,
Paul and Sankaranarayanan (2015), the brain tumor is detected
using the edge-detection of canny algorithms as it is well known
the best edge detection tools for the discontinuity of the signal
of the image, along with the used of histogram thresholding.
While Ali, Khalaph and Nema (2014) used the techniques of
enhanced threshoding algorithm for the brain tumor detected.
By using these two experiments as references, we are interested
in using the edge segmentation algorithms, which are the
Roberts, Prewitt, Sobel, Canny and Laplacian of Gaussian and
2. intensity thresholding algorithm for detecting the lesion on the
selected images. The main purpose of this experiment is to
evaluate the performance of the noise removal algorithms and
segmentation algorithms on different images and to determine
which edge detection algorithms that are sufficient in detecting
the edge for interpretation of the lesion. The comparison will
exclude the canny algorithm because it is already known as the
best tools in detecting the edge.
II. METHODOLOGY
The proposal methodology mainly has two stages; the first
stage is to preprocessing the selected MRI images and the next
step is the segmentation process using intensity thresholding and
edge detection for the purpose of extraction and detecting edges
of the lesions. The steps are as the following:
A. Data Collection
Three MRI images of the lesion which consists of two MRI
Brain images and one image of MRI Breast are collected from
the Radiopedia.com web page. The MRI images are selected
because the MR imaging has been known to have a better
delineation of the soft tissue of the human body and are
excellent in detecting the lesion related with soft tissue disease,
for example tumor or cancerous disease. The normal appearance
of the organs in the MR images is quite similar to the
surrounding structures. With the presence of the lesions, the
contrast between the lesions and surrounding structure are quite
different but edges of the lesions are sometimes ill-defined.
B. Prepocessing
The MRI images are converted to the grayscale image for
processing procedure. Each of the images is evaluated whether
there is the presence of the noises on the image. The noises are
detected by the noise detector. One portion of area with
consistent intensity of the images is cropped and histogram of
the portions is generated using imhist function. The histogram is
compared to the histogram of the noise-model. In order to
remove the noises, different types of filters with the same size
kernel 9x9 are applied to each of the images. The size of 9x9
kernel is selected for faster removal of the noises. The noise
removal filters that are being used; the Average, Median,
Adaptive and the Gaussian filters. The effect of the noise
removal filter is a bit blur on the image, thus it is need to
sharpen the image using the sharpen filter algorithm.
The output result of the noise removal filter are evaluated
and the best image which is free from the noise is selected for
the sharpen procedure. Once the best image is selected, the
image is written with the different name. Because of there are
two images of the brain, the image is named with ‘Filtered
BrainTumor.jpg’ and Filtered BrainTumor 2.jpg’, while for the
MRI breast image, the image is named with “Filtered
BreastLesion.jpg’. For the sharpening process, two algorithms
of high-pass filter are being used, which are the Laplacian filter
and unsharp filter. Each of the three images of MRI brain and
breast are applied with the sharpening filter. For the Laplacian
filter, we need to create the Laplacian mask and add it on the
previously smoothed and denoise image for enhancing and
sharpening of the image. While for the unsharp filter, the mask
of unsharp is added on the image. The output images of the
sharpening filter are evaluated and the best image which has
enhanced the detail of the structure is selected. The selected
image is named with ‘Sharpened BrainTumor.jpg’, ‘Sharpened
BrainTumor 2.jpg’ and ‘Sharpened BreastLesion.jpg’ for
making the images easier to manage and process for the next
steps of the experiment.
Matlab function used for smoothing filters in this study:
I = imread(each image file of the three MRI images that have
been selected)
Average Filter = filter2 (fspecial (‘average’, 9) ,I) / 255
Median Filter = medfilt2 (I, [9 9])
Adaptive Filter = wiener2(I, [9 9])
Gaussian Filter = a = fspecial(‘gaussian’, [9 9], 6)
h = imfilter(I, a)
Matlab function used for sharpening filters being used:
I = imread(the image file of the smoothed image selected for the
next step)
Unsharp Masking = a = fspecial(‘unsharp’)
b = imfilter(I, a, ‘replicate’)
Laplacian = f = [-1 -1 -1; -1 8 -1; -1 -1 -1]
d = imfilter(I, f, ‘replicate’)
e = imadd(I, c)
C. Segmentation Process
The lesions are extracted from the organ using intensity
thresholding. Threshoding is a process of converting a grayscale
input image to a bi-level image. The purpose of intensity
thresholding is to produce a binary image containing a variety of
objects of different shapes and extract the pixels which meet the
rules. (Gonzalez & Woods, 2010). The regionprops is a
powerful in built function that can be used to measure the area
and parameter of each of objects in binary object along with the
function bwlabel; a matrix which has have its own features.
With using the regionprops function, the area and parameter of
the objects are calculated. The pixels that are belonging to the
lesions are retaining while the pixels that are not belong to the
lesions are removed. This can be obtained by using bwlabel
function, in which this function will assign the value of pixels,
for example all pixels belonging to the organ will have the value
of 1 and all the pixels belonging to the surrounding soft tissue
will have the value of 2.
Edge detection is the process of segmenting the pixels into
regions based on the discontinuity of the pixels value. For the
cases of the soft tissue tumors on the MRI images, the contrast
of the lesion and surrounding structures are low and sometime it
3. is quite difficult to differentiate between these tumor structures
and the healthy surrounding structures. Due to this problem, we
are assigning the pixels and thresholding the pixel first before
detecting the edges of lesion for excluding the unnecessary
signal. Edge detections are necessary for the MRI cases for
assisting of further treatment and diagnosis of the disease. There
are two types of the edge detection, which are based on the
principle of first derivative and second derivative. We are using
both of the principles and are comparing the output image of the
tumors. The algorithms of the Roberts, Prewitt, Sobel, Canny
and Laplacian of Gaussian are used in this experiment.
Function for intensity thresholding being used:
Bw = (img > 0.5*255) % to isolate the bright pixels
Lbl = bwlabel(Bw) % to assign the pixels into its belonging
structure
Props = regionprops(lbl, ‘solidity’, ‘area’)
Matlab function used for the edge detection algorithms being
used for this study:
I = imread(the image file of the smoothed and sharpened image)
Roberts = edge(I, ‘roberts’)
Prewitt = edge(I, ‘prewitt’)
Sobel = edge(I, ‘sobel’)
Canny = edge(I, ‘canny’)
Laplacian of Gaussian = edge(I, ‘log’)
The resulting images are plotted into subplots.
III. RESULT
The results are the images obtained after image enhancement
and image segmentation are done on the selected images using
Matlab R2013a. The results are subdivided into preprocessing
result and segmentation result. The preprocessing result includes
the smoothing of image to reduce noise and sharpening of the
images to sharpen the blurred image as a result from smoothing.
The segmentation result includes the result from intensity
thresholding which enable tumor or lesion to be extracted and
the result from edge detection by Roberts, Prewitt, Sobel, Canny
and Laplacian of Gaussian (LoG) operators which show the
edge of the respective lesion or tumor.
A. Preprocessing Result
Noise detection
The small portion of the image is cropped and histogram is
generated for determining whether there is the presence of the
noises on the image. The histogram is then compared to the
histogram of noise-model. Based on the histogram below, there
is the evidence of Gaussian noise due to its bell-shape
appearance.
Figure 1: Image MRI BrainTumor 1 with cropped portion of
the image (middle) and histogram of the cropped portion (right)
Figure 2: Image MRI BrainTumor 2 with cropped portion of
the image (middle) and histogram of the cropped portion (right)
Figure 3: Image MRI BreastLesion with cropped portion of the
image (middle) and histogram of the cropped portion (right)
Denoising the images
The MRI images are applied with different noise removal
algorithms using the similar pixel kernel sizes of 9x9. The
images are consists of MRI of brain tumor, brain lesion and
breast lesion. The best images with removal of nearly all noises
are selected for preceding the next sharpens process. The
resultant output images are as follow.
Figure 4: Image of MRI Brain lesion which has been
smoothened using Average filter (above middle), Median filter
(above right), Adaptive filter (below left) and Gaussian filter
(below middle)
4. Figure 5: Image of MRI Brain tumor which has been
smoothened using Average filter (above middle), Median filter
(above right), Adaptive filter (below left) and Gaussian filter
(below middle)
Figure 6: Image of MRI Breast lesion which has been
smoothened using Average filter (above middle), Median filter
(above right), Adaptive filter (below left) and Gaussian filter
(below middle)
The three MRI images are selected and the histogram is
generated to determine the types of noise present within the
image. Based on the histogram in Figure 1, 2 and 3, there is the
evidence of Gaussian noise on the three images. Four different
noise removal algorithms have been applied on each of the
images, respectively. For all the images, the median filtered
images are the best filtered images because it has smoothed the
images and produces images with better appearance compared
to the other three filters. Adaptive filter which is the Wiener
filter does preserve the information of the image but it does not
smoothed as high as Median filter. In this paper, Median filtered
images are selected due to the better smoothing effect by the
Median filter that does not cause image to be blurred as much as
Average and Gaussian filters.
Sharpening the images
Figure 7: The sharpened BrainTumor (left) with Laplacian
mask (middle) and the resultant of sharpen image by Laplacian
(right)
Figure 8: The sharpened BrainTumor (left) with the resultant
of sharpen image by Unsharp filter (right)
Figure 9: The sharpened BrainTumor 2 (left) with Laplacian
mask (middle) and the resultant of sharpen image by Laplacian
(right)
Figure 10: The sharpened BrainTumor 2 (left) with the
resultant of sharpen image by Unsharp filter (right)
Figure 11: The sharpened BreastLesion (left) with Laplacian
mask (middle) and the resultant of sharpen image by Laplacian
(right)
Figure 11: The sharpened BreastLesion (left) with the
resultant of sharpen image by Unsharp filter (right)
5. The images that are selected after the process of noise
removal is sharpen using two types of high-pass filter, which are
the Laplacian filter and Unsharp filter. Based on the figure 4, 5
and 6, the images which are undergo for sharpen using Unsharp
filter are better compare to the images which undergo the
sharpen process using Laplacian filter. The noises can be clearly
noticed from the images with Laplacian filter. The Laplacian
filter is basically using the principle of second derivative, which
are known to have the ability of detecting the edge of the
structures but the noise are pronounced in these three images.
The image with Unsharp filter appear clear from the noise and
these images are being selected for the segmentation stage.
B. Segmentation Result
Figure 7: Smoothed and sharpened MRI brain lesion image
(left), image where the skull has been removed (middle) and
image of extracted brain tumor (right)
Figure 8: Image showing extracted brain lesion (above, left);
edge of lesion detected by Roberts operator (above,
middle); edge of lesion detected by Prewitt operator
(above, right); edge of lesion detected by Sobel operator
(below, left); edge of lesion detected by Canny operator
(below, middle); edge of lesion detected by Laplacian of
Gaussian operator (below, right)
Figure 9: Smoothed and sharpened MRI brain tumor
image (left), image where the skull has been removed
(middle) and image of extracted brain tumor (right)
Figure 10: Image showing extracted brain tumor (above,
left); edge of tumor detected by Roberts operator (above,
middle); edge of tumor detected by Prewitt operator
(above, right); edge of tumor detected by Sobel operator
(below, left); edge of tumor detected by Canny operator
(below, middle); edge of tumor detected by Laplacian of
Gaussian operator (below, right)
Figure 11: Sharpened image of the breast lesion (left) and the
image of extracted breast lesion (right)
Figure 12: Image showing extracted breast lesion (above,
left); edge of lesion detected by Roberts operator (above,
middle); edge of lesion detected by Prewitt operator
(above, right); edge of lesion detected by Sobel operator
(below, left); edge of lesion detected by Canny operator
(below, middle); edge of lesion detected by Laplacian of
Gaussian operator (below, right)
The lesion on each of the images is extracted using the
intensity thresholding algorithm. Because of there is the
hyperintensity value of the skull’s pixel or signals for the
images of the brain, we need to remove the pixels belonging to
the skull before proceeding the intensity thresholding. When
comparing to the original image, the pixels of the soft tissue are
filtered out and is appear as black, or 0 while the pixels
belonging to the lesion are retain and appear as bright, or 1.
6. These are accomplished by using bwlabel function, which it
assign the pixels into its belonging structures and removed the
unneeded pixels using intensity thresholding function. The
extraction of the lesion is also aiding in detection of the lesion
because the intensity of the lesion and some structures and
quite similar, thus it is necessary to remove all unneeded pixels
and concerning only to the region of interest.
After completing the extraction process, the edge detection
algorithms are applied on each of extracted lesion. The edge
detection algorithms that are being used are composed of the
Roberts, Prewitt, Sobel, Canny and Laplacian of Gaussian. The
Canny algorithm is well known as the best tools in detecting the
edges of the structures. The main objective of our experiment is
to evaluate the edge detection algorithms in detecting the edges
of selected image. Based on the figure 8, 10 and 12, it is proven
that the canny algorithm is able to detect the low signal of the
edge of the lesion as compared to other algorithms. The
Laplacian of Gaussian are also able to detecting the low signal
since the principles that is being used is the second derivative,
however, the line edges of the lesion are not smooth and ill-
defined.
Based on the figure 8, 10 and 12, the Roberts algorithm is
the best in detecting the edge of the lesion as compared to the
Prewitt, Sobel and LoG. The line of edge of lesion is well-
defined, connecting to each other and can be said to be isolated
from the surrounding structures. For aiding the diagnosing and
treatment purposes, it is importance to have the knowledge of
the extension of the lesion. The application of edge detection
algorithm using Roberts is sufficient for these three cases of
MRI image.
IV. CONCLUSION
Segmentation is important to isolate an object of interest
from the image. The image must be enhanced by the process of
smoothing or sharpening as required segmentation process is
performed on the image. Smoothing filter that is the best in
filtering the noises present in the image should be used. The
resulting image which has been smoothed to suppress the noise
can appear blurred and the sharpening filter is used when this
happens. After that, segmentation is done using the
segmentation operator. The type of segmentation used in this
paper which is the intensity thresholding is suitable for
segmenting the lesion or tumor present in the MRI images
selected. The tumor or lesion in each image has been isolated by
intensity thresholding before edge detection algorithms, namely,
Roberts edge detection algorithm, Prewitt edge detection
algorithm, Sobel edge detection algorithm, Canny edge
detection algorithm and Laplacian of Gaussian (LoG) edge
detection algorithm are performed on the extracted tumor or
lesion.
V. ACKNOWLEDGMENT
We would like to thank our lecturer for this Digital Image
Processing Course, Dr. Elaiza, lecturer of Faculty of Computer
Science MARA University of Technology (UiTM) Shah Alam,
Selangor for her guidance and time spent in sharing her
knowledge with her students. We would also like to thank our
parents for their undying support that keep us motivated to carry
on despite all the life obstacles. Last but not least, many thanks
are also given to other individuals who have helped us
throughout the completion of the project directly or indirectly.
REFERENCES
[1] Ali, A. H., Khalaph, K. A. & Nema, I. S. 2014. Segmentation of Brain
Tumour using Enhanced Tresholding Algorithm and Calculated Area of
the Tumour. IOSR Journal of Research & Method in Education, 4, 58-62.
[2] Gonzalez, R. C., Woods, R. E. & Eddins, S. L. (2002). Digital Image
Processing Using MATLAB, 2nd edn, Gatesmark Publishing, United
State of America
[3] Gonzalez, R. C. & Woods, R. E. (2010). Digital Image Processing, 3rd
edn, Pearson Education International, United State of America.
[4] Selkar, R. G. & Thakare, M. N. 2014. Brain Tumor Detection and
Segmentation by using Thresholding and Watershed Algorithm.
International Journal of Advance Information and Communication
Technologies, 1, 321-324.
[5] S, S. P., Devassy, D., Paul, V. & N, S. P. 2015. Brain Tumor Detection
and Classification Using Histogram Thresholding and ANN. International
Journal of Computer Science and Information Technologies, 6, 173-