38
1 INDEX INDEX....................................................................................................................................1 1 INTRODUCTION.............................................................................................................. 2 2 PROJECT DESCRIPTION & PLAN................................................................................. 5 3 THEORETICAL BACKGROUND................................................................................... 7 3.1.Methods Used In Vessel Segmentation Algorithms................................................. 7 3.1.1. Morphological Operators............................................................................... 7 3.1.2. Laplacian Of Gaussian Filter........................................................................ 12 3.1.3. Scale-Space Theory...................................................................................... 13 3.2.Methods Used In Optic Disk Detection................................................................. 15 3.2.1 Fast Radial Symmetry Transform..................................................................15 4 ANALYSIS & MODELING............................................................................................ 16 4.1. Analysis.................................................................................................................... 16 4.2. Modeling................................................................................................................... 17 5 DESIGN, IMPLEMENTATION AND TEST.................................................................. 18 5.1. Vessel Segmentation Design,Implementation........................................................... 18 5.1.1. Mask Generation............................................................................................... 18 5.1.2. Morphological Method Implementation........................................................... 21 5.1.3. Laplacian Of Gaussian Implementation............................................................ 24 5.1.4. Alternating Filter and Thresholding.................................................................. 24 5.2. Optic Disc Detection Design, Implementation..........................................................27 5.2.1. Fast Radial Symmetry Transform Implementation ........................................... 27 5.2.2. Modified Fast Radial Symmetry Transform ..................................................... 32 6 TEST RESULTS............................................................................................................... 33 7 RESULTS AND SUGGESTIONS.................................................................................. 36 8 REFERENCES................................................................................................................. 37

İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

Embed Size (px)

Citation preview

Page 1: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

1

INDEX

INDEX....................................................................................................................................11 INTRODUCTION..............................................................................................................22 PROJECT DESCRIPTION & PLAN.................................................................................53 THEORETICAL BACKGROUND................................................................................... 7

3.1.Methods Used In Vessel Segmentation Algorithms................................................. 7 3.1.1. Morphological Operators............................................................................... 7 3.1.2. Laplacian Of Gaussian Filter........................................................................12 3.1.3. Scale-Space Theory...................................................................................... 13

3.2.Methods Used In Optic Disk Detection................................................................. 15 3.2.1 Fast Radial Symmetry Transform..................................................................15

4 ANALYSIS & MODELING............................................................................................ 164.1. Analysis.................................................................................................................... 164.2. Modeling................................................................................................................... 17

5 DESIGN, IMPLEMENTATION AND TEST.................................................................. 185.1. Vessel Segmentation Design,Implementation........................................................... 18

5.1.1. Mask Generation............................................................................................... 185.1.2. Morphological Method Implementation........................................................... 215.1.3. Laplacian Of Gaussian Implementation............................................................ 245.1.4. Alternating Filter and Thresholding.................................................................. 24

5.2. Optic Disc Detection Design, Implementation..........................................................275.2.1. Fast Radial Symmetry Transform Implementation ...........................................275.2.2. Modified Fast Radial Symmetry Transform .....................................................32

6 TEST RESULTS...............................................................................................................337 RESULTS AND SUGGESTIONS.................................................................................. 368 REFERENCES.................................................................................................................37

Page 2: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

2

1 INTRODUCTION

The features of a retinal image are hard to extract due to a lot of reasons. Vessels are one of these features. First of all, having a noisy background makes the extraction of the vessels even harder. This noisy background includes some big black regions reasoned by hemorhagges, small bright regions called exudates, smaller black regions called microaneurysm and relatively brighter areas called foveas.

Another feature of a retinal image is the circle shaped fundus. Their sizes are standard in all human beings. Although, the lenses that were used to generate retinal angiography images are different, which causes the radiuses of the fundus appear different in all the images. That lens difference makes fundus extraction harder. Secondly, in some unqualified images fundus is not bright enough and the gradient of that region is varying due to the noise.

During the research in these topics, a lot of work has been found regarding vessel extraction(segmentation), optic nerve(fundus) extraction, other features' extraction and registration. As this project is a research project, all the researched work will be explained below. First, vessel extraction methods will be given and then second optic nerve detection methods will be explained briefly.

Mathematical morphological operators are very well known and widely used technique for retinal vessel extraction. In 2001, Zana and Klein[VS1] used this method in their work to segment the vessels. This method is based on, extracting the linear structures with a standard length using opening by reconstruction and tophat morphological operators sequentially and then extracting the curvature information by calculating Laplacian of Gaussian of the image. Finally linear filtering is used to yield to the final result. The algorithm is robust for low-contrast and with late diffusion time images, while it's not robust to changes of scale.

