Académique Documents
Professionnel Documents
Culture Documents
Abstract:
In this project ,we propose a color based segmentation method that uses the K means
clustering technique to track tumor objects in magnetic resonance (MR) brain images.
The key concept in this color based segmentation algorithm with k means means to
convert a given gray level MR image in to a color space image and then separate the
position of tumor objects from other items of an MR image by using K means clustering
And histogram clustering .Experiments demonstrates that the method can successfully
achieve segmentation for MR brain images to help pathologists distinguish exactly lesion
size and region.
3
INTRODUCTION
and number of medical images, the use of computers in facilitating their processing
and analysis has become necessary. In particular, computer algorithms for the
delineation of anatomical structures and other regions of interest are a key
component in assisting and automating specific radiological tasks. These
algorithms, called image segmentation algorithms, play a vital role in numerous
biomedical imaging applications such as the quantification of tissue volumes ,
diagnosis , localization of pathology , study of anatomical structure , treatment
planning , partial volume correction of functional imaging data , and computer
integrated surgery .
Image Segmentation is the process of identifying features in images and
marking them as distinct from one another. These features can be things like grey
and white matter in an MRI of the brain or individual organs in an MR or CT
image.
Magnetic resonance imaging (MRI) provides detailed images of living tissues,
and is used for both brain and body human studies. Data obtained from MR images
is used for detecting tissue deformities such as cancers and injuries; MR is also
used extensively in studies of brain pathology, where regions of interest (ROI’s) are
often examined in detail, for example in multiple sclerosis (MS) studies. In order to
perform good quantitative studies, ROI’s within the brain must be well defined. In
traditional methods, a skilled operator manually outlines the ROI’s using a mouse
or cursor. More recently, computer-assisted methods have been used for specific
tasks such as extraction of MS lesions from MRI brain scans , or extraction of the
cerebral ventricles in schizophrenia studies . Many of these computer-assisted tasks
require segmentation of the whole brain from the head.
Classically, image segmentation is defined as the partitioning of an image into
nonoverlapping, constituent regions that are homogeneous with respect to some
characteristic such as intensity or texture. If the domain of the image is given by,
then the segmentation problem is to determine the sets whose union is the
entire domain . Thus, the sets that make up a segmentation must satisfy
5
threshold selection . In addition, the edges found are usually not closed such that
edge linking techniques are further required.
Multispectral segmentation
Segmentation techniques using clustering techniques like k-means clustering ,
adaptive hierarchical clustering , fuzzy k-means , etc. are applied [. Like all
unsupervised segmentation techniques, multispectral data analysis is fully
automatic and superior in reproducibility, but it can only be exploited when the MR
characteristics of the object of interest differ significantly from those of the
surrounding structures. On the other hand, results of supervised segmentation are
less reproducible but the segmentation process can be controlled by the operator.
We choose for a semiautomatic single image segmentation procedure for 3D MR
images in which user interaction is allowed to control the segmentation process and
in which data is preprocessed as far as possible such that the posterior user-
interaction time is strongly reduced
Echo MR slice
8
Classification-Based Segmentation
one to model the spatial interactions between neighboring voxels. The bias field
estimation problem is cast in a Bayesian framework and the expectation-
maximization (EM) algorithm is used to estimate the inhomogeneity and the tissue
classes. However, their method needs to be supplied with the tissue class
conditional intensity models, which are typically constructed manually from
training data. They also did not consider neighborhood dependencies for the tissue
segmentation. algorithm by using MRF to introduce context or dependency among
neighboring voxels. Propose to use a 3-step EM algorithm, which interleaves voxel
classification, class distribution parameter estimation, and bias field estimation.
Instead of using manually constructed tissue class conditional intensity models,
their method employs digital brain atlas with a priori probability maps for each
tissue class to automatically construct intensity models for each individual scan
being processed. The brain tissue classes are modeled as finite Gaussian mixtures
with MRF regularization to account for contextual information and the bias field is
modeled as a fourth order least square polynomial fit. It also use the Gaussian
mixture to model the three brain tissue classes. The biological variations of a
particular tissue class are accounted for in their statistical model by assuming that
the mean intensities of the tissue classes are slowly varying spatial functions. The
magnetic field in homogeneities modify both the mean tissue intensities and the
noise variances in a similar manner. To account for the smoothness and piecewise
contiguous nature of the tissue regions, they use a 3D MRF as a prior. Consider the
statistical segmentation of multispectral MR brain image. In their work, the
intensity distributions of the brain tissues are again modeled as a mixture of
Gaussians. They use a robust version of the EM algorithm called logistic EM
algorithm to estimate the model parameters, and use MRF to incorporate prior
knowledge into the segmentation process. Another major class of voxel
classification techniques uses clustering-based method. Clustering is a popular
unsupervised classification method and has found many applications in pattern
classification and image segmentation. Clustering algorithm attempts to classify a
voxel to a tissue class by using the notion of similarity to the class.
11
Region-Based Segmentation
The shape of an object can be described in terms of its boundary or the region it
occupies. Image region belonging to an object generally have homogeneous
characteristics, e.g. similar in intensity or texture. Region-based segmentation
techniques attempt to segment an image by identifying the various homogeneous
regions that correspond to different objects in an image. Unlike clustering methods,
region-based methods explicitly consider spatial interactions between neighboring
voxels. In its simplest form, region growing methods usually start by locating some
seeds representing distinct regions in the image . The seeds are then grown until
they eventually cover the entire image. The region growing process is therefore
governed by a rule that describe the growth mechanism and a rule that check the
homogeneity of the regions at each growth step. Region growing technique has
been applied to MRI segmentation. A semi-automatic, interactive MRI
segmentation algorithm was developed that employ simple region growing
technique for lesion segmentation. In , an automatic statistical region growing
algorithm based on a robust estimation of local region mean and variance for every
voxel on the image was proposed for MRI segmentation. The best region growing
parameters are automatically found via the minimization of a cost functional.
Furthermore, relaxation labeling, region splitting, and constrained region merging
were used to improve the quality of the MRI segmentation. The determination of an
appropriate region homogeneity criterion is an important factor in region growing
segmentation methods. However, such homogeneity criterion may be difficult to
obtain a priori. An adaptive region growing method is proposed where the
homogeneity criterion is learned automatically from characteristics of the region to
be segmented while searching for the region.
Other region-based segmentation techniques,
1. Split-and-merge based segmentation and
12
.
Description of input data
MR scans of the head is given as input to the algorithm. Currently working with
gradient echo images acquired using a General Electric Sigma 1.5 Tesla clinical
MR imager. The voxel size is approximately 1 × 1 × 1.5 mm and there are
256×256×60 voxels per data set Tissue classes visible in such MRI scans include
white and grey matter, cerebrospinal fluid (csf), meninges (the protective
membranes surrounding the brain), skull, muscle, fat, skin or air . Pathology
introduces the additional classes of edema, tumor, hemorrhage or other
abnormality.
due to limitations of the imaging process, and noise may be introduced due to
movement of the patient during the acquisition of the scan. This model of the brain
strongly suggests the use of intensity distributions as well as absolute and relative
spatial arrangement of the various structures in the head to aid the segmentation
process.
Biomedical-Imaging Applications
The growing size and number of these medical images have necessitated the use
of computers to facilitate processing and analysis. In particular, computer
algorithms for the delineation of anatomical structures and other regions of interest
are becoming increasingly important in assisting and automating specific
radiological tasks. These algorithms, called image segmentation algorithms, play a
vital role in numerous biomedical-imaging applications, such as
1. The quantification of tissue volumes
2. Diagnosis
3. localization of pathology
4. Study of anatomical structure
5. Treatment planning and
6. Computer-integrated surgery
Segmentation Methods:
Several common approaches have appeared in the recent literature on
medicalimage segmentation. We define each method, provide an overview of its
implementation, and discuss its advantages and disadvantages. Although each
technique is described separately, multiple techniques are often used in conjunction
for solving different segmentation problems.
We divide segmentation methods into eight categories:
Thresholding approaches,
1) Region growing approaches,
2) Clustering approaches,
17
Thresholding
Thresholding approaches segment scalar images by creating a binary partitioning
of the image intensities. The histogram of a scalar image that possesses different
apparent classes, corresponding to the different modes. A thresholding procedure
attempts to determine an intensity value, called the threshold, which separates the
desired classes. The segmentation is then achieved by grouping all pixels with
intensities greater than the threshold into one class and all other pixels into another
class. Determination of more than one threshold value is a process called
multithresholding. Thresholding is a simple yet often effective means for obtaining
a segmentation of images in which different structures have contrasting intensities
or other quantifiable features. The partition is usually generated interactively,
although automated methods do exist . Thresholding is often performed
interactively, based on the operator’s visual assessment of the resulting
segmentation.
Thresholding is often used as an initial step in a sequence of image-processing
operations. It has been applied in digital mammography, in which two classes of
tissue are typically present—healthy and tumorous . Its main limitations are that, in
its simplest form, only two classes are generated, and it cannot be applied to
multichannel images. In addition, thresholding typically does not take into account
the spatial characteristics of an image. This causes it to be sensitive to noise and
intensity inhomogeneities, which can occur in MR images. Both of these artifacts
essentially corrupt the histogram of the image, making separation more difficult.
For these reasons, variations on classical thresholding have been proposed for
medical-image segmentation that incorporate information based on local intensities
and connectivity .
18
Region Growing:
The first region growing method was the seeded region growing method. This method
takes a set of seeds as input along with the image. The seeds mark each of the objects to
be segmented. The regions are iteratively grown by comparing all unallocated
neighboring pixels to the regions. The difference between a pixel's intensity value and
the region's mean, δ, is used as a measure of similarity. The pixel with the smallest
difference measured this way is allocated to the respective region. This process continues
until all pixels are allocated to a region.
The growth of the regions is carried out from the seeds that were determined as
input, where each one of them contains the following information:
� Position. These are x, y and z coordinates within the image. It is known that this
point belongs to the region of interest.
� Intensity. The voxel intensity is important to determine the rank of intensities
that will be included in the region (if the inclusion criterion makes use of this
value).
Another input data of the algorithm is the three-dimensional image with a
cubical matrix shape. The algorithm output will be a matrix with the same
dimensions as the input image. This output matrix is initially filled out with zeroes
in all the positions, and the seeds will be marked to let the region grow.
19
One of the most remarkable aspects of this technique is that it always grows by
neighbors, so it maintains connectivity between the elements that are included
within the segmented region.
Growth Types
Three growth variations are provided to consider if a voxel belongs or not to the
region of interest. The first one considers the variation of voxel intensity in relation
to the seed intensity. The second one considers the local intensity variation in
relation to the neighbor being visited. The last one considers the three-dimensional
gradient of the image.
Seed Growth
In this case the seed intensity is taken always as reference. Each new voxel that is
added to the region is included if the intensity difference that exists between it and
the intensity of the seed maintains within a threshold determined previously. This
20
threshold is compared directly with the intensity difference. This technique gives as
result regions that contain voxels whose intensities are within a
certain rank.
Neighbor Growth
Unlike the previous case, this variation considers that the voxel belongs to the
region if the intensity difference with its neighbor remains underneath the
threshold. In this technique, voxels that have great variations of intensity with their
neighbors are excluded
Disadvantages of Region growing:
The primary disadvantage of region growing is that it requires manual interaction
to obtain the seed point. Thus, for each region that needs to be extracted, a seed
must be planted. Splitand-merge is an algorithm related to region growing, but it
does not require a seed point . Region growing can also be sensitive to noise,
causing extracted regions to have holes or even become disconnected. Conversely,
partial-volume effects can cause separate regions to become connected. To help
alleviate these problems, a homotopic region-growing algorithm has been proposed
that preserves the topology between an initial region and an extracted region .
Fuzzy analogies to region growing have also been developed .
Clustering
Clustering algorithms essentially perform the same function as classifier methods
without the use of training data. Thus, they are termed unsupervised methods. To
compensate for the lack of training data, clustering methods iteratatively alternate
between segmenting the image and characterizing the properties of each class. In a
sense, clustering methods train themselves, using the available data. Three
commonly used clustering algorithms are the K-means or ISODATA algorithm ,
the fuzzy c-means algorithm , and the expectation-maximization (EM) algorithm .
The K-means clustering algorithm clusters data by iteratively computing a mean
intensity for each class and segmenting the image by classifying each pixel in the
class with the closest mean . Figure 4b shows the result of applying the K-means
algorithm to a slice of an MR brain image in Figure 4a. The number of classes was
21
.
23
1)Region Splitting
K-Means Algorithm
The K-means algorithm is an iterative technique that is used to partition an image into K
clusters. The basic algorithm is:
In this case, variance is the squared or absolute difference between a pixel and a cluster
center. The difference is typically based on pixel color, intensity, texture, and location, or
a weighted combination of these factors. K can be selected manually, randomly, or by a
heuristic.
This algorithm is guaranteed to converge, but it may not return the optimal solution. The
quality of the solution depends on the initial set of clusters and the value of K.
The other approach to partition an image into K clusters is the statistical hierarchical
aglomerative clusterization technique for identification of images regions by the color
similarity. This method uses a binary mask and ranks the color components of the
clusters’ central components. The basic algorithm is:
Histogram-Based Methods
Histogram-based methods are very efficient when compared to other image segmentation
methods because they typically require only one pass through the pixels. In this
technique, a histogram is computed from all of the pixels in the image, and the peaks and
valleys in the histogram are used to locate the clusters in the image. Color or intensity can
be used as the measure.
Edge-Based Segmentation
Contour and shape models approach the problem from the point of view of
edges rather than regions. Edges are usually modeled (either piecewise or in
totality) as splines, and a search or relaxation technique is used to push the splines
towards the edges. This type of segmentation method tries to find any places where
a rapid transition from one brightness or colour value to another occurs. The
fundamental principle involves convolving gradient operators with the image. High
values of the gradient magnitude are possible places of rapid transition between two
different regions; these are what we see as edges. After the step of finding edges on
the image, they have to be linked to form closed boundaries of the regions.
Edge detection is a well-developed field on its own within image processing. Region
boundaries and edges are closely related, since there is often a sharp adjustment in
26
intensity at the region boundaries. Edge detection techniques have therefore been used as
the base of another segmentation technique.
The edges identified by edge detection are often disconnected. To segment an object from
an image however, one needs closed region boundaries. Discontinuities are bridged if the
distance between the two edges is within some predetermined threshold.
Region growing approach is the opposite of the split and merge approach: An
initial set of small areas are iteratively merged according to similarity constraints.
• Start by choosing an arbitrary seed pixel and compare it with neighbouring pixels
• Region is grown from the seed pixel by adding in neighbouring pixels that are
similar, increasing the size of the region.
• When the growth of one region stops we simply choose another seed pixel which
does not yet belong to any region and start again.
• This whole process is continued until all pixels belong to some region.
• A bottom up method.
Region growing methods often give very good segmentations that correspond well to the
observed edges.
28
However starting with a particular seed pixel and letting this region grow
completely before trying other seeds biases the segmentation in favour of the
regions which are segmented first.
To counter the above problems, simultaneous region growing techniques have been
developed.
Seeded region growing (SRG) algorithm is very attractive for semantic image
segmentation by involving high-level knowledge of image components in the seed
selection procedure. However, the SRG algorithm also suffers from the problems of
pixel sorting orders for labeling and automatic seed selection. An obvious way to
improve the SRG algorithm is to provide more effective pixel labeling technique
and automate the process of seed selection. To provide such a framework. we
design an automatic SRG algorithm, along with a boundary-oriented parallel pixel
29
Algorithm Steps:
Further assumptions:
30
Region-Oriented Segmentation
Region Growing
Region growing is a procedure that groups pixels or subregions into larger
regions.
The simplest of these approaches is pixel aggregation, which starts with a
set of “seed” points and from these grows regions by appending to each
seed points those neighboring pixels that have similar properties (such as
gray level, texture, color, shape).
Region growing based techniques are better than the edge-based
techniques in noisy images where edges are difficult to detect.
This is the counterpart of the edge linking mechanism which is based on local
comparison of pixel properties without reference to a more global viewpoint.
Regions (or pixels) should be merged if they are homogeneous, i.e. have similar
grey level intensity, colour, texture, depth etc.
In a segmented image,
31
First we consider a recursive algorithm (iterative equivalents scan the image top to
bottom, left to right) based on a 4-connected model of image connectivity.
fig 3.5
4-connected
An initial pixel must be found. This may satisfy some predetermined criteria,
e.g. start with the most red or brightest pixel, or may start from some predetermined
location, e.g. the centre of the image. When the recursive function terminates, there
will, in general, be a group of pixels conjoined to form a labelled region with
property I. The process must be repeated for another start pixel with similar or
different property value. For example, if the goal was colour segmentation it might
be appropriate to form the red regions, then when no more red pixels can be found
to form the green regions and so on.
clusters being formed. Some progress has been made on this issue, however much
experimentation still needs to be done
An alternative set of algorithms exists which uses color similarity and a region-
growing approach to spatial information . Region growing is based on the
following principles. The algorithm starts with a seed pixel, examines local pixels
around it, determines the most similar one, which is then included in the region if it
meets certain criteria. This process is followed until no more pixels can be added.
The definition of similarity may be set in any number of different ways.
Region growing algorithms have been used mostly in the analysis of grayscale
images; however, some significant work has been completed in the color realm by
Tremeau et al. They discuss the segmentation of color regions which are
homogeneous in color (i.e., no illumination effects are considered) thus restricting
the application domain. They use a set of thresholds when calculating whether a
color pixel is part of a region or not, and the Euclidean distance is used a as the
measure of similarity between two color vectors.
A region growing algorithm is proposed in this paper based on the vector angle
color similarity measure and the use of the principal component of the covariance
matrix as the "characteristic" color of the region, with the goal of a region-based
segmentation which is perceptually-based. The algorithm is presented as follows:
This algorithm presents several advantages over other color image segmentation
algorithms. First, it is based on the concept of color vector angle. The vector angle
is a shading-invariant color similarity measure, implying that intensity variations
will be discounted in the region growing process, which is clearly not the case
when using the Euclidean distance. Secondly, since spatial information is taken into
account, regions having a slightly different color, but still spatially distinct, should
appear as separate regions due to the region growing process.
Disadvantages:
Clearly a significant disadvantage of this approach to color image segmentation
algorithm is need for seed pixels, and careful consideration needs to be given to the
selection of those pixels. Alternative approaches include finding those pixels in the
color image with the greatest intensity, or to use the MPC algorithm to select the
seeds based on the clustering result.
Region Splitting
Region growing starts from a set of seed points.
An alternative is to start with the whole image as a single region and
subdivide the regions that do not satisfy a condition of homogeneity.
Region Merging
Region merging is the opposite of region splitting.
Start with small regions (e.g. 2x2 or 4x4 regions) and merge the regions
that have similar characteristics (such as gray level, variance).
35
Splitting and merging attempts to divide an image into uniform regions. The basic
representational structure is pyramidal, i.e. a square region of size m by m at one
and is the mean intensity of the N pixels in the region. Whereas splitting is quite
simple, merging is more complex. Different algorithms are possible, some use the
same test for homogeneity but others use the difference in average values.
Generally, pairs of regions are compared, allowing more complex shapes to
emerge.
A program in use at Heriot-Watt is spam ( split and merge) which takes regions a
pair at a time and uses the difference of averages to judge similarity, i.e. merge
region A with neighbouring region B if the difference in average intensities of A
and B is below a threshold.
Thresholding
Search all the pixels f(i,j) of the image f. An image element g(i,j) of the segmented
image is an object pixel if f(i,j) >=T, and is a background pixel otherwise.
In many vision applications, it is useful to be able to separate out the regions of the
image corresponding to objects in which we are interested, from the regions of the
image that correspond to background. Thresholding often provides an easy and
convenient way to perform this segmentation on the basis of the different
intensities or colors in the foreground and background regions of an image.
In addition, it is often useful to be able to see what areas of an image consist of
pixels whose values lie within a specified range, or band of intensities (or colors).
Thresholding can be used for this as well.
Working:
Not all images can be neatly segmented into foreground and background using
simple thresholding. Whether or not an image can be correctly segmented this way
can be determined by looking at an intensity histogram of the image. We will
consider just a grayscale histogram here, but the extension to color is trivial.
Multithresholding
resulting image is no longer binary
Semithresholding aims to mask out the image background leaving gray level
information present in the objects
Thresholding
This technique is based upon a simple concept. A parameter called the brightness
threshold is chosen and applied to the image a[m,n] as follows:
This version of the algorithm assumes that we are interested in light objects on a
dark background. For dark objects on a light background we would use:
The output is the label "object" or "background" which, due to its dichotomous
nature, can be represented as a Boolean variable "1" or "0". In principle, the test
40
condition could be based upon some other property than simple brightness (for
example, If (Redness{a[m,n]} >= ), but the concept is clear.
red
Threshold techniques are based on the thresholds which are normally selected
from the image histogram. It is said that all pixels whose values (this value can be
either gray intensity, color, or any number of other features) are between two
values of thresholds belong to one region. The fact that the thresholds are derived
from the histogram says that these techniques don’t take into account spatial
information of the image and therefore, incur problems to do with noise as well as
with blurred edges in the image. To go from image edges to the image boundaries
is an extremely difficult task.
Two pixels –based segmentation methods are applied in our proposed method. One
is histogram statistics and the other is K-, means clustering
How It Works
The operation is very simple. The image is scanned in a single pass and a running
count of the number of pixels found at each intensity value is kept. This is then
used to construct a suitable histogram.
Histograms have many uses. One of the more common is to decide what value of
threshold to use when converting a grayscale image to a binary one by
thresholding. If the image is suitable for thresholding then the histogram will be bi-
modal --- i.e. the pixel intensities will be clustered around two well-separated
values. A suitable threshold for separating these two groups will be found
somewhere in between the two peaks in the histogram. If the distribution is not like
this then it is unlikely that a good segmentation can be produced by thresholding.
Whereas the conventional thresholding operator uses a global threshold for all
pixels, adaptive thresholding changes the threshold dynamically over the image.
This more sophisticated version of thresholding can accommodate changing
lighting conditions in the image, e.g. those occurring as a result of a strong
illumination gradient or shadows.
The simplest property that pixels in a region can share is intensity. So, a natural way to
segment such regions is through thresholding, the separation of light and dark regions.
Thresholding creates binary images from grey-level ones by turning all pixels below
some threshold to zero and all pixels about that threshold to one. (What you want to do
with pixels at the threshold doesn't matter, as long as you're consistent.)
g(x,y)= 1 if f(x,y)>t
=0 otherwise
The major problem with thresholding is that we consider only the intensity, not any
relationships between the pixels. There is no guarantee that the pixels identified by
the thresholding process are contiguous.
We can easily include extraneous pixels that aren't part of the desired region, and
we can just as easily miss isolated pixels within the region (especially near the
boundaries of the region). These effects get worse as the noise gets worse, simply
because it's more likely that a pixels intensity doesn't represent the normal intensity
in the region.
43
When we use thresholding, we typically have to play with it, sometimes losing too
much of the region and sometimes getting too many extraneous background pixels.
(Shadows of objects in the image are also a real pain--not just where they fall
across another object but where they mistakenly get included as part of a dark
object on a light background.)
The K means algorithm will do the four steps below until convergence
Step 2. Put any initial partition that classifies the data into k clusters. You may
assign the training samples randomly, or systematically as the following:
Step 3 . Take each sample in sequence and compute its distance from the centroid
of each of the clusters. If a sample is not currently in the cluster with the closest
centroid, switch this sample to that cluster and update the centroid of the cluster
gaining the new sample and the cluster losing the sample.
Step 4 . Repeat step 3 until convergence is achieved, that is until a pass through the
training sample causes no new assignments.
Since we are not sure about the location of the centroid, we need to adjust the
centroid location based on the current updated data. Then we assign all the data to
this new centroid. This process is repeated until no data is moving to another
cluster anymore. Mathematically this loop can be proved to be convergent. The
convergence will always occur if the following condition satisfied:
1. Each switch in step 2 the sum of distances from each training sample to that
2. There are only finitely many partitions of the training examples into k clusters.
The metric to minimize and the choice of a distance measure will determine the
shape of the optimium clusters.
Two procedures are available to search for the optimum set of clusters. The first
assigns each object to a cluster and the second sets initial positions for the cluster
centroids.
In the first procedure, the objects are randomly assigned to one of the K clusters.
Once this is done, the position of the K centroids are determined, as is the value of
the metric to minimize. A global optimization method is then used to reassign some
of the objects to different clusters. New centroids are determined, as is the metric to
minimize. This procedure is continued until (hopefully) the optimum assignment of
objects to clusters is found.
In the second procedure for K-means clustering, placement of the K centroids can
be done by the following procedure.
1. Place K points into the space represented by the objects that are being
2. Assign each object to the group that has the closest centroid.
3. When all objects have been assigned, recalculate the positions of k-
centroids
4. repeat step 2 and 3 until the centroids no longer move This produces a
A global optimization method is then used to move the position of one or more
of the centroids. The above procedure is repeated and new metric is determined.
The object is to move the centroids into a position such that an optimum separation
of objects into groups occurrs.
There are several variants of the k-means clustering algorithm, but most variants
involve an iterative scheme that operates over a fixed number of clusters, while
attempting to satisfy the following properties:
1. Each class has a center which is the mean position of all the samples in that
Algorithm steps
3. Repeat the following steps until the cluster labels of the image does not change
anymore.
4. Cluster the points based on distance of their intensities from the centroid
intensities.
K-Means Algorithm
Pick k centers randomly
K-Means Iterations
Assign every point to the closest center
Compute the center of every cluster to replace the old one
Stop the algorithm if the centers are stable
Initialize
Loop
until termination condition is met:
1. For each pixel in the image, assign that pixel to a class such that the distance
from this pixel to the center of that class is minimized.
2. For each class, recalculate the means of the class based on the pixels that
belong to that class.
48
end loop;
The following images demonstrate the k-means clustering algorithm in action, for the
two-dimensional case. The initial centres are generated randomly to demonstrate the
stages in more detail. The background space partitions are only for illustration and are not
generated by the k-means algorithm.
Initialization of K-means
The straightforward way to do this is to assign the ith pixel to the i modulo kth
class. This is a good approach when the number of channels is greater than the
number of classes. You may need a large number of bits of precision just for the
first few iterations -- to ensure that there is some distance between the different
means. For this reason, it works better in software than hardware.
This is a good approach if the number of channels is less than the number of
classes. Otherwise it is difficult to distribute the means.
To initialize k classes, choose k pixels at random from the image. (Note -- they
don't need to be that random.) Make sure that the pairwise distance between the k
distance is large enough.
How to ensure that 2 pixels are sufficiently far away from each other ? One
(compute intensive) way to do this is to choose p pixels at random from the image
( where p >> k but smaller than all the pixels in the image) and then do k means
clustering on those p pixels.
Distance Measure
The meat of the k-means algorithm is calculating the distance between each pixel
and each class center. There are different distance measures that can be used. The
most common are:
One issue is how to measure the quality of the results provided by k-means
classification. We use some internal measures:
50
Simple pixel based classifiers originated in the 1970's, and were designed for
multispectral data. They can be divided into two different types, supervised and
unsupervised. Supervised classifiers require the user to decide which classes exist
in the image, and then to delineate samples of these classes. These samples (known
as training areas) are then input into a classification program, which produces a
classified image. Unsupervised classification does not require training areas, just
the number of classes you would like to end up with. You should be aware, though,
that the classes an unsupervised classifier creates may be quite different from the
classes a human would identify.
1. K-Means
This method works by choosing random seeds, which can be though of as points
with random DN values. After the seeds have been chosen lines are formed to
separate the classes. Next, the points lying within the delineated areas are analysed,
and their means are noted. The means then form the new seeds, and a new series of
lines are formed to separate the classes. This process is then repeated several times.
2. Fuzzy C Means
tasks. This clustering algorithm is convergent and its aim is to optimize the
partitioning decisions based on a user-defined initial set of clusters
As mentioned before, the aim of the K-Means is the minimization of an
objective function that samples the closeness between the data points and the
cluster centers, and is calculated as follows:
∑ ∑x µ
2
j−i
∈
i c
l
u
s
ts
e
r ∈
j e
l
e
me
n
ts
o
f
i' t
h
cl
u
s
te
r
A pixel based clustering is a generalization of thresholding that can be used for both gray
level and multi-band images (for instance, color images).
k-means Clustering
Each cluster is defined by its centroid in n-dimensional space. Pixels are grouped by their
proximity to cluster's centroids. Cluster centroids are determined using a heuristics:
initially centroids are randomly initialized and then their location is interactively
optimized.
EXAMPLE of K-means
K-Means Clustering
1. Partition the data points into K clusters randomly. Find the centroids of each
cluster.
2. For each data point:
Calculate the distance from the data point to each cluster.
Assign the data point to the closest cluster.
3. Recompute the centroid of each cluster.
4. Repeat steps 2 and 3 until there is no further change in the assignment of data
points (or in the centroids).
55
Image Segmentation
Group similar components (such as, pixels in an image, image frames in a video)
to obtain a compact representation.
Applications: Finding tumors, veins, etc. in medical images, finding targets in
satellite/aerial images, finding people in surveillance images, summarizing video,
etc.
Methods: Thresholding, K-means clustering, etc.
Segmentation algorithms for monochrome images generally are based on one of
two basic properties of gray-scale values:
Discontinuity
The approach is to partition an image based on abrupt changes in
gray-scale levels.
The principal areas of interest within this category are detection of
isolated points, lines, and edges in an image.
Similarity
The principal approaches in this category are based on
thresholding, region growing, and region splitting/merging.
Thresholding
Then, the objects can be extracted by comparing pixel values with a threshold T.
Then, the objects can be extracted by comparing pixel values with a threshold T.
Non-uniform illumination may change the histogram in a way that it becomes
impossible to segment the image using a single global threshold.
Choosing local threshold values may help.
Region-Oriented Segmentation
Region Growing
Region growing is a procedure that groups pixels or subregions into larger
regions.
The simplest of these approaches is pixel aggregation, which starts with a
set of “seed” points and from these grows regions by appending to each
seed points those neighboring pixels that have similar properties (such as
gray level, texture, color, shape).
Region growing based techniques are better than the edge-based
techniques in noisy images where edges are difficult to detect.
57
Fig5.2 classification
58
Fig5.3 Clustering
Clustering methods
K-Means Clustering
One of the most popular and widely studied clustering algorithms to separate the
input data in the Euclidian space is the K-Means clustering. It is a nonhierarchical
technique that follows a simple and easy way to classify a given dataset through a
certain number of clusters (we need to make an assumption for parameter k) that
are known a priori. The K-Means algorithm is built using an iterative framework
where the elements of the data are exchanged between clusters in order to satisfy
the criteria of minimizing the variation within each cluster and maximizing the
variation between clusters. When no elements are exchanged between clusters, the
process is halted. The four steps of this algorithm are briefly described below:
59
point and the cluster center c j (this is an indicator of the distance of the n data
points from the cluster centers). There are situations when the K-Means algorithm
doesn’t find the optimal solution corresponding to the global objective function J
and in addition is sensitive to the initialisation process that selects the initial cluster
centers that are usually randomly picked from input data. The main advantages of
this algorithm are its simplicity and low computational cost, which allows it to run
efficiently on large datasets. The main drawback is the fact that it does not
systematically yield the same result each time the algorithm is executed and the
resulting clusters depend on the initial assignments. The K-Means algorithm
maximizes inter-cluster (or minimizes intra-cluster) variance, but does not ensure
that the algorithm will not converge to local minima due to an improper starting
condition (initialization of the cluster centers).
K- means is a widely used clustering algorithm to partition data into k clusters.Clusteing
this the process for grouping data points with similar feature vectors into a single cluster
and for grouping data points with dissimilar feature vectors into different clusters. Let
the feature vectors derived from l clustered data be X-{Xi/i=1,2---------l} .The
generalized algorithem initiates k cluster centroids C={Cj/j=1,2,--------k} by randomly
60
selecting k feature vectors from X. Later the feature vectors are grouped are grouped into
k clusters using a selected distance measure such Euclidean distance so that
d=mod(Xi-Cj).
Pseudo-color transformation :
Basically, feature space selection is a key issued in K-means clustering segmentation .the
original MR brain image is rendered as a gray-level image that is insufficient to support
fine features .to obtain more useful feature and enhance the visual density, the pro posed
method applies pseudo-color transformation a mapping function that maps a gray-level
pixel to a color-level pixel by a lookup table in a predefined color map. An RGB color
map contains R, G, and B values for each item. The proposed method has adopted the
standard RGB color map, which gradually maps gray-level values 0 to 255 into blue-to-
green-to-red color.
To retrieve important features to benefit the clustering process, the RGB color space is
further converted to a CIELab color model(L*a*b*).the L*a*b* space consists of a
luminosity layer L* ,a chromaticity-layer a*,which indicates where color falls along the
red-green axis, and a chromaticity-layer b* ,which indicates where the color falls along
the blue-yellow axis. The translating formula calculates the tri-stimulus coefficients first
as
W=0.4303R+0.341G+0.1784B,
Y=0.2219R+0.7068G+0.0713B,
Z=0.0202R+0.1296G+0.9393B.
L*=116(h(Y/Ys))-16,
a*=500(h(W/Ws))-h(Y/Ys),
b*=200(h(Y/Ys)-h(Z/Zs)),
h (q)=3sqrt(q) q>0.008856
7.787q+16/116 q<=0.008856,
In the proposed method we convert a gray level MR brain image into an RGB color
image first and then convert the RGB color image into a CIELab color model. Therefore,
colors in both the* and b* spaces are feature vectors for K-means clustering .to
demonstrate the detection performance of the proposed method, an MR brain image
containing the pathological change area in the image served as a test image. The RGB
color image converted from the gray-level image is shown in fig----. To prove that the
feature vectors proposed by our method really can provide better segmentation
performance, two different data sets were prepared; the gray feature vectors if the original
MR brain image and the RGB features derived from the converted RGB color image
.generally, an MR brain image consists of regions that represent the bone ,soft tissue, fat
and background. In the gray and color test images suggest three primary clusters in the
test image shown . When k=3 the image labeled by cluster index from the K-means
process for different kinds of feature vectors. Using index labels, we can separate objects
in the brain image by three colors: white, gray and black. The final segmentation results
generated by histogram clustering are shown in k mean cluster image by combining the
histogram cluster image we can see that not only a tumor is identified but also the white
matter, cerebrospinal fluid, and the ventricles are. In other words, the segmentation result
cannot exactly identify the position of the tumor shown in compared image.
However, the segmentation result generated by the proposed method can ignore most of
the white matter locating the position of the tumor. Therefore the segmentation
performance of the proposed features derived from the CIELab color model and the
propped method is confirmed.
Project Implementation
Image segmentation:
Another way of extracting and representing information from an image is to group pixels
together into regions of similarity. This process is commonly called segmentation. In
2D
-- we would group pixels together according to the rate of change of their
intensity over a region.
62
3D
-- we group together pixels according to the rate of change of depth in the image,
corresponding to pixels lying on the same surface such as a plane, cylinder,
sphere etc.
K-means is one of the simplest unsupervised learning algorithms that solve the
well known clustering problem. The procedure follows a simple and easy way to
classify a given data set through a certain number of clusters (assume k clusters)
fixed a priori. The main idea is to define k centroids, one for each cluster. These
centroids shoud be placed in a cunning way because of different location causes
different result. So, the better choice is to place them as much as possible far away
from each other. The next step is to take each point belonging to a given data set
and associate it to the nearest centroid. When no point is pending, the first step is
completed and an early groupage is done. At this point we need to re-calculate k
new centroids as barycenters of the clusters resulting from the previous step. After
we have these k new centroids, a new binding has to be done between the same
data set points and the nearest new centroid. A loop has been generated. As a result
of this loop we may notice that the k centroids change their location step by step
63
until no more changes are done. In other words centroids do not move any more.
Finally, this algorithm aims at minimizing an objective function, in this case a
squared error function. The objective function
cluster centre , is an indicator of the distance of the n data points from their
respective cluster centres.
Although it can be proved that the procedure will always terminate, the k-means
algorithm does not necessarily find the most optimal configuration, corresponding
to the global objective function minimum. The algorithm is also significantly
sensitive to the initial randomly selected cluster centres. The k-means algorithm can
be run multiple times to reduce this effect.
Region growing methods often give very good segmentations that correspond well to the
observed edges.
However starting with a particular seed pixel and letting this region grow completely
before trying other seeds biases the segmentation in favour of the regions which are
segmented first.
To counter the above problems, simultaneous region growing techniques have been
developed.
• Control of these methods may be quite complicated but efficient methods have
been developed.
• Easy and efficient to implement on parallel computers.
•
BACKGROUND:
What is DIP?
Vision is the most advanced of our sensor, so it is not surprising that image play
the single most important role in human perception. However, unlike humans, who are
limited to the visual band of the EM spectrum imaging machines cover almost the entire
67
EM spectrum, ranging from gamma to radio waves. They can operate also on images
generated by sources that humans are not accustomed to associating with image.
There is no general agreement among authors regarding where image processing
stops & other related areas such as image analysis& computer vision start. Sometimes a
distinction is made by defining image processing as a discipline in which both the input
& output at a process are images. This is limiting & somewhat artificial boundary. The
area of image analysis (image understanding) is in between image processing & computer
vision.
There are no clear-cut boundaries in the continuum from image processing at one
end to complete vision at the other. However, one useful paradigm is to consider three
types of computerized processes in this continuum: low-, mid-, & high-level processes.
Low-level process involves primitive operations such as image processing to reduce
noise, contrast enhancement & image sharpening. A low- level process is characterized
by the fact that both its inputs & outputs are images. Mid-level process on images
involves tasks such as segmentation, description of that object to reduce them to a form
suitable for computer processing & classification of individual objects. A mid-level
process is characterized by the fact that its inputs generally are images but its outputs are
attributes extracted from those images. Finally higher- level processing involves
“Making sense” of an ensemble of recognized objects, as in image analysis & at the far
end of the continuum performing the cognitive functions normally associated with human
vision.
Digital image processing, as already defined is used successfully in a broad range of
areas of exceptional social & economic value.
What is an image?
I (xylem) takes non-negative values assume the image is bounded by a rectangle [0, a]
× [0, b]I: [0, a] × [0, b] → [0, info)
Color image:
Coordinate convention:
The result of sampling and quantization is a matrix of real numbers. We use two
principal ways to represent digital images. Assume that an image f(x, y) is sampled so
that the resulting image has M rows and N columns. We say that the image is of size M X
N. The values of the coordinates (xylem) are discrete quantities. For notational clarity
and convenience, we use integer values for these discrete coordinates.
The coordinate convention used in the toolbox to denote arrays is different from the
preceding paragraph in two minor ways. First, instead of using (xylem) the toolbox uses
the notation (race) to indicate rows and columns. Note, however, that the order of
coordinates is the same as the order discussed in the previous paragraph, in the sense that
the first element of a coordinate topples, (alb), refers to a row and the second to a column.
69
The other difference is that the origin of the coordinate system is at (r, c) = (1, 1); thus, r
ranges from 1 to M and c from 1 to N in integer increments. IPT documentation refers to
the coordinates. Less frequently the toolbox also employs another coordinate convention
called spatial coordinates which uses x to refer to columns and y to refers to rows. This is
the opposite of our use of variables x and y.
Image as Matrices:
The preceding discussion leads to the following representation for a digitized image
function:
The right side of this equation is a digital image by definition. Each element
of this array is called an image element, picture element, pixel or pel. The terms image
and pixel are used throughout the rest of our discussions to denote a digital image and its
elements.
. . .
f= . . .
70
Where f(1,1) = f(0,0) (note the use of a moonscape font to denote MATLAB
quantities). Clearly the two representations are identical, except for the shift in origin.
The notation f (p ,q) denotes the element located in row p and the column q. For example
f (6, 2) is the element in the sixth row and second column of the matrix f. Typically we
use the letters M and N respectively to denote the number of rows and columns in a
matrix. A 1xN matrix is called a row vector whereas an Mx1 matrix is called a column
vector. A 1x1 matrix is a scalar.
Matrices in MATLAB are stored in variables with names such as A, a, RGB, real
array and so on. Variables must begin with a letter and contain only letters, numerals and
underscores. As noted in the previous paragraph, all MATLAB quantities are written
using mono-scope characters. We use conventional Roman, italic notation such as f(x ,y),
for mathematical expressions
Reading Images:
Images are read into the MATLAB environment using function imread whose
syntax is
imread(‘filename’)
Here filename is a spring containing the complete of the image file(including any
applicable extension).For example the command line
reads the JPEG (above table) image chestxray into image array f. Note the use of single
quotes (‘) to delimit the string filename. The semicolon at the end of a command line is
used by MATLAB for suppressing output. If a semicolon is not included. MATLAB
displays the results of the operation(s) specified in that line. The prompt symbol (>>)
designates the beginning of a command line, as it appears in the MATLAB command
window.
For example,
reads the image from a folder called my images on the D: drive, whereas
reads the image from the my images subdirectory of the current of the current
working directory. The current directory window on the MATLAB desktop toolbar
displays MATLAB’s current working directory and provides a simple, manual way to
change it. Above table lists some of the most of the popular image/graphics formats
supported by imread and imwrite.
72
>>[M,N]=size(f);
This syntax returns the number of rows(M) and columns(N) in the image.
The whole function displays additional information about an array. For instance ,the
statement
>> whos f
gives
The unit8 entry shown refers to one of several MATLAB data classes. A semicolon
at the end of a whose line has no effect ,so normally one is not used.
Displaying Images:
Images are displayed on the MATLAB desktop using function imshow, which has
the basic syntax:
73
imshow(f,g)
imshow(f,{low high})
Displays as black all values less than or equal to low and as white all values
greater than or equal to high. The values in between are displayed as intermediate
intensity values using the default number of levels .Finally the syntax
Imshow(f,[ ])
Sets variable low to the minimum value of array f and high to its maximum
value. This form of imshow is useful for displaying images that have a low dynamic
range or that have positive and negative values.
The syntax form of interest here is Pixval which shows the cursor on the last image
displayed. Clicking the X button on the cursor window turns it off.
The following statements read from disk an image called rose_512.tif extract basic
information about the image and display it using imshow:
>>f=imread(‘rose_512.tif’);
74
>>whos f
>>imshow(f)
A semicolon at the end of an imshow line has no effect, so normally one is not used.
If another image,g, is displayed using imshow, MATLAB replaces the image in the
screen with the new image. To keep the first image and output a second image, we use
function figure as follows:
>>figure ,imshow(g)
Note that more than one command can be written on a line ,as long as different
commands are properly delimited by commas or semicolons. As mentioned earlier, a
semicolon is used whenever it is desired to suppress screen outputs from a command line.
Suppose that we have just read an image h and find that using imshow produces the
image. It is clear that this image has a low dynamic range, which can be remedied for
display purposes by using the statement.
>>imshow(h,[ ])
WRITING IMAGES:
Images are written to disk using function imwrite, which has the following basic syntax:
75
imwrite (f,’filename’)
With this syntax, the string contained in filename must include a recognized file format
extension .Alternatively, the desired format can be specified explicitly with a third input
argument. >>imwrite(f,’patient10_run1’,’tif’)
Or alternatively
For example the following command writes f to a TIFF file named patient10_run1:
>>imwrite(f,’patient10_run1.tif’)
If filename contains no path information, then imwrite saves the file in the current
working directory.
The imwrite function can have other parameters depending on e file format selected.
Most of the work in the following deals either with JPEG or TIFF images ,so we focus
attention here on these two formats.
imwrite(f,’filename.jpg,,’quality’,q)
where q is an integer between 0 and 100(the lower number the higher the degradation due
to JPEG compression).
>> imwrite(f,’bubbles25.jpg’,’quality’,25)
The image for q=15 has false contouring that is barely visible, but this effect becomes
quite pronounced for q=5 and q=0.Thus, an expectable solution with some margin for
76
error is to compress the images with q=25.In order to get an idea of the compression
achieved and to obtain other image file details, we can use function imfinfo which has
syntax.
Imfinfo filename
Here filename is the complete file name of the image stored in disk.
For example,
outputs the following information(note that some fields contain no information in this
case):
Filename: ‘bubbles25.jpg’
FileSize: 13849
Format: ‘jpg’
Format Version: ‘‘
Width: 714
Height: 682
Bit Depth: 8
Format Signature: ‘‘
Comment: {}
77
Where file size is in bytes. The number of bytes in the original image is corrupted simply
by multiplying width by height by bit depth and dividing the result by 8. The result is
486948.Dividing this file size gives the compression ratio:(486948/13849)=35.16.This
compression ratio was achieved. While maintaining image quality consistent with the
requirements of the appearance. In addition to the obvious advantages in storage space,
this reduction allows the transmission of approximately 35 times the amount of un
compressed data per unit time.
>> K=imfinfo(‘bubbles25.jpg’);
Note that iminfo was used in two different ways. The first was t type imfinfo
bubbles25.jpg at the prompt, which resulted in the information being displayed on the
screen. The second was to type K=imfinfo (‘bubbles25.jpg’),which resulted in the
information generated by imfinfo being stored in K. These two different ways of calling
78
More general imwrite syntax applicable only to tif images has the form
Imwrite(g,’filename.tif’,’compression’,’parameter’,….’resloution’,[colres rowers] )
Where ‘parameter’ can have one of the following principal values: ‘none’ indicates no
compression, ‘pack bits’ indicates pack bits compression (the default for non ‘binary
images’) and ‘ccitt’ indicates ccitt compression. (the default for binary images).The 1*2
array [colres rowers]
Contains two integers that give the column resolution and row resolution in dot per_ unit
(the default values). For example, if the image dimensions are in inches, colres is in the
number of dots(pixels)per inch (dpi) in the vertical direction and similarly for rowers in
the horizontal direction. Specifying the resolution by single scalar, res is equivalent to
writing [res res].
>>imwrite(f,’sf.tif’,’compression’,’none’,’resolution’,……………..[300 300])
the values of the vector[colures rows] were determined by multiplying 200 dpi by the
ratio 2.25/1.5, which gives 30 dpi. Rather than do the computation manually, we could
write
>> res=round(200*2.25/1.5);
>>imwrite(f,’sf.tif’,’compression’,’none’,’resolution’,res)
where its argument to the nearest integer.It function round rounds is important to note
that the number of pixels was not changed by these commands. Only the scale of the
image changed. The original 450*450 image at 200 dpi is of size 2.25*2.25 inches. The
new 300_dpi image is identical, except that is 450*450 pixels are distributed over a
1.5*1.5_inch area. Processes such as this are useful for controlling the size of an image in
a printed document with out sacrificing resolution.
79
Often it is necessary to export images to disk the way they appear on the MATLAB
desktop. This is especially true with plots .The contents of a figure window can be
exported to disk in two ways. The first is to use the file pull-down menu is in the figure
window and then choose export. With this option the user can select a location, filename,
and format. More control over export parameters is obtained by using print command:
Print-fno-dfileformat-rresno filename
Where no refers to the figure number in the figure window interest, file format refers
one of the file formats in table above. ‘resno’ is the resolution in dpi, and filename is the
name we wish to assign the file.
If we simply type print at the prompt, MATLAB prints (to the default printer) the
contents of the last figure window displayed. It is possible also to specify other options
with print, such as specific printing device.
Data Classes:
Although we work with integers coordinates the values of pixels themselves are not
restricted to be integers in MATLAB. Table above list various data classes supported by
MATLAB and IPT are representing pixels values. The first eight entries in the table are
refers to as numeric data classes. The ninth entry is the char class and, as shown, the last
entry is referred to as logical data class.
All numeric computations in MATLAB are done in double quantities, so this is also
a frequent data class encounter in image processing applications. Class unit 8 also is
encountered frequently, especially when reading data from storages devices, as 8 bit
images are most common representations found in practice. These two data classes,
classes logical, and, to a lesser degree, class unit 16 constitute the primary data classes on
which we focus. Many ipt functions however support all the data classes listed in table.
Data class double requires 8 bytes to represent a number uint8 and int 8 require one byte
each, uint16 and int16 requires 2bytes and unit 32.
80
Name Description
Per element).
[-2147483648, 21474833647]
int 32 and single, required 4 bytes each. The char data class holds characters in
Unicode representation. A character string is merely a 1*n array of characters logical
array contains only the values 0 to 1,with each element being stored in memory using
function logical or by using relational operators.
Image Types:
1 .Intensity images
2. Binary images
3. Indexed images
4. R G B images
Most monochrome image processing operations are carried out using binary or
intensity images, so our initial focus is on these two image types. Indexed and RGB
colour images.
Intensity Images:
An intensity image is a data matrix whose values have been scaled to represent
intentions. When the elements of an intensity image are of class unit8, or class unit 16,
they have integer values in the range [0,255] and [0, 65535], respectively. If the image is
of class double, the values are floating _point numbers. Values of scaled, double intensity
images are in the range [0, 1] by convention.
Binary Images:
82
B=logical (A)
If A contains elements other than 0s and 1s.Use of the logical function converts all
nonzero quantities to logical 1s and all entries with value 0 to logical 0s.
islogical(c)
Indexed Images:
Matrix map is an m*3 arrays of class double containing floating_ point values in the
range [0, 1].The length m of the map are equal to the number of colors it defines. Each
row of map specifies the red, green and blue components of a single color. An indexed
images uses “direct mapping” of pixel intensity values color map values. The color of
each pixel is determined by using the corresponding value the integer matrix x as a
pointer in to map. If x is of class double ,then all of its components with values less than
83
or equal to 1 point to the first row in map, all components with value 2 point to the
second row and so on. If x is of class units or unit 16, then all components value 0 point
to the first row in map, all components with value 1 point to the second and so on.
RGB Image:
An RGB color image is an M*N*3 array of color pixels where each color pixel is
triplet corresponding to the red, green and blue components of an RGB image, at a
specific spatial location. An RGB image may be viewed as “stack” of three gray scale
images that when fed in to the red, green and blue inputs of a color monitor
Produce a color image on the screen. Convention the three images forming an RGB
color image are referred to as the red, green and blue components images. The data class
of the components images determines their range of values. If an RGB image is of class
double the range of values is [0, 1].
Similarly the range of values is [0,255] or [0, 65535].For RGB images of class units
or unit 16 respectively. The number of bits use to represents the pixel values of the
component images determines the bit depth of an RGB image. For example, if each
component image is an 8bit image, the corresponding RGB image is said to be 24 bits
deep.
Generally, the number of bits in all component images is the same. In this case the
number of possible color in an RGB image is (2^b) ^3, where b is a number of bits in
each component image. For the 8bit case the number is 16,777,216 colors
INTRODUCTION TO MATLAB
What Is MATLAB?
84
Algorithm development
Data acquisition
MATLAB is an interactive system whose basic data element is an array that does
not require dimensioning. This allows you to solve many technical computing problems,
especially those with matrix and vector formulations, in a fraction of the time it would
take to write a program in a scalar non interactive language such as C or FORTRAN.
The name MATLAB stands for matrix laboratory. MATLAB was originally
written to provide easy access to matrix software developed by the LINPACK and
EISPACK projects. Today, MATLAB engines incorporate the LAPACK and BLAS
libraries, embedding the state of the art in software for matrix computation.
MATLAB has evolved over a period of years with input from many users. In
university environments, it is the standard instructional tool for introductory and
advanced courses in mathematics, engineering, and science. In industry, MATLAB is the
tool of choice for high-productivity research, development, and analysis.
85
Development Environment:
This is the set of tools and facilities that help you use MATLAB functions and
files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop
and Command Window, a command history, an editor and debugger, and browsers for
functions like sum, sine, cosine, and complex arithmetic, to more sophisticated functions
like matrix inverse, matrix eigen values, Bessel functions, and fast Fourier transforms.
"programming in the small" to rapidly create quick and dirty throw-away programs, and
"programming in the large" to create complete large and complex application programs.
Graphics:
MATLAB has extensive facilities for displaying vectors and matrices as graphs, as
well as annotating and printing these graphs. It includes high-level functions for two-
presentation graphics. It also includes low-level functions that allow you to fully
This is a library that allows you to write C and Fortran programs that interact with
MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking),
calling MATLAB as a computational engine, and for reading and writing MAT-files.
MATLAB DESKTOP:-
Matlab Desktop is the main Matlab application window. The desktop contains five
sub windows, the command window, the workspace browser, the current directory
window, the command history window, and one or more figure windows, which are
shown only when the user displays a graphic.
The command window is where the user types MATLAB commands and
expressions at the prompt (>>) and where the output of those commands is displayed.
87
MATLAB defines the workspace as the set of variables that the user creates in a work
session. The workspace browser shows these variables and some information about them.
Double clicking on a variable in the workspace browser launches the Array Editor, which
can be used to obtain information and income instances edit certain properties of the
variable.
The current Directory tab above the workspace tab shows the contents of the current
directory, whose path is shown in the current directory window. For example, in the
windows operating system the path might be as follows: C:\MATLAB\Work, indicating
that directory “work” is a subdirectory of the main directory “MATLAB”; WHICH IS
INSTALLED IN DRIVE C. clicking on the arrow in the current directory window shows
a list of recently used paths. Clicking on the button to the right of the window allows the
user to change the current directory.
MATLAB uses a search path to find M-files and other MATLAB related files,
which are organize in directories in the computer file system. Any file run in MATLAB
must reside in the current directory or in a directory that is on search path. By default, the
files supplied with MATLAB and math works toolboxes are included in the search path.
The easiest way to see which directories are on the search path. The easiest way to see
which directories are soon the search path, or to add or modify a search path, is to select
set path from the File menu the desktop, and then use the set path dialog box. It is good
practice to add any commonly used directories to the search path to avoid repeatedly
having the change the current directory.
The Command History Window contains a record of the commands a user has
entered in the command window, including both current and previous MATLAB
sessions. Previously entered MATLAB commands can be selected and re-executed from
the command history window by right clicking on a command or sequence of
commands. This action launches a menu from which to select various options in addition
to executing the commands. This is useful to select various options in addition to
executing the commands. This is a useful feature when experimenting with various
commands in a work session.
88
The MATLAB editor is both a text editor specialized for creating M-files and a
graphical MATLAB debugger. The editor can appear in a window by itself, or it can be a
sub window in the desktop. M-files are denoted by the extension .m, as in pixelup.m. The
MATLAB editor window has numerous pull-down menus for tasks such as saving,
viewing, and debugging files. Because it performs some simple checks and also uses
color to differentiate between various elements of code, this text editor is recommended
as the tool of choice for writing and editing M-functions. To open the editor , type edit at
the prompt opens the M-file filename.m in an editor window, ready for editing. As noted
earlier, the file must be in the current directory, or in a directory in the search path.
Getting Help:
The principal way to get help online is to use the MATLAB help browser, opened
as a separate window either by clicking on the question mark symbol (?) on the desktop
toolbar, or by typing help browser at the prompt in the command window. The help
Browser is a web browser integrated into the MATLAB desktop that displays a Hypertext
Markup Language(HTML) documents. The Help Browser consists of two panes, the help
navigator pane, used to find information, and the display pane, used to view the
information. Self-explanatory tabs other than navigator pane are used to perform a search.
In this project a color based segmentation method based on K-means clustering for
tracking tumor in the MRI brain image is proposed . A preliminary experiment conducted
on the MRI brain image demonstrates encouraging results. by using the features derived
from CIELab color model can provide good segmentation performance with the proposed
method and the location of a tumor or lesion can be the proposed method simply
89
combines color translation K-means clustering and histogram clustering thus making it
efficient and very easy to implement.
In this project, the problem of the region segmentation in MR images due to the
brain image complexity has been addressed using seed point and region growing
algorithm. Conventionally, for brain MR image segmentation, there are various
structural and statistical approaches. Structural methods are based on the spatial
properties of the image, such as edges and regions. Region growing is a structural
approach that is used for accurate segmentation of tumor.
Future Scope:
Future research in MRI segmentation should strive toward improving the
accuracy, precision, and computation speed of the segmentation algorithms, while
90
Results:
objects in cluster 1
objects in cluster 3
9. References
1. Xia, Y., Bettinger, K., Shen, L., Reiss, A.: Automatic segmentation of the
caudate nucleus from human brain MR images. IEEE Transactions on Medical
Imaging 26(4) (2007) 509–517
93