-
Notifications
You must be signed in to change notification settings - Fork 1
/
vorticity_threshold.m
61 lines (44 loc) · 2.05 KB
/
vorticity_threshold.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
function vort = vorticity_threshold(vorticity, swirl, thresh_criterion, threshold, MASK)
[nRows, nColumns] = size(vorticity);
switch thresh_criterion
case 'Swirl'
if MASK(1) == 0 && threshold>0 % Gaussian masking
% Parameters for Gaussian smoothing
kernel = fspecial('gaussian',MASK(2),MASK(3));
se = strel('disk',MASK(4));
% Filtering the swirl function
SWIRL = filtered_map(swirl, kernel, se, threshold);
% find regions of high swirl
tmp = reshape(vorticity, nRows*nColumns, 1); % Reshaping the vorticity array as a column vector (according to columns)
tmp(find(SWIRL(:,:)==0))=0;
vort = reshape(tmp, nRows, nColumns);
elseif MASK(1) == 1 && threshold>0 % Regular masking
P = swirl;
P_max = max(max(abs(P)));
P_thres = threshold*P_max;
vorticity(abs(P)<=P_thres) = 0;
vort = vorticity;
else
vort = vorticity;
end
case 'Vorticity'
if MASK(1) == 0 && threshold>0% Gaussian masking
% Parameters for Gaussian smoothing
kernel = fspecial('gaussian',MASK(2),MASK(3));
se = strel('disk',MASK(4));
% Filtering the swirl function
VORTICITY = filtered_map(vorticity, kernel, se, threshold);
% find regions of high swirl
tmp = reshape(vorticity, nRows*nColumns, 1); % Reshaping the vorticity array as a column vector (according to columns)
tmp(find(VORTICITY(:,:)==0))=0;
vort = reshape(tmp, nRows, nColumns);
elseif MASK(1) == 1 && threshold>0% Regular masking
P = vorticity;
P_max = max(max(abs(P)));
P_thres = threshold*P_max;
vorticity(abs(P)<=P_thres) = 0;
vort = vorticity;
else
vort = vorticity;
end
end