Another work that made use of mathematical morphological operator was done by combining Wavelet transform technique and morphological operators by Jorge J. G. Leandro ,Roberto M Cesar Jr and Herbert F. Jelinek[VS2]. In this method, as the results of morphological operators were not satisfactory, Morlet wavelet transform was used to be able to switch frequencies and thus be capable of noise filtering.

In addition to morphological operators and wavelet transforms, scale space analysis is another widely used technique. The method that was used by Martinez-Perez et..al[VS3] which made use of the multiscale analysis of the first and second derivative of the image followed by a region growing. This method is a good choice for retinal images which have vessels of large range of widths.

Another approach was using scale space features and k-nearest neighbour by Nancy M. Salem et..al[VS4]. This method is based on classifying the pixels with knn algorithm, a supervised algorithm, according to their properties of ridge strength, edge strength that derives from the first derivative,second derivative and gradient magnitude information. In order to get a good result from this method a postprocessing step is required. This method

Page 3: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

3

is relatively fast, because calculation of the features proposed in the algorithm is simple, and doesn't require too much processing time.

The basic vessel segmentation methods for retinal images were briefly explained above. There're also large variety of methods for fundus(optic nerve) detection. There're a few basic approaches to optic nerve detection. In most of the methods, first the vessels are extracted and then to find the fundus center, vessels are tracked to the center. The other approaches include, dynamic counter fitting[OD1], fuzzy logic[OD2] geometric model fitting[OD3] and morphological operators together with watershed transformation[OD4].

In the work by Kenneth W. Tobin et..al[OD5], a probabilistic framework approach has been used. According to this approach, after segmenting the vessels, four features called retina luminance, average vessel density, vessel thickness and average vessel orientation is calculated, thus the region which is most likely to be a fundus center is found using this features. The average performace method is between 81% to 87% which is satisfactory enough when applied to abnormal images.

Another approach to segment fundus was using mathematical morphological operators. Geodesic reconstruction by dilation is used to generate a marker for watershed transformation, then the region is extracted with watershed transformation. As stated in the[OD6], this approach can find the exact place of the region in 48 images out of 50.

In this graduation project, the aim was researching the methods for segmentation and finding the weak and strong points of the methods. Unfortunately, it was not possible to implement all the methods mentioned above so the algorithms are theoretically analized and the proposed method by Zana, Klein[VS1] has been implemented. This method was satisfacory for smooth backgrounded images and not so satisfactory for the noisy images. Then a novel method is implemented to detect optic disk center and calculate radius, inspired by fast radial symmetry transform[FRST]. The results of the method were satisfactory for center detection but not always satisfactory for radius calculation.

This study is documented in 8 chapters. In this chapter, the project topic, the previous works about the topic, our work and results are simply explained.

In chapter two, this project will be introduced briefly and differences from other studies will be stated. In this chapter, estimated time schedule that was designed at the beginning of the project duration will be compared with the real time schedule that was followed during the project work.

In chapter three, theoretical background information will be explained briefly. These theoretic information will be needed in the next chapters in which the actual project work is explained.

In chapter four, analysis and modelling efforts will be introduced. In this chapter, problem domain and the model constructed according to the knowledge gained from that domain will be expressed.

In chapter five, design&implementation and the test efforts will be explained. As this project is a research project, and not an implementation project, not so much design and implementation will be explained.

Page 4: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

4

In chapter six, project results are explained and compared with others’ results and the expected results. In chapter seven, project result and conclusion & suggestions are expressed.

In chapter eight, the references used in the project are listed.

Page 5: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

5

2 PROJECT DESCRIPTION & PLAN

As mentioned before, this project's aim is to research the best methods for classification of the features in retinal images and search for the weaknesses of the methods, so to improve them or develop a better or new methods.

The modules of the project can be described as:

1. Research for the retinal parameters.2. Research for the suitable segmentation algorithms3. Determination and implementation of the segmentation algorithm on the data set.4. Research for classification methods and getting information about the diseases.5. Determination and implementation of the classification algorithm on the data set. 6. Evaluation of the results. 7. Test

The Gantt Chart for the designed modules is:

Level Starting

date

End

date

October

2008

November

2008

December

2008

January

20096 13 20 27 3 10 17 24 1 8 15 22 1 5

1 06.10.2008 20.10.2008

2 20.10.2008 03.11.2008

3 03.11.2008 24.11.2008

