You are on page 1of 10

Spectral Analysis and Filter Design for Cells Images Using

Discrete Wavelet Transform


Tarundeep Singh Dhot
Dept of ECE
Concordia University
Montreal, QC H3G 1M8
t_dhot@encs.concordia.ca

Abstract and translations obeying some defined rules. In other words, this
The purpose of this study was to design a filter which could transform decomposes the signal into mutually orthogonal set of
isolate the high frequency components in our cell images. These wavelets, which is the main difference from the continuous
high frequency components are essentially the inclusions wavelet transform (CWT), or its implementation for the discrete
present in cells which indicate that the cell is diseased. Thus, if
time series sometimes called discrete-time continuous wavelet
we could design a suitable filter for them, then by observing
their corresponding histogram responses, we could derive a transform (DT-CWT). For most signal and image processing
means of classification of cells based on the frequency spectrum applications, DWT-based analysis is best described in terms of
of the cell image. The approach selected for the filter design was filter banks i.e. iteration of filters. The use of group of filters to
chosen to be Discrete Wavelet Transform using Daubechies and divide up a signal into various spectral components is termed
Haar Filters due to their ability to provide time-frequency sub-band coding. Considering the most basic implementation of
information of the signal and secondly due to its simplistic yet DWT using only two filters in the filter bank, the waveform
effective implementation and analysis.
under analysis is divided into two components, ylp(n) and
Categories and Subject Descriptors yhp(n), by digital filters H0(w) and H1(w). The spectral
I.4 [Image Processing and Computer Vision]: Segmentation – characteristics of the two filters must be carefully chosen with
pixel classification H0(w) having a lowpass spectral characteristic and H1(w) a
highpass spectral characteristic. The highpass filter is analogous
General Terms
to the application of the wavelet to the original signal, while the
Algorithms, Experimentation.
lowpass filter is analogous the application of the scaling or
Keywords smoothing function. The scaling function facilitates computation
Image Segmentation, Spectral Analysis of DWT. To implement the DWT efficiently, the finest
resolution is compared first. The computation then proceeds to
coarser resolutions, but rather than start over on the original
1. INTRODUCTION
waveform, the computation uses a smoothed version of the fine
resolution waveform which is obtained using the scaling or
1.1 Wavelet Transform smoothing function. If the filters are invertible filters, then it is
A transform can be thought of as a remapping of a signal that possible to construct complementary filters that will recover the
provides more information than the original without changing
original waveform from either of the sub-band signals, ylp(n) or
the information content present in the signal. The Fourier
Transform fits this definition quite well because the frequency yhp(n).
information it provides leads to new insights about the original
signal. However, the inability of the Fourier Transform to x (n) H0(w) ylp(n)
describe both time and frequency characteristics of the
waveform limits its utility in time-frequency problems. The
wavelet transform provides time-frequency information of the
H1(w) yhp(n)
signal and uses multi-resolution technique by which different
frequencies are analyzed with different resolutions.
Figure 1: Simple filter bank consisting of only two filters
applied to the same waveform. Filters have lowpass and
1.2 Discrete Wavelet Transform highpass spectral characteristics. Filter outputs consist of a
lowpass sub-band, ylp(n) and highpass sub-band, yhp(n)
The discrete wavelet transform (DWT) is an implementation of
the wavelet transform using a discrete set of the wavelet scales
1.3 The Daubechies Wavelet Transform in the fact that it connects the continuous-time multiresolution to
discrete-time filters.
The Daubechies wavelets are a family of orthogonal wavelets
defining a discrete wavelet transform and characterized by a
Given a signal x of length N, the DWT consists of log2N stages
maximal number of vanishing moments for some given support.
at most. Starting from x, the first step produces two sets of
With each wavelet type of this class, there is a scaling function coefficients: approximation coefficients A1, and detail
(also called father wavelet) which generates an orthogonal coefficients D1. These vectors are obtained by convolving s
multi-resolution analysis. Daubechies orthogonal wavelets D2- with the low-pass filter H0 for approximation, and with the
D20 (even index numbers only) are commonly used. The index high-pass filter H1 for detail coefficients. It can represented
number refers to the number N of coefficients. Each wavelet has more precisely as a wavelet decomposition tree as shown in Fig
2.1.
a number of zero moments or vanishing moments equal to half
the number of coefficients. For example D2 (the Haar wavelet) At each level, the high pass filter produces detail information,
has one vanishing moments, D4 has two moments, etc. A Dj, while the low pass filter associated with scaling function
vanishing moment refers to the wavelets ability to represent produces coarse approximations, Aj. The length of each filter is
polynomial behaviour or information in a signal. For example, equal to 2N. If n = length (x), the signals F and G are of length n
D2, with one moment, easily encodes polynomials of one + 2N – 1.
coefficient, i.e. constant signal components. D4 encodes
The next step splits the approximation coefficients A1 in two
polynomials of two coefficients, i.e. constant and linear signal
parts using the same scheme, replacing x by A1 and producing
components, D6 encodes 3-polynomials, i.e. constant, linear and A2 and D2, and so on.
quadratic signal components.
Initialization A0 = x
1.4 The Haar Wavelet Transform So the wavelet decomposition of the signal s analyzed at level j
Each step in the Haar transform calculates a set of wavelet has the following structure: [Aj, Dj, ..., D1]. This structure
coefficients and a set of averages. If a data set s0, s1, ... sN-1 contains for J = 3 the terminal nodes of the following tree.
contains N elements, there will be N/2 averages and N/2
coefficient values. The averages are stored in the lower half of 2.1 Method: Filter Implementation on Cell
the N element array and the coefficients are stored in the upper
half. The averages become the input for the next step in the Images
wavelet calculation, where for iteration i+1, Ni+1 = Ni/2. The
recursive iterations continue until a single average and a single Two filters were used for spectral analysis of the cell images,
coefficient are calculated. This replaces the original data set of namely Daubechies filter (dbN) and Haar Filter. But before we
N elements with an average, followed by a set of coefficients can implement the filter on the images, the images need to be
whose size is an increasing power of two (e.g., 20, 21, 22 ... pre-processed. Pre-processing of the image is done in the
N/2). following manner:

The Haar equations to calculate an average (ai) and a wavelet (i) Grayscale the image
coefficient (ci) from an odd and even element in the data set are (ii) Contrast improvement of the grayscaled image
shown below: (iii) Convert image to double precision
ai = ( si + si+1 )/2
ci = ( si - si+1 )/2 Since we are interested in the frequency response only the cell,
we need to convert the background of the cell from white to
In wavelet terminology the Haar average is calculated by the black. In order to do this, we set a threshold, above which, all
scaling function which is represented by gi. The coefficient is pixels should be converted to black. On the grayscale (0-255),
calculated by the wavelet function represented by hi. the optimum value for this threshold was found to be 241. So we
Algebraically speaking, in Haar transform, the first average is need to run a loop on the image setting the value of all pixel
calculated by the inner product of the signal [s0, s1, ... sN-1] and present above 241 to zero so that we neutralize the background
the vector, of the same size, [0.5, 0.5, 0, 0, ..., 0]. This is the of the cell, as otherwise the histogram results would be way
scaling vector.The first coefficient is calculated by the inner different due to the effect of presence of white background.
product of the signal and the vector [0.5, -0.5, 0, 0, ..., 0]. This is Thus, we can see that all the vacant area outside the border of
the wavelet vector. The next average and coefficient are the cell is set to value 0 on the grayscale.
calculated by shifting the scaling and wavelet vectors by two
and calculating the inner products. Once this is done, we can apply the filters on the image. Three
wavelets of the Daubechies filter (db1, db2, db3) are applied as
well as the Haar filter in similar fashion. Once this is done, the
1.5 DWT: Algorithm corresponding histograms are plotted.
As mentioned above, the DWT is computed by successive
lowpass and highpass filtering of the discrete time-domain
signal. This is called as Mallet algorithm and its significance lies
low-pass filter downsample
H0 ↓2 A1: Approximation
F coefficients
x

H1 ↓2 D1 : Detail coefficient
G
high-pass filter downsample

where: X Convolute the Filter X

↓2 Keep the even indexed elements

Figure 2 (a): Wavelet Decomposition Tree: Level 1

H0 ↓2 Aj+1
Aj Level j+1
Level j
H1 ↓2 Dj+1
Figure 2 (b): One-Dimensional DWT

A1 D1

A2 D2

A3 D3

Figure 2 (c): Wavelet Decomposition Of The Signal S Analyzed at Level j = 3


2.2 Pseudo-Code for Neutralization of mean, variance and standard deviation can help decide a suitable
threshold above which we could safely classify cells as sick.
Background
Apart from that, conventional filters can also be applied on the
[m,n]= size(ImgGS); image just as an exercise to compare results. Even though it
for i = 1:m would be a slightly more complicated exercise requiring
for j = 1:n calculation of cut-off frequencies (range) which would be
temp = ImgGS(i,j); different for all images and best suited order, by it should offer a
if temp < 0.9 healthy comparison to the method used above.
ImgGS1(i,j) = temp;
else 5 References
ImgGS1(i,j) = 0; [1] P. Sarkar, M. Salazar-Palma and M. Wicks, “Wavelet
end Applications in Engineering Electromagnetics, 2002
end [2] A. Jensen, A. La Cour-Harbo, “Ripples in Mathematics: The
end Discrete Wavelet Transform”, Springer, pp. ix – 246
[3] P. Wojtaszczyk, “A Mathematical Introduction to
Wavelets”, Cambridge Univ Press, 1997
[4] I. Daubechies, “The wavelet transform, time-frequency
3 Results: Filtered Images and Histograms localization and signal analysis”, IEEE Transactions on
The figures shown above are of a sick 2a Hela cell (40X). Fig 3a Information Theory Society, Sept 1990
(i) shows the preprocessed cell without the background removed
labeled as Original. Fig 3a (ii) shows the filtered image using a
Daubechies filter of order 1 (db1). Its corresponding histogram
is shown in Fig 3b (ii). After applying this filter on a number of
images, we see that nothing conclusive can be inferred from
their corresponding histograms such that we can use some sort
of complexity measure and classify them. Thus we decompose
the filtered image once again using another db1 filter, thus,
effectively it becomes a db2 filter. After observing a number of
images of various cells, the distribution on the histogram is
spread out between 0 and 1 with considerable amount of values
above 0.5. If a corresponding histogram for a healthy cell is
compared to this, it shows that it has considerable amount of
values around and below 0.5. Thus, we can identify this as a
distinguishing feature at db2 filtering. Again this filtered image
was filtered using a db1 filter with resulting effect of a db3
filter. But we observe blurring of the original image as shown in
Fig 3a (iv). The corresponding histogram shows a much spread
out spectrum of values between 0.5 and 1. Similar results are
seen with the spectral analysis using a Haar filter. Thus, we
observe distinguishing features using filters of order 2 shown by
their corresponding histograms.

