-
Notifications
You must be signed in to change notification settings - Fork 1
/
ExampleBloodVesselSegmentation.m
74 lines (66 loc) · 2.74 KB
/
ExampleBloodVesselSegmentation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function [output, oriensmap] = ExampleBloodVesselSegmentation( )
% Delineation of blood vessels in retinal images based on combination of BCOSFIRE filter responses
%
% Version: v1.3
% Author(s): Nicola Strisciuglio (nic.strisciuglio@gmail.com)
% George Azzopardi
%
% Description:
% Example application for the B-COSFIRE filters for delineation of
% elongated structures in images. This example demonstrates how to
% configure different types of filters (line and line-ending detectors) and
% how to combine their responses.
%
% Application() returns:
% output A struct that contains the BCOSFIRE filters response
% and the final segmented image. In details
% - output.respimage: response of the combination of a symmetric and an
% asymemtric COSFIRE filters
% - output.segmented: the binary output image after
% thresholding
% oriensmap [optional] map of the orientation that gives the strongest
% response at each pixel.
%
% If you use this software please cite the following paper:
%
% "George Azzopardi, Nicola Strisciuglio, Mario Vento, Nicolai Petkov,
% Trainable COSFIRE filters for vessel delineation with application to retinal images,
% Medical Image Analysis, Volume 19 , Issue 1 , 46 - 57, ISSN 1361-8415
%
% Requires the compiling of the mex-file for the fast implementation of the
% max-blurring function in case it is not compiled already
if ~exist('./COSFIRE/dilate')
BeforeUsing();
end
% Example with an image from DRIVE data set
image = double(imread('./data/Retina_example/test/images/01_test.tif')) ./ 255;
%% Symmetric filter params
symmfilter = struct();
symmfilter.sigma = 2.4;
symmfilter.len = 8;
symmfilter.sigma0 = 3;
symmfilter.alpha = 0.7;
%% Asymmetric filter params
asymmfilter = struct();
asymmfilter.sigma = 1.8;
asymmfilter.len = 22;
asymmfilter.sigma0 = 2;
asymmfilter.alpha = 0.1;
%% Filters responses
% Tresholds values
% DRIVE -> preprocessthresh = 0.5, thresh = 37
% STARE -> preprocessthresh = 0.5, thresh = 40
% CHASE_DB1 -> preprocessthresh = 0.1, thresh = 38
output = struct();
if nargout == 1 || nargout == 0
[output.respimage] = BCOSFIRE_media15(image, symmfilter, asymmfilter, 0.5);
elseif nargout == 2
[output.respimage, oriensmap] = BCOSFIRE_media15(image, symmfilter, asymmfilter, 0.5);
else
error('ERROR: too many output arguments.');
end
output.segmented = (output.respimage > 37);
if nargout == 0
figure; imagesc(output.respimage); colormap(gray); axis off; axis image; title('B-COSFIRE response image');
figure; imagesc(output.segmented); colormap(gray); axis off; axis image; title('B-COSFIRE segmented image');
end