4 24.11.2008 01.12.2008

5 01.12.2008 22.12.2008

6 22.12.2008 05.01.2009

7 05.01.2009 12.01.2009

The first phase of the project is of course researching for the features that should be segmented. In the first phase, some research has been made amongst the published articles .

After deciding what to segment, the second phase includes research for the best segmentation algorithms. First segmentation algorithms for vessel extraction are researched and then the optic disc segmentation algorithms are researched. The second and the third phase were simultaneous phases. While researching, also the implementation is progressed for some cases. These phases were the skeleton of the project.

The second and the third phases took quite long time, thus the fourth phase could only be researched and the fifth phase was reserved for the improvement of fundus detection algorithm.

The sixth phase was the evaluation of the results. The realization of this phase was dependent on the real data set that would be given by th supervisor. As the dataset received from the supervisor, this phase ran simultanously with the previous phases.

Page 6: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

6

The last phase was the test phase. The last week is reserved for this phase.

This project is done only by one student, thus all the work mentioned was done by one student.

Page 7: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

7

3 THEORETICAL BACKGROUND

3.1. Methods Used In Vessel Segmentation Algorithms

3.1.1. Morphological Operators

Mathematical morphological operators are used as a tool for extracting image components that are useful in the representaion and description of the region shape such as boundaries, skeletons and the convex hull.

First of all the two basic operators, erosion and dilation will be explained.

3.1.1.1 Dilation

The dilation operation usually uses a structuring element for probing and expanding the shapes contained in the input image. The dilation can be formulized as follows;

Where Bs denotes the symmetric of the set B and z denotes the shifting. Thus, the dilation A by B can be expressed as the set of all displacements by z such that A and Bs has at least one element in common.

The example below shows the effect of the dilation operator with a 3 by 3 square structuring element.

Figure 1 – Effect of dilation

Page 8: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

8

3.1.1.2 Erosion

For the sets A and B, the erosion can be denoted as:

Here z is the displacement and Bz is the displaced B by z. Thus result of the erosion is the set of the points where the displaced B is included in A.

The example below shows the effect of the erosion operator with a 3 by 3 square structuring element.

Figure 2 – Effect of erosion

3.1.1.3 Opening

Opening can be explained as an erosion followed by a dilation, where the both operators use the same structuring element(B). It can be denoted as:

The example below shows the effect of the opening operator with a 3 by 3 square structuring element.

Page 9: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

9

Figure 3 – Effect of opening

3.1.1.4 Closing

Closing can be explained as a dilation followed by an erosion, where the both operators use the same structuring element(B). It can be denoted as:

The example below shows the effect of the closing operator with a 3 by 3 square structuring element.

Figure 4 – Effect of closing

Page 10: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

10

3.1.1.5 Top hat Transformation

Top hat transform has two types: • White top-hat transform• Balck top-hat transform

In our application the vessels seem brighter than the surroundings, so white top-hat transform will be explained.

White top hat transform is the difference between the input and the opening of the input image. Thus, it can be concluded that this transformation extracts the structures that are smaller than the structuring element, which is good to extract vessels which are smaller then a certain value.

Figure 5 – Image after top hat transformation

3.1.1.6 Opening by reconstruction

Reconstruction filters are helpful, if the counters are needed to be preserved but noise is needed to be removed. Thus, two images called marker and mask are generated. Then the image is reconstructed from the connected components of the marker image that had not been removed by the marker, which was generated with an erosion operator in this case.

Opening by reconstruction requires removing pixels of the foreground from an image by any given criteria and in reconstructing all connected components of the image that had not been totally removed.[OBR]

Page 11: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

11

Figure 6 – Opening by reconstruction a)the original image b)the marker image(original image after the erosion operator by 11by11 square structuring element) c) reconstructed image

3.1.1.7 Closing by reconstruction

Closing by reconstruction is the dual of the opening by reconstruction.

Figure 7 – Closing by reconstruction

Page 12: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

12

3.1.2. Laplacian Of Gaussian Filter

In order to find the areas of rapid change, the derivative filters are used. Laplacian filter is also a kind of derivative filter[LOG1]. Derivative filters are so sensitive to noise, so a smoothing filter(Gauss) is used before applying Laplacian filter. This process is called Laplacian of Gaussian filter.

And the Gaussian filter formula can be given as:

In order to obtain a laplacian of gaussian filter, these two equations should be combined:

So this filter takes the second derivative of the image. The response of the filter will be 0, where the image is uniform, it'll be negative on the lighter side and positive on the darker side.

Page 13: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

13

