-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathanisor.m
More file actions
104 lines (93 loc) · 3.77 KB
/
anisor.m
File metadata and controls
104 lines (93 loc) · 3.77 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
%% ANISOR - Compute the orientation information derived from the anisotropic
% continous scale model of [BBW07].
%
%% Description
%
%% Syntax
% kappa = anisor(I);
% kappa = anisor(I, nu, rho, sig, ...
% 'Property', propertyvalue, ...);
%
%% Inputs
% *|I|* : an input image with size |(X,Y,C)|, where |C>1| when |I| is multichannel.
%
% *|nu|* : (optional) nonegative integer which influences the propagation of
% the structures in the normal to the gradient direction; default: nu=4.
%
% *|rho|* : post-smoothing width; this parameter sets the integration scale
% for spatial averaging, that controls the size of the neighbourhood
% in which an orientation is dominant; it is used for averaging the
% partial directional derivatives of the tensor with a Gaussian kernel;
% if rho<0.05, then no smoothing is performed; default: rho=1.
%
% *|sig|* : pre-smoothing width; this parameter sets the differentiation
% scale in the case the image is smoothed prior to the differentiation
% through Gaussian filtering; sigma typically controls the size of the
% objects whose orientation has to be estimated; default: sigma=1,
% i.e. Gaussian regularisation is used for estimating the derivatives.
%
%% Property [propertyname propertyvalues]
% *|'der'|* : string defining the method of pre-smoothing/differentiation used
% for estimating the directional derivatives of the input image; it is
% either (see GRDSMOOTH): 'matlab', 'vista', 'fast', 'conv', 'diag',
% 'tap5', 'sob', 'opt' or 'ana'; default: der='fast'.
%
% *|'int'|* : string defining the method used for the post-smoothing of the GST;
% it is either (see GRD2GST): 'matlab', 'conv' or 'fast' for isotropic
% Gaussian intoothing, or 'ani' for anisotropic Gaussian (using hour-
% glass shaped Gaussian kernels) along the edges; this latter better
% captures edges anisotropy; default: int='fast'.
%
% *|'samp'|* : to perform (* samp) interpolation of the estimated gradient to
% avoid aliasing (should set to 2); default: samp=1, ie no interpolation
% is performed.
%
%% Output
% *|kappa|* : orientation information in [0,1].
%
%% Reference
% [BBW07] M. Breuß, B. Burgeth and J. Weickert: "Anisotropic continuous-scale
% morphology", Proc. IbPRIA, LNCS 4478, pp. 515-522, Springer, 2007.
% <http://www.springerlink.com/content/1hm264w86111m148/>
%
%% See also
% Related:
% <../../derive/html/GSTSMOOTH.html |GSTSMOOTH|>,
% <ANISORFILT.html |ANISORFILT|>.
% Called:
% <ANISOR_BASE.html |ANISOR_BASE|>.
%% Function implementation
function kappa = anisor(I,varargin)
%%
% parsing parameters
error(nargchk(1, 18, nargin, 'struct'));
error(nargoutchk(1, 1, nargout, 'struct'));
% mandatory parameter
if ~isnumeric(I)
error('anisor:inputerror','a matrix is required in input');
end
% optional parameters
p = createParser('ANISOR');
% principal optional parameters
p.addOptional('nu', 4, @(x)isscalar(x) && x>=0);
p.addOptional('rho', 3, @(x)isscalar(x) && isfloat(x) && x>=0);
p.addOptional('sigma', 1, @(x)isscalar(x) && isfloat(x) && x>=0);
p.addParamValue('der', 'fast', @(x)islogical(x) || (ischar(x) && ...
any(strcmpi(x,{'matlab','vista','fast','conv','diag', ...
'tap5','sob','opt','ana'}))));
p.addParamValue('int', 'fast', @(x)islogical(x) || (ischar(x) && ...
any(strcmpi(x,{'matlab','conv','fast','ani'}))));
p.addParamValue('samp', 2, @(x)isscalar(x) && round(x)==x && x>=1 && x<=5);
% parse and validate all input arguments
p.parse(varargin{:});
p = getvarParser(p);
%%
% calculation
kappa = anisor_base(I, p.nu, p.rho, p.sigma, p.der, p.int, p.samp);
%%
% display
if p.disp
figure, imagesc(kappa), colormap gray, axis image off;
title('orientation indice')
end
end % end of anisor