DIGITAL IMAGE PROCESSING IN OPTICAL COHERENCE … Fiakkou.pdf · DIGITAL IMAGE PROCESSING IN ....
Transcript of DIGITAL IMAGE PROCESSING IN OPTICAL COHERENCE … Fiakkou.pdf · DIGITAL IMAGE PROCESSING IN ....
DIGITAL IMAGE PROCESSING IN OPTICAL COHERENCE TOMOGRAPHY IMAGING
FOR THE EVALUATION OF WATERMELON PROPERTIES
By
Maria Fiakkou
Submitted to the University of Cyprus in partial fulfillment
of the requirements for the degree of Master of Science in Electrical Engineering
Department of Electrical and Computer Engineering
May 2015
DIGITAL IMAGE PROCESSING IN OPTICAL COHERENCE TOMOGRAPHY IMAGING
FOR THE EVALUATION OF WATERMELON PROPERTIES
By
Maria Fiakkou
Examination committee:
Dr. Constantinos Pitris Associate Professor, Department of ECE, Research Supervisor
Dr. George Ellinas Associate Professor, Department of ECE, Committee Member
Dr. Christina Orphanidou Special Scientist, Department of ECE, Committee Member
Abstract
Watermelon is one of the most popular summer fruits and it is cultivated all over the world.
Nevertheless, you can never determine with certainty the quality and the freshness of a
watermelon when you choose one. In this thesis the Optical Coherence Tomography was used for
imaging of watermelon cells and peels in an attempt to evaluate the watermelon properties and
determine quality. More specifically, at what extent the cytological changes have an impact in the
ripening and firmness of the watermelon.
Samples of OCT imaging were acquired for watermelon flesh and peel. Subsequently several
algorithms of digital image processing were applied on OCT imaging samples. In particular,
quantification of connective tissue and peel was performed as well as manual an automatic
segmentation of the watermelon cells. Manual segmentation was performed in an attempt to test
the reliability of the automatic segmentation. The yielded dataset were used afterwards for
statistical analysis and classification.
Notwithstanding, the above during the experimental process, back reflections and noise artifacts
affect significantly the imaging. To smooth out their effect on the imaging, and the possible
alternations of the results, median filter and morphological operations were used. This method
optimizes the images and resolve OCT physical issues.
The majority of the results obtained from the statistical analysis and classification do not lead to
desirable and reasonable conclusions. Few samples though gave satisfactory and useful results for
the evaluation of watermelon properties.
Keywords: Optical Coherence Tomography, Digital Image Processing, Quantification, Watershed
Transformation, Manual and Automatic Segmentation, Watermelon Properties.
Περίληψη
Το καρπούζι είναι ένα από τα πιο δημοφιλή καλοκαιρινά φρούτα και καλλιεργείται σε όλο τον
κόσμο. Παρ’ όλα αυτά, δεν μπορεί ποτέ με βεβαιότητα να προσδιοριστεί η ποιότητα και η
φρεσκάδα του καρπουζιού όταν επιλέγεται. Στην παρούσα διατριβή απεικόνιση των κυττάρων του
καρπουζιού αλλά και της φλούδας εκτελέστηκε με την χρήση του Οπτικού Τομογράφου Συνοχής
(OCT), σε μια προσπάθεια αξιολόγησης των ιδιοτήτων του καρπουζιού και καθορισμού της
ποιότητας του. Πιο συγκεκριμένα, σε ποιο βαθμό οι κυτταρολογικές αλλαγές έχουν αντίκτυπο
στην ωρίμανση και την συνεκτικότητα του καρπουζιού.
Δείγματα απεικόνισης Οπτικού Τομογράφου Συνοχής από την σάρκα και φλούδα του καρπουζιού
αποκτήθηκαν. Στη συνέχεια, διάφοροι αλγόριθμοι ψηφιακής επεξεργασίας εικόνας
εφαρμόστηκαν στα δείγματα αυτά. Ειδικότερα, έγινε διεξαγωγή ποσοτικοποίησης του συνδετικού
ιστού και φλούδας όπως επίσης και κατάτμηση των κυττάρων με την χρήση του Μετασχηματισμού
Απορροής. Σε μια προσπάθεια αξιολόγησης της αξιοπιστίας και ορθότητας της κατάτμησης των
κυττάρων, χειροκίνητη κατάτμηση διεξήχθητε. Τα προκύπτοντα σύνολα δεδομένων
χρησιμοποιήθηκαν σε μεταγενέστερο στάδιο για στατιστική ανάλυση και ταξινόμηση.
Παρ’ όλα όσα είχαμε αναφέρει κατά την διάρκεια της πειραματικής διαδικασίας παρουσία
θορύβου και αντανακλάσεων εμφανίζονταν επηρεάζοντας σημαντικά την απεικόνιση. Για την
εξομάλυνση του φαινομένου αυτού το όποιο θα αλλοίωνε τα αποτελέσματα, μεσαίο φίλτρο και
μορφολογικές λειτουργίες εφαρμόστηκαν. Η μέθοδος αυτή βελτιστοποιεί τις εικόνες και επιλύει
φυσικά προβλήματα που προκύπτουν κατά την απεικόνιση με την χρήση του Οπτικού
Τομογράφου Συνοχής.
Τα πλείστα αποτελέσματα τα όποια προκύπτουν από την στατιστική ανάλυση και ταξινόμηση δεν
οδηγούν σε επιθυμητά και λογικά συμπεράσματα. Μια μερίδα όμως δειγμάτων δίνει
ικανοποιητικά και χρήσιμα αποτελέσματα για την εκτίμηση των ιδιοτήτων του καρπουζιού.
Λέξεις – κλειδιά: Οπτικός Τομογράφος Συνοχής, Ψηφιακή Επεξεργασία Εικόνας, Ποσοτικοποίηση,
Μετασχηματισμός Απορροής, Χειροκίνητη και Αυτόματη Κατάτμηση, Ιδιότητες Καρπουζιού.
Acknowledgments
Foremost, I would like to express my sincere gratitude to my advisor Dr. Constantino Pitri, for the
continuous support of my Master research, for his patience, motivation, and immense knowledge.
His guidance helped me in all the time of research.
Besides my advisor, I would like to thank especially Dr. Mario Kyriacou, Senior Agricultural
Research, and Mr. George Soteriou, Agricultural Research of the Agricultural Research Institute
Cyprus, for the excellent cooperation and the concession of watermelons, which was necessary for
the completion of this research.
My sincere thanks also go to Dr. Evgenia Bousi for the valuable help and cooperation for the
performance and completion of the experiments.
I would like also to thank my special friends who are always by my side and support me during my
studies and in my whole life. Last but not least, I would like to express with appreciation and
respect, my gratitude to my family for the morals and principles passed to me during my life.
Table of Contents
1 Introduction ................................................................................................................... 1
1.1. Brief Overview in Optical Coherence Tomography (OCT) ........................................................... 1
1.2. Digital Image Processing ............................................................................................................... 2
1.3. Motivation ...................................................................................................................................... 3
1.4. Scope of Thesis ............................................................................................................................... 3
1.5. Chapters Overview ......................................................................................................................... 4
2 Background and Literature Review ................................................................................5
2.1. Optical Coherence Tomography (OCT) ........................................................................................ 5
2.1.1. Introduction to Optical Coherence Tomography ...................................................................... 5
2.1.2. Time-Domain Optical Coherence Tomography (TD OCT) ...................................................... 7
2.1.3. Frequency-Domain Optical Coherence Tomography (FD OCT) .............................................. 8
2.1.4. Application of OCT ................................................................................................................... 10
2.2. Previous Research in OCT Imaging of Watermelon ................................................................... 11
3 Experimental Procedure & Image Processing in OCT Imaging ..................................... 13
3.1. Experimental Procedure ............................................................................................................... 13
3.2. Quantification of Watermelon Peels ............................................................................................ 15
3.3. Quantification of Watermelon Connective Tissue ..................................................................... 18
3.4. Image Segmentation based on Watershed Transform .................................................................. 20
3.5. Manual Segmentation of OCT Watermelon Imaging ................................................................ 24
3.6. Semitransparency for Comparison Purposes ............................................................................. 27
3.7. Measurement of Region Properties ............................................................................................ 28
4 Multivariate Techniques and Algorithms ..................................................................... 31
4.1. Definitions of Statistical Data ...................................................................................................... 31
4.2. Statistical Data Acquisition ......................................................................................................... 34
4.3. Statistical Analysis based on Regression Analysis ..................................................................... 35
4.4. Classification based on Statistical Multivariate Analysis .......................................................... 37
4.5. Correlation and Error Estimation based on Statistical Analysis ............................................... 40
4.6. Manual versus Automatic Segmentation based on Measurements of Region Properties ....... 42
5 Results ......................................................................................................................... 44
5.1. Regression Analysis Results ........................................................................................................ 44
5.2. Classification Results ................................................................................................................... 47
5.2.1. Classification Results based on Watermelon Peel Statistical Data ........................................ 47
5.2.2. Classification Results based on OCT Imaging of Watermelon Flesh Statistical Data .......... 50
5.2.3. Classification Results based on Manual OCT Imaging of Watermelon Flesh Statistical Data
............................................................................................................................................................... 52
5.3. Correlation and Mean Percentage Error Estimation Results .................................................... 54
5.3.1. Correlation and Mean Percentage Error Estimation Result based on OCT Imaging of
Watermelon Peel Statistical Data ........................................................................................................ 54
5.3.2. Correlation and Mean Percentage Error Estimation Result based on OCT Imaging of
Watermelon Statistical Data ................................................................................................................ 56
5.3.3. Correlation and Mean Percentage Error Estimation Result based on Manual OCT Imaging
of Watermelon Statistical Data ............................................................................................................ 58
5.4. Automatic versus Manual Segmentation Results ...................................................................... 60
6 Summary and Future Works ....................................................................................... 62
6.1. Summary and Conclusions .......................................................................................................... 62
6.2. Errors and Future Works ............................................................................................................ 63
Bibliography ............................................................................................................... 64
List of Figures
Figure 2.1: Schematic of OCT System based on Michelson interferometer. ............................................ 6
Figure 2.2: Typical fiber-optic implementation of TD OCT system, interferogram, and the A-scan
envelope. ......................................................................................................................................................... 8
Figure 2.3: Typical fiber-optic implementation of FD OCT system, spectrogram, and back-reflection
profile. ............................................................................................................................................................. 9
Figure 2.4: Typical fiber-optic implementation of SS OCT system, interferogram, and back-reflection
profile. ........................................................................................................................................................... 10
Figure 3.1: The area points which is taken around the heart of the watermelon market with X. ..........14
Figure 3.2: The area points which is taken at the darkest green of the watermelon peel market with X.
........................................................................................................................................................................ 15
Figure 3.3: Sample Image of Watermelon Peel. .......................................................................................16
Figure 3.4: Sample Binary Image of Watermelon Peel after the Application of Median Filter and
Morphological Closing. ................................................................................................................................ 18
Figure 3.5: Sample Image which contains only the part with the Watermelon Peel. ............................ 18
Figure 3.6: Sample OCT Image of Watermelon before processing. ........................................................ 20
Figure 3.7: Sample OCT Image of Watermelon after processing. ........................................................... 20
Figure 3.8: Image viewed as a surface, with labeled watershed ridge line and catchments basins. ...... 21
Figure 3.9: Sample of inverse OCT Image of Watermelon. ..................................................................... 22
Figure 3.10: Sample Binary Image of Watermelon after the Application of Median Filter and
Morphological Closing. ................................................................................................................................ 23
Figure 3.11: Distance Metric of the OCT Image of Watermelon. ............................................................ 23
Figure 3.12: Watershed Transformation of OCT Image of Watermelon. ............................................... 24
Figure 3.13: Sample OCT Watermelon Image of Manual Segmentation. .............................................. 25
Figure 3.14: Sample Binary OCT Watermelon Image of Manual Segmentation. .................................. 26
Figure 3.15: Distance Metric of Manual Segment OCT Image of Watermelon. ..................................... 26
Figure 3.16: Watershed Transformation of Manual Segment OCT Image of Watermelon. ................. 27
Figure 3.17: Application of Semitransparent technique onto manual and automatic segmentation. .. 28
Figure 3.18: (a) Binary Manual Segment Image, (b) Binary Image containing only the region
between 800 and 200,000 pixels, (c) Binary Image containing the centroid of each region (marked
with *), the red circle corresponds to the cell #4, (d) Binary Image containing only the enable region
(cell #4). ........................................................................................................................................................ 29
Figure 3.19: (a) Binary Manual Segment Image, (b) Binary Image containing only the region
between 4000 and 90,000 pixels, (c) Binary Image containing the centroid of each region (marked
with *), the red circle corresponds to the cell #19, (d) Binary Image containing only the enable region
(cell #19). ....................................................................................................................................................... 30
Figure 4.1: Characteristic Curve of Negative Skewness. .......................................................................... 33
Figure 4.2: Characteristic Curve of Positive Skewness. ........................................................................... 33
Figure 4.3: (a) Watershed Transformation of Manual Segmented OCT Image of Watermelon, (b)
Watershed Transformation of Automatic Segmented OCT Image of Watermelon (postgraduate data).43
Figure 4.4: (a) Watershed Transformation of Manual Segmented OCT Image of Watermelon, (b)
Watershed Transformation of Automatic Segmented OCT Image of Watermelon (undergraduate data).
....................................................................................................................................................................... 43
Figure 5.1: Regression Equation and Line for Pen versus Age. ............................................................... 45
Figure 5.2: Regression Equation and Line for Pen versus Weight. ........................................................ 46
Figure 5.3: Regression Equation and Line for Age versus Weight. ........................................................ 47
Figure 5.4: Canonical Variables and Classification Error per Age (OCT Imaging of Watermelon Peel).
....................................................................................................................................................................... 48
Figure 5.5: Canonical Variables and Classification Error per Pen (OCT Imaging of Watermelon Peel).
....................................................................................................................................................................... 49
Figure 5.6: Canonical Variables and Classification Error per Weight (OCT Imaging of Watermelon
Peel). .............................................................................................................................................................. 49
Figure 5.7: Canonical Variables and Classification Error per Age (OCT Imaging of Watermelon Flesh).
....................................................................................................................................................................... 50
Figure 5.8: Canonical Variables and Classification Error per Pen (OCT Imaging of Watermelon Flesh).
........................................................................................................................................................................ 51
Figure 5.9: Canonical Variables and Classification Error per Weight (OCT Imaging of Watermelon
Flesh). ............................................................................................................................................................. 51
Figure 5.10: Canonical Variables and Classification Error per Age (Manual OCT Imaging of
Watermelon Flesh). ...................................................................................................................................... 52
Figure 5.11: Canonical Variables and Classification Error per Pen (Manual OCT Imaging of
Watermelon). ................................................................................................................................................ 53
Figure 5.12: Canonical Variables and Classification Error per Weight (Manual OCT Imaging of
Watermelon). ................................................................................................................................................ 53
Figure 5.13: Correlation and MPE Estimation of Age (OCT Imaging of Watermelon Peel). ................ 55
Figure 5.14: Correlation and MPE Estimation of Pen (OCT Imaging of Watermelon Peel). ................ 55
Figure 5.15: Correlation and MPE Estimation of Weight (OCT Imaging of Watermelon Peel). .......... 56
Figure 5.16: Correlation and MPE Estimation of Age (OCT Imaging of Watermelon Cells). ............... 57
Figure 5.17: Correlation and MPE Estimation of Pen (OCT Imaging of Watermelon Cells). ............... 57
Figure 5.18: Correlation and MPE Estimation of Weight (OCT Imaging of Watermelon Cells). ......... 58
Figure 5.19: Correlation and MPE Estimation of Age (Manual OCT Imaging of Watermelon Cells). . 59
Figure 5.20: Correlation and MPE Estimation of Pen (Manual OCT Imaging of Watermelon Cells). 59
Figure 5.21: Correlation and MPE Estimation of Weight (Manual OCT Imaging of Watermelon Cells).
....................................................................................................................................................................... 60
Figure 5.22: (a) Outlines of manual and automatic segmentation, (b) Subtraction of manual and
automatic segment cell (new data) ...............................................................................................................61
Figure 5.23: (a) Outlines of manual and automatic segmentation, (b) Subtraction of manual and
automatic segment cell (old data).................................................................................................................61
List of Tables
Table 4.1: Statistical data of the intensity images. ................................................................................... 34
Table 4.2: Statistical data of power spectral density. ............................................................................... 35
Table 4.3: Measurements of Agricultural Research Institute.................................................................. 35
Table 5.1: Classification error (OCT Imaging of Watermelon Peel). ....................................................... 48
Table 5.2: Classification error (OCT Imaging of Watermelon Flesh). .................................................... 50
Table 5.3: Classification error (Manual OCT Imaging of Watermelon Flesh). ....................................... 52
Table 5.4: Correlation and mean error estimation result (OCT Imaging of Watermelon Peel). ........... 54
Table 5.5: Correlation and mean percentage error estimation results (OCT Imaging of Watermelon
Cells). ............................................................................................................................................................. 56
Table 5.6: Correlation and mean percentage error estimation results (Manual OCT Imaging of
Watermelon Cells). ....................................................................................................................................... 58
Abbreviations
AR Autoregressive
ARI Agricultural Research Institute
DFT Discrete Fourier Transform
FD OCT Frequency/Fourier Domain Optical Coherence Tomography
FFT Fast Fourier Transform
GUI Graphical User Interference
LCI Low Coherence Interferometer
LOOCV Leave-One-Out Cross Validation
MANOVA Multivariate One-Way Analysis of Variance
MPE Mean Percentage Error
MRI Magnetic Resonance Imaging
OCT Optical Coherence Tomography
OFDI Optical Frequency Domain Imaging
PCA Principal Component Analysis
PSD Power Spectral Density
SD OCT Spectral Domain OCT
SS OCT Swept Source Optical Coherence Tomography
TD OCT Time Domain Optical Coherence Tomography
1 Introduction
1.1. Brief Overview in Optical Coherence Tomography (OCT)
The term tomography refers to the method of producing two-dimensional data derived from
three-dimensional object to construct a slice image of the solid object's internal structure [1].
In the last decade, many tomographic imaging techniques have been developed, like
Ultrasound, Magnetic Resonance Imaging (MRI) and Computer-Generated Imaging [17].
Optical Coherence Tomography is a fundamentally novel technique of optical imaging
modality. This technique has been developed for noninvasive cross sectional imaging in
biological systems [5]. Furthermore, OCT has a determinant role in imaging due to the
accuracy of micrometer resolution and millimeter penetration depth.
Optical Coherence Tomography is based on the detection of infrared light waves to acquire
micron scale, cross-sectional, and three dimensional (3D) image of the subsurface
microstructure of biological tissues. It is analogous to B-mode ultrasound imaging, except that
the echo time delay and the intensity of back-reflected or back-scattered infrared light instead
of the acoustic waves, is measured. The principal operation of OCT is based on fiber optic
Michelson interferometer, which performs measurements with a low coherence length light
source. The “sample arm” of the interferometer illuminates the light on the tissue and collects
the backscattered light and the “reference arm” of the interferometer has a reference path
P a g e 2 Chapter 1: Introduction
delay that is scanned as a function of time. Optical interference between the light from the
sample and the reference arms occurs only when the optical delays correspond to within the
coherence length of the light source [1]. Two basic approaches of OCT have been developed
through the years, the Time Domain OCT (TD OCT) and the Fourier or Frequency Domain
OCT (FD OCT).
The rapid evolution of OCT reflected in the number of publications. Based on the PubMed
database for biomedical literature, the number of publications with the term “Optical
Coherence Tomography” increased slowly until 200 and had a stable increase of more than
200 publications per year [3].
1.2. Digital Image Processing
Human Vision is the most advanced and complex perception mechanism. It provides
information needed for simple as well as very complex tasks. Also, it is acceptable that the
image has a great impact in life. The importance of image is described in a well-known
proverb that says “One picture is worth a thousand words”. Several media adjust the images
into their requirements using digital image processing in order to achieve the transmission of
the necessary information [16].
Digital Image Processing refers to processing digital images by means of a digital computer.
Note that a digital image composed of a finite number of elements, each of which has a
particular location and value. These elements are referred to as picture elements, image
elements, pels and pixels. Pixel is the term most widely used to denote the elements of a
digital image [17]. Digital image processing allows a wide range of algorithms to apply to the
images and avoid problems such as the built-up noise and signal distortion.
There is no general agreement regarding where image processing stops and other related
areas such as image analysis and computer vision start. Sometimes a distinction is made by
defining image processing as a discipline in which both the input and output are digital
images.
Many techniques of digital image processing were developed in the last decade. These
reflected in the large number of papers published in international scientific journals each year,
as well as in a good number of specialized books in digital image processing.
An important characteristic underlying the design of image processing systems is the
significant level of testing and experimentation that normally is required before arriving at the
acceptable solution. This characteristic implies that the ability to formulate approaches and
P a g e 3 Chapter 1: Introduction
quickly prototype possible solutions generally plays a major role in reducing the cost and time
required to arrive at a viable system implementation [17].
1.3. Motivation
The initial motivation for the research in the watermelon was given by the Agricultural
Research Institute in an effort to interpret the physical attributes of watermelons. The primary
research was performed within the framework of my undergraduate studies (a brief overview
of this can be found in section 2.2) and due to the unexpected excellent results is given a
further motivation to study this subject in order to certify the validity of these results.
In combination with the aforementioned is also given the motivation to use OCT imaging to
study the watermelon cells, due to the fact that until now only the Electron Microscopy has
obtained their study. The procedure to obtain a sample using Electron Microscopy is time
consuming and expensive in contrast the procedure to obtain a sample using OCT. It is
important to be mentioned that the imaging of the watermelon peels used experimentally
given that no research, so far, has given satisfactory results.
Furthermore, digital image processing is used in an effort to enhance the resolution and the
quality of OCT imaging. Note that, when OCT became a research hotspot, most researchers
were interested in physics mechanism, instrumentation and practical applications. As the
research goes on, more people think of using image processing to solve the resulting problems.
They realize that some of the problems may not be easily solved by physical methods.
1.4. Scope of Thesis
This research project involves two main objectives for achieving. The first objective aims to
establish an algorithm for the improvement of the quality and accuracy of OCT imaging.
Furthermore, the second objective is to evolve a novel method that aims to create a reliable
and efficient solution which will provide information about the properties of watermelon.
More specific the requirement of the improvement of OCT imaging occurs due to the existence
of noise artifacts and back reflections in the resulting OCT imaging. These faults in the OCT
imaging are expected to cause alterations regarding the results; therefore algorithms are
implemented to avoid these consequences of alterations. Likewise, this algorithm gives the
ability to enhance the resolution and the quality of the OCT imaging.
In order to develop the appropriate method for the watermelons properties, a further, more
detailed and quantitative analysis of the watermelon changes, was performed. This study was
P a g e 4 Chapter 1: Introduction
facilitated by the creation of an algorithm that were identified automatically and quantitative
the cytological changes and the changes in the configuration of the peel during the ripening of
them.
Apart of the application of quantitative analysis of the watermelon peel and connective tissue,
automatic and manual segmentations were examined in order to check whether the latter
response to the first.
1.5. Chapters Overview
The current research is organized as follow:
Chapter 2: Background and Literature Review. This chapter gives an outline of the
fundamental principles of the innovative Optical Coherence Tomography approaches and the
main applications. Additionally, it presents the previous research which is the base and the
main motivation of the current research.
Chapter 3: Experimental Procedure and Image Processing in OCT Imaging. The
experimental procedure which is followed to acquire the OCT imaging samples of watermelon
and the implementation of the image processing in these samples, are covered and described
in this chapter.
Chapter 4: Multivariate Techniques and Algorithms. This chapter provides the
definitions of the statistical data and the manner of the statistical data acquisition.
Furthermore, covers all statistical analysis techniques, which is followed within the framework
of this research.
Chapter 5: Results. This chapter demonstrates and analyzes the obtaining results of the
statistical analysis.
Chapter 6: Summary and Future Works. This chapter gives a brief overview of this
thesis and possible future work.
2 Background and Literature Review
Following the brief reference in Optical Coherence Tomography, an extensive approach and
description is given in the current chapter. In addition, it gives an overview of the previous
work in OCT imaging of the watermelon.
2.1. Optical Coherence Tomography (OCT)
2.1.1. Introduction to Optical Coherence Tomography
Optical Coherence Tomography is a novel noninvasive, high-resolution tomographic imaging
technique using near-infrared light to acquire micron scale, cross-sectional, and three
dimensional (3D) image of the subsurface microstructure of biological specimens in situ and
in real time, which introduced in 1991. OCT imaging has a number of features that make it
attractive for a wide range of application.
The physical principle of OCT is analogous to B-mode ultrasound imaging, except that the
echo time delay and the intensity of back-reflected or back-scattered infrared light rather the
acoustic waves, is measured. The infrared light wavelengths used in OCT are up to two orders
of magnitude higher than ultrasound wavelengths, so OCT technology can yield a lateral and
axial spatial resolution of 1-10 μm, which is 10 to 25 times better than that of available high
P a g e 6 Chapter 2: Background and Literature Review
frequency ultrasound imaging. It is important to be mentioned that OCT imaging is sufficient
to reveal the fine biological structures, due to the advantage of high resolution, instead of
ultrasound imaging which is not. Additionally, the penetration depth of OCT imaging is
approximately 1-2 mm depending on tissue structure, focus depth of the probe used, and
pressure applied to the tissue surface. The resolution in combination with the penetration
depth gives the ability to OCT function as a type of “optical biopsy”, which is approaching
those of standard excisional biopsy and histopathology, but without the need to remove and
process the tissue specimens.
The classical layout of an OCT system is based on the fiber optic Michelson interferometer
(Figure 2.1.1) with a low coherence length light source (wavelength ranging from 700-1400
nm) from a superluminescent diode. It is important to mention that the wavelength range
used for OCT has to be selected in a way that guarantees high penetration into the specimen.
In the interferometer, the beam from the light source is directed onto a beam splitter that
divides the beam into a reference and a sample arm. The “sample arm” of the interferometer
illuminates the light on the tissue and collects the backscattered light. The “reference arm” of
the interferometer has a reference path delay that is scanned as a function of time. The
broadband nature of light causes interference of the optical fields to occur only when the path
lengths of the reference and the sample arm are matched to within the coherence length of the
light source. The interference signal carries information about the sample at a depth
determined by the reference path lengths.
Figure 2.1: Schematic of OCT System based on Michelson interferometer.
Source
Detector
50/50
Sample
Reference
z z
Δlc
Long Coherence Length Short Coherence Length
P a g e 7 Chapter 2: Background and Literature Review
The OCT System can be broadly classifier as Time-Domain OCT (TD OCT) and the Frequency-
Domain OCT (FD OCT).
Important parameters for OCT
Axial (or depth) Resolution is an important parameter in OCT system. It is used to measure
how fine the structures can be resolved in the depth direction. In all types of OCT systems, the
achievable resolution depends on the temporal coherence length of the light source. Larger
bandwidth of source and wider tuning bandwidth give better axial resolution.
Sensitivity in OCT refers to ability of the system to detect smallest amount back-reflection
from the sample under observation. Higher sensitivity gives also the ability of increase the
imaging speed.
2.1.2. Time-Domain Optical Coherence Tomography (TD OCT)
The first generation of OCT systems, denoted “time-domain OCT” (TD OCT), which was firstly
demonstrated in 1991 for cross-sectional imaging of retina and coronary artery. Since then,
OCT has rapidly developed as a noninvasive biomedical imaging modality between 1991 and
2003. It is remarkable, that the first commercial OCT device was released in 1996 for retinal
imaging and by 2002 gained Federal Drug Administration approval.
TD OCT has the advantage that can achieve detection sensitivity above 100dB and up to
several kHz axial scan speed, which gives the ability of real time imaging of tissue at a frame
rate on the order of 1-10 frames per second.
In TD OCT, multiple parallel Low Coherence Interferometer (LCI) scans performed to
generate two dimensional (2D) images. In OCT, a typical measurement system uses a low
temporal coherence light source, such as a superluminescent diode or a broad bandwidth laser,
which illuminate the Michelson interferometer. The measurement object is placed in the
sample arm of the interferometer [1, 3]. A measurement beam emitted by the light source is
reflected or backscattered from the object with different delay times, depending on the various
optical properties of the different layers within the object [1]. By changing the pathlength of
the reference arm, and synchronously recording the magnitude of the intensity of the resulting
interference fringes, a longitudinal profile of reflectivity in respect to depth is obtained. A
fringe signal is detected only when the optical path difference in the interferometer is shorter
than the coherence length of the light source. Locating the maximum fringe visibility position
allows one to determine the location of internal structures of the object with a resolution in
P a g e 8 Chapter 2: Background and Literature Review
the micrometer scale. Figure 2.1.2 presents a simple TD OCT system with the interference
signal and the A-scan envelope.
Figure 2.2: Typical fiber-optic implementation of TD OCT system, interferogram, and the A-scan envelope.
2.1.3. Frequency-Domain Optical Coherence Tomography (FD OCT)
The concept of Frequency Domain OCT (FD OCT), which is also known as Fourier Domain
OCT, introduced in 2003 that aimed to enable 10-100 fold improvements in detection
sensitivity and the speed of optical delay lines over the time-domain configuration. Instead of
the improvement of OCT performance, FD OCT enables 3D-OCT imaging in vivo. [1, 3]
In Fourier-Domain detection, the difference in length between sample and reference arm is
fixed, and echoes of light are obtained by Fourier transforming the interference spectrum.
Generally the interference spectrum can be performed using two complementary techniques,
first by analyzing the interfering signal with the spectrometer which referred to as spectral
domain OCT (SD OCT), or, second by sweeping the wavelength of the light directed to the
interferometer as a function of time. The latter is denoted as swept source OCT or optical
frequency domain imaging (OFDI).
Spectral Radar: Optical Coherence Tomography in the Fourier Domain
(FD OCT/SD OCT)
Spectral/Fourier domain detection uses a spectrometer and a high-speed line scan camera to
measure the interference spectrum in parallel. As aforementioned, the reference arm of FD
OCT is kept constant against the TD OCT.
Broad bandwidthsource
Detector
Beam splitter
Tissue
Scanning reference mirror
λ2
ΔL
dz
Single Reflection Site
Analog to digitalconverter Display
z
Filter Demodulate
P a g e 9 Chapter 2: Background and Literature Review
In FD OCT, the depth information is provided by an inverse Fourier transform of the
spectrum of the backscatter light. The amplitude of the spectrum of the backscattered sample
light amplitude is measured using spectrometer. The inverse Fourier transform of the
recorder spectral intensity yields the same signal as obtained by standard low interferometry
and provides a back-reflection profile as a function of depth. The broadband source used is
similar to TD OCT. FD OCT measures the signal in the Fourier domain and by Fourier
transformation, delivers the scattering profile in spatial domain. The Fourier transform
provides the location of the peak at that frequency that corresponds to the scatterer location
[1]. Figure 2.1.3 presents a simple FD OCT system with the spectrogram and the back-
reflection profile.
Figure 2.3: Typical fiber-optic implementation of FD OCT system, spectrogram, and back-reflection profile.
The measurable axial range of FD OCT is limited by the resolution of spectrometer, which is in
sharp contrast with TD OCT. However, FD OCT has the advantage of higher sensitivity over
conventional TD OCT, which increases the imaging speed.
Swept Source Optical Coherence Tomography (SS OCT) or Wavelength
Tuning
Swept Source OCT (SS OCT) or Wavelength Tuning is an alternative approach which use a
frequency-swept laser light source and a photodetector to measure the interference spectrum.
SS OCT technology can perform imaging at longer wavelengths of 1000 and 1300 nm and
reduces optical scattering and improves image penetration depths. Moreover, SS OCT enables
three dimensional (3D) OCT imaging of highly scattering tissues. [1, 3, 6]
Broad bandwidthsource
Beam splitter
Tissue
Reference mirror
Digitizer FFT Display
GratingCCD
Single Reflection Site
zλ
P a g e 10 Chapter 2: Background and Literature Review
By the usage of SS OCT technique as in the case of SD OCT, the reference arm length is fixed
and no moving parts are required for axial scan. This is an advantage which significantly
increases the speed of scanning. Additionally, another advantage is the use of a single
photodetector that provides a simple elimination of the unwanted DC intensity by a high-pass
filtering of the photodetector signal. This enhances the usable dynamic range of the detection
system considerably. In comparison with the FD OCT, SS OCT provides similar high-speed
data acquisition but without the drawbacks of the spectral limitation of the spectral
limitations of the charge-coupled device (CCD) camera. Figure 2.1.4 presents a simple SS OCT
system with the interferogram and the back-reflection profile. [1, 6]
Figure 2.4: Typical fiber-optic implementation of SS OCT system, interferogram, and back-reflection profile.
2.1.4. Application of OCT
Optical Coherence Tomography has evolved from an experimental laboratory tool to a new
diagnostic imaging modality with a wide spectrum of clinical applications in medical practice
including ophthalmology, cardiology, oncology, gastroenterology, dermatology, dentistry,
urology, gynecology among others [1]. OCT was initially applied for imaging in ophthalmology.
Nevertheless, additional advances in OCT technology have made it possible to use OCT in a
wide variety of applications. Medical applications are still dominating in the OCT application.
Besides the closely related surface tomography techniques, only a few non-medical OCT
applications have been investigated so far [9].
Most developed medical OCT applications:
Ophthalmology: Ophthalmic applications of OCT have been expanded rapidly, due to the
reason of the relatively transparent nature and accessibility of the human eye [1]. Another
Tunable lasersource
Beam splitter
Tissue
Reference mirror
Analog to digitalconverter FFT Display
λ
Time
Single Reflection Site
z
t
Detector
P a g e 11 Chapter 2: Background and Literature Review
reason is the interferometric sensitivity and precision of OCT which fits quite well the near-
optical quality of many ophthalmological structures. Still another reason is the independence
of depth resolution from sample beam aperture which enables high sensitivity layer structure
recording at the fundus of the eye [9]. It constitutes an invaluable diagnostic tool in the areas
of retina diseases and glaucoma [1].
Cardiology: The domain of cardiology has been extensively investigated. Firstly, OCT was
applied to the examination of coronary artery structure and the evaluation of atherosclerotic
plague morphology and stenting complications. Subsequently, cellular, mechanical, and
molecular analysis was performed including the estimation of macrophage load. Moreover,
the application of OCT to cardiology was greatly enhanced by technological developments
such as rotational catheter-based probes, very high imaging speed systems, and functional
OCT modalities [1].
Oncology: Imaging has been performed in a wide range of malignancies including
gastrointestinal, respiratory and reproductive tract, skin, breast, blander, brain, ear, nose, and
throat cancers. OCT has been used to evaluate the larynx, and has been shown to effectively
quantify the thickness of the epithelium and evaluate the integrity of the basement membrane.
It was also used to visualize the structure of the lamina propria [1]. Moreover there are
additional applications for oncology but is at the experimental level. This is happen because of
the improvement of accuracy needed.
Non-medical OCT applications:
Low-coherence interferometry has already been used in optical production technology and
other technical fields. For example, LCI or ‘interference with white light’ has been used for
many years in industrial metrology, e.g. as position sensor , for thickness measurement of thin
films , and for other measures that can be converted to a displacement. Recently, LCI has been
proposed as a key technology for high density data storage on multilayer optical discs [9].
2.2. Previous Research in OCT Imaging of Watermelon
Within the framework of my undergraduate studies, I have implemented a similar research for
the OCT imaging of watermelon. It is important to record an overview of this research for the
reason that constitutes the base foundation of the current research.
The aim was to find a tool which allows the agriculturist to separate and identify the ripening
and examines also the cytological changes into two varieties of watermelons. This research
was based in OCT imaging, in combination with image processing.
P a g e 12 Chapter 2: Background and Literature Review
The aspects which were covered within the framework of my undergraduate research are the
following:
Experimental Procedure: Using the IVS 300 Optical Coherence Tomography, imaging of two
varieties of watermelons was performed and saved for image processing.
Image Processing: Many methods of image processing were performed such as quantification
of connective tissue (using median filter and morphological opening and closing), and
segmentation of the watermelon cells (using watershed transformation). These methods are
explained further in the next chapter because are also used in the current research. Based on
the resulting images of the image processing, statistical data was acquired.
Statistical Data Acquisition: Statistical data was used for the production of histograms and
the estimation of the p-value. Likewise, these data was used for classification purposes.
Results: Based on histograms, the physical interpretation of the watermelon was given and it
was consistent according the opinion of agriculturist. In addition, by using classification
method it was revealed that the usage of OCT imaging could absolutely distinguish (100%) the
varieties and age of watermelons.
As referred, within this research, interesting and unexpectedly excellent results were given
and, thus, further research in this field was motivated.
3 Experimental Procedure &
Image Processing in OCT Imaging
Optical Coherence Tomography (OCT) Image has not been validated for the quality and
accuracy of micrometer-level information, therefore many researches leading in Image
Processing to solve physical problems.
This Chapter describes the experimental procedure and the image processing, which followed
within the framework of this research. For the implementation of image processing the
numerical computing programming language named Matlab is used.
3.1. Experimental Procedure
In the context of the completion of this research, two experiments methods were performed in
order to gather various samples of OCT Images of Watermelon flesh and peel. The
experimental procedure held in the Laboratory of Biomedical and Applied Optics at University
of Cyprus, during the summer months (July and August). For the experiments needs, the
watermelons were supplied by the Agricultural Research Institute of Cyprus.
The experiments dates were determined based on harvest days of the watermelons which were
25th and 29th of July 2013 and 2nd and 5th of August 2013. In each period, ten watermelons
P a g e 14 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
were used. Some of these were enough ripe, others were unripe and others were at the
appropriate age of harvest. The watermelons which were used for the experiments were
grafted onto cucurbit hybrids.
The steps for the implementation of the experimental procedure for the imaging of
watermelon flesh were the following:
i. Each watermelon was cutting transversely in the middle with specialize knife, so as
not to cause alternation to the cells.
ii. Using the Optical Coherence Tomography, eight samples of each watermelon flesh
were taken around the hearth, in the center of the watermelon (Figure 3.1).
Figure 3.1: The area points which is taken around the heart of the watermelon market with X.
iii. Image Properties:
• Diameter of Imaging: 6cm (around the center) to avoid imaging of seeds and
ovary of the watermelon.
• Total Images : 4 days x 10 watermelons x 8 samples = 320 images of the
watermelon flesh
iv. Saving of OCT Images.
Furthermore, the steps for the implementation of the experimental procedure for the imaging
of watermelon peel were the following:
i. Using the Optical Coherence Tomography, two samples of each watermelon peel were
taken at the darkest green area of the peel. (Figure 3.2). The imaging was applied in
the darkest green area of peel, for the reason that according the agriculturists this
area changes during the ripening period.
P a g e 15 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.2: The area points which is taken at the darkest green of the watermelon peel market with X.
v. Image Properties:
• Area of Imaging: darkest green of the peel.
• Total Images: 4 days x 10 watermelons x 2 samples = 80 images of the
watermelon peel.
vi. Saving of OCT Images.
3.2. Quantification of Watermelon Peels
The aim of the process covered in the next pages was to create an image which contained the
part only with the watermelon peels. To achieve this objective the image noise has been
reduced, in order to not alter the results. The OCT Images used for quantification of
watermelon peels, were collected with the methodology which referred in section 3.1.
The steps for the implementation of this process quoted in the current section of this chapter.
The programming code regarding the implementation it can be found in Appendix A.
Step 1: Import of OCT Image of Watermelon Peels
Firstly, the two images imported of the peel from each watermelon opened and displayed
(Figure 3.3), simultaneously. In order to open the images the absolute value of FFT and the
logarithmic of data were performed.
P a g e 16 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.3: Sample Image of Watermelon Peel.
Step 2: Application of Median Filter and Morphological Closing and
Conversion of the OCT Image to Binary
At this step images normalized in order their pixels values lies in the range of zero (0) and one
(1). A median filter was performed after the completion of the normalized procedure.
The Median Filter is a non-linear operation, which is used in image processing to remove or
reduce the “salt and pepper” noise. Noise reduction is an effective method, often use as pre-
processing step to improve the results of later processing. Median filtering is widely used in
image processing because, under certain conditions, it preserves edges while removing noise
[13].
Once the median filter was applied, the threshold level was computed with the usage of Otsu
Algorithm. The Otsu method has the ability to choose the threshold to minimize the intraclass
variance of black and white pixels. The threshold level can be used to convert an intensity
image to a binary image [17]. Thereinafter, the intensity images were converted to binary
images.
The process about conversion images to binary followed by the usage of the Morphological
Closing. This operation is a combination of the operations Erosion and Dilation, where are
fundamental to morphological image processing.
Dilation is an operation that “grows” or “thickens” objects in a binary image. The specific
manner and extent of this thickening is controlled by a shape referred as a structuring element.
Structuring element typically are represented by matrix of zeros (0s) and ones (1s).
Mathematically, dilation is defined in terms of set operations. The dilation of A by B, is
defined as
P a g e 17 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
𝐴⨁𝐵 = {𝑧|�𝐵��𝑧 ∩ 𝐴 ≠ ∅}
where ∅ the empty set and B represents the structuring element.
Erosion “shrinks” or “thins” objects in a binary image. As in dilation, the manner and extent of
shrinking is controlled by a structuring element.
Mathematically, the definition of erosion is similar to the dilation. The erosion of A by B is
defined as
𝐴⊖ 𝐵 = {𝑧|(𝐵)𝑧⋂𝐴𝑐 ≠ ∅}
The Morphological Closing of A by B, denoted 𝐴 ∙ 𝐵, is a dilation followed by an erosion using
the same structuring element for both operation:
𝐴 ∙ 𝐵 = (𝐴⨁𝐵) ⊖𝐵
where A represents a binary image and B represents a matrix of zeros (0s) and ones (1s) that
specifies the structuring element.
Morphological Closing tends to smooth the contours of objects. It generally joins narrow
breaks, fills long thin gulfs, and fills holes smaller than the structuring element. The
structuring element which is used for the purpose of this process is a flat, disk-shaped with
radius R [17].
The Figure 3.4 below shows the results of the above processing. It is clear to see that the most
content of the images were removed, but the surface of the peel is distinguishable and
consecutive.
P a g e 18 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.4: Sample Binary Image of Watermelon Peel after the Application
of Median Filter and Morphological Closing.
Step 3: Creation of an Image containing only Watermelon Peel
In the final step of this procedure, the images were amended 550 pixels below the front
surface of the peel. The Figure 3.5 shows a sample image which contains only the part with the
watermelon peel.
Figure 3.5: Sample Image which contains only the part with the
Watermelon Peel.
As aforementioned above, the aim of this process was about to reduce the noise and create an
image comprising only the part of the watermelon peel. Upon the completion of this process,
statistics were obtained for subsequent statistical analysis and classification. Further analysis
and discussion for these statistics provided in Chapter 4 and 5.
3.3. Quantification of Watermelon Connective Tissue
The aim of the process described in this section is to create an image which will contain only
the connective tissues and the cell walls. To achieve this target the image noise was reduced
and the back-reflections were removed, in order not to alter the results. The OCT Images were
P a g e 19 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
used for quantification of watermelon tissue, were gathered with the methodology which is
referred in section 3.1.
To achieve this objective, using Matlab, a graphical user interface (GUI) was created in order
to improve image quality and resolution. With the usage of GUI, the following commands
were available for application at the images: (some of these were explained further in section
3.2)
Median Filter: removing or reducing the “salt and pepper” noise and preserving edges.
Morphological Image Closing: smoothing the contours of objects, joining narrow breaks,
filling long thin gulfs and holes.
Removal of Vertical Lines: removing the vertical line (back-reflections) of the image.
Colormap: adjusting the image color for perceptual vision (the applicable properties was gray,
brown, blue and red). Colormap blue was applied because it made the content of the image
more visible.
Lower and Upper Limit: expanding midrange color resolution by mapping low values to the
first color and high values to the last color in the colormap by specifying lower and upper
value limit, respectively.
Export: use to save image to various file formats. For the purpose of the research, the images
saved as a jpeg format.
The above mention features were applied and the result of this procedure can be found in
Figure 3.6 and 3.7 which show the same sample image of watermelon before and after
processing, respectively.
P a g e 20 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.6: Sample OCT Image of Watermelon before processing.
Figure 3.7: Sample OCT Image of Watermelon after processing.
It is important to note, that the result was remarkable when the above-mentioned commands
were applied. In Figure3.6 the content of the image was not visible enough, but after the
processing (Figure 3.7) it was. In fact, a proportion of noise was removed and the color of the
image was strengthened. However, the second amplified the back-reflections, something
which it is expected that it will alternate the future results.
On the completion of the process mentioned above, images of watermelon opened and
normalized in order their pixels values lies in the range of zero (0) and one (1). Following that,
statistics were obtained for future statistical analysis and classification. Further analysis and
discussion for the interpretation of these statistics are provided in Chapters 4 and 5.
The programming code used regarding the processing that described in this section can be
found in Appendix B.
3.4. Image Segmentation based on Watershed Transform
To segment the image into homogeneous regions that corresponds to the cells of the OCT
Watermelon Image, Watershed Transform has been performed.
According to geography, watershed is the ridge of high land dividing areas that are drained by
different river systems. A catchment basin is the geographical area into a river or reservoir.
For further determination of watershed, a topological surface with two areas can be assumed,
as seen in Figure 3.8. If we imagine rain falling on this surface, it is clear that the water would
collect in the two areas labeled as catchment basins. Rain falling exactly on the labeled
P a g e 21 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
watershed ridge line would be equally likely to collect in either of the two catchments basins
[17].
Figure 3.8: Image viewed as a surface, with labeled watershed ridge line and catchments basins.
The Watershed Transform can be used to solve a variety of image segmentation problems.
The watershed transform finds the catchment basins and ridge lines in a gray scale image. In
terms of solving image segmentation problems, the key concept is to change the starting image
into another image whose catchment basins are the object or regions we want to identify [17].
For the implementation of this process, the following steps were applied. The programming
code is given in Appendix B.
Step 1: Import of OCT Image of Watermelon
For the application of Watershed Transformation, the OCT Images of Watermelon which were
process via GUI were used. So in this step truecolor RGB OCT Images opened and converted
to the grayscale intensity images. Afterwards, the images were normalized. The Figure 3.9
illustrates a sample of the inverse OCT Image of Watermelon.
P a g e 22 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.9: Sample of inverse OCT Image of Watermelon.
Step 2: Conversion of the OCT Image to Binary and Application of
Morphological Opening
In this step, the threshold level computed with the usage of Otsu Algorithm, as referred before,
and the intensity grayscale image converted to binary image. The process of conversion the
images to binary followed by the usage of the Morphological Opening.
The Morphological Opening of A by B, denoted 𝐴°𝐵, is simply erosion of A by B, followed by
dilation, using the same structuring element for both operation:
𝐴°𝐵 = (𝐴⊖ 𝐵)⨁ 𝐵
where A represents a binary image and B represents a matrix of zeros (0s) and ones (1s) that
specifies the structuring element.
Morphological Opening removes completely region of an object that cannot contain the
structuring element, smooths object contours, breaks thin connections, and removes thin
protrusions. The structuring element which is also used for the purpose of this process is a flat,
disk-shaped with radius R. [17]
The figure 3.10 illustrates the results of the above processing.
P a g e 23 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.10: Sample Binary Image of Watermelon after the Application of Median Filter and Morphological Closing.
Step 3: Computation of Distance Metric
A tool commonly used in conjunction with the watershed transform for segmentation is the
distance transform. The Distance Transform of a binary image is a relative simple concept: It
is the distance from every pixel to the nearest non zero-valued pixel. The method which is
used to compute the distance transform was the chessboard. The chessboard distance between
(x1, y1) and (x2, y2) is max(|x1 - x2|,| y1 - y2|).
The Figure 3.11 shows the distance metric of the OCT Image of Watermelon. This image has a
maximum value at the center of each cell and a minimum at the periphery (along the
membrane).
Figure 3.11: Distance Metric of the OCT Image of Watermelon.
Step 4: Watershed Segmentation Using the Distance Transform
P a g e 24 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Following the computation of distance metric, the Watershed Transform was applied, in order
to segment the image into homogeneous regions. The inverse image which is created in Step 3
was used as the initial image to perform the Watershed Transformation. So in the center of
each cell, a minimum value (valley) exists.
The result of the Watershed Segmentation appears in Figure 3.12.
Figure 3.12: Watershed Transformation of OCT Image of Watermelon.
As aforementioned, the scope of this process was to segment the image into homogeneous
region which corresponds to the cells of the OCT Watermelon Image. When this process was
completed, statistics were obtained for subsequent analysis and classification. Further analysis
and discussion for these statistics are provided in Chapters 4 and 5.
3.5. Manual Segmentation of OCT Watermelon Imaging
Up to this step of research, automatic algorithm was performed in order to segment the
images into regions. The results of the above-mentioned process were not the desirable, since
the Watershed Segmentation splits the image into smaller regions, which was visible that they
do not exist. To improve the accuracy of image segmentation, manual segmentation was
examined, in order to compare with the automatic algorithm of segmentation.
The procedure followed to perform manual segmentation can be characterized as subjective.
Nevertheless, all images that were under this, their containing the same level of subjectivity,
because their generated by a particular person, called as “expert”.
In order to generate the images for the manual segmentation, the images which were the
results of the process via GUI were used. These images were printed and the “expert” draws in
P a g e 25 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
transparent papers step-by-step the outline of each cell in OCT image. Thereinafter, these
papers scanned and saved as digital image (jpeg format) for subsequent use.
The programming code regarding the implementation of the manual segmented image which
followed can be found in Appendix C.
Step 1: Import of Manual Segment OCT Imaging of Watermelon.
Once the procedure of manual segmentation was completed, OCT Watermelon Images opened
through the use of Matlab. Therefore the images have been cropped in the right dimensions
and were displayed. The Figure 3.13 shows a sample image of manual segmentation.
Figure 3.13: Sample OCT Watermelon Image of Manual Segmentation.
Step 2: Conversion of the Manual Segment OCT Imaging to Binary
While, the OCT Images opened, the threshold level was computed so as to convert an intensity
to a binary image. The Figure 3.14 shows a sample manual segmentation binary OCT
Watermelon Image.
P a g e 26 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.14: Sample Binary OCT Watermelon Image of Manual Segmentation.
Step 3: Computation of Distance Metric
Distance Transform0m is the distance from every pixel to the nearest non zero-valued pixel.
The method which is used to compute the distance transform was the chessboard, which is
previously explained.
The Figure 3.15 shows the distance metric of the OCT Image of Watermelon. This image has a
maximum value at the center of each cell and a minimum at the periphery (along the
membrane).
Figure 3.15: Distance Metric of Manual Segment OCT Image of Watermelon.
Following that statistics were obtained by the usage of the binary image for future analysis and
classification. Further analysis and discussion for these statistics are provided in Chapters 4
and 5.
Step 4: Watershed Segmentation
P a g e 27 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
As mentioned above Watershed Transformation is capable to segment the image into
homogeneous regions. In case of manual segmentation Watershed must have better and
reliable results due to the outline of each cell being closed and consecutive. The inverse binary
image that was created in Step 2 was used as the initial image to perform the Watershed
Transformation. In the center of each cell, a minimum value exists.
The results of the Watershed Transformation in manual segment images illustrates in Figure
3.16. It is observable that a few cells do not recognized due to that the outline is not
consecutive.
Figure 3.16: Watershed Transformation of Manual Segment OCT Image of Watermelon.
The aim of the manual segmentation was to segment the image into homogeneous region
which corresponds to the cells of the OCT Watermelon Imaging, which was created form the
“expert”. This method was followed in order to compare with the automatic algorithm. Once
this process was completed, statistics were obtained for subsequent statistical analysis and
classification. Further analysis and discussion for these statistics are provided in Chapters 4
and 5.
3.6. Semitransparency for Comparison Purposes
An effort was operated to ascertain the accuracy and the correctness of automatic
segmentation in comparison with the manual segmentation. To achieve this, semitransparent
technique was used. This technique gives the ability to make an object transparent onto
another object and make it visible what information the object would obscure if it was
completely opaque. The semitransparent technique was applied onto the image of the manual
segmentation and the resulting image of the watershed transformation. Figure 3.17
demonstrates the resulting image of this application.
P a g e 28 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Figure 3.17: Application of Semitransparent technique onto manual and automatic segmentation.
If the segmented cell by the usage of manual segmentation lies into correspond area of the
automatic segmentation, since the result of the automatic segmentation is correct. As seen,
the result obtained is not the expected, thus another operation follows in order to provide a
more adequate manner of comparison.
3.7. Measurement of Region Properties
The target of this procedure is to specify properties for each component (object) within an
image. By measuring properties of OCT and manual OCT imaging are given the ability to use
them to compare and draw conclusions about the reliability and the accuracy of segmentation.
Initially, the manual segment image was opened and converted into binary image and with the
usage of latter the connected component of each image were labeled, in order to find out the
specific properties of each one of them. For the research needs, the properties that were
measured are the following:
Area: the Area property returns a scalar that specifies the actual number of pixels in the
region. In Figure 3.19 (b), the area between 800 and 200,000 pixels is chosen in order to
remove the small areas which are obtained because some outlines are not continuous.
Centroid: the Centroid property returns a 1-by-Q vector that specifies the center of mass of the
region. The first element of Centroid is the horizontal coordinate (x-coordinate) of the center
of mass, and the second element is the vertical coordinate (y-coordinate). Using these
coordinates the centroid of each cell was plotted and the result can be found in Figure 3.18 (c),
the centroids of each cell can be recognized by the blue star (*).
Image: the Image property returns a binary image (logical) of the same size as the bounding
box of the region. The “on” pixels correspond to the region, and all other pixels are “off”. In
Figure 3.18 (d), the enable region corresponds to the cell which labeled with the number 4.
P a g e 29 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
Also, in Figure 3.18 (c) this cell represented with a red circle. In order to create this red circle
the property Minor and Major Axis Length and Centroid were used to define the center and
the radius of the circle.
Minor Axis Length: the minor axis length property returns a scalar that specifies the length in
pixels of the minor axis of the ellipse that has the same normalized second central moments as
the region.
Major Axis Length: the major axis length property returns a scalar that specifies the length in
pixels of the major axis of the ellipse that has the same normalized second central moments as
the region.
Figure 3.18: (a) Binary Manual Segment Image, (b) Binary Image containing only the region between 800 and 200,000 pixels, (c) Binary
Image containing the centroid of each region (marked with *), the red circle corresponds to the cell #4, (d) Binary Image containing only the enable
region (cell #4).
For comparison purposes, the image which was obtained by the automatic segmentation used
in order to measure their region properties. For this image centroid, image, minor and major
P a g e 30 Chapter 3: Experimental Procedure & Image Processing in OCT Imaging
axis length properties were also measured. Consequently, using the properties of each region
is given the ability to use them and compare each region separately.
The same method was also followed in the samples of image which is obtained during my
undergraduate research (described in section 2.2). These old data was used due to the better
quality of imaging and expected to have lower proportion of error. Figure 3.19 shows the
results of the measurement of the aforementioned properties.
Figure 3.19: (a) Binary Manual Segment Image, (b) Binary Image containing only the region between 4000 and 90,000 pixels, (c) Binary
Image containing the centroid of each region (marked with *), the red circle corresponds to the cell #19, (d) Binary Image containing only the enable
region (cell #19).
On the completion of the application of several methods for digital image processing, as
referred above, statistical characteristics of each method were acquired and used for statistical
analysis and classification.
The programming code for the implementation of this procedure is given in Appendix D.
4 Multivariate Techniques and Algorithms
The statistical analysis of the statistical data acquired from the methods that described in
Chapter 3 is essential for mean percentage error estimation, estimation of relationships
among variables (correlation), classification and estimation of classification error. For the
aforementioned estimations advance techniques, such as Regression Analysis, Leave-One-Out
Cross Validation (LOOCV), Principal Component Analysis (PCA), Multivariate Analysis of
Variance (MANOVA), Discriminant Analysis and Correlation were used.
This Chapter describes the techniques for the statistical analysis, mentions the statistical data
and the acquisition of them. For the purpose of the statistical procedure, techniques and
algorithms have been implemented in Matlab.
4.1. Definitions of Statistical Data
Mean: mean and expected value are used synonymously to refer to one measure of the
central tendency either of a probability distribution or of the random variable characterized by
that distribution. Specifically, the sum of the observations divided by the number of the
observations.
The mathematical approach for the mean can be expressed in the following formula:
P a g e 32 Chapter 4: Multivariate Techniques and Algorithms
�̅� =𝑠𝑠𝑠 𝑜𝑜 𝑜𝑜𝑠𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑠
𝑜𝑠𝑠𝑜𝑜𝑜 𝑜𝑜 𝑜𝑜𝑠𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑠=∑ 𝑥𝑖𝑛𝑖=1
𝑜
where �̅� is the mean, xi is the observation, and n represents the number of observations.
Median: is the number which is separating the higher half of a data sample, a population, or
a probability distribution, from the lower half. The median of a finite list of numbers can be
found by arranging all the observations from lowest value to highest value and picking the
middle one.
The mathematical approach for the median can be expressed in the following formula:
𝜇 = �
𝑥�𝑛+12 � , 𝑜 𝑜𝑜𝑜
𝑥�𝑛2�+ 𝑥�𝑛+12 �
2, 𝑜 𝑜𝑜𝑜𝑜
where μ is the mean, x is the observation, and n represents the number of observations.
Variance: measures how far a set of numbers (observations) is spread out. A variance of
zero indicates that all the values are identical. A small variance indicates that the data points
tend to be very close to the mean and hence to each other, while a high variance indicates that
the data points are very spread out around the mean and from each other.
The mathematical approach for the variance can be expressed in the following formula:
𝜎2 = ∑ (𝑥𝑖 − �̅�)2𝑛𝑖=1
𝑜 − 1
where σ2 is the variance, xi is the observation, �̅� is the mean value and n represents the
number of observations.
Standard Deviation: is a measure that is used to quantify the amount of variation or
dispersion of set of data values. A standard deviation close to zero indicates that the data point
tend to be very close to the mean of the set, while a high standard deviation indicates that the
data points are spread out over a wider range of values. Standard Deviation is equal to the
positive square root of variance.
The mathematical approach for the standard deviation can be expressed in the following
formula:
𝜎 = +�𝜎2
P a g e 33 Chapter 4: Multivariate Techniques and Algorithms
where σ is the standard deviation and the sub root (𝜎2) contains the square of variance.
Skewness: is a measure of the asymmetry of the probability distribution of a real-valued
random variable about its mean. The skewness value can be positive or negative, or even
undefined.
Negative skew indicates that the tail on the left side of the probability density function is
longer or fatter than the right side. Conversely, positive skew indicates that the tail on the
right side is longer or fatter than the left side.
Figure 4.1: Characteristic Curve of Negative Skewness.
Figure 4.2: Characteristic Curve of Positive Skewness.
Kurtosis: is any measure of the “peakedness” of the probability distribution of a real-valued
random variable. Kurtosis is a descriptor of the shape of a probability distribution.
Distributions with negative or positive excess kurtosis are called paltykurtic distributions and
leptokurtic distributions respectively.
Autoregressive Power Spectral Density - Burg’s method: Power spectral
density (PSD) describes how the power of a signal or time series is distributed over the
different frequencies [14].
Assume a matrix x, the PSD is computed independently for each column and stored in the
corresponding column in matrix pxx, pxx is the distribution of power per unit frequency. The
frequency is expressed in units of rad/sample.
P a g e 34 Chapter 4: Multivariate Techniques and Algorithms
At this point it is important to mention essential parameters for watermelons
(measured and provided by the ARI) which are referred in the following procedures:
Age of watermelon: is defined by the planting day of watermelon until the harvest day.
Weight of watermelon: is defined by the weight of watermelon in kilos (kg).
Firmness of watermelon: was recorded as the maximum resistance force to penetration
around the heart of each fruit in cross-section to depth of 50 mm (measurement unit: kg). In
this thesis is also referred as pen [18].
4.2. Statistical Data Acquisition
As referred in Chapter 3, statistical data acquisition of OCT imaging was performed, upon the
completion of image processing. These data saved in tables and was used for subsequent
statistical analysis.
Using the intensity image, namely the pixel value, of each OCT imaging of watermelon peel
and flesh, mean, median, variance, standard deviation, kurtosis and skewness were measured.
Note that, similar tables were acquired using the result images of the watershed
transformation. In Table 4.1 demonstrates a sample table of OCT imaging of the watermelon
flesh. Each row corresponds to the statistical data value obtained by a watermelon intensity
image.
Table 4.1: Statistical data of the intensity images.
Intensity Variance
Intensity Mean
Intensity Median
Intensity Standard Deviation
Intensity Kurtosis
Intensity Skewness
0,0616 0,8819 0,9804 0,2483 8,7597 -2,6466
··· ··· ··· ··· ··· ···
··· ··· ··· ··· ··· ···
0,0590 0,8840 0,9765 0,2429 9,1818 -2,7110
Furthermore, power spectral density (PSD) measured in each case of study. The Table 4.2 is
the distribution of power per unit frequency. Each row corresponds to power spectral density
by a watermelon OCT imaging. The number of order and the nfft points which used for the
statistical acquisition was chosen by the trial and error method. The term order defined as the
P a g e 35 Chapter 4: Multivariate Techniques and Algorithms
order of the autoregressive (AR) model used to produce the PSD estimate and the term nfft
determines the points in the DFT (Discrete Fourier Transform).
Table 4.2: Statistical data of power spectral density.
Points in Discrete Fourier
Transform
1 ··· 256 ···
Sample 1
29,2384 ··· 0,0367 ···
···
··· ··· ··· ···
···
··· ··· ··· ···
Sample 152
30,0521 ··· 0,0351 ···
The measurements provided by the Agricultural Research Institute for the research are
presented in Table 4.3.
Table 4.3: Measurements of Agricultural Research Institute.
Sample Set Date Harvest Date
Fruit Age (days)
Weight (kg)
Pressure - Pen (kg)
1 14/06/2013 25/07/2013 41 5,7 3,9
··· ··· ··· ··· ··· ···
10 17/06/2013 25/07/2013 38 4,3 3,9
1 23/06/2013 29/07/2013 39 3,6 4,7
··· ··· ··· ··· ··· ···
10 21/06/2013 29/07/2013 38 4,7 5,1
··· ··· ··· ··· ··· ···
The acquisition of the statistical data gives the ability to apply several statistical analysis
methods for comparison and classification purposes. The explanation and the results of the
statistical analysis are given in the current chapter and in Chapter 5, respectively.
4.3. Statistical Analysis based on Regression Analysis
Regression analysis is a statistical process for the estimation of the relationships among
variables [13]. It gives the ability to predict continuous dependent variables from a number of
P a g e 36 Chapter 4: Multivariate Techniques and Algorithms
independent variables. It can be used to identify the form of curve which provides the best fit
through a dataset. For the purpose of research polynomial regression analysis was performed.
Polynomial Regression is a form of linear regression in which the independent variable x and
the dependent variable y is modeled as an n-th degree polynomial. Polynomial regression fits
using the least squares method. The least squares method minimizes the variance of the
unbiased estimators of the coefficients, under the conditions of the Gauss-Markov theorem.
The mathematical approach for the polynomial analysis can be expressed in the following
general formula:
𝑦 = 𝑝1𝑥𝑛 + 𝑝2𝑥𝑛−1 + ⋯+ 𝑝𝑛𝑥 + 𝑝𝑛+1
where x is the independent variable, y is the dependent variable, n represents the degree of
the polynomial and p represents the coefficient of the polynomial.
Another significant coefficient closely related with the regression analysis is the R squared
(R2). R squared denotes the coefficient of determination, which indicates the proportionate
amount of variation in the response variable y explained by the independent variables x in the
regression model. The larger the R-squared is the more variability is explained by the
regression model. The R-squared is range from 0 up to 1, and denotes the strength of the
linear association between x and y.
R-squared is the proportion of the total sum squares which is explained by the following
model:
𝑅2 = 1 −∑ (𝑦𝑖 − 𝑜𝑖)2𝑖
∑ (𝑦𝑖 − 𝑦�)2𝑖
where the numerator of the fraction represents the residual sum of squares and the
denominator of the fraction represents the total sum of squares.
For the purpose of this research regression analysis is used in order to yield models for the
data that the Agricultural Research Institute provided for studying. The parameters measured
by the ARI were age, pen and the weight. Regression analysis was performed repetitively using
each time a combination of two out of the three variables given by ARI. One parameter was
used as independent and the other one as dependent variable.
The results of the application of regression analysis will discuss in Chapter 5. Moreover, the
related algorithm can be found in Appendix E.
P a g e 37 Chapter 4: Multivariate Techniques and Algorithms
4.4. Classification based on Statistical Multivariate Analysis
Several method of statistical analysis is used in different aspects in terms of research and
experiments. Many research used different statistical analysis methods in order to lead in an
optimum results of their experiments.
In this part of research an effort is given to classify the watermelons according the ripening
day, the weight and the pen, with the usage of the following methods. Therefore, statistics
which arisen by the processing of OCT imaging and by the ARI, have been used.
Leave-One-Out Cross Validation (LOOCV)
Cross Validation is an evaluation method which is used to measure the predictive performance
of statistical method. Generally, the operation method is to split the statistical data into two
dataset, the training and the testing. The training dataset contains the known data on which
the training of algorithm run and a dataset of unknown data against which the model is tested.
In case of leave-one-out cross validation, for a dataset with N observations, N experiments
perform. Therefore for each experiment, N-1 observations are used for training and the
remaining observation for testing.
The computational time of LOOCV is expensive due to the number of experiments instead of
this the predictive performance is accurate enough.
Principal Components Analysis (PCA)
Principal Components Analysis (PCA) is statistical procedure which gives the ability of
identifying patterns in data, by reducing a complex data set to lower dimension, without loss
of information and expressing the data in such a way as to highlight the importance of values
[10]. PCA uses an orthogonal transformation to convert a set of observations of possibly
correlated variables into a set of values of linearly uncorrelated variables, the principal
components. The number of principal components is less or equal to the number of original
variables. This transformation is defined in such a way that the first principal component has
the largest possible variance and each succeeding component in turn has the highest variance
possible under the constraint that it is orthogonal to the preceding components [11].
Assume an m-by-n data matrix X to perform principal component analysis with standardized
variables, that is, based on correlations and compute the principal component coefficients.
The rows of X correspond to observations and the columns to variables. The result of the PCA
P a g e 38 Chapter 4: Multivariate Techniques and Algorithms
command is an n-by-n matrix, each column containing coefficients for one principal
component. The columns are in order of decreasing component variance.
Mathematical Approach of PCA
The starting point for PCA is a random vector x with n elements, and x has zero empirical
mean, is centered by subtracting its mean. A linear combination of the vector x can be defined
as:
𝑦1 = �𝑤𝑘𝑥𝑘 = 𝐰1T𝐱
𝑛
𝑘=1
where w11, …, wn1 represent elements of an n-dimensional weight vector w1.
If y1 has maximum variance then is the first PC of x, variance depends on both the norm and
orientation of the weight vector w1 the constraint that the norm equals to 1 must be imposed,
||w1||=1. The variance of y1 is defined as:
𝐸{𝑦12} = 𝐸 ��𝐰𝟏T𝐱�2� = 𝐰𝟏
𝐓𝐸{𝐱𝐱𝑇}𝐰1 = 𝐰1𝑇𝐂𝐱𝐰1
where Cx is the m-by-n covariance of x. The weight vector that maximizes the above equation
must be calculated so that ||w1||=1, it is well known that the eigenvectors of the covariance Cx,
e1, …, en are the solutions for the maximization variance. Thus, the first PC is given by:
𝑦1 = 𝐞𝟏𝑻𝐱
Generalized the equation of variance y1 to k PCs, 𝑦𝑘 = 𝐰𝟏𝑻𝐱 one can find the rest PCs under the
constraint that yk is uncorrelated with all the previously found PCs. It follows that:
𝐰𝑘 = 𝒆𝑘
Thus the k-th PC is
𝑦𝑘 = 𝐞𝑘𝑇𝐱
It has been proved that the PC basis vector wk is eigenvectors ek of the covariance matrix Cx it
follows that:
𝐸{𝑦𝑚2 } = 𝐞𝑚𝑇 𝐸{𝐱𝐱𝑇}𝐞𝑚 = 𝐞𝑚𝑇 𝐂𝐱𝐞𝑚 = 𝑜𝑚
P a g e 39 Chapter 4: Multivariate Techniques and Algorithms
where dm are the eigenvalues of Cx. Thus, by ordering the eigenvectors found from the
covariance matrix by eigenvalue, from highest to lowest, this gives PCs in order of significance
[11] [12].
Discriminant Analysis and Classification
Discriminant Analysis is a statistical analysis which is used to predict a categorical dependent
variable by one or more independent variables. Moreover, discriminant analysis is a
classification method used to determine in which category each sample belongs.
A number of types for classifier exist such as linear, mahalanobis, quadratic etc., which it
gives the ability to specify the type of discriminant function. Linear discriminant analysis fits
a multivariate normal density to each group, with a pooled estimate of covariance.
Mahalanobis discriminant analysis uses Mahalanobis distances with stratified covariance
estimates. The mahalanobis distance of an observation x = (x1, …, xn)T from a group of
observations with mean μ= (μ1. …, μn)T and covariance matrix S is defined as:
𝐷𝑚(𝑥) = �(𝑥 − 𝜇)𝛵 × 𝑆−1(𝑥 − 𝜇)
Quadratic discriminant analysis, it computes the sample mean of each class. Then it computes
the sample covariances by first subtracting the sample mean of each class from the
observations of that class, and taking the empirical covariance of each class.
Within the framework of the current research the above mention type of discriminant analysis
was used, in order to find out the type that minimized the classification error.
Multivariate One-Way Analysis of Variance (MANOVA)
Multivariate Analysis of Variance is a statistical test procedure, which is used to determine
multivariate means among several groups. It is closely related to Discriminant Analysis and
Classification [15].
The data in MANOVA may be considered as forming a matrix X in which the columns
correspond to a measured variable. X is an m-by-n matrix of data values, and each row is a
vector of measurements on n variables for a single observation. In order to compare
multivariate means of the columns of X grouped by group, MANOVA was performed. Group
is a grouping variable defined as a categorical variable. Two observations are in the same
group if they have the same value in the group array. The observations in each group
represent a sample from a distribution (population). The function MANOVA tests the null
P a g e 40 Chapter 4: Multivariate Techniques and Algorithms
hypothesis that the means of each group are the n-dimensional multivariate vector, and that
any difference observed in the sample X is due to random chance.
Steps of Classification
Step 1: Application of leave-one-out cross validation (LOOCV). For each experiment all
observations (N) of the watermelon were split into training and testing datasets. The training
dataset contains the known data (N-1 observations) on which the training of algorithm run
and a dataset of unknown data (1 observation) against which the model is tested.
Step 2: Application of principal component analysis (PCA) to reduce the data dimensions. The
number of principal component which was used in each classification was determined by trial
and error method in order to give the lower classification error.
Step 3: Application of mahalanobis discriminant analysis for classification purposes. The type
of discriminating function was selected by trial and error method.
Step 4: Application of multivariate one-way analysis of variance (MANOVA) to determine
whether the mean of a variable differs significantly among groups, using canonical variable
values. Each column in the matrix of canonical value is a linear combination of the mean-
centered original variables.
Step 5: Estimation of Classification Error.
The programming code for the implementation of the classification can be found in Appendix
F.
4.5. Correlation and Error Estimation based on Statistical
Analysis
In this part of research an effort is given in order to estimate error and correlation of the
watermelons according the ripening day, the weight and the pen. The statistics which are
arisen by the image processing of OCT imaging and by the ARI, have been also used for the
completion of this procedure.
Correlation
Correlation is a statistical technique that can show whether and how strongly pairs of
variables are related. The quantity R, called linear correlation coefficient, measures the
P a g e 41 Chapter 4: Multivariate Techniques and Algorithms
correlation. The value of R is range from -1 up to +1. The + sign represents positive linear
correlations, and the – sign represents negative linear correlations.
The mathematic formula for computing R is:
𝑅(𝑥, 𝑦) = 𝑐𝑜𝑜𝑜(𝑥,𝑦) =𝑐𝑜𝑜(𝑥, 𝑦)𝜎𝑥𝜎𝑦
=𝐸[(𝑥 − 𝜇𝑥)�𝑦 − 𝜇𝑦�]
𝜎𝑥𝜎𝑦
where E is the expected value operator, cov means covariance, and corr is a widely used
alternative notation for the correlation coefficient.
Positive correlation: If x and y have a strong positive linear correlation, r is close to +1. An r
value of exactly +1 indicates a perfect positive fit. Positive values indicate a relationship
between x and y variables such that as values for x increase, values for y also increase.
Negative correlation: If x and y have a strong negative linear correlation, r is close to -1. An r
value of exactly -1 indicates a perfect negative fit. Negative values indicate a relationship
between x and y such that as values for x increase, values for y decrease.
No correlation: If there is no linear correlation or a weak linear correlation, r is close to 0. A
value near zero means that there is a random, nonlinear relationship between the two
variables.
Steps of Percentage Error Estimation and Correlation
Step 1: Application of leave-one-out cross validation (LOOCV). For each experiment all
observations of the watermelon except one are used for training and the remaining
observation for testing.
Step 2: Application of principal component analysis (PCA) to reduce the data dimensions. The
number of principal component which was used in each classification was determined by trial
and error.
Step 3: Estimation of mean percentage error.
The formula for Mean Percentage Error is the following:
𝑀𝑀𝐸 =100%𝑜
× �𝑜𝑖 − 𝑜𝑖𝑜𝑖
𝑛
𝑖=1
P a g e 42 Chapter 4: Multivariate Techniques and Algorithms
where 𝑜𝑖represents the actual value of the quantity being forecast, 𝑜𝑖represents the forecast,
and n is the number of times for which the variable is forecast.
Step 4: Computation of correlation coefficient.
The programming code for the implementation of the correlation is given in Appendix G.
4.6. Manual versus Automatic Segmentation based on
Measurements of Region Properties
The question of this procedure is to find out whether manual or automatic segmentation is
adequate to distinguish the watermelon cells. If the comparisons of the segmentations have a
high proportion of similarities, implies that the automatic segmentation is functional, accurate
and reliable. A Matlab code was generated in order to contribute to the comparison of both
aforementioned segmentations. As referred in section 3.7, samples from both (undergraduate
and postgraduate research) experiments which used.
Initially, the measurement of the centroid of each region in the manual segmented image was
used as a reference point. Using this point, the corresponding centroid in the automatic
segmented image was found. Subsequently, both centroids were situated in the same
coordinates and the outline of each region in manual segmented image and the corresponding
outline of the automatic segmented image plotted in the same figure. In order to complete this
procedure the pixel values of the one region were deducted from the other corresponding
region.
Figure 4.3 and 4.4 show the resulting watershed from the manual (a) and automatic (b)
segmentation, which should be comparing.
P a g e 43 Chapter 4: Multivariate Techniques and Algorithms
Figure 4.3: (a) Watershed Transformation of Manual Segmented OCT Image of Watermelon, (b) Watershed Transformation of Automatic
Segmented OCT Image of Watermelon (postgraduate data).
Figure 4.4: (a) Watershed Transformation of Manual Segmented OCT Image of Watermelon, (b) Watershed Transformation of Automatic
Segmented OCT Image of Watermelon (undergraduate data).
The results of the statistical analysis can give an evaluation for the physical interpretation of
the watermelon properties.
5 Results
This Chapter demonstrates the results which obtained within the framework of the
completion of the image processing and the statistical analysis. It is necessary to interpret the
results in order to understand the actual meaning of the experiment and understand the
errors which yielded.
5.1. Regression Analysis Results
Regression analysis is performed and the polynomial model equation was computed in each
case of study. This statistical method gives the ability to predict the relationship among
variables.
At the first case of study, pen was used as an independent variable and age as a dependent
variable. The resulting polynomial approach for this model is a linear first order equation,
which represented as follows:
𝑝𝑜𝑜 = 0.026 × 𝑜𝑎𝑜 + 4.313
The coefficient of determination (R2) for this case was 0.010, which means that 1% of the total
variation in pen can be explained by linear relationship between pen and age. The other 99%
P a g e 45 Chapter 5: Results
in pen remains unexplained. Also, as seen in Figure 5.1 the regression line is away from the
points, so it is not able to explain the variation. Summarized this model is not predictable.
Figure 5.1: Regression Equation and Line for Pen versus Age.
The second case of study was performed regression analysis for pen and weight, the first was
independent variable and the latter was dependent variable. The resulting polynomial
approach for this model is a linear first order equation, which represented as following:
𝑝𝑜𝑜 = 0.546 × 𝑤𝑜𝑜𝑎ℎ𝑜 + 7.564
The coefficient of determination (R2) for this case was 0.130, which means that 13% of the
total variation in pen can be explained by linear relationship between pen and weight. The rest
87% in pen remains unexplained. Also, as seen in Figure 5.2 the regression line is away from
the points, so it is not able to explain the variation. Therefore, this model is not predictable
enough.
P a g e 46 Chapter 5: Results
Figure 5.2: Regression Equation and Line for Pen versus Weight.
The latter case of study was also to predict regression curve and equation for age and weight,
the first was independent variable and the latter was dependent variable. The resulting
polynomial approach for this model is a linear first order equation, which represented as
following:
𝑜𝑎𝑜 = 1.207 × 𝑤𝑜𝑜𝑎ℎ𝑜 + 34.076
The coefficient of determination (R2) for this case was 0.042, which means that 4.2% of the
total variation in age can be explained by linear relationship between age and weight. The
other 95.8% in age remains unexplained. Also, as seen in Figure 5.3 the regression line is away
from the points, so it is not able to explain the variation. To sum up this model is not
predictable.
P a g e 47 Chapter 5: Results
Figure 5.3: Regression Equation and Line for Age versus Weight.
The data values are scattered and there are no relationship among this data. In conclusion, it
is observable that regression analysis cannot estimate a predictable model for pen, age and
weight of watermelon.
5.2. Classification Results
Classification of the watermelon peel and flesh according the age, the weight and the pen,
performed, and the classification error are estimated. In each case, an effort is produced to
observe whether the statistical data which were obtained after the image processing can be
classify according the parameters which measured by ARI. The results of this procedure are
presented in the current section that aims to determine the statistical and physical
interpretation.
The classification algorithm was responsible to classify the observations among two groups,
above or below to 35, 5, 4 for age, pen and weight respectively. It is important to note that the
classification error should be at least below the 0.1. If it is close to zero (0), the predictable
observation classified to the correct group of the known data set.
5.2.1. Classification Results based on Watermelon Peel Statistical Data
The classification results obtained using manual OCT imaging of watermelon peel statistical
data, are shown in Table 5.1 and in Figure 5.4, 5.5 and 5.6.
P a g e 48 Chapter 5: Results
Table 5.1: Classification error (OCT Imaging of Watermelon Peel).
Variable – Parameter Classification Error (%)
Age 24.324
Pen 43.243
Weight 27.027
Figure 5.4: Canonical Variables and Classification Error per Age (OCT
Imaging of Watermelon Peel).
P a g e 49 Chapter 5: Results
Figure 5.5: Canonical Variables and Classification Error per Pen
(OCT Imaging of Watermelon Peel).
Figure 5.6: Canonical Variables and Classification Error per Weight (OCT
Imaging of Watermelon Peel).
It is observed that none of these parameters can be used to classify the new observation in the
correct data set, since the classification error in each case is higher than the limit of 10%.
Therefore, the OCT imaging of watermelon peel cannot used to predict the group which each
watermelon belongs.
P a g e 50 Chapter 5: Results
5.2.2. Classification Results based on OCT Imaging of Watermelon Flesh
Statistical Data
The classification results obtained using OCT imaging of watermelon flesh statistical data, are
shown in Table 5. 2 and in Figure 5.7, 5.8 and 5.9.
Table 5.2: Classification error (OCT Imaging of Watermelon Flesh).
Variable – Parameter Classification Error (%)
Age 22.222
Pen 22.222
Weight 22.222
Figure 5.7: Canonical Variables and Classification Error per Age (OCT
Imaging of Watermelon Flesh).
P a g e 51 Chapter 5: Results
Figure 5.8: Canonical Variables and Classification Error per Pen (OCT
Imaging of Watermelon Flesh).
Figure 5.9: Canonical Variables and Classification Error per Weight (OCT
Imaging of Watermelon Flesh).
It is observed that none of these parameters can used to classify the new observation in the
correct data set, since the classification error is 22.222% in each case which is higher than the
limit of 10%. Therefore, the OCT imaging of watermelon flesh cannot be used to predict in
P a g e 52 Chapter 5: Results
which group the watermelon belongs, thus, it is not possible to gain any information about the
properties of watermelon.
5.2.3. Classification Results based on Manual OCT Imaging of
Watermelon Flesh Statistical Data
The classification results obtained using manual OCT imaging of watermelon peel statistical
data, are shown in Table 5.3 and in Figure 5.10, 5.11 and 5.12.
Table 5.3: Classification error (Manual OCT Imaging of Watermelon Flesh).
Variable – Parameter Classification Error (%)
Age 25.000
Pen 6.250
Weight 31.250
Figure 5.10: Canonical Variables and Classification Error per Age (Manual
OCT Imaging of Watermelon Flesh).
P a g e 53 Chapter 5: Results
Figure 5.11: Canonical Variables and Classification Error per Pen (Manual
OCT Imaging of Watermelon).
Figure 5.12: Canonical Variables and Classification Error per Weight
(Manual OCT Imaging of Watermelon).
It is observed that the parameters age and weight cannot be used to classify the new
observation in the correct data set, since the classification error in each case is higher than the
limit of 10%. However, the parameter pen, as seen, can be used to predict the group in which
the watermelon belongs and thus determine its properties.
P a g e 54 Chapter 5: Results
5.3. Correlation and Mean Percentage Error Estimation
Results
Correlation Coefficients and Mean Percentage Error of the watermelon peel and cells
according to the ripening day, the weight and the pen, are estimated. In each case of study, an
effort is effected to examine whether the parameters, which measured by ARI, are related with
the statistical data which were obtained after the image processing. The results of this
procedure are presented in the current section that aims to determine the statistical and
physical interpretation.
A mean percentage error should be at least below the 20 %. If it is approaching the zero (0),
then the experimental value is close enough to the targeted value. Additionally, a correlation
greater than 0.8 is generally described as strong, whereas a correlation less than 0.5 is
generally described as weak. A study utilizing scientific data requires a strong correlation. It is
not enough to have only a low mean percentage error, but a high correlation coefficient is
needed, so that these two statistical values are interrelated.
5.3.1. Correlation and Mean Percentage Error Estimation Result based
on OCT Imaging of Watermelon Peel Statistical Data
Once the procedure for the estimation of the correlation and the mean percentage error for
the statistical data of the OCT imaging of watermelon peel completed, the results obtained can
be found in this part of research (Table 5.4 and Figure 5.13, 5.14 and 5.15).
Table 5.4: Correlation and mean error estimation result (OCT Imaging of Watermelon Peel).
Variable – Parameter Mean Error (%) Correlation Coefficient
Age 14.301 -0.082
Pen 30.079 -0.0178
Weight 21.028 0.364
P a g e 55 Chapter 5: Results
Figure 5.13: Correlation and MPE Estimation of Age (OCT Imaging of Watermelon Peel).
Figure 5.14: Correlation and MPE Estimation of Pen (OCT Imaging of Watermelon Peel).
P a g e 56 Chapter 5: Results
Figure 5.15: Correlation and MPE Estimation of Weight (OCT Imaging of Watermelon Peel).
Based on the results obtained, it is observed that the only variable that presented mean
percentage error lower than 20% is the age. However this cannot be validated because the
correlation coefficient approaches zero (o), something which indicates that there is no
correlation among the variables. The variables pen and weight do not satisfy any of the
conditions mentioned above, so cannot be used as a way to identify the relation between them.
Summarized, these variables have weak correlation and a high percentage error, thus cannot
use the OCT imaging of the watermelon peel to provide any information about the physical
interpretation of the watermelon properties.
5.3.2. Correlation and Mean Percentage Error Estimation Result based
on OCT Imaging of Watermelon Statistical Data
Using OCT imaging of watermelon flesh statistical data, the results obtained are shown in
Table 5.5 and in Figure 5.16, 5.17 and 5.18.
Table 5.5: Correlation and mean percentage error estimation results (OCT Imaging of Watermelon
Cells).
Variable – Parameter Mean Error (%) Correlation Coefficient
Age 9.648 0.745
P a g e 57 Chapter 5: Results
Pen 26.344 -0.039
Weight 21.136 0.389
Figure 5.16: Correlation and MPE Estimation of Age (OCT Imaging of Watermelon Cells).
Figure 5.17: Correlation and MPE Estimation of Pen (OCT Imaging of Watermelon Cells).
P a g e 58 Chapter 5: Results
Figure 5.18: Correlation and MPE Estimation of Weight (OCT Imaging of Watermelon Cells).
Based on the results obtained, it is observed that the only variable that presented low mean
percentage error and a remarkable correlation coefficient is the age. The mean percentage
error for the variable age is below 10% (9.648%) and the correlation coefficient is around 0.8
(0.745), so the OCT imaging of the watermelon cells can be possibly used to predict the actual
age of watermelon. The variable pen and weight do not satisfy the necessary conditions, so are
considered that cannot predict or evaluate the watermelon properties. Summarized, it is
observable that the statistical data of OCT imaging of watermelon can be used to determine
the watermelon age.
5.3.3. Correlation and Mean Percentage Error Estimation Result based
on Manual OCT Imaging of Watermelon Statistical Data
Using manual OCT imaging of watermelon flesh statistical data, the results obtained are
shown in Table 5.6 and in Graph 5.19, 5.20 and 5.20.
Table 5.6: Correlation and mean percentage error estimation results (Manual OCT Imaging of
Watermelon Cells).
Variable – Parameter Mean Error (%) Correlation Coefficient
Age 12.115 0.570
P a g e 59 Chapter 5: Results
Pen 30.861 -0.511
Weight 18.900 0.448
Figure 5.19: Correlation and MPE Estimation of Age (Manual OCT Imaging of Watermelon Cells).
Figure 5.20: Correlation and MPE Estimation of Pen (Manual OCT Imaging of Watermelon Cells).
P a g e 60 Chapter 5: Results
Figure 5.21: Correlation and MPE Estimation of Weight (Manual OCT Imaging of Watermelon Cells).
Based on the results obtained, it is observed that the variable age, pen and weight cannot be
used to estimate the actual value of these properties for the watermelon. The correlation
coefficients are around 0.5, something that denote weak correlation among the variables. In
the case of age and weight, the mean percentage errors are remarkable, but the correlation
coefficient is lower than the essential conditions. Summarized, it is observable that the
statistical data of the manual OCT imaging of watermelon cannot be used to determine the
watermelon properties.
5.4. Automatic versus Manual Segmentation Results
In an attempt to evaluate the reliability of automatic and manual segmentation, a procedure
was performed, for comparison purposes. If the comparisons of the segmentations have a high
proportion of similarities, implies that is adequate to distinguish the watermelon cells by
manual and automatic manner and lead on reliable results.
Unfortunately, the results of this procedure were not the expected, since the proportion of
error was extremely high when the manual segmented cell subtracted from the automatic
segmented cell. Figure 5.22 can confirm that the automatic segmentation is not reliable to
segment the cells. Likewise Figure 5.23 can confirm that neither the automatic segmentation
of the old data can use to distinguish and segment the cells.
P a g e 61 Chapter 5: Results
Figure 5.22: (a) Outlines of manual and automatic segmentation, (b) Subtraction of manual and automatic segment cell (new data)
Figure 5.23: (a) Outlines of manual and automatic segmentation, (b) Subtraction of manual and automatic segment cell (old data).
In conclusion, the results obtained from the completion of this research were not expected and
desired due to possible errors in the experiments or absence relations between the measurable
parameters of the watermelons. However, some of these results can lead in a logical conclusion
due to the low MPE and classification error.
6 Summary and Future Works
This Chapter consist a brief overview of this thesis and it suggests possible future work for the
optimization of this research.
6.1. Summary and Conclusions
The usage of the Optical Coherence Tomography, in conjunction with the developed
algorithms, for the purposes of this thesis aimed to optimize the quality and resolution of the
OCT imaging. Apart from this, an effort was given to interpret the physical characteristics
(estimation of age and pen) of the watermelons based on the cytological changes,
quantification of the watermelon peels and connective tissues. In case the research yielded the
expected and desired results, it would constitute a pioneer tool for the agriculturist and a step
towards the optimization of the OCT image.
The majority of the results obtained from the statistical analysis and classification do not lead
to desirable and reasonable conclusions. This was a result of errors during the experiments or
even due to the absences of relation between the samples of watermelons.
To sum up, it worth mentioning that the image processing and the statistical analysis yielded a
low mean percentage error (9,648%) and a high correlation coefficient (0,745) giving the
P a g e 63 Chapter 6: Results
ability to predict the age of the watermelon. In addition, the manual segmentation of the cells
and the algorithms created are giving the possibility of classification since they had a low
classification error (6,250%).
6.2. Errors and Future Works
During the OCT imaging and the development of algorithms some issues came up which will
be important to be taking into consideration for the improvement of the algorithms and the
guarantee of more reliable and useful results.
The experimental process of OCT imaging gave back reflections and noise artifacts, due to
technical problems, which was the main issue during the image processing. A possible
solution is the technical improvement of the imaging and, maybe, the creation of additional
algorithms for the deduction of back reflections which had serious effect on the results of the
research.
In conclusion, additional research, development and improvement of the existing and also
new algorithms for the extraction of more information from the OCT images that would be
useful for the agriculturist. It worth mentioning that two additional characteristics have been
studied by this thesis in addition to the work performed during my undergraduate studies.
Bibliography
[1] Chen Yu, Bousie Evgenia, Pitris Constantinos, Fujimoto G. James. Optical Coherence Tomography:
Introduction and Theory
[2] Testoni Alberto Pier. “Optical Coherence Tomography”. The Scientific World Journal. Volume 7. pp.
87-108, January 2007.
[3] Walther Julia, Caertner, Cimalla Peter, Burkhardt Anke, Kirsten Lars, Meissner Sven, Koch Edmund.
“Optical Coherence Tomography in biomedical research”. Volume 400. pp. 2721-2743, May 2011.
[4] Podoleanu Gh. A. “Optical Coherence Tomography”, March 2012.
[5] Huang David, Swanson A. Eric, Lin P. Charles, Schuman S. Joel, Stinson G. William, Ghang Warren,
Hee R. Michael, Flotte Thomas, Gregory Kenton, Puliafito A. Carmen, Fujimoto G. James. “Optical
Coherence Tomography”. Science. Volume 254.
[6] Ali Murtaza, Parlapalli Renuka. “Signal Processing Overview of Optical Coherence Tomography
Systems for Medical Imaging”, June 2010.
[7] Kai Yu, Liang Ji, Lei Wang, Ping Xue. “How to optimize OCT image”. Volume 9. June 2001.
[8] McCabe M. James, Croce J. Kevin. “Optical Coherence Tomography”
[9] A F Fercher, W Drexler, C K Hitzenberger, T Lasser. “Optical Coherence Tomography – Principles
and Applications”, January 2003.
[10] Smith I. Lindsay. “A tutorial on Principal Components Analysis”, February 2002.
[11] M. Mudrova, A. Prochazka. “Principal Component Analysis in Image Processing”.
[12] Kartakoullis Andreas. “Spectral Analysis of Optical Coherence Tomography Signals”, May 2008.
[13] “Regression Analysis Tutorial”
[14] Kazlauskas Kazys. “The Burg Algorithm with the Exrapolation for Improving the Frequency
Estimation”, December 2010.
[15] French Aaron, Macedo Marcelo, Poulsen John, Waterson Tyler, Yu Angela. “Multivariate Analysis
of Variance (MANOVA)”
[16] Pitas Ioannis. “Digital Image Processing Algorithms and Applications”
[17] Gonzalez C. Rafael, Woods E. Richard, Eddins L. Steven. “Digital Image Processing Using Matlab”
[18] Kyriacou C. Marios, Soteriou Georgios, “Quality and Postharvest Performance of Watermelon Fruit
in response to grafting on interspecific cucurbit rootstocks ”. Journal of Food Quality, August 2014.
Appendices
Appendix A
clear; close all; clc; count=0; DoPlot=0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load Image Day=cellstr(['25072013';'29072013';'02082013';'05082013']); for i=1:size(Day) folders = dir(Day{i}); for j=1:size(folders) for ImNum=1:2; if size(folders(j).name, 2) > 2 FileName=sprintf('C:\\Users\\Maria\\Desktop\\New folder\\Watermelon OCT\\2013\\%s\\%s\\fl%d',Day{i},folders(j).name,1); FileName1=sprintf('C:\\Users\\Maria\\Desktop\\New folder\\Watermelon OCT\\2013\\%s\\%s\\fl%d',Day{i},folders(j).name,2); count=count+1; InterpFile='datainterp1000.mat'; DoLog=1; DoAbs=1; [IM h fs snr llim ulim] = OpenOCTFDImage(FileName,InterpFile,2,0,DoAbs,DoLog,0,1); DoLog=1; DoAbs=1; [IM1 h fs snr llim ulim] = OpenOCTFDImage(FileName1,InterpFile,2,0,DoAbs,DoLog,0,1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Display OCT Image if DoPlot DisplayOCTFDImage(IM, h, llim, ulim, octcolor(256,0,'blue')); DisplayOCTFDImage(IM1, h, llim, ulim, octcolor(256,0,'blue')); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Normalize IM=IM-min(min(IM)); % Normalize between 0 and 1 IM=IM./max(max(IM)); IM1=IM1-min(min(IM1)); % Normalize between 0 and 1 IM1=IM1./max(max(IM1)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Filter and convert to binary fIM=medfilt2(IM,[11 11]); % Filter the image cf=1.25; level = cf*graythresh(fIM); % Convert the image to binary BW = im2bw(fIM,level);
se=strel('disk',40); % Perform close to close gaps BW=imclose(BW,se); fIM1=medfilt2(IM1,[11 11]); % Filter the image cf=1.25; level = cf*graythresh(fIM1); % Convert the image to binary BW1 = im2bw(fIM1,level); se=strel('disk',40); % Perform close to close gaps BW1=imclose(BW1,se); if DoPlot figure; imagesc(BW); % Display the image axis xy; colormap(gray); figure; imagesc(BW1); % Display the image axis xy; title('Thresholded Image'); colormap(gray); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Find the front surface [m n]=size(IM); for q=20:n-20 temp=find(BW(:,q),1,'last'); y(q)=temp; sIM(:,q-19)=IM(y(q)-700:y(q)-150,q); %spectrum IM_nolog / Statistics log_abs end; [m n]=size(IM1); % Find the top surface for q=20:n-20 temp=find(BW1(:,q),1,'last'); y(q)=temp; sIM1(:,q-19)=IM1(y(q)-700:y(q)-150,q); %spectrum IM_nolog / Statistics log_abs end; if DoPlot figure; imagesc(sIM); colormap(gray); axis xy; figure; imagesc(sIM1); colormap(gray); axis xy; end; fprintf('%d\n',count); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Statistics [m n]=size(sIM); temp1=reshape(sIM,[m*n 1]); [m n]=size(sIM1); temp2=reshape(sIM1,[m*n 1]); temp=[temp1;temp2]; S(count,:)= pburg(temp, 4, 4096); S(count,1)=var(temp); S(count,2)=mean(temp); S(count,3)=median(temp); S(count,4)=std(temp); S(count,5)=kurtosis(temp); S(count,6)=skewness(temp); end; end; end; end;
Appendix B
clc; close all; clear; count=0; DoPlot=0; Day=cellstr(['02082013';'05082013';]);%'29072013';'02082013';'05082013'25072013]); for i=1:size(Day) folders = dir(Day{i}); for j=1:size(folders) for ImNum=1:8; if size(folders(j).name, 2) > 2 FileName=sprintf('C:\\Users\\Maria\\Desktop\\New folder\\Watermelon OCT\\2013\\jpegs\\%s\\%s\\im%d.jpg',Day{i},folders(j).name,ImNum); count=count+1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Image Normalization I = imread(FileName); I = double(rgb2gray(I)); I = I(1:end-50,:); I = I-min(min(I)); I = I/max(max(I)); I=1-I; if DoPlot figure; subplot(2,2,1); imagesc(I);colormap(gray); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Conversion to Binary Image thr=graythresh(I); BW=im2bw(I,0.3*thr); se=strel('disk',3); BW = imopen(BW,se); if DoPlot subplot(2,2,2); imagesc(BW); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Dinstance Metric D = bwdist(~BW,'chessboard'); D(~BW) = -Inf; D = -D; if DoPlot subplot(2,2,3); imagesc(D); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Watershed Transformation L = watershed(D,8); if DoPlot subplot(2,2,4); imagesc(L); end; Lrgb = label2rgb(L, 'jet', 'w', 'shuffle'); if DoPlot figure; subplot(2,1,1); imagesc(I);colormap(gray); subplot(2,1,2);imagesc(Lrgb); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Statistics of the Segmented Image
NumOfRegions=max(max(L)); for q=1:NumOfRegions ind=find(L==q); A(q)=length(ind); end; S(count,:)= pburg(A, 4, 4096); S(count,1)=var(A); S(count,2)=mean(A); S(count,3)=median(A); S(count,4)=std(A); S(count,5)=kurtosis(A); S(count,6)=skewness(A); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Statistics of the Intensity Image [m n]=size(I); temp=reshape(I,[m*n 1]); S(count,:)= pburg(temp, 4, 4096); S(count,1)=var(temp); S(count,2)=mean(temp); S(count,3)=median(temp); S(count,4)=std(temp); S(count,5)=kurtosis(temp); S(count,6)=skewness(temp); end; end; end; end;
Appendix C
clear; close all; clc; count=0; DoPlot=0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load Image Day=cellstr(['02082013';'05082013']);%;'29072013';'25072013';]); for i=1:size(Day) folders = dir(Day{i}); allNames = {folders.name}; Folders = folders(~strcmpi(allNames, 'Thumbs.db')); for j=1:size(Folders) for ImNum=1:8; if size(Folders(j).name, 2) > 2 FileName=sprintf('C:\\Users\\Maria\\Desktop\\New folder\\Watermelon OCT\\2013JPEG\\%s\\%s\\Image%d.jpg',Day{i},Folders(j).name,ImNum); count=count+1; IM=imread(FileName); [m n]= size(IM); cIM = imcrop(IM,[700 1000 3250 1400]); if DoPlot figure(); subplot(2,1,1); imagesc(cIM); title('OCT Image of Watermelon'); axis on; end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Convert to binary level = graythresh(cIM); BW = im2bw(cIM,level); if DoPlot subplot(2,1,2);imagesc(BW);colormap(gray); title('Binary OCT Image of Watermelon'); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Distance Metric D = bwdist(~BW,'chessboard'); D(~BW) = -Inf; D = -D; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Watershed based transformation L = watershed(-BW); % Perform watershed if DoPlot subplot(2,1,2); imagesc(L); title('Watershed-based Segmentation'); end; I=1-L; if DoPlot figure imagesc(I);colormap(gray); end; Lrgb = label2rgb(L, 'jet', 'w'); if DoPlot figure; subplot(2,1,1); imagesc(I);colormap(gray); subplot(2,1,2); imagesc(Lrgb); end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Get Statistics NumOfRegions=max(max(L)); % Calculate the area of each region for q=1:NumOfRegions ind=find(L==q); A(q)=length(ind); end; S(count,:)= pburg(A, 4, 4096); S(count,1)=var(A); S(count,2)=mean(A); S(count,3)=median(A); S(count,4)=std(A); S(count,5)=skewness(A); S(count,6)=kurtosis(A); end; end; end; end;
Appendix D
clc; close all; clear; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % I= imread('OCTImage_02082013_003-01072013_Im1.jpg'); subplot (2,2,1); subimage(I); title('Manually Segment Image');colormap(gray);xlabel('(a)') BW=im2bw(I); f=bwlabel(BW); propiedArea=regionprops(f, 'Area'); area_values=[propiedArea.Area]; idx=find((800<= area_values)& (area_values <=200000)); h=ismember(f,idx); f=f.*h; subplot (2,2,2); subimage(f); title('Area Between 800 and 200000');xlabel('(b)') subplot (2,2,3);imagesc(f);colormap('jet');title('Centroid of each region'); xlabel('(c)') props=regionprops(f, 'Image','Centroid', 'MajorAxisLength', 'MinorAxisLength'); centers = props(4).Centroid; diameters = mean([props.MajorAxisLength props.MinorAxisLength],2); radii = (diameters+diameters)/2; centroids = cat(1, props.Centroid); hold on plot(centroids(:,1), centroids(:,2), 'b*') hold on viscircles(centers,radii); hold off subplot (2,2,4); subimage (props(4).Image);colormap('gray') title('Cell #4'); xlabel('(d)') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IM = imread('02082013_003-01072013_im1.jpg'); IM = double(rgb2gray(IM)); IM = IM(1:end-50,:); IM = IM-min(min(IM)); IM = IM/max(max(IM)); IM=1-IM; figure; subplot(2,2,1); imagesc(IM);colormap(gray);title('Original OCT Image'); thr=graythresh(IM); bw=im2bw(IM,0.3*thr); se=strel('disk',3); bw = imopen(bw,se); subplot(2,2,2); imagesc(bw); title('Binary Image'); D = bwdist(~bw,'chessboard'); D(~bw) = -Inf; D = -D; subplot(2,2,3); imagesc(D);title('Distance Metric'); L = watershed(D,8); subplot(2,2,4); imagesc(L);title('Watershed of Original OCT Image'); propsOCT=regionprops(L, 'Image','Centroid','MajorAxisLength','MinorAxisLength'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DoPlot=1; count=0; [m1 n1]=size(I);
[mIM nIM]=size(IM); MC=m1/mIM; NC=n1/nIM; for p=2:4;%length(props) ManImage=props(p).Image; ind=props(p).Centroid; if ~isnan(ind), TheRegion=L(floor(ind(2)/MC),floor(ind(1)/NC)); else TheRegion=0; end; if TheRegion C=propsOCT(TheRegion).Centroid; C=round([C(2) C(1)]); count=count+1; OCTImage=propsOCT(TheRegion).Image; [m1 n1]=size(ManImage); [m2 n2]=size(OCTImage); OCTImage=imresize(OCTImage,[round(m2*MC) round(n2*NC)]); [m2 n2]=size(OCTImage); NewIm=zeros([max(m1,m2) max(n1,n2)]); [M N]=size(NewIm); dm=propsOCT(TheRegion).MajorAxisLength; dn=propsOCT(TheRegion).MajorAxisLength; % OCTSeg=IM(max(C(1)-dm,1):min(C(1)+dm,mIM),max(C(2)-dn,1):min(C(2)+dn,nIM)); if DoPlot NewIm(M/2-m1/2+1:M/2+m1/2,N/2-n1/2+1:N/2+n1/2)=edge(ManImage,'prewitt'); NewIm(M/2-m2/2+1:M/2+m2/2,N/2-n2/2+1:N/2+n2/2)=NewIm(M/2-m2/2+1:M/2+m2/2,N/2-n2/2+1:N/2+n2/2)+2*edge(OCTImage,'prewitt'); figure; subplot(1,2,1);imagesc(NewIm);title('Outlines of Manual and Automatic Segment Cell'); xlabel('(a)') NewIm=zeros([max(m1,m2) max(n1,n2)]); end; NewIm(M/2-m1/2+1:M/2+m1/2,N/2-n1/2+1:N/2+n1/2)=ManImage; NewIm(M/2-m2/2+1:M/2+m2/2,N/2-n2/2+1:N/2+n2/2)=NewIm(M/2-m2/2+1:M/2+m2/2,N/2-n2/2+1:N/2+n2/2)-OCTImage; NewIm=abs(NewIm); if DoPlot, subplot(1,2,2);imagesc(NewIm); title('Subtraction of Manual from Automatic Segment Cell'); xlabel('(b)') end; perc_err(count)=sum(sum(NewIm))/sum(sum(ManImage)); end; end; figure subplot (2,1,1); imagesc(f); colormap('jet'); title('Watershed of Manually Segmented Image');xlabel('(a)') subplot(2,1,2); imagesc(L);title('Watershed of Automatic Segmented Image');colormap('jet');;xlabel('(b)')
Appendix E
clear; close all; clc; data= xlsread('WatermelonEXP2013_correct.xlsx'); age= data(:,1); pen= data(:,2); weight= data(:,3); figure(1); p= polyfit(age,pen,1); f= polyval(p, age); plot(age, pen, 'bo', age, f, 'r'); title('Age Vs. Pen'); xlabel('Age'); ylabel('Pen'); mu= mean (pen); J= sum((f-pen).^2); S= sum((pen-mu).^2); R2= 1-J/S; text(26 , 3, sprintf('pen= %3.3f*age + %3.3f',p(1),p(2)), 'Color', 'k'); text(26 , 2.5, sprintf('R^2= %3.3f',R2), 'Color', 'k'); figure(2); p= polyfit(weight,pen,1); f= polyval(p, weight); plot(weight, pen, 'bo', weight, f, 'r'); title('Weight Vs. Pen'); xlabel('Weight'); ylabel('Pen'); mu= mean (pen); J= sum((f-pen).^2); S= sum((pen-mu).^2); R2= 1-J/S; text(2.15 , 3, sprintf('pen= %3.3f*weight + %3.3f',p(1),p(2)), 'Color', 'k'); text(2.15 , 2.5, sprintf('R^2= %3.3f',R2), 'Color', 'k'); figure(3); p= polyfit(weight,age,1); f= polyval(p, weight); plot(weight, age, 'bo', weight, f, 'r'); title('Weight Vs. Age'); xlabel('Weight'); ylabel('Age'); mu= mean (age); J= sum((f-age).^2); S= sum((age-mu).^2); R2= 1-J/S; text(2.15,30, sprintf('age= %3.3f*weight + %3.3f',p(1),p(2)), 'Color', 'k'); text(2.15,28, sprintf('R^2= %3.3f',R2), 'Color', 'k');
Appendix F
close all; clc; clear all; load Statistics.mat; A= [S]; load StatisticsSpectrum_Order4_Points4096.mat; A= [ A S]; data= xlsread('WatermelonEXP2013.xlsx'); age= data(:,1); S=A(:,:); [m n]= size(S); for q=1:8:m Snew(q,:)= (S(q,:)+S(q+1,:)+S(q+2,:)+S(q+3,:)+S(q+4,:)+S(q+5,:)+S(q+6,:)+S(q+7,:))/8; agenew(q,:)= (age(q,:)+age(q+1,:)+age(q+2,:)+age(q+3,:)+age(q+4,:)+age(q+5,:)+age(q+6,:)+age(q+7,:))/8; S_new=Snew(1:8:end,:); age_new=agenew(1:8:end,:); end; C=zeros(size(age_new)); C(find(age_new>35))=1; [m n]= size(S_new); for p=1:m Stest= S_new(p,:); Strain= S_new([1:p-1 p+1:m], :); Ptrain= age_new([1:p-1 p+1:m], :); Ctrain=C([1:p-1 p+1:m], :); coeff=pca(Strain(:,:)); Npca= [ 2 3 4 6]; PCdataTest= Stest*coeff(:,Npca); PCdataTrain= Strain*coeff(:,Npca); A= pinv(PCdataTrain)*Ptrain; Ptest(p,1)= PCdataTest*A; Ctest(p,1)=classify(PCdataTest, PCdataTrain, Ctrain, 'mahalanobis'); end; C_error = (length(find(abs(C-Ctest)))/length(Ctrain))*100; [D,P,stats] = manova1(PCdataTrain,Ctrain); c1 = stats.canon(:,1); c2 = stats.canon(:,2); figure; gscatter(c2,c1,Ctrain,[],'ox') legend('Age < 35','Age > 35'); text(-2,-2,sprintf('Err: %3.3f',C_error)); title('Classification Age (OCT Imaging of Watermelon)')
Appendix G
close all; clc; clear all; load Statistics.mat; A= [S]; load StatisticsSpectrum_Order4_Points4096.mat; A= [A S]; data= xlsread('WatermelonEXP2013.xlsx'); age= data(:,1); S=A(:,:); [m n]= size(S); for q=1:8:m Snew(q,:)= (S(q,:)+S(q+1,:)+S(q+2,:)+S(q+3,:)+S(q+4,:)+S(q+5,:)+S(q+6,:)+S(q+7,:))/8; agenew(q,:)= (age(q,:)+age(q+1,:)+age(q+2,:)+age(q+3,:)+age(q+4,:)+age(q+5,:)+age(q+6,:)+age(q+7,:))/8; S_new=Snew(1:8:end,:); age_new=agenew(1:8:end,:); end; C=zeros(size(age_new)); [m n]= size(S_new); for p=1:m Stest= S_new(p,:); Strain= S_new([1:p-1 p+1:m], :); Ptrain= age_new([1:p-1 p+1:m], :); Ctrain=C([1:p-1 p+1:m], :); coeff=princomp(Strain(:,:)); Npca=[1 2 3 5 6 7]; PCdataTest= Stest*coeff(:,Npca); PCdataTrain= Strain*coeff(:,Npca); A= pinv(PCdataTrain)*Ptrain; Ptest(p,1)= PCdataTest*A; end; P_error= mean((abs(Ptest-age_new)./age_new))*100; R=corrcoef(age_new,Ptest); R=R(1,2); plot(age_new,Ptest,'*'); axis([20 60 20 60]); hold on plot(20:60,20:60); hold off; text(25,25,sprintf('Err: %3.3f R: %3.3f',P_error,R)); title('Error Age (OCT Imaging of Watermelon Cells)');