3.1.3. Scale-Space Theory

It is a formal theory for handling image structures at different scales, by representing an image as a one-parameter family of smoothed images, the scale-space representation, parametrized by the size of the smoothing kernel used for suppressing fine-scale structures.[SST1]

Let's assume that f(r) is the original image and there're derived images which can be expressed as D(r,t) where t is the scale and r is the position.

Thus, L(r,0) = f(r);

So as the t increases, smoothing is more effective and so the image has less details but the size doesn't change.

To create a hierarchic image family, derivation on discrete images is needed. As it's not possible on discrete domain, convolution is used. Thus, scale is represented by the convolution with the Gaussian with increasing varience.

Gaussian kernel is defined as:

So the derived images can be expressed as the convolution of the f(r), with the gaussian kernel in the t. scale:

Below are the 4 example images in different scales:

Scale-space representation L(r;t) at Scale-space representation L(r;t) at scale t = 0, corresponding to the original scale t = 1.image f(r).

Page 14: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

14

Scale-space representation L(r;t) at Scale-space representation L(r;t) at scale scale t = 4. t = 16.

Figure 8 – Scale space example

Page 15: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

15

3.2. Methods Used In Optic Disk Detection

There're a few methods to detect the optic disk as mentioned earlier, but only one method will be theoretically described.

3.2.1 Fast Radial Symmetry Transform

This technique is based on gradient operator ant it's designed to detect the points with a high radial symmetry.

This transform is calculated over a set of ranges called N. That range can be expressed as the radius of the symmetry.The value of the transform at range n indicates the contribution to radial symmetry of the gradients a distance n away from each point.

Some terms should be described as follows:

G(p) = gradient value at point pD(p) = direction of the gradient in the point p: G(p) / ∥G(p)∥q(p) = possible symmetry center p = the current pixel point

Thus, q(p) can be describes as:

qn(p) = p − nD(p)�

While exploring the image, two images were calculated, O and M. O stands for orientation and M stands for magnitude. For each n(radius) the following equations are made and the O and M images are updated.

On(qn(p)) = On(qn(p))+1 Mn(qn(p)) = Mn(qn(p))+�G(p)�

As a result, if the original image I has a circle inside with radius r and center p, the pixels surrounding the circle will have gradients pointing to outside of the circle , thus O(p) will have a bigger value than the other pixel's value.

As can be seen S image is very easy to calculate. Once the image is generated, the pixels that have high probability for being a symmetry center will have bigger values.

Page 16: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

16

4 ANALYSIS & MODELING

4.1. AnalysisDuring the research for the techniques as explained in the section 3, a lot of time has been spent. All the techniques were suitable for the problem domain, since the images were very similiar. The criterias were defined to choose a suitable method. The criterias for choosing the algorithm was; performance for noisy images, performance for low-contrast images, processing time, need for prior information.

Mathematical morphological operators are very well known and widely used technique for retinal vessel extraction. In 2001, Zana and Klein[VS1] used this method in their work to segment the vessels. The algorithm is robust for low-contrast and with late diffusion time images, while it's not robust to changes of scale.

Another work that made use of mathematical morphological operator was done by combining Wavelet transform technique and morphological operators by Jorge J. G. et..al[VS2]. In this method, as the results of morphological operators were not satisfactory, Morlet wavelet transform was used to be able to switch frequencies and thus be capable of noise filtering.

Scale space analysis was used by Martinez-Perez et..al[VS3] which made use of the multiscale analysis of the first and second derivative of the image followed by a region growing. This method is a good choice for retinal images which have vessels of large range of widths.

Another approach was using scale space features and k-nearest neighbour by Nancy M. Salem et..al[VS4]. This method is relatively fast, because calculation of the features proposed in the algorithm is simple, and doesn't require too much processing time.

When the methods above are compared;

• The mathematical morphology method by Zana and Klein[VS1] has a good performance for low-contrast images, processing time is short , no priori information is needed but performance for noisy images are not so satisfactory, since Laplacian operator is used.

• Wavelet transform method has a intermediate performance for low-contrast images, processing time is short , no priori information is needed but less details can be extracted with these method as stated in [VS2].

• Multi-scale approach has a intermediate performance for low-contrast images since it only uses gradient information of the image, processing time is short, no priori information is needed, performance for noisy images are not so satisfactory.

• K-nearest-neighbour algorithm has an intermediate performance for low-contrast images since it only uses gradient information of the image, processing time is short, no priori information is needed, performance for noisy images are not so satisfactory. Additionally this method requires postprocessing.

Page 17: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

17

As a result, the first method seemed to be easy to implement, has a short processing time, has a good performance for low-contrast images suitable for our images and have a high possibility on giving good results since it was the algorithm that was used in most of the articles as a starting point.

For the detection of the optic disk, in the work by Kenneth W. Tobin et..al[OD5], a probabilistic framework approach has been used for detection of optic disk. The average performace method is between 81% to 87% which is satisfactory enough when applied to abnormal images.

Another approach to segment fundus was using mathematical morphological operators. As stated in the[OD6], this approach can find the exact place of the region in 48 images out of 50.

In the optic disk detection problem, none of the above were used. Another approach that was explained in section 3 under fast radial symmetry transform was used. This approach has a good performance on symmetry center estimation , has a short processing time but the results are not so satisfactory in unqualified images.

4.2. Modeling

As explained in the analysis section,the defined algorithms will be used in the segmentation of the features. There is no need to model any special structure.

Page 18: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

18

5 DESIGN, IMPLEMENTATION AND TEST

5.1. Vessel Segmentation Design,Implementation

5.1.1. Mask Generation

The input images have a size of 2044x2028, which can be considered as very large. Thus, even the algorithm is simple, processing on this big size of image takes quite long time. That's why, a mask, which help us ignore the unnecessary pixels that give no information, is generated.After the mask is generated, the masked pixels are not used for further processing.

Figure 9 – Histogram

Above the histogram of the image is shown. As can be seen below, the peak on the left of the histogram corresponds to the surrounding black pixels of the retina, where no information about vessels or optic disc exists.

In order to generate the mask; the following function has been written in Matlab:

Page 19: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

19

function mask = generateMask( I )% function R = generateMask(I)%% I Grayscale 2D Imaged% mask Resulting segmentation, a 2D matrix with the same size as I, % (0 = background, 1 = segmented) [counts, x]=imhist(I);[intensity,index] = sort(counts,'descend');% find the minimum intensityminIntens = min(min(I));% find the maximum intensitymaxIntens = max(max(I));% if the image has low contrast, increase contrast% low contrast : maximum intensity - minIntensity = level < 200if ((maxIntens-minIntens)< 200 ) I = adapthisteq(I);endfigure; imhist(I)[counts,x]=imhist(I);[lmval,indd]=lmin(counts,2);% find the local minima with the smallest intensity value%thresh = index(1);thresh=indd(1);mask = double(threshold(I,0,thresh));mask = imcomplement(mask);

Figure 10 – generateMask.m

First, the histogram is calculated. imhist function returns the intensity values and the count of each intensity value. Then the intensity values are sorted in descending order. If the image is a low-contrast image, an adapted histogram equalization is applied. In our case low-contrast means, the difference between the maximum intensity value and the minimum intensity value has a lower value than 200.

In fact , a suitable threshold value is trying to be found. Thus, the local minima is found with the help of the lmin function. Then out of all the local minimas, the one with the lowest intensity value has been chosen for the threshold value. Then when the image is thresholded, applying an imcomplement to the image, results with a mask.

Page 20: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

20

Figure 11 – original image

Figure 12 – mask image

Page 21: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

21

5.1.2. Morphological Method Implementation

After generating the mask, next step is applying morphological operators to brighten the vessels. The most important parameter of this method is the structuring element. As proposed in this method, it will be a line structure, but the length of the structure should be decided with the resolution and the width of the vessels. As the resolution of the image is 2044x2028 , the biggest vessel width is approximated as 30 pixels.

First the masked image is generated and the followings have been applied:

mask = generateMask(I);I = double(I);Imasked = mask.*I;

Figure 13 – image masking

So the Imasked has 0 values in the surrounding area.

%using connectivity property - opening by reconstructionfor i=1:12 s = strel('line',30,i*15); im = imerode(I,s); I = imreconstruct(im,I); % figure,colormap(gray(256)) ,image(I); end

Figure 14 – applying opening by reconstruction

The structering element of size 30 will be applied in each direction with the angle i*15.

As explained in section 3, opening by reconstruction is expected to remove the noise. The reconstructed image after erosion can be seen in figure 16.

a) original cropped Image b) supremum of openings Figure 15– supremum of openings

Page 22: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

22

a) original image

b) reconstructed image (noise is removed)

Figure 16 – original and the reconstructed image

Page 23: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

23

After the noise is removed, sum of the top-hats is applied to the image, which will brighten the linear structures-vessels.