4 DISCUSSION

The goal of the study was to identify and design which filters
would be useful to cell classification. Spectral analysis using
Discrete Wavelet Transform was done it can be used to solve
time-frequency problems which is not possible using Fourier
Transforms. Using DWT filters for spectral analysis is more
convenient as we don’t need to specifically point out cut-off
frequencies instead they use wavelet analysis for filtering. From
the filters used in our problem, it is seen that both second order
Haar filter and Daubechies filter show differences in the
corresponding histograms of healthy and sick cells. Thus using
statistical methods, we can develop distinct features which could
be used for classifying cells. Simple statistical measures like
(i) (ii)

(iii) (iv)
Figure 3 (a): Filtered Images

(i) (ii)

(iii) (iv)
Figure 3 (b): Histograms of Filtered Images

Figure 3: Spectral Analysis of a Sick Cell Showing Inclusions Using dbN Filter
3 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: db1 Filter
(iii) db2 Filter applied on Image (iv) db3 Filter applied on Image
Figure 3 (b): (i) Histogram of original pre-possessed image (ii) Histogram of db1 Filtered Image
(iii) Histogram of db2 Filtered Image (iv) Histogram of db3 Filtered Image
(i)
(ii)

(iii) (iv)
Figure 4 (a): Filtered Images

(i) (ii)

(iii) (iv)
Figure 4 (b): Histograms of Filtered Images

Figure 4: Spectral Analysis of a Healthy Cell Using dbN Filter


4 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: db1 Filter
(iii) db2 Filter applied on Image (iv) db3 Filter applied on Image
4 (b): (i) Histogram of original pre-possessed image (ii) Histogram of db1 Filtered Image
(iii) Histogram of db2 Filtered Image (iv) Histogram of db3 Filtered Image
(i)
(ii)

(iii) (iv)
Figure 5 (a): Filtered Images

(i) (ii)

(iii) (iv)
Figure 5 (b): Histograms of Filtered Images

Figure 5: Spectral Analysis of a Sick Cell Showing Inclusions Using Haar Filter
5 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: Haar1 Filter
(iii) Haar2 Filter applied on Image (iv) Haar 3 Filter applied on Image
5 (b): (i) Histogram of original pre-possessed image (ii) Histogram of Haar 1 Filter Image
(iii) Histogram of Haar 2 Filter Image (iv) Histogram of Haar 3 Filter Image
(i) (ii)

(iii) Figure 6 (a): Filtered Images (iv)

(i) (ii)

(iii) Figure 6 (b): Histograms of Filtered Images (iv)

Figure 6: Spectral Analysis of a Sick Cell Showing Inclusions Using dbN Filter
6 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: db1 Filter
(iii) db2 Filter applied on Image (iv) db3 Filter applied on Image
6 (b): (i) Histogram of original pre-possessed image (ii) Histogram of db1 Filtered Image
(iii) Histogram of db2 Filtered Image (iv) Histogram of db3 Filtered Image
(i) (ii)

(iii) Figure 7 (a): Filtered Images (iv)

(i) (ii)

(iii) Figure 7 (b): Histograms of Filtered Images (iv)

Figure 7: Spectral Analysis of a Healthy Cell Showing Inclusions Using Haar Filter
7 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: Haar1 Filter
(iii) Haar2 Filter applied on Image (iv) Haar 3 Filter applied on Image
7 (b): (i) Histogram of original pre-possessed image (ii) Histogram of Haar 1 Filter Image
(iii) Histogram of Haar 2 Filter Image (iv) Histogram of Haar 3 Filter Image
(i) (ii)

(iii) Figure 8 (a): Filtered Images (iv)

(i) (ii)

(iii) Figure 8 (b): Filtered Images (iv)

Figure 8: Spectral Analysis of a Healthy Cell Showing Inclusions Using dbN Filter
8 (a): (i) Original pre-possessed image of cell (ii) Filtered Image: db1 Filter
(iii) db2 Filter applied on Image (iv) db3 Filter applied on Image
8 (b): (i) Histogram of original pre-possessed image (ii) Histogram of db1 Filtered Image
(iii) Histogram of db2 Filtered Image (iv) Histogram of db3 Filtered Image