Top Quality Call Girl Service Kalyanpur 6378878445 Available Call Girls Any Time
The evaluation of antimicrobial susceptibility testing using MATLAB
1. CHAPTER 1
INTRODUCTION
Determining the antimicrobial susceptibility of microorganisms is of great
importance in clinical microbiology not only to guide therapeutic decisions in infectious
diseases, but also to investigate the evolution and epidemiology of resistance [1] which is
essential for implementing hospital prevention programs. Antimicrobial susceptibility
tests are used to examine the in vitro activity of different antimicrobial agents against a
specific microorganism. There are a variety of methods for determining antimicrobial
susceptibility, including disk diffusion, agar dilution or broth micro dilution. All these
techniques must be performed under standardized conditions (culture media, temperature,
incubation time, among others) in order to achieve assessable, interpretable, reproducible
and comparable test results.
The Kirby-Bauer or disk diffusion assay, is a qualitative test widely used in
routine microbiology practice, mainly in bacterial isolates, due to its convenience,
reliability and low cost [1, 2]. In this method, cellulose disks impregnated with specific
dilutions of different antimicrobial agents are placed on the surface of agar plates
previously inoculated with a standardized suspension of the microorganism [3]. Agar
plates are incubated using optimal conditions depending on the microorganism, and, then,
the diameter (in mm) of the zone of growth inhibition surrounding each antimicrobial
disk is measured. The diameter of the inhibition zone is related to the susceptibility of the
isolate and to the diffusion rate of the antimicrobial through the agar medium [4]. Hence,
this allows the categorization of the bacterial isolate as susceptible, intermediate or
resistant to each antimicrobial drug tested according to the clinical breakpoints
established by international committees such as the Clinical and Laboratory.
Recently several zone readers and computer assisted devices are available to
determine the zones of inhibition. They are based mostly on scanners as a stand-alone
system connected to laboratory computing systems and plates are scanned to measure the
2. zones of inhibition. The system identifies the pattern of the discs being studied. In some
cases the zone recognition facility failed to identify the correct zone diameter for the
measurement [5].
Some of the specialized electronic beam scanners and high resolution cameras are
used in newer computer assisted zone measurement which is expensive. There is no need
for specific scanners and high resolution cameras in our new approach. We can use a
normal digital camera, mobile camera or tablets. There are some newer technologies
available for measurements but computer programs that are ready to install in any
computer is still not available now. Hence image processing algorithms, will be useful in
such cases. Among other computer software programs like Aura image processing
algorithm and JAVA powered software programs, MATLAB programming language is
very convenient because of the filters and edge detection algorithms that are helpful in
processing the image and interpreting the results quickly and accurately.
In this work, a newer algorithm based on semi-automatic software development is
proposed which allows the user to select the needed image, to make corrections and also
able to save the results along with the image for further use. The diameter calculation and
decision making are done less than a second and gives immediate results. The semi-
automatic mode is better than having automatic zone readers which are comparatively
expensive.
3. CHAPTER 2
PROJECT RATIONALE
The measurement of the diameter of the zone of growth inhibition obtained by
disk diffusion test is frequently performed manually by specialists using a ruler.
Subsequently, the specialist consults the standard’s breakpoints and categorizes the
bacterial isolate for each drug tested as susceptible, intermediate or resistant. This process
is time-consuming and the task of measuring the inhibition zones can be highly
dependent on the researcher. Automated and semi-automated inhibition zone readers
facilitate objective and rapid resulting, reduce the operator variability in reading plates
and also reduce the likelihood of introducing errors in the transcription of results. In
addition, these systems enable a more thorough quality review, and facilitate the
comparison of cultures from multiple sites and at multiple time points during incubation.
However, automated inhibition zone readers are usually expensive instruments with
embedded software that require significant changes in laboratory design and workflow.
An affordable alternative to those systems could be software program that deal with
images of agar plates from disk diffusion tests image captured with a camera will be a
great solution and convenience to the current situation.
4. CHAPTER 3
AIM AND OBJECTIVES
Design and development of a user-friendly semi-automated software program for
the evaluation of antimicrobial susceptibility testing using MATLAB
programming language.
Image acquisition, data validation and interpretation based on the
measurements of zone of inhibition, and categorizing them into resistant,
intermediate and susceptible drugs for personalized medicine.
Performance and comparative analysis to evaluate the efficiency of the
developed program.
The present study deals with the semi-automated interpretation of antimicrobial
susceptibility testing based on image processing techniques. The development of this
system consists of three modules: image acquisition, software program development,
performance and comparison with the manual records by the laboratory technicians.
6. CHAPTER 5
REVIEW OF LITERATURE
One of the most important tasks in the medical microbiology laboratory is the
performance of antimicrobial susceptibility tests on significant bacterial isolates. The
main goal of susceptibility testing is to predict the likely outcome of treating a patient’s
infection with a particular antimicrobial agent. Antimicrobial resistance surveillance is
becoming critical in a global situation of increased occurrence and spread of resistance
genes among bacterial pathogens. Several surveillance programs have been launched to
meet the need for antimicrobial resistance information. Among the vast varieties of
antimicrobial susceptibility testing, disk diffusion method (Kirby-Bauer) is the popular
program due to its low operating cost, ability to perform with multiple specimens and
multiple antibiotics [6]. Especially, this technique can be easily applied by automatic or
semi-automatic process.
The major advantage of automated susceptibility methodologies is time
consumption in calculating the zones of inhibition. Another advantage is that these
systems can provide faster reporting of susceptibility results, potentially leading to the
earlier initiation of appropriate antibiotic therapy. For semi-automated antimicrobial
susceptibility testing, based on disk diffusion method, it brings on some features of
testing such as standardization, reduction of the measured variation and human error,
production accurate and precise results, decrease in analyzing and reporting time,
improvement of hospital information management and suitable for the modern medical
information system.
The oxoid aura image antibiotic sensitivity test system used as a standalone device
was compared with manual measurement and use a template, for the determination of
sensitivity. An overall correlation of zones of diameter showed a difference between
7. manual and semi-automatic values >3 mm. The results obtained were less reliable than
the zone measurement [7].
The aim of semi-automated susceptibility testing systems like the Cobas Bact is to
provide the clinicians with rapid and reliable results for the care of patients and to
decrease the work load in microbiological laboratories. Because data about accuracy on
mezlocillin, azlocillin and ciprofloxacin were lacking, 184 bacterial strains were
investigated and compared with the results of Cobas Bact susceptibility testing to
standardized agar dilution and agar diffusion methods. Essential correlations for all
methods compared exceeded 90% for three chemotherapeutics and all species
investigated, with the exception of Pseudomonas aeruginosa. On an average only 15%
very major errors were observed with the several species of Enterobacteriaceae, whereas
P. aeruginosa and Enterococcus faecalis were characterized by the complete absence of
very major errors when Cobas Bact was correlated to NCCLS agar diffusion [10].
Measurement of inhibition zones by the OSIRIS system was compared with
manual measurement. In total, 14176 measurements were made with 352 staphylococcal
and 80 Enterobacteriaceae isolates, involving four panels of antibiotics on round and
square Mueller–Hinton agar plates, according to the German DIN 58940
recommendations. Variations of ± 3 mm in zone size measurements were defined as
tolerable. Very major errors (i.e., classification of a resistant isolate as susceptible by the
OSIRIS system) occurred in <1% of tests. With Staphylococci, the best concordance was
recorded for rifampicin (91.3%), moxifloxacin (88.1%), and gentamicin (86.3%), while
the concordance on square plates for vancomycin, pristinamycin and kanamycin was
97.2%, 96.1% and 96.0%, respectively [11].
Results of disk diffusion antimicrobial susceptibility testing depend on individual
visual reading of inhibition zone diameters. Therefore, automated or semi-automated
reading using camera systems might represent a useful tool for standardization [12].
Several approaches for automatic or semi-automatic inhibition zone detection have been
introduced in recent years. Nevertheless, most of the algorithms are based on a similar
8. radial profile analysis. Krepelka et al., designed a novel image-processing algorithm for
measuring the size of inhibition zones of antibiotics based on an analysis of corrected
image and rated this image with multi-criterial algorithms (based on an observation of the
radius profile). The algorithm was tested on 100 clinical isolates, resulting in calculation
accuracy of 89% (ratio of success computed radii). If the alternative radii (to be selected
manually) are included, the precision of the calculation rises to 98% (tolerance deviations
between manual and automatic measurements were 2 mm) [13]. The achieved accuracy
was independent of the culture medium (e.g., Muller-Hinton, blood agar, chocolate agar).
The main advantage of the algorithm is the invariants to the tested bacterial strain and
culture medium. The new algorithm offers an alternative way to determine inhibition
zones and evaluate antimicrobial susceptibility.
Okowat et al., reports the development of interpreting system for antimicrobial
susceptibility testing by disc diffusion technique which automatically measures and
interprets inhibition zone diameter. The operated system comprises the electronic part,
optical devices, video capture part, and software which manages and analyses all the
processes [14]. A study aimed to evaluate the antibiotic resistance profiles of
Enterobacter cloacae isolated from the First Bethune Hospital. Disk diffusion method
was used to study the antimicrobial resistance. The data were analyzed by WHONET 5
software according to Clinical and Laboratory Standards Institute (CLSI). The majority
of 683 strains of Enterobacter cloacae were collected from sputum (410, 60.0%),
secretions and pus (105, 15.4%), urine (69, 10.1%) [15]. With generalized programming,
the automatic antimicrobial susceptibility testing system is suitable for further developing
process concerned with artificial intelligence and expert system. The development of
automatic system might lead to high quality and effective cost system based on this
software program.
9. CHAPTER 6
METHODOLOGY
6.1 MEASUREMENT OF ZONE OF INHIBITION USING DEVELOPED
SEMI-AUTOMATED PROGRAM
The images are acquired and transmitted to the personal camera via USB ports.
The captured frame in the video stream is first enhanced and image contrast by histogram
equalization. The enhanced image is then processed with Gaussian filter to remove the
artifacts. The circular Hough transform is then performed to locate the disk drug. The
orientation of disk drug loaded on the antimicrobial susceptibility test plate was
processed in the next step. Adaptive thresholding is employed to convert image into
binary image. The set of letters is extracted by connected components labeling and found
the orientation of each letters by ellipse fitting.
6.1.1 Image acquisition
The image acquisition is a prime area of concern in the move to automate the
processes of measuring the anti microbial colony growth. As the assay is made up of
transparent material, there is higher chance of light interference from the environment.
The image captured will have a dark background which makes a way for distinguishing
the colony and the microorganism in the assay. The image was acquired with a digital
camera of 11 mega pixel CCD resolution. Once the image is fed to the computer,
cropping along the chords perpendicular to the centre of the circle is performed. This will
avoid the time required to process the components present in the dark background, hence
resulting in less computational time.
The cropped image was subjected to enhancement, stronger-edge detection and
circle detection system so as to identify the colony which appears in a circular pattern.
10. 6.1.2 Loading image for process of calculation
The program is written in the way of choosing the image from any location of the
system where the images of the antimicrobial susceptibility testing plates which are
captured already using a camera placing it on a black background in order to get the
zones of inhibition clearly visible and suitable for circle identification using MATLAB
program.
6.2 Pre-process
Histogram Equalization is used as a contrast enhancement technique with the
objective to obtain a new enhanced image with a uniform histogram. This can be
achieved by using the normalized cumulative histogram as the gray scale mapping
function. When disk drug image is obtained, the image contrast enhancement is necessary
adjusted by applying the histogram equalization shown in Fig. 1[17].
Fig 1. Histogram Equalization
Gaussian filter is a 2-D convolution operator that is used to `blur' images and
remove detail and noise that shown in Fig. 2. In this sense it is similar to the mean filter,
but it uses a different kernel that represents the shape of a Gaussian (`bell-shaped') hump.
This kernel has some special properties by the use of 2-D distribution as a ‘point-spread’
function, and this is achieved by convolution [14]. Since the image is stored as a
11. collection of discrete pixels, we need to produce a discrete approximation to the Gaussian
function before we can perform the convolution. In theory, the Gaussian distribution is
nonzero everywhere, which would require an infinitely large convolution kernel, but in
practice it is effectively zero more than about three standard deviations from the mean,
and so we can truncate the kernel at this point.
Fig. 2. Image filtered with Gaussian kernel.
6.3 Image enhancement
Image enhancement is the primary step in our system to improve the visual
perception of the captured image. Our area of interest that surrounds the drug well has a
weak boundary with the background (micro organism). On enhancing the cropped image
a strong boundary was achieved along the area of invasion [14]. Contrast limited adaptive
histogram equalization (CLAHE) method used by Hanan et al., [15] best suits our system
on enhancing the gray scale image. In this method the image is crossed into equal blocks
and histogram is calculated for each block followed by equally distributing the pixel
value to each gray level [17]. The distribution is given by
CR x CR y
av
g
I I
I
I
(1)
avI = Average number of pixels
gI = Gray levels number in the contextual region
12. CR xI = Pixels number in the x dimension of the contextual region
CR yI = pixels number in the y dimension of the contextual region
c
acv
I
I
I
(2)
The acvI can be calculated by the Equ. 2: acvI = cI × avI (4) Where, acvI is actual clip-
limit; cI is the maximum multiple of average pixels in each gray level of the
contextual region.
After the above distribution, the remaining number of clipped pixels is expressed as
LPI and then the step of distributed pixels is given by
g
d
LP
I
P
I
(3)
The CLAHE method stands unique in its robust computational methods and
excellent desired results.
6.4 Canny edge detection
In order to preserve the structural properties and increase the speed of processing
by reducing the data in the image, an edge detection algorithm is applied on the captured
image. Canny edge detection stand odd among all the other edge detection techniques as
it is capable of detecting low contrast edges [18]. Gaussian Smoothing is the first step in
edge detection where Gaussian filter is applied for filtering the noise by using a small
standard deviation and a 3x3 kernel to reduce the small noise present in the image. The
sobel operator was used to find the gradient vector [19]. With non-maxima suppression
the blurred edges were converted to sharp edge taking care of retaining the local maxima.
In the double thresholding analysis pixels that are stronger than the upper threshold value
13. were considered edges and those weaker than the lower threshold value were considered
as background. The remaining edges are considered as weak edges and are included with
the strong edge only if have a connectivity with those strong edges [20].
6.5 Circular Hough Transforms
In the list of tools to identify the parametric curves in an image using the voting on
edges, the circular Hough transform as a pioneer among all the other techniques. The
peaks that are corresponding to the mapped space are considered as the parameters of the
curves. In the Circular Hough Transform (CHT) the circles are identified by a center
point (x0,y0) and a radius r is computed from the center and Hough peaks [19,20,21].
6.5.1 Algorithm for circle detection
Step 1: Small and large Eigen values and the covariance matrix for the edge image
are calculated.
Step 2: The sparse matrix technique is used to identify the CHT for Eigen values.
Step 3: Hough peaks are identified using neighborhood suppression scheme.
Step 4: The centre of the circle is identified from the candidates of the Hough
peaks using raster scan algorithm.
Step 5: once the circular objects are identified if two circles share same center
point, only the larger circle is considered as the boundary of the area of invasion.
It is important to use an algorithm which reliably finds a circle whose
circumference brightness is increased above a given brightness level. The algorithm is
based on computing points, which do not belong to other circles. The problem is how to
choose the optimum brightness level. Analytical deduction of the optimal luminance level
is difficult and would require a complex description of the image. The described
algorithm uses a different approach. Circles (the edges of the zone of inhibition) were
detected using N different thresholds. For each investigated zone, we obtained N
potential radii of inhibition zones.
14. The calculated radius probabilities are given by their frequencies in the measured
set of size N. The radius with the biggest probability (most often measured) is considered
to be final | other radii can be proposed as an alternative. The frequency calculation is
supplemented by tolerance | this means that the measured radii are divided into groups
that have similar radius size. The resulting value is given by the arithmetic mean in
grouped values.
6.6 Decision making and integrating with the image
Finally after the calculation of diameters and based upon the diameter range as per
the image, the decisions were made as susceptible (S), intermediate (IM), resistance (R).
Both the diameters and the decisions are set to be mentioned on the original image itself.
16. CHAPTER 7
PROGRAM/CODING
7.1 SEMI-AUTOMATIC MEASUREMENT OF ZONES OF INHIBITION
(STAGE-I)
im = imread('3.jpg');
im=rgb2gray(im);
e = edge(im, 'canny');
imshow(e);
radii = 15:1:40;
h = circle_hg(e, radii, 'same', 'normalise');
peaks = circle_hgpeaks(h, radii, 'nhoodxy', 15, 'nhoodr', 21, 'npeaks', 10);
imshow(im);
hold on;
for peak = peaks
[x, y] = circlepoints(peak(3));
if(peak(3)<23)
plot(x+peak(1), y+peak(2), 'g-');
end
if(peak(3)>22&&peak(3)<28)
plot(x+peak(1), y+peak(2), 'b-');
end
17. if(peak(3)>=28)
plot(x+peak(1), y+peak(2), 'r-');
end
disp(peak(1));
disp(peak(2));
disp(2*peak(3));
end
hold off
7.1.1 Circle hg Peaks
function peaks = circle_hgpeaks(h, radii, varargin)
params = checkargs(h, radii, varargin{:});
ifparams.smoothxy> 0
[m, hsize] = gaussmask1d(params.smoothxy);
% smooth each dimension separately, with reflection
h = cat(1, h(hsize:-1:1,:,:), h, h(end:-1:end-hsize+1,:,:));
h = convn(h, reshape(m, length(m), 1, 1), 'valid');
h = cat(2, h(:,hsize:-1:1,:), h, h(:,end:-1:end-hsize+1,:));
h = convn(h, reshape(m, 1, length(m), 1), 'valid');
end
% smooth the accumulator - r
ifparams.smoothr> 0
18. [m, hsize] = gaussmask1d(params.smoothr);
h = cat(3, h(:,:,hsize:-1:1), h, h(:,:,end:-1:end-hsize+1));
h = convn(h, reshape(m, 1, 1, length(m)), 'valid');
end
% set threshold
ifisempty(params.threshold)
params.threshold = 0.5 * max(h(:));
end
ifisempty(params.nhoodxy) &&isempty(params.nhoodr)
maxarr = imregionalmax(h);
maxarr = maxarr& h >= params.threshold;
peakind = find(maxarr);
[y, x, rind] = ind2sub(size(h), peakind);
peaks = [x'; y'; radii(rind)];
if ~isempty(params.npeaks) &¶ms.npeaks< size(peaks,2)
[~, ind] = sort(h(peakind), 'descend');
ind = ind(1:params.npeaks);
peaks = peaks(:, ind);
end
else
ifisempty(params.nhoodxy)
19. params.nhoodxy = 1;
elseifisempty(params.nhoodr)
params.nhoodr = 1;
end
nhood2 = ([params.nhoodxyparams.nhoodxyparams.nhoodr]-1) / 2;
ifisempty(params.npeaks)
maxpks = 0;
peaks = zeros(3, round(numel(h)/100));
else
maxpks = params.npeaks;
peaks = zeros(3, maxpks);
end
np = 0;
while true
[r, c, k, v] = max3(h);
if v <params.threshold || v == 0
break;
end
np = np + 1;
peaks(:, np) = [c; r; radii(k)];
if np == maxpks
20. break;
end
r0 = max([1 1 1], [r c k]-nhood2);
r1 = min(size(h), [r c k]+nhood2);
h(r0(1):r1(1), r0(2):r1(2), r0(3):r1(3)) = 0;
end
peaks(:, np+1:end) = []; % trim
end
ifparams.margin> 0
peaks([1 2], :) = peaks([1 2], :) - params.margin;
end
end
functionparams = checkargs(h, radii, varargin)
ip = inputParser;
% required
htest = @(h) validateattributes(h, {'double'}, {'real' 'nonnegative' 'nonsparse'});
ip.addRequired('h', htest);
rtest = @(radii) validateattributes(radii, {'double'}, {'real' 'positive' 'vector'});
ip.addRequired('radii', rtest);
% optional
mtest = @(n) validateattributes(n, {'double'}, {'real' 'nonnegative' 'integer' 'scalar'});
22. function [r, c, k, v] = max3(h)
% location and value of global maximum of a 3D array
[vr, r] = max(h);
[vc, c] = max(vr);
[v, k] = max(vc);
c = c(1, 1, k);
r = r(1, c, k);
end
7.2 SEMI-AUTOMATIC MEASUREMENT OF ZONES OF INHIBITION
(STAGE-II)
7.2.1 Circle coding-I
function [xp,yp]=circle(x,y,r)
ang=0:0.001:2*pi;
xp=r*cos(ang);
yp=r*sin(ang);
plot(x+xp,y+yp);
end
7.2.2 Circle coding-II
function [xp,yp]=circle2(x,y,r)
ang=0:0.001:2*pi;
xp=r*cos(ang);
yp=r*sin(ang);
plot(x+xp,y+yp,'color', [1 0 0])
end
23. 7.2.3 Circle coding-III
function [xp,yp]=circle3(x,y,r)
ang=0:0.001:2*pi;
xp=r*cos(ang);
yp=r*sin(ang);
plot(x+xp,y+yp,'color', [1 1 1]);
end
7.2.4 Coding for circular hough transform
function [accum, varargout] = CircularHough_Grd(img, radrange, varargin)
7.2.5 Arguments and parameters
% Validation of arguments
if ndims(img) ~= 2 || ~isnumeric(img),
error('CircularHough_Grd: ''img'' has to be 2 dimensional');
end
if ~all(size(img) >= 32),
error('CircularHough_Grd: ''img'' has to be larger than 32-by-32');
end
if numel(radrange) ~= 2 || ~isnumeric(radrange),
error(['CircularHough_Grd: ''radrange'' has to be ', ...
'a two-element vector']);
end
prm_r_range = sort(max( [0,0;radrange(1),radrange(2)] ));
% Parameters (default values)
prm_grdthres = 10;
prm_fltrLM_R = 8;
prm_multirad = 0.5;
func_compu_cen = true;
24. func_compu_radii = true;
% Validation of arguments
vap_grdthres = 1;
if nargin > (1 + vap_grdthres),
if isnumeric(varargin{vap_grdthres}) && ...
varargin{vap_grdthres}(1) >= 0,
prm_grdthres = varargin{vap_grdthres}(1);
else
error(['CircularHough_Grd: ''grdthres'' has to be ', ...
'a non-negative number']);
end
end
vap_fltr4LM = 2; % filter for the search of local maxima
if nargin > (1 + vap_fltr4LM),
if isnumeric(varargin{vap_fltr4LM}) && varargin{vap_fltr4LM}(1) >= 3,
prm_fltrLM_R = varargin{vap_fltr4LM}(1);
else
error(['CircularHough_Grd: ''fltr4LM_R'' has to be ', ...
'larger than or equal to 3']);
end
end
vap_multirad = 3;
if nargin > (1 + vap_multirad),
if isnumeric(varargin{vap_multirad}) && ...
varargin{vap_multirad}(1) >= 0.1 && ...
varargin{vap_multirad}(1) <= 1,
prm_multirad = varargin{vap_multirad}(1);
else
error(['CircularHough_Grd: ''multirad'' has to be ', ...
25. 'within the range [0.1, 1]']);
end
end
vap_fltr4accum = 4; % filter for smoothing the accumulation array
if nargin > (1 + vap_fltr4accum),
if isnumeric(varargin{vap_fltr4accum}) && ...
ndims(varargin{vap_fltr4accum}) == 2 && ...
all(size(varargin{vap_fltr4accum}) >= 3),
fltr4accum = varargin{vap_fltr4accum};
else
error(['CircularHough_Grd: ''fltr4accum'' has to be ', ...
'a 2-D matrix with a minimum size of 3-by-3']);
end
else
% Default filter (5-by-5)
fltr4accum = ones(5,5);
fltr4accum(2:4,2:4) = 2;
fltr4accum(3,3) = 6;
end
func_compu_cen = ( nargout > 1 );
func_compu_radii = ( nargout > 2 );
% Reserved parameters
dbg_on = false; % debug information
dbg_bfigno = 4;
if nargout > 3, dbg_on = true; end
7.2.6 Building accumulation array
img_is_double = isa(img, 'double');
if ~(img_is_double || isa(img, 'single')),
27. lin2accum_size = size( lin2accum );
lin2accum = reshape( lin2accum, [numel(lin2accum),1] );
clear lin2accum_aI lin2accum_aJ;
accum = accumarray( lin2accum , weight4accum );
accum = [ accum ; zeros( numel(grdmag) - numel(accum) , 1 ) ];
accum = reshape( accum, size(grdmag) );
7.2.7 Locating local maxima in the accumulation array
if ~func_compu_cen,
return;
end
clear lin2accum weight4accum;
prm_useaoi = true;
prm_aoithres_s = 2;
prm_aoiminsize = floor(min([ min(size(accum)) * 0.25, ...
prm_r_range(2) * 1.5 ]));
% -- Filter for searching for local maxima
prm_fltrLM_s = 1.35;
prm_fltrLM_r = ceil( prm_fltrLM_R * 0.6 );
prm_fltrLM_npix = max([ 6, ceil((prm_fltrLM_R/2)^1.8) ]);
% -- Lower bound of the intensity of local maxima
prm_LM_LoBndRa = 0.2; % minimum ratio of LM to the max of 'accum'
% Smooth the accumulation array
fltr4accum = fltr4accum / sum(fltr4accum(:));
accum = filter2( fltr4accum, accum );
% Select a number of Areas-Of-Interest from the accumulation array
if prm_useaoi,
% Threshold value for 'accum'
prm_llm_thres1 = prm_grdthres * prm_aoithres_s;
28. % Thresholding over the accumulation array
accummask = ( accum > prm_llm_thres1 );
% Segmentation over the mask
[accumlabel, accum_nRgn] = bwlabel( accummask, 8 );
% Select AOIs from segmented regions
accumAOI = ones(0,4);
for k = 1 : accum_nRgn,
accumrgn_lin = find( accumlabel == k );
[accumrgn_IdxI, accumrgn_IdxJ] = ...
ind2sub( size(accumlabel), accumrgn_lin );
rgn_top = min( accumrgn_IdxI );
rgn_bottom = max( accumrgn_IdxI );
rgn_left = min( accumrgn_IdxJ );
rgn_right = max( accumrgn_IdxJ );
% The AOIs selected must satisfy a minimum size
if ( (rgn_right - rgn_left + 1) >= prm_aoiminsize && ...
(rgn_bottom - rgn_top + 1) >= prm_aoiminsize ),
accumAOI = [ accumAOI; ...
rgn_top, rgn_bottom, rgn_left, rgn_right ];
end
end
else
% Whole accumulation array as the one AOI
accumAOI = [1, size(accum,1), 1, size(accum,2)];
end
% Thresholding of 'accum' by a lower bound
prm_LM_LoBnd = max(accum(:)) * prm_LM_LoBndRa;
29. % Build the filter for searching for local maxima
fltr4LM = zeros(2 * prm_fltrLM_R + 1);
[mesh4fLM_x, mesh4fLM_y] = meshgrid(-prm_fltrLM_R : prm_fltrLM_R);
mesh4fLM_r = sqrt( mesh4fLM_x.^2 + mesh4fLM_y.^2 );
fltr4LM_mask = ...
( mesh4fLM_r > prm_fltrLM_r & mesh4fLM_r <= prm_fltrLM_R );
fltr4LM = fltr4LM - ...
fltr4LM_mask * (prm_fltrLM_s / sum(fltr4LM_mask(:)));
if prm_fltrLM_R >= 4,
fltr4LM_mask = ( mesh4fLM_r < (prm_fltrLM_r - 1) );
else
fltr4LM_mask = ( mesh4fLM_r < prm_fltrLM_r );
end
fltr4LM = fltr4LM + fltr4LM_mask / sum(fltr4LM_mask(:));
% **** Debug code (begin)
if dbg_on,
dbg_LMmask = zeros(size(accum));
end
% **** Debug code (end)
% For each of the AOIs selected, locate the local maxima
circen = zeros(0,2);
for k = 1 : size(accumAOI, 1),
aoi = accumAOI(k,:); % just for referencing convenience
% Thresholding of 'accum' by a lower bound
accumaoi_LBMask = ...
( accum(aoi(1):aoi(2), aoi(3):aoi(4)) > prm_LM_LoBnd );
% Apply the local maxima filter
candLM = conv2( accum(aoi(1):aoi(2), aoi(3):aoi(4)) , ...
fltr4LM , 'same' );
30. candLM_mask = ( candLM > 0 );
% Clear the margins of 'candLM_mask'
candLM_mask([1:prm_fltrLM_R, (end-prm_fltrLM_R+1):end], :) = 0;
candLM_mask(:, [1:prm_fltrLM_R, (end-prm_fltrLM_R+1):end]) = 0;
% **** Debug code (begin)
if dbg_on,
dbg_LMmask(aoi(1):aoi(2), aoi(3):aoi(4)) = ...
dbg_LMmask(aoi(1):aoi(2), aoi(3):aoi(4)) + ...
accumaoi_LBMask + 2 * candLM_mask;
end
% **** Debug code (end)
for ilabel = 1 : candLM_nRgn,
% Indices (to current AOI) of the pixels in the group
candgrp_masklin = find( candLM_label == ilabel );
[candgrp_IdxI, candgrp_IdxJ] = ...
ind2sub( size(candLM_label) , candgrp_masklin );
% Indices (to 'accum') of the pixels in the group
candgrp_IdxI = candgrp_IdxI + ( aoi(1) - 1 );
candgrp_IdxJ = candgrp_IdxJ + ( aoi(3) - 1 );
candgrp_idx2acm = ...
sub2ind( size(accum) , candgrp_IdxI , candgrp_IdxJ );
% Minimum number of qulified pixels in the group
if sum(accumaoi_LBMask(candgrp_masklin)) < prm_fltrLM_npix,
continue;
end
% Compute the centroid position
candgrp_acmsum = sum( accum(candgrp_idx2acm) );
cc_x = sum( candgrp_IdxJ .* accum(candgrp_idx2acm) ) / ...
candgrp_acmsum;
31. cc_y = sum( candgrp_IdxI .* accum(candgrp_idx2acm) ) / ...
candgrp_acmsum;
circen = [circen; cc_x, cc_y];
end
end
% **** Debug code (begin)
if dbg_on,
figure(dbg_bfigno); imagesc(dbg_LMmask); axis image;
title('Generated map of local maxima');
if size(accumAOI, 1) == 1,
figure(dbg_bfigno+1);
surf(candLM, 'EdgeColor', 'none'); axis ij;
title('Accumulation array after local maximum filtering');
end
end
% **** Debug code (end)
6.2.8 Estimation of the Radii of Circles
% Stop if no need to estimate the radii of circles
if ~func_compu_radii,
varargout{1} = circen;
return;
end
% Parameters for the estimation of the radii of circles
fltr4SgnCv = [2 1 1];
fltr4SgnCv = fltr4SgnCv / sum(fltr4SgnCv);
% Find circle's radius using its signature curve
cirrad = zeros( size(circen,1), 1 );
32. for k = 1 : size(circen,1),
% Neighborhood region of the circle for building the sgn. curve
circen_round = round( circen(k,:) );
SCvR_I0 = circen_round(2) - prm_r_range(2) - 1;
if SCvR_I0 < 1,
SCvR_I0 = 1;
end
SCvR_I1 = circen_round(2) + prm_r_range(2) + 1;
if SCvR_I1 > size(grdx,1),
SCvR_I1 = size(grdx,1);
end
SCvR_J0 = circen_round(1) - prm_r_range(2) - 1;
if SCvR_J0 < 1,
SCvR_J0 = 1;
end
SCvR_J1 = circen_round(1) + prm_r_range(2) + 1;
if SCvR_J1 > size(grdx,2),
SCvR_J1 = size(grdx,2);
end
% Build the sgn. curve
SgnCvMat_dx = repmat( (SCvR_J0:SCvR_J1) - circen(k,1) , ...
[SCvR_I1 - SCvR_I0 + 1 , 1] );
SgnCvMat_dy = repmat( (SCvR_I0:SCvR_I1)' - circen(k,2) , ...
[1 , SCvR_J1 - SCvR_J0 + 1] );
SgnCvMat_r = sqrt( SgnCvMat_dx .^2 + SgnCvMat_dy .^2 );
SgnCvMat_rp1 = round(SgnCvMat_r) + 1;
f4SgnCv = abs( ...
double(grdx(SCvR_I0:SCvR_I1, SCvR_J0:SCvR_J1)) .* SgnCvMat_dx + ...
double(grdy(SCvR_I0:SCvR_I1, SCvR_J0:SCvR_J1)) .* SgnCvMat_dy ...
33. ) ./ SgnCvMat_r;
SgnCv = accumarray( SgnCvMat_rp1(:) , f4SgnCv(:) );
SgnCv_Cnt = accumarray( SgnCvMat_rp1(:) , ones(numel(f4SgnCv),1) );
SgnCv_Cnt = SgnCv_Cnt + (SgnCv_Cnt == 0);
SgnCv = SgnCv ./ SgnCv_Cnt;
% Suppress the undesired entries in the sgn. curve
% -- Radii that correspond to short arcs
SgnCv = SgnCv .* ( SgnCv_Cnt >= (pi/4 * [0:(numel(SgnCv_Cnt)-1)]') );
% -- Radii that are out of the given range
SgnCv( 1 : (round(prm_r_range(1))+1) ) = 0;
SgnCv( (round(prm_r_range(2))+1) : end ) = 0;
% Get rid of the zero radius entry in the array
SgnCv = SgnCv(2:end);
% Smooth the sgn. curve
SgnCv = filtfilt( fltr4SgnCv , [1] , SgnCv );
% Get the maximum value in the sgn. curve
SgnCv_max = max(SgnCv);
if SgnCv_max <= 0,
cirrad(k) = 0;
continue;
end
% Find the local maxima in sgn. curve by 1st order derivatives
% -- Mark the ascending edges in the sgn. curve as 1s and
% -- descending edges as 0s
SgnCv_AscEdg = ( SgnCv(2:end) - SgnCv(1:(end-1)) ) > 0;
% -- Mark the transition (ascending to descending) regions
SgnCv_LMmask = [ 0; 0; SgnCv_AscEdg(1:(end-2)) ] & (~SgnCv_AscEdg);
SgnCv_LMmask = SgnCv_LMmask & [ SgnCv_LMmask(2:end) ; 0 ];
34. % Incorporate the minimum value requirement
SgnCv_LMmask = SgnCv_LMmask & ...
( SgnCv(1:(end-1)) >= (prm_multirad * SgnCv_max) );
% Get the positions of the peaks
SgnCv_LMPos = sort( find(SgnCv_LMmask) );
% Save the detected radii
if isempty(SgnCv_LMPos),
cirrad(k) = 0;
else
cirrad(k) = SgnCv_LMPos(end);
for i_radii = (length(SgnCv_LMPos) - 1) : -1 : 1,
circen = [ circen; circen(k,:) ];
cirrad = [ cirrad; SgnCv_LMPos(i_radii) ];
end
end
end
% Output
varargout{1} = circen;
varargout{2} = cirrad;
if nargout > 3,
varargout{3} = dbg_LMmask;
end
6.2.9 Coding for circle drawing
function DrawCircle(x, y, r, nseg, S)
theta = 0 : (2 * pi / nseg) : (2 * pi);
pline_x = r * cos(theta) + x;
pline_y = r * sin(theta) + y;
35. plot(pline_x, pline_y, S);
6.2.10 Coding for get no double clickinput
function [x,y] = getptsNoDoubleClick(varargin)
imshow('moon.tif')
[x,y] = getpts
% See also GETRECT, GETLINE.
% Callback syntaxes:
getpts('KeyPress')
getpts('FirstButtonDown')
getpts('NextButtonDown')
global GETPTS_FIG GETPTS_AX GETPTS_H1 GETPTS_H2
global GETPTS_PT1
if ((nargin >= 1) && (ischar(varargin{1})))
Callback invocation: 'KeyPress', 'FirstButtonDown', or
'NextButtonDown'.
feval(varargin{:});
return;
end
if (nargin < 1)
GETPTS_AX = gca;
GETPTS_FIG = ancestor(GETPTS_AX, 'figure');
else
if (~ishandle(varargin{1}))
eid = 'Images:getpts:expectedHandle';
error(eid, '%s', 'First argument is not a valid handle');
end
switch get(varargin{1}, 'Type')
case 'figure'
36. GETPTS_FIG = varargin{1};
GETPTS_AX = get(GETPTS_FIG, 'CurrentAxes');
if (isempty(GETPTS_AX))
GETPTS_AX = axes('Parent', GETPTS_FIG);
end
case 'axes'
GETPTS_AX = varargin{1};
GETPTS_FIG = ancestor(GETPTS_AX, 'figure');
otherwise
eid = 'Images:getpts:expectedFigureOrAxesHandle';
error(eid, '%s', 'First argument should be a figure or axes handle');
end
end
% Bring target figure forward
figure(GETPTS_FIG);
% Remember initial figure state
state = uisuspend(GETPTS_FIG);
% Set up initial callbacks for initial stage
[pointerShape, pointerHotSpot] = CreatePointer;
% jg: change handles to call getptsNoDoubleClick
set(GETPTS_FIG, 'WindowButtonDownFcn',
'getptsNoDoubleClick(''FirstButtonDown'');', ...
'KeyPressFcn', 'getptsNoDoubleClick(''KeyPress'');', ...
'Pointer', 'custom', ...
'PointerShapeCData', pointerShape, ...
'PointerShapeHotSpot', pointerHotSpot);
% Initialize the lines to be used for the drag
markerSize = 9;
GETPTS_H1 = line('Parent', GETPTS_AX, ...
38. errStatus = 'unknown';
else
errStatus = 'ok';
x = get(GETPTS_H1, 'XData');
y = get(GETPTS_H1, 'YData');
x = x(:);
y = y(:);
if (isempty(x))
x = zeros(0,1);
end
if (isempty(y))
y = zeros(0,1);
end
end
% Delete the animation objects
if (ishandle(GETPTS_H1))
delete(GETPTS_H1);
end
if (ishandle(GETPTS_H2))
delete(GETPTS_H2);
end
% Restore the figure state
if (ishandle(GETPTS_FIG))
uirestore(state);
end
% Clean up the global workspace
clear global GETPTS_FIG GETPTS_AX GETPTS_H1 GETPTS_H2
clear global GETPTS_PT1
% Depending on the error status, return the answer or generate
39. % an error message.
switch errStatus
case 'ok'
% No action needed.
case 'trap'
% An error was trapped during the waitfor
eid = 'Images:getpts:interruptedMouseSelection';
error(eid, '%s', 'Interruption during mouse point selection.');
case 'unknown'
eid = 'Images:getpts:interruptedMouseSelection';
error(eid, '%s', 'Interruption during mouse point selection.');
end
global GETPTS_FIG GETPTS_AX GETPTS_H1 GETPTS_H2
global GETPTS_PT1
key = get(GETPTS_FIG, 'CurrentCharacter');
switch key
case {char(8), char(127)} % delete and backspace keys
x = get(GETPTS_H1, 'XData');
y = get(GETPTS_H1, 'YData');
switch length(x)
case 0
% nothing to do
case 1
% remove point and start over
set([GETPTS_H1 GETPTS_H2], ...
'XData', [], ...
'YData', []);
% jg: call getptsNoDoubleClick
set(GETPTS_FIG, 'WindowButtonDownFcn', ...
40. 'getptsNoDoubleClick(''FirstButtonDown'');');
otherwise
% remove last point
set([GETPTS_H1 GETPTS_H2], ...
'XData', x(1:end-1), ...
'YData', y(1:end-1));
end
case {char(13), char(3)} % enter and return keys
% return control to line after waitfor
set(GETPTS_H1, 'UserData', 'Completed');
end
global GETPTS_FIG GETPTS_AX GETPTS_H1 GETPTS_H2
[x,y] = getcurpt(GETPTS_AX);
set([GETPTS_H1 GETPTS_H2], ...
'XData', x, ...
'YData', y, ...
'Visible', 'on');
%if (~strcmp(get(GETPTS_FIG, 'SelectionType'), 'normal'))
set(GETPTS_H1, 'UserData', 'Completed');
else
% jg: call getptsNoDoubleClick
set(GETPTS_FIG, 'WindowButtonDownFcn',
'getptsNoDoubleClick(''NextButtonDown'');');
%end
global GETPTS_FIG GETPTS_AX GETPTS_H1 GETPTS_H2
% jg: always report that this is a single click
%selectionType = get(GETPTS_FIG, 'SelectionType');
selectionType = 'normal';
if (~strcmp(selectionType, 'open'))
41. [newx, newy] = getcurpt(GETPTS_AX);
x = get(GETPTS_H1, 'XData');
y = get(GETPTS_H2, 'YData');
set([GETPTS_H1 GETPTS_H2], 'XData', [x newx], ...
'YData', [y newy]);
end
% jg: never interpret double click
%if (~strcmp(get(GETPTS_FIG, 'SelectionType'), 'normal'))
% set(GETPTS_H1, 'UserData', 'Completed');
%end
function [x,y] = getcurpt(axHandle)
%GETCURPT Get current point.
x = pt(1,1);
y = pt(1,2);
6.2.11 coding for get input
function [out1,out2,out3] = ginput_1(arg1)
[x,y] = ginput;
[x,y] = ginput(5);
[x, y, button] = ginput(1);
out1 = []; out2 = []; out3 = []; y = [];
c = computer;
if ~strcmp(c(1:2),'PC')
tp = get(0,'TerminalProtocol');
else
tp = 'micro';
end
if ~strcmp(tp,'none') && ~strcmp(tp,'x') && ~strcmp(tp,'micro'),
if nargout == 1,
42. if nargin == 1,
out1 = trmginput(arg1);
else
out1 = trmginput;
end
elseif nargout == 2 || nargout == 0,
if nargin == 1,
[out1,out2] = trmginput(arg1);
else
[out1,out2] = trmginput;
end
if nargout == 0
out1 = [ out1 out2 ];
return;
end
elseif nargout == 3,
if nargin == 1,
[out1,out2,out3] = trmginput(arg1);
else
[out1,out2,out3] = trmginput;
end
end
else
fig = gcf;
figure(gcf);
if nargin == 0
how_many = -1;
b = [];
43. else
how_many = arg1;
b = [];
if ischar(how_many) ...
|| size(how_many,1) ~= 1 || size(how_many,2) ~= 1 ...
|| ~(fix(how_many) == how_many) ...
|| how_many < 0
error(message('MATLAB:ginput:NeedPositiveInt'))
end
if how_many == 0
% If input argument is equal to zero points, give a warning and return empty for
the outputs.
warning (message('MATLAB:ginput:InputArgumentZero'));
end
end
drawnow
char = 0;
while how_many ~= 0
% Use no-side effect WAITFORBUTTONPRESS
waserr = 0;
try
keydown = wfbp;
catch %#ok<CTCH>
waserr = 1;
end
if(waserr == 1)
if(ishghandle(fig))
cleanup(c);
error(message('MATLAB:ginput:Interrupted'));
44. else
cleanup(c);
error(message('MATLAB:ginput:FigureDeletionPause'));
end
end
figchildren = allchild(0);
if ~isempty(figchildren)
ptr_fig = figchildren(1);
else
error(message('MATLAB:ginput:FigureUnavailable'));
end
% old code -> ptr_fig = get(0,'CurrentFigure'); Fails when the clicked figure has
handle visibility set to callback
if(ptr_fig == fig)
if keydown
char = get(fig, 'CurrentCharacter');
button = abs(get(fig, 'CurrentCharacter'));
else
button = get(fig, 'SelectionType');
if strcmp(button,'open')
button = 1;
elseif strcmp(button,'normal')
button = 1;
elseif strcmp(button,'extend')
button = 2;
elseif strcmp(button,'alt')
button = 3;
else
error(message('MATLAB:ginput:InvalidSelection'))
45. end
end
axes_handle = gca;
drawnow;
pt = get(axes_handle, 'CurrentPoint');
how_many = how_many - 1;
if(char == 13) % & how_many ~= 0)
break;
end
out1 = [out1;pt(1,1)]; %#ok<AGROW>
y = [y;pt(1,2)]; %#ok<AGROW>
b = [b;button]; %#ok<AGROW>
end
end
% Cleanup and Restore
cleanup(c);
if nargout > 1
out2 = y;
if nargout > 2
out3 = b;
end
else
out1 = [out1 y];
end
end
end
function key = wfbp
fig = gcf;
current_char = []; %#ok<NASGU>
46. % Now wait for that buttonpress, and check for error conditions
waserr = 0;
try
h=findall(fig,'Type','uimenu','Accelerator','C');
if(current_char == 3)
waserr = 1;
end
end
set(h,'Accelerator','C'); .
catch %#ok<CTCH>
waserr = 1;
end
drawnow;
if(waserr == 1)
set(h,'Accelerator','C');
error(message('MATLAB:ginput:Interrupted'));
end
if nargout>0, key = keydown; end
end
function initialState = setupFcn(fig)
% Store Figure Handle.
initialState.figureHandle = fig;
% Suspend figure functions
initialState.uisuspendState = uisuspend(fig);
% Disable Plottools Buttons
initialState.toolbar = findobj(allchild(fig),'flat','Type','uitoolbar');
if ~isempty(initialState.toolbar)
initialState.ptButtons = [uigettool(initialState.toolbar,'Plottools.PlottoolsOff'), ...
47. uigettool(initialState.toolbar,'Plottools.PlottoolsOn')];
initialState.ptState = get (initialState.ptButtons,'Enable');
set (initialState.ptButtons,'Enable','off');
end
% Setup FullCrosshair Pointer without warning.
oldwarnstate = warning('off', 'MATLAB:hg:Figure:Pointer');
set(fig,'Pointer','fullcrosshair');
warning(oldwarnstate);
% Adding this to enable automatic updating of currentpoint on the figure
set(fig,'WindowButtonMotionFcn',@(o,e) dummy());
% Get the initial Figure Units
initialState.fig_units = get(fig,'Units');
end
function restoreFcn(initialState)
if ishghandle(initialState.figureHandle)
% Figure Units
set(initialState.figureHandle,'Units',initialState.fig_units);
set(initialState.figureHandle,'WindowButtonMotionFcn','');
% Plottools Icons
if ~isempty(initialState.toolbar) && ~isempty(initialState.ptButtons)
set (initialState.ptButtons(1),'Enable',initialState.ptState{1});
set (initialState.ptButtons(2),'Enable',initialState.ptState{2});
end
% UISUSPEND
uirestore(initialState.uisuspendState);
end
end
function dummy()
% do nothing, this is there to update the GINPUT WindowButtonMotionFcn.
48. end
function cleanup(c)
if isvalid(c)
delete(c);
end
end
7.2.12 Coding for manual selectionof input
function demoOnImageClick
clc;clear;
clear all
close all
warning off
I=imread('D:antimicro1 (1).jpg');
I=imresize(I,[600,600]);
I2=I;
imObj = I;
figure;
hAxes = axes();
imageHandle = imshow(imObj);
set(imageHandle,'ButtonDownFcn',@ImageClickCallback);
% function ImageClickCallback ( objectHandle , eventData )
axesHandle = get(objectHandle,'Parent');
coordinates = get(axesHandle,'CurrentPoint');
coordinates = coordinates(1,1:2);
message = sprintf('x: %.1f , y: %.1f',coordinates (1) ,coordinates (2));
helpdlg(message);
end
49. clear all
close all
warning off
[FileName,PathName] = uigetfile('*.*','Select an image');
I=imread(strcat(PathName,FileName));
I=imresize(I,[600,600]);
I2=I;
figure,imshow(I);
[x, y] = getpts;
i=1:2:14;
j=2:2:14;
for k=1:7
xm(k)=(x(j(k))+x(i(k)))/2;
ym(k)=(y(j(k))+y(i(k)))/2;
x1=(x(j(k))-x(i(k)))^2;
y1=(y(j(k))-y(i(k)))^2;
d(k,1)=sqrt(x1+y1);
d(k,1)=d(k,1)*0.1606;
if d(k,1)<=.5
d(k,1)=0;
end
end
imshow(I);
hold on
plot(x,y,'r+','MarkerSize',10);
hold off
for i=1:7
hText = text(xm(i),ym(i),mat2cell(d(i,1)),'Color',[1 1 0],'FontSize',10);
end
50. 7.2.13 Final coding for semi-automatic zone measurement and decision making
clear all
close all
warning off
[FileName,PathName] = uigetfile('*.*','Select an image');
I=imread(strcat(PathName,FileName));
%I=imread('D:antimicro1 (1).jpg');
I=imresize(I,[600,600]);
I2=I;
figure,imshow(I);grid on
roi_i=zeros(size(I));
for n=1:14
[x(n),y(n)]=ginput(1);
hold on
plot(x(n),y(n),'r+','MarkerSize',10);
hold off
end
i=1:2:14;
j=2:2:14;
for k=1:7
xm(k)=(x(j(k))+x(i(k)))/2;
ym(k)=(y(j(k))+y(i(k)))/2;
x1=(x(j(k))-x(i(k)))^2;
y1=(y(j(k))-y(i(k)))^2;
d(k,1)=sqrt(x1+y1);
d1(k,1)=d(k,1);
d(k,1)=d(k,1)*0.1606;
51. if round(d(k,1))>=1 && round(d(k,1))<=8
result_condition{k,1}='R';
elseif round(d(k,1))>8 && round(d(k,1))<=17
result_condition{k,1}='IM';
elseif round(d(k,1))>17
result_condition{k,1}='S';
end
hold on
[xp,yp]=circle2(xm(k),ym(k),(7/0.1606)/2);
hold off
if d(k,1)>8
hold on
[xp,yp]=circle(xm(k),ym(k),d1(k,1)/2);
hold off
end
end
for i=1:7
hText = text(xm(i)-15,ym(i)+15,mat2cell(round(d(i,1))),'Color',[1 1 0],'FontSize',10);
hText2 = text(xm(i)-30,ym(i)+30,result_condition{i,1},'Color',[0 1 0],'FontSize',10);
end
figure,imshow(roi_i)
i=1:2:14;
j=2:2:14;
for k=1:7
xm(k)=(x(j(k))+x(i(k)))/2;
ym(k)=(y(j(k))+y(i(k)))/2;
x1=(x(j(k))-x(i(k)))^2;
y1=(y(j(k))-y(i(k)))^2;
53. CHAPTER 8
RESULTS AND DISCUSSION
8.1 SEMI-AUTOMATIC MEASUREMENT OF ZONES OF INHIBITION
(STAGE-I)
8.1.1 Sample Image
An image is selected to detect the zones of inhibition and diameter measurement
from saved images.
Fig.3. Sample 1
8.1.2 Output
Fig.4. First stage output
54. The zones of inhibition are measured and categorized into sensitive (S),
intermediate (IM) and resistance (R) based on CLSI standards fixed for individual
antibiotics at defined concentrations that are normally used at clinics while testing the
samples. The categorization between S, IM and R is done on the basis of color. The red
color indicates S, blue color indicates IM and green color indicates R of the respective
antibiotics tested against the sample. Also, the diameter were calculated on the basis of x
axis and y axis and displayed in the command window.
8.2 SEMI-AUTOMATIC MEASUREMENT OF ZONES OF INHIBITION
(STAGE-I)
8.2.1 Sample image
A sample image is chosen randomly from the previously captured and saved
images. After image acquisition, the color image is converted to gray scale in order to
have a single layer processing application.
Fig.5. Sample 2
The assay image contains a transparent zone around the drug which is the measure
to identify whether the drug is resistant or sensitive. The region of activity around the
drug shares a weak boundary with the microorganism. So an enhancement operation was
performed to strengthen the edges. By applying this method the global contrast of the
image will be increased following which the intensities of the image would be well
55. distributed. Once the operation is completed the contrast of the image is enhanced
resulting in a clear identification of edges of the zone formed by the activity of the drug
on the microorganism in the assay. The next process is to identify the edges of the zone
of inhibition by finding its diameter with which the efficacy of the drug is assessed.
Fig.6. Canny edge detected
The edge detection is performed using canny edge detection system. Edge
detection is considered to the most important step in estimating the structural information
in an image. It uses a multi stage algorithm to extract the larger range of edges present in
the given image. This algorithm has several positive aspects like detection of edges with
low error rate, edge centre localization and elimination of noise edges on the image. The
canny edge detection applies the Gaussian filter to smoothen the image and finds the
intensity gradients present in the image. A double threshold method is used in this edge
detector to identify the sensitive edges and the edge finalization is done with the
condition of identifying the stronger edges. In our case the stronger edges would be
identified at the wall of the drug and the wall of the colony created by the drug activity.
This binary image is subjected to Hough transform to identify the circles and find their
radius. The Hough transform plays a significant role in identifying the shapes such as
straight lines, circles in the process of automatic analysis of digital images. Hough
56. transform seems to the simplest way to identify the circle in an image. The identification
process begins with generating an accumulator space with ‘0’ pixel values of size equal
to the size of the binary edge image. For every edge point in the image all the cells are
incremented with reference to the equation of the circle. The search begins to look for the
local maximum which holds the highest possibility to begin a circle
8.2.2 Final output
Fig.7. Second stage output
The obtained image with the circles is analyzed with connected component
labeling in order to mark the entire individual component in the image. The possible
connected component in the assay image would be the drug and the zone formed by the
activity. Once the components are identified, their coordinates are used to calculate the
radius of the circle using the parametric equation given below,
57. mm = (pixels * 25.4) /dpi
(4)
where, mm refers to millimeter and dpi refers to dot per inch.
The detected circles are shown in the figure where both the drug and invasion area
are represented in circles from where then radius of the outer most circle is taken as the
area of invasion.
The output image contains the marking of boundaries, naming the drug in
alphabetical order, displaying the diameter of the zone of inhibition and classification of
drugs into R, IM or S, based on the following table,
S.no Drug name Disc
code
Resistant Intermediate Sensitive
< or = mm mm = or > mm
1 CCiipprrooffllooxxaacciinn((55µµgg)) CCIIPP 15 16-20 21
2 CCeepphhaallootthhiinn((2255µµgg)) CCEEPP 14 15-17 18
3 GGeennttaammiicciinn((1100 µµgg)) GGEENN 12 13-14 15
4 MMeerrooppeenneemm((1100 µµgg)) MMRRPP 9 10-13 14
5 NNiittrrooffuurraannttooiinn((330000µµgg)) NNIITT 12 13-14 15
6 CCeepphhaalleexxiinn((3300 µµgg)) CCNN 14 15-17 18
7 AAmmooxxiicciilllliinn//ccllaavvuullaanniicc
aacciidd((2200//1100 µµgg))
AAMMCC 19 _ 20
88 CCeeffoottaaxxiimmee((2255 µµgg)) CCTTXX 13 14-16 17
58. 99 OOffllooxxaacciinn((55 µµgg)) OOFF 14 15-17 18
1100 AAmmiikkaacciinn((3300 µµgg)) AAKK 11 12-13 14
1111 CCoo--ttrriimmooxxaazzoollee((2255µµgg)) CCOOTT 14 15-20 21
1122 PPiippeerraacciilllliinn//TTaazzoobbaaccttaamm
((110000//1100 µµgg))
PPIITT 28 _ 29
1133 VVaannccoommyycciinn((3300µµgg)) VVAA 9 10-11 12
1144 EErryytthhrroommyycciinn((1155µµgg)) EE 13 14-22 23
1155 CChhlloorraammpphheenniiccooll((3300µµgg)) CC 12 13-17 18
1166 OOxxaacciilllliinn((11 µµgg)) OOXX 10 11-12 13
1177 AAmmiikkaacciinn((3300 µµgg)) AAKK <13 14-17 18
1188 CCeeffttrriiaaxxoonnee((3300 µµgg)) CCTTRR 14 15-20 21
Table.1. values based on CLSI standards
The report generation contains a table containing plate number, obtained diameter
in millimeters and the classification of drug susceptibility.
8.3 Comparison
The results obtained from the semi-automated system were compared with the
results obtained with the existing manual measurement method followed in KAP
59. Vishwanathan Medical College, Trichy. A total of 44 samples namely 10 urine samples,
18 pus samples and 16 blood samples were captured in a high resolution camera and used
for testing with our system and the results have been tabulated.
Table 2 shows the diameter of zone of inhibition (mm) obtained for urine samples,
pus samples and blood samples tested against various drugs using the existing manual
method and the semi-automated method proposed in this research work. Some of the
results obtained from the semi-automated program exhibit a slight variation due to the
occurrence of irregular zone formation around the drug incorporated discs but this
program is capable of detecting even 1 mm change. No growth is represented as R which
denotes the diameter of the disc (6 mm). It is clear that both the results coincide with a
tolerance level of +/- 1 mm and the error rate is found to be around 3%. Though the
measurement deviates slightly in certain cases, the classification of the drug susceptibility
is same for all cases for both manual and semi-automated method.
60. CHAPTER 9
OUTCOME & FUTURE DIRECTIONS
9.1 Advantages
The major advantage of the developed semi-automated system over the existing
method is that the edge detection of zone of inhibition using simple setting of dark
background and high resolution of the camera gives higher precision in
measurement than visual appearance of measurement by vernier callipers.
Ready to be installed in any computer and user-friendly.
9.2 Societal impact
Laborious manual screening of large number of samples at diagnostic laboratories
are still being preferred by microbiologists and clinicians due to expensive automated
devices. As there is an emerging antimicrobial drug resistance, careful selection of drugs
to prescribe a patient is challenging. To overcome the cumbersome manual process and
data interpretation, our proposed semi-automated software system will reduce the
workload and enable to perform the task simpler overcoming manual errors.
9.3 Future Directions
61. To develop a cost-effective, portable, compact and fully automated device over the
other available devices in the market for antimicrobial susceptibility testing
To develop an automated device with indigenous and open source components,
thus bypassing commercial licensing
CHAPTER 10
CONCLUSION
The disk diffusion test is one of the most commonly used methods for microbial
susceptibility testing which determines the size of inhibition zones of sensitive and
resistant strains. Analyzing larger number of patient samples everyday by clinicians is a
cumbersome process. Automated or semi-automated systems are available to overcome
time-consuming and laborious tasks of trained microbiologists while analysing a vast
number of biological specimens. In this work, a newer semi-automation algorithm is
proposed and validated to overcome the challenges posed by the laborious manual
screenings of test samples. The advantages of this semi-automated program over existing
manual method of data interpretation are accuracy, sensitivity, reproducibility and
independency in data entry. Manual measurement and interpretation may lead to manual
errors when the number of samples to be analyzed is quite large. In the proposed system,
the work of the technician would largely limit with capturing the image and feeding it to
the program. Hence the demand for a skilled man power in a particular domain would be
compensated.
62. CHAPTER 11
REFERENCES
[1] S.G. Jenkins , A.N. Schuetz , Current concepts in laboratory testing to guide an-
timicrobial therapy, Mayo Clin. Proc. 87 (3) (2012) 290–675 .
[2] E. Matuschek , D.F. Brown , G. Kahlmeter , Development of the EUCAST disk
diffusion antimicrobial susceptibility testing method and its implementation in routine
microbiology laboratories, Clin. Microbiol. Infect. 20 (4) (2014) O255–66 .
[3] A.W. Bauer, W.M. Kirby , J.C. Sherris , M. Turck ,Antibiotic susceptibility testing
by a standardized single disk method, Am. J. Clin. Pathol. 45 (1966) 4 93–4 96 .
[4] L.B. Reller , M. Weinstein , J.H. Jorgensen , M.J. Ferraro , Antimicrobial suscepti-
bility testing: a review of general principles and contemporary practices, Clin. Infect. Dis.
49 (11) (2009) 1749–1755 .
[5] Clinical , L.S. Institute , Performance standards for antimicrobial susceptibility
testing, CLSI, 26, Clinical and Laboratory Standards Institute, Wayne, PA, 2016 .
Supplement M100S.
[6] E.C.o. A. S. Testing, Breakpoint tables for interpretation of MICs and zone di-
ameters. Version 6.0, 2016.
[7] Andrews, J. M.; Boswell, F. J.; Wise, R. -- Evaluation of the Oxoid Aura image
system for measuring zones of.inhibition, Journal of Antimicrobial Chemotherapy
Volume 46 issue 4 (2000).
63. [8] Canton, R., M. Perez-Vazquez, A. Oliver, B. S. Del Saz, M. O. Gutierrez, M.
Martinez-Ferrer, and F. Baquero, Evaluation of the wider system, a new computer-
assisted image-processing device for bacterial identi¯cation and susceptibility testing,"
Journal of Clinical Microbiology,Vol. 38, 1339,1346, (2000).
[9] G. Hejblum , et al. , Automated interpretation of disk diffusion antibiotic sus-
ceptibility tests with the radial profile analysis algorithm, J. Clin. Microbiol. 31 (1993)
2396–2401.
[10] L.F.R. Costa , et al. , Development of an automatic identification algorithm for
antibiogram analysis, Comput. Biol. Med. 67 (2015) 104–115.
[11] D.D. Rhoads , S.M. Novak , L. Pantanowitz , A review of the current state of dig-
ital plate reading of cultures in clinical microbiology, J. Pathol. Inform. 6 (23) (2015) .
[12] A. Croxatto , et al. , Laboratory automation in clinical bacteriology: what system to
choose? Clin. Microbiol. Infect. 22 (3) (2016) 217–235 .
[13] Acharya and Ray, Image Processing: Principles and Applications, Wiley-
Interscience 2005 ISBN 0-471-71998-6.
[14] N. Bassiou and C. Kotropoulos, "Color image histogram equalization by absolute
discounting back-off," Computer Vision and Image Understanding, vol. 107, no. 1-2,
pp.108-122, Jul.-Aug. 2007.
[15] Lindeberg, Tony "Edge detection and ridge detection with automatic scale
selection", International Journal of Computer Vision, 30, 2, pp 117—154, 1998. (Includes
the differential approach to non-maximum suppression.
[16] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ,
Prentice Hall, 1990, pp. 478-488.
[17] T.J Atherton, D.J. Kerbyson. "Size invariant circle detection." Image and Vision
Computing. Volume 17, Number 11, 1999, pp. 795-803.
[18]H.K. Yuen , et al. , Comparative study of hough transform methods for circle finding,
Image Vis. Comput. 8 (1) (1990) 71–77
64. [19] H.K Yuen, .J. Princen, J. Illingworth, and J. Kittler. "Comparative study of Hough
transform methods for circle finding." Image and Vision Computing. Volume 8, Number
1, 1990, pp. 71–77.
[20] E.R. Davies, Machine Vision: Theory, Algorithms, Practicalities. Chapter 10. 3rd
Edition. Morgan Kauffman Publishers, 2005.
[21] Pavel Krepelka, Robert Kadlec, Karel Bartusek, and Martin Jakubec, New Method
for Automated Disk Diffusion Test, Progress In Electromagnetics Research Symposium
Proceedings, Guangzhou, China, Aug. 25{28, 2014) 192-194.
[22] A.B. Mochon , M.S. Cruz , Telemicrobiology: focusing on quality in an era of lab-
oratory consolidation, Clin. Microbiol. Newsl. 38 (3) (2016) 19–24 .
[23]Jiancheng Xu, Man Zhang, Bin Zhao, and Qi Zhou, Antimicrobial Resistance Profile
of Enterobacter Cloacae Isolated from the First Bethune Hospital, 2011 DOI:
10.1109/ICCASE.2011.5997674
[24]Thitikarn Okowat, Somchat Taertulakarn, Seksun Samosornsuk, and Chuchart
Pintavirooj, Detection of Disk Drug Orientation for Disk Diffusion Susceptibility
Testing, Biomedical Engineering International Conference (BMEiCON), 2012
DOI: 10.1109/BMEiCon.2012.6172058.
[25] E.S. Lestari , et al. , Comparison of the accuracy of disk diffusion zone diameters
obtained by manual zone measurements to that by automated zone measure- ments to
determine antimicrobial susceptibility, J. Microbiol. Methods 75 (2) (2008) 177–181 .