sum = zeros(size(I,1),size(I,2));for i=1:12 s = strel('line',30,i*15); im = imtophat(I,s); % figure,colormap(gray(256)) ,image(im); sum = imadd(sum,im); % figure,colormap(gray(256)) ,image(sum); end

As explained in the section 3, top hat transformation calculates the difference between the image and its opening.

Figure 17 – sum of top hats

As can be seen, the vessels are brightened but also some noise still exists. Therefore, some further treatment should be applied. These treatment will be Laplacian of Gaussian filter.

Page 24: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

24

5.1.3. Laplacian Of Gaussian Implementation

As mentioned in section 3, Laplacian operator takes the second derivative of the image, but also sensitive to noise. Thus, a smoothing filter- Gaussian is applied first. Log filter is the combination of these two processes.

h = fspecial('log',14,7/4);sumf = imfilter(sum,h,'conv');sumof = sumf;

Figure 18 – log filter implementation

Figure 19 – result image after log filter

5.1.4. Alternating Filter and ThresholdingAfter applying Laplacian of Gaussian filter to the image, the borders of the vessels are clear, so a final alternating filter is needed to yield to the final result.

In order to avoid the noise, again opening by reconstruction is applied:

Page 25: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

25

sumof = sumf;% linear opening by reconstructionfor i=1:12 s = strel('line',30,i*15); im = imerode(sumof,s); sumof = imreconstruct(im,sumof); figure,colormap(gray(256)) ,image(sumof); end

Figure 20 – opening by reconstruction

After removing noise, the gaps between the vessels should be filled, thus a closing operator is applied to the reconstructed image.

sumcl = sumof;% linear closing by reconstructionfor i=1:12 s = strel('line',30,i*15); im = imdilate(sumcl,s);sumcl = imreconstruct(imcomplement(im),imcomplement(sumcl)); sumcl = imcomplement(sumcl); figure,colormap(gray(256)) ,image(sumcl); end

Figure 21 – closing by reconstruction

Now the threshold can be applied to the image. Unfortunately, threshold generation is not automatic, the results for different thresholds can be seen below.

Page 26: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

26

b) The segmentation result for threshold 5

Figure 22 – Vessel segmentation result

Page 27: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

27

5.2. Optic Disc Detection Design, Implementation

While designing the algorithm, a fast radial symmetry transform approach has been used, which was explained in details in section 3.

5.2.1. Fast Radial Symmetry Transform Implementation

Before applying the algorithm, a preprocessing step is required. This preprocessing step is the smoothing of the image. Since the borders of the circle-like-shape is enough for detection, all the details will be smoothed with a big kernel.

[row,col] = size(I);I = double(I(:,:,1));gaussian = fspecial('gaussian',40,16);MMFI = imfilter(I,gaussian,'conv');

Figure 23 – Gaussian Filter implementation

After the image is smoothed, gradient directions and gradient magnitude of the image is found with the piece of code in Figure 24.

[Ix, Iy] = gradient(gaussIm);gradmag = sqrt(Ix.^2 + Iy.^2);figure, imshow(gradmag,[]), title('Gradient magnitude (gradmag)'); Dx = Ix ./ gradmag;Dy = Iy ./ gradmag;

Figure 24 – Gradient directions and gradient magnitude calculation

Page 28: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

28

a) Smoothed image b) Gradient magnitude of the smoothed image

Figure 25 – Smoothed Image and Gradient magnitude

After that, as mentioned in chapter 3, orientation and magnitude images are found with the following piece of code:

function [imO, imM] = createOM(row,col,Dx,Dy,gradmag,r )% gaussIm : 2d grayscale image % r : radius% G(p) -> gradient of the image at point p% D(p) -> G(p)/||G(p)|| direction of the gradient image at point p% qr(p) -> p - r.D(p) center of the symmetry for point p% Or(qr(p)) = Or(qr(p))+1 -> updated O imageimO = zeros(row,col);imM = zeros(row,col);for i=1:row for j=1:col qi = round(i - r*Dy(i,j)); qj = round(j - r*Dx(i,j)); if(qi>0 && qj>0 &&qi<row && qj<col) imO(qi,qj) = imO(qi,qj)+1; imM(qi,qj) = imM(qi,qj)+gradmag(i,j); end endend

Figure 26 – createOM.m

One example of orientation and magnitude images for radius 160 is given in Figure 27.

Page 29: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

29

Figure 27 - Io and Im for radius 160

After generating the orientation and the magnitude image, the level images are generated for all radiuses with the following code piece in Figure 28.

