MATLAB implementation of a method for segmentation of vein images using a matching filter

Source: Internet
Author: User

Segmentation is a very common technique that separates what you want to study from irrelevant things, for example, we often use Photoshop to take photos from people and change the background or PS. This is image segmentation, but in this field we are studying Automatic Image Segmentation technology, manual splitting is not required. There are many methods for automatic image segmentation that have been proposed, but they can only solve some of the problems. Some images still have to be divided manually, so the challenges still exist, and new methods are constantly proposed.

For some medical purposes, it is often necessary to segment the vascular images of some medical imaging and extract the bleeding duct for further research. Therefore, vascular segmentation is a class of image segmentation, there are many things dedicated to solving this problemAlgorithmProposed. The method described in this article belongs to one of all vascular segmentation methods, which is based on something called a matched filter. This method was proposed as early as 1989 [1]. In fact, this article also summarizes and implements this paper, and there are many improved algorithms based on this paper.

This method is inspired by matching filters in signal processing. According to what was set up in Baidu encyclopedia, the performance of the matching filter is consistent with that of the signal. This maximizes the ratio of the instantaneous signal power at the filter output end to the average noise power, that is, when the signal and noise enter the filter at the same time, it causes a peak value of the signal component at a certain moment, and the noise component is restrained. To design a matching filter, the signal waveform must be known. Although we do not know the specific situation of the vascular image as a signal, the characteristics of the vascular image are known. Based on this prior knowledge, we can design a matching filter for the vascular image, then, according to the matching filter principle, when the vascular part is input, there will be a relatively small value, and when the background area is input, so as to separate the vein from the vascular.

Based on the above analysis, we need to study the characteristics of vascular. The vascular has the following characteristics: the vascular width changes only within a small range, the two lines of the vascular wall are parallel, and the vascular direction, and with in-depth analysis of vascular images, we can also find that the gray curve of the vascular cross line is like the following:

 

According to the above vascular features,ArticleIn [1], a design method of matching filter is proposed. First, think of the vascular as a combination of a short parallel area, set the length to L, width to 2 sigma, then, an inverted Gaussian curve is used to simulate the grayscale curve of the above vascular cross line, and the matching filter is obtained as follows:

Because the vascular has a direction, a 15-degree rotation is performed on the basis of this filter to obtain 12 matching filters from 0 degrees to 180 degrees, and then perform convolution respectively, the value of each pixel is the value of the filter with the largest response. After filtering, a global threshold value is used for filtering. The image size is divided by one side to obtain a binarization vascular image.

The above is just a simple introduction, and there are still many details that have not been put forward. For specific methods, refer to the paper.

Below is matlabCode:

Function [g, BG] = matchedfilter2 (f) F = double (f); % mean filterf = medfilt2 (F, [5, 5]); F = medfilt2 (F, [21 1]); F = medfilt2 (F, [1, 7]); % parameter OS = 12; % Number of angles Sigma = 10; Tim = 4; L = 9; T = 70; % threshholdthetas = 0 :( OS-1); Thetas = Thetas. * (180/OS); n1 =-Tim * Sigma: Tim * sigma; n1 =-exp (-(N1. ^ 2)/(2 * Sigma * sigma )); N = repmat (N1, [2 * floor (l/2) + 1,1]); r2 = floor (l/2); C2 = floor (TIM * sigma ); [M, N] = size (f); RNS = cell (1, OS); % rotated kernalsmfr = cell (1, OS); % filtered imagesg1 = F; % matched filterfor I = 1: OS Theta = Thetas (I); Rn = imrotate (n, theta); % remove unnecessary 0 rows and zero columns Rn = rn (:, any (RN); Rn = rn (any (RN '), :); meann = mean2 (RN); Rn = rn-meann; RNS {1, I} = rn; MFR {1, I} = imfilter (F, RN, 'conv', 'durric '); end % get the max responseg = MFR {}; for J = 2: OS G = max (G, MFR {1, J}); endbg = G <t; End

 

The selection of the three parameters Sigma, L, and t needs to be tried for different applications. If we split the retina vascular image as in the paper, the parameters can be changed to 2, 9, 3. What I do is the division of the opponent's vein, so the parameter is shown in the code above. As for the selection of global threshold t, the most crude and common method is to try to find the best one several times. Of course there are other methods to find this threshold. I think the performance of this method is good. However, preprocessing and subsequent processing are also essential for obtaining good results.

 

[1] S. chaudhuri, S. chatterjee, N. katz, M. nelson, M. goldbaum, detection of blood vessels in retinal images using two dimensional matched filters, IEEE Trans. med. imaging 8 (3) (1989) 263-269.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.