% for each radius calculate S(p) and R(k) S = zeros(row,col);R = zeros(row,col);alfa = 1; for i=100:10:160 [Io, Im] = createOM(row,col,Dx,Dy,gradmag,i,I); ILevel = computeLevel(alfa,Io,Im,i); S = S+ILevel; R = R+(i*ILevel); figure,colormap(gray(256)),imshow(S),title('image S')end

Figure 28 – calculation of S and R

In the code above, the level image, called L, is calculated for radiuses starting for 100 and lasts at 160. In computeLevel function, normalization is done for the generated O and M images., which means dividing each value to the maximum value.

Page 30: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

30

The result image S, is the addition of the level images, thus includes all the possibilites in all radiuses.

Figure 29 – Image S

As can be seen in the figure, some pixels are brighter than the others. In the formula given for S image, the bright pixels represent the possibility of being a radial symmetry center. Thus, if the brightest pixel is picked, the most likely center is picked.

In order to find the radius, the following formula is applied. In this formula, r represents the radius where k represents the estimated center. Here the weighted level images are divided by the level images and the k. pixel gives the estimated radius.

The result image with the estimated center and the radius can be seen in Figure 30.

Page 31: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

31

Figure 30 – result for pre.jpg

Figure 31 – result for post.jpg

Page 32: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

32

5.2.2. Modified Fast Radial Symmetry Transform

The algorithm explained above, is a general algorithm to find only one radial center in the image. In retinal images, the gradient magnitude is effected by the vessels in a bad way. If the vessel map that found previously can be used to extract the vessels, the gradient magnitude can be improved.

Another thing that affects the gradient magnitude image is the big black regions called hemorrhages. Since the radiuses of the hemorrhages can be closer to optic disc's radius, this feature can be a big risk for this algorithm. The bad affect of the hemorrhage can be seen in the figure 32.

Figure 32 – Wrong center estimation in hemorrhage pointed with the blue point

The first idea is to segment the hemorrhages with the radius close to the optic disc, and extract the vessels.Thus, the gradient magnitude can only be affacted by the optic disc.

The second idea is to create a probability map from the previously found optic disc centers and apply the map on the result image S. Thus, the bright pixels on the image S will be brighter after the probabilities of centers were applied onto the image.

The second idea was implemented, since the implementation was simpler and the deadline was tight. Although the results were not better than the previous ones, in fact the results were worse.

Page 33: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

33

6 TEST RESULTS

The algorithms were applied to the test images supplied by the supervisor. The results for vessel segmentation is given below.

Figure 33 – results for qualified images

Page 34: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

34

Below are the results for unqualified images:

Figure 34 – FRST results

Page 35: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

35

Figure 35 – Vessel segmentation results for unqualified images

The results images for radial symmetry transform was able to find the centers close to the real centers, although the centers were not exact. This algorithm was also able to guess the radius close to the real radius value. Due to the fact that the radiuses are varying in all the images, using a standard algorithm is hard, but the algotihm that was applied to the images were a standardized algorithm.

The results were vessel segmentation were good for qualified images, unless the results were not so satisfactory for unqualified images.The first image was in fact qualified, but has a different type.The second image has a very big bright area that doesn't belong to the vessel area.

Page 36: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

36

7 RESULTS AND SUGGESTIONS

As a result, two segmentation algorithms were implemented and applied on the images. Before vessel segmentation, a mask is generated in order to speed up the process and avoid unnecessary operations. Vessel segmentation is implemented by the help of the algorithm explained in [VS1], and a method based on a fast radial smmetry transform[FRST1] is modified to be applied on to the retinal images.

Mask generation algorithm was successfully implemented and applied on all the images. As it's a histogram based operation, the cost is low and the algorithm is fast.

Vessel segmentation algorithm was applied on different kinds of images. Algorithm was not so fast due to the number of steps required to extract the vessels, but the algorithm is almost automatic and the only input parameter is the threshold and the biggest vessel width. The results for qualified images were satisfactory, unless the results for the unqualified images were not so satosfactory.

Vessel segmentation algorithm's processing time was under 5 minute, which can be considered slow, due to the number of steps required and the complexity of the steps and the resolution of the input images.

Optic disc detection algorithm was chosen to be the fast radial symmetry transform method, but the method was modified in order to apply on retinal images. The results for this method were given in the results section. For all the images, the algorithm was able to find the inner side of the circle as the center and find a radius close to the real radius. Altough the method can be improved with the methods recommended in the design section.

Optic disc detection method's processing time was under 1 minute, which can be considered as fast, since instead of the Gaussian filtered image, the reduced sample of the image was used.

As a conclusion, these two methods can be a good start for a long term retinal images registration project. Due to different kinds of modalities and different kind of parameters that affect the images, it's very challenging to produce a standard and full automatic algorithm. When these conditions are considered, the work that was done and the results that were acquired, was satisfactory due to the limited time and limited research conditions. For the ones, who would like to contribute to this problem in the future should make use of this work and the referenced papers.

Page 37: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

37

8 REFERENCES

[VS1] J. J. G. Leandro,R. M Cesar JR,H. F. Jelinek , "Blood Vessels Segmentation in Retina: Preliminary Assessment of the Mathematical Morphology and of the Wavelet Transform Techniques," Brazilian Conference on Computer Graphics, Image Processing - Sibgrapi03. IEEE Computer Society Press, 2003. p.262 - 269

[VS2] F. Zana and J. Klein, "Segmentation of Vessel-Like Patterns Using Mathematical Morphology and Curvature Evaluation ,"IEEE Transactions on image processing, VOL. 10, NO.7, JULY 2001

[VS3] M. E. Mart´ınez-P´erez, A. D. Hughes , A. V. Stanton , S. A. Thom , A. A. Bharath, and K. H. Parker , "Retinal Blood Vessel Segmentation by Means of Scale-Space Analysis and Region Growing" , Medical Image Computing and Computer-Assisted Intervention, Miccai'99, Proceedings, 1999

[VS4] N. M. Salem and A. K. Nandi , "Segmentation of retinal blood vessels using scale-space features and k-nearest neighbour classifier" , Acoustics, Speech and Signal Processing, 2006. ICASSP 2006 Proceedings. 2006

[OD1] D.T. Morris, C. Donnison, “Identifying the neuroretinal rim boundary using dynamic contours,” Image and Vision Computing, Vol. 17, 1999, p. 169-174.

[OD2] A. Hoover, M. Goldbaum, “Locating the Optic Nerve in a Retinal Image Using the Fuzzy Convergence of Blood Vessels,” IEEE Trans. On Medical Imaging, Vol. 22, No. 8, 2003, p. 951-958.

[OD3] M. Foracchia, E. Grisan, A. Ruggeri, “Detection of the optic disc in retinal images by means of a geometrical model of vessel structure,” IEEE Trans. on Medical Imaging, Vol. 23, No. 10, Oct. 2004, p. 1189-1195.

[OD4] K. W. Tobin, E. Chaum, V. P. Govindasamy, T. P. Karnowski, O. Sezer, “ Characterization of the optic disc in retinal imagery using a probabilistic approach, ” Medical Imaging 2006: Image Processing. Edited by Reinhardt, Joseph M.; Pluim, Josien P. W. Proceedings of the SPIE, Volume 6144, pp. 1088-1097 (2006).

[OD5]D. Jegelevicius, D. Buteikiene, V. Barzdziukas and A. Paunksnis, “Parameterization of the Optic Nerve Disk in Eye Fundus Images ,” IFMBE Proceedings: 14th Nordic-Baltic Conference on Biomedical Engineering and Medical Physics NBC 2008 16–20 June 2008 Riga, Latvia,10.1007/978-3-540-69367-3_141

[OD6] K. Stapor , A. Switonski, R. Chrastek , and G. Michelson, “Segmentation of Fundus Eye Images Using Methods of Mathematical Morphology for Glaucoma Diagnosis, ” International Conference on Computational Science 2004: 41-48

[FRST1] Gatta,C. , Pujol, O. , Rodríguez-Leor,O. ,Mauri, J. ,Radeva, P., “ Improved Rigid Registration of Vessel Structures using the Fast Radial Symmetry Transform, ” Computer Vision for Intravascular Imaging CVII'08 Workshop Medical Image Computing and

Page 38: İSTANBUL TEKNİK ÜNİVERSİTESİ - myweb.sabanciuniv.edumyweb.sabanciuniv.edu/isguder/files/2011/04/GozdeGulIsguderBitirme... · Closing can be explained as a dilation followed

38

Computer-Assisted Intervention MICCAI'2008, 11th International Conference, NY (USA), pp. 128-136, |9|2008 .

[OBR] Opening by reconstruction, Tutorials, 2001, http://rfv.insa-lyon.fr/~jolion/IP2000/report/node40.html

[LOG1] Laplacian Of Gaussian, Tutorial, http://academic.mu.edu/phys/matthysd/web226/Lab02.htm

[SST1] Scale-Space representation, Definition, http://en.wikipedia.org/wiki/Scale-space