-
Notifications
You must be signed in to change notification settings - Fork 5
/
mStat_WaveletAnalysis.m
527 lines (407 loc) · 17.2 KB
/
mStat_WaveletAnalysis.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
function varargout = mStat_WaveletAnalysis(varargin)
%MStaT mStat_WaveletAnalysis function determinate and graphs the wavelet
%analyzes
% Last Modified by GUIDE v2.5 11-Apr-2020 13:29:34
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @mStat_WaveletAnalysis_OpeningFcn, ...
'gui_OutputFcn', @mStat_WaveletAnalysis_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
%--------------------------------------------------------------------------
% --- Executes just before mStat_WaveletAnalysis is made visible.
function mStat_WaveletAnalysis_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for mStat_WaveletAnalysis
handles.output = hObject;
% Update GUI data.
guidata(hObject, handles);
set(handles.figure1,'Name',['MStaT: Wavelet Analysis '], ...
'DockControls','off')
%selector de angulo o curvatura
sel=1;
%set slider
set(handles.slidercurvature,'Max',length(varargin{1}.sResample),'Min',0)
%significancia
SIGLVL=0.95;
handles.geovar=varargin{1};
handles.filter=0;
handles.axest=[handles.curveandangle_axes handles.wavel_axes handles.centerline_axes handles.power_axes];
guidata(hObject, handles);
Module=1;
vars=[];
%this function go to plt function
mStat_plotWavel(varargin{1},sel,SIGLVL,handles.filter,handles.axest,Module,vars)
% End bend selection section.
%--------------------------------------------------------------------------
% --- Outputs from this function are returned to the command line.
function varargout = mStat_WaveletAnalysis_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
function figure1_CreateFcn(hObject, eventdata, handles)
% Empty
% --------------------------------------------------------------------
function file_Callback(hObject, eventdata, handles)
%Empty
% --------------------------------------------------------------------
function close_Callback(hObject, eventdata, handles)
close
% --- Executes during object creation, after setting all properties.
function wavelet_axes_CreateFcn(hObject, eventdata, handles)
% Empty
% --- Executes during object deletion, before destroying properties.
function wavelet_axes_DeleteFcn(hObject, eventdata, handles)
% Empty
% --- Executes on mouse press over axes background.
function centerline_plot_ButtonDownFcn(hObject, eventdata, handles)
% Empty
% --- Executes during object creation, after setting all properties.
function centerline_plot_CreateFcn(hObject, eventdata, handles)
% Empty
% --- Executes on selection change in bendNumbers.
function bendNumbers_Callback(hObject, eventdata, handles)
% Empty
% --- Executes during object creation, after setting all properties.
function bendNumbers_CreateFcn(hObject, eventdata, handles)
% hObject handle to bendNumbers (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in select.
function select_Callback(hObject, eventdata, handles)
% Empty
% --------------------------------------------------------------------
function exportfigure_Callback(hObject, eventdata, handles)
% Empty
% --------------------------------------------------------------------
function exportFIG_Callback(hObject, eventdata, handles)
handles.getexport = mStat_Waveletexport(handles.axest);
uiresume(gcbf);
% --- Executes during object creation, after setting all properties.
function significance_Callback(hObject, eventdata, handles)
% Empty
% --- Executes during object creation, after setting all properties.
function significance_CreateFcn(hObject, eventdata, handles)
% hObject handle to significance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in calculatesignificance.
function calculatesignificance_Callback(hObject, eventdata, handles)
significance=get(handles.significance,'String');
if isempty(significance)
SIGLVL=0.95;
else
SIGLVL=str2num(significance)/100;
end
sel=get(handles.curvatureandangle,'Value');
Module=1;
vars=[];
mStat_plotWavel(handles.geovar,sel,SIGLVL,handles.filter,handles.axest,Module,vars)
% --- Executes on selection change in curvatureandangle.
function curvatureandangle_Callback(hObject, eventdata, handles)
significance=get(handles.significance,'String');
if isempty(significance)
SIGLVL=0.95;
else
SIGLVL=str2num(significance)/100;
end
sel=get(handles.curvatureandangle,'Value');
Module=1;
vars=[];
mStat_plotWavel(handles.geovar,sel,SIGLVL,handles.filter,handles.axest,Module,vars)
% --- Executes during object creation, after setting all properties.
function curvatureandangle_CreateFcn(hObject, eventdata, handles)
% hObject handle to curvatureandangle (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function mincurvature_Callback(hObject, eventdata, handles)
% Empty
% --- Executes during object creation, after setting all properties.
function mincurvature_CreateFcn(hObject, eventdata, handles)
% hObject handle to mincurvature (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --------------------------------------------------------------------
function savefigure_ClickedCallback(hObject, eventdata, handles)
%Save figures
handles.save=mStat_Waveletexport;
% --------------------------------------------------------------------
function clearfigure_ClickedCallback(hObject, eventdata, handles)
mStat_plotWavel
% --- Executes on button press in filterarc.
function filterarc_Callback(hObject, eventdata, handles)
% Empty
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
% Empty
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: delete(hObject) closes the figure
delete(hObject);
% --- Executes on button press in filter.
function filter_Callback(hObject, eventdata, handles)
%Read input variables
riverName = getappdata(0, 'riverName');
guidata(hObject, handles);
handles.filter=1;
guidata(hObject,handles)
%read filter data
x = newid({'Min Arc-Wavelength','Max Arc-Wavelength','Min Sinuosity','Max Sinuosity'},...
'mStat',[1 50;1 50;1 50;1 50],{'0','0','0','0'});
if isempty(x)
else
[handles.minarcwavelength,handles.maxarcwavelength,handles.minsinuosity,handles.maxsinuosity] = x{:};
%Apply of Filter
handles.minarc = str2num(handles.minarcwavelength);
handles.maxarc = str2num(handles.maxarcwavelength);
handles.minsin = str2num(handles.minsinuosity);
handles.maxsin = str2num(handles.maxsinuosity);
guidata(hObject,handles)
%
if handles.minarc==handles.maxarc & handles.minsin~=handles.maxsin
inds = +not(abs(sign(sign(handles.minsin - handles.geovar.sinuosityOfBends) + sign(handles.maxsin - handles.geovar.sinuosityOfBends))));
%
bendwavelength=find(inds==1);
%upload data
handles.bendwavelength = num2str(bendwavelength);
setappdata(0, 'bendwavelength', handles.bendwavelength);
guidata(hObject,handles)
%Apply filter
handles.filter=1;
%
% Call the "userSelectBend" function to get the index of intersection
% points and the highlighted bend limits.
highlightx_arc=nan(length(bendwavelength),200);
highlighty_arc=nan(length(bendwavelength),200);
%
%Find bends using the Filter
for i=1:length(bendwavelength)
[highlightX, highlightY, indi1] = userSelectBend(handles.geovar.intS, bendwavelength(i),...
handles.geovar.equallySpacedX,handles.geovar.equallySpacedY,handles.geovar.newInflectionPts,...
handles.geovar.sResample);
highlightx_arc(i,1:length(highlightX))=highlightX;
highlighty_arc(i,1:length(highlightY))=highlightY;
indi(i,1:2)=indi1(1,1:2);
end
%upload data
handles.highlightx_arc = num2str(highlightx_arc);
setappdata(0, 'highlightx_arc', handles.highlightx_arc);
handles.highlighty_arc = num2str(highlighty_arc);
setappdata(0, 'highlighty_arc', handles.highlighty_arc);
handles.indi = num2str(indi);
setappdata(0, 'indi', handles.indi);
guidata(hObject,handles)
elseif handles.minarc~=handles.maxarc & handles.minsin==handles.maxsin
inds = +not(abs(sign(sign(handles.minarc - handles.geovar.wavelengthOfBends) + sign(handles.maxarc - handles.geovar.wavelengthOfBends))));
%
bendwavelength=find(inds==1);
%upload data
handles.bendwavelength = num2str(bendwavelength);
setappdata(0, 'bendwavelength', handles.bendwavelength);
guidata(hObject,handles)
handles.filter=1;
%Apply Filter
% Call the "userSelectBend" function to get the index of intersection
% points and the highlighted bend limits.
highlightx_arc=nan(length(bendwavelength),200);
highlighty_arc=nan(length(bendwavelength),200);
%
%Find bends using the Filter
for i=1:length(bendwavelength)
[highlightX, highlightY, indi1] = userSelectBend(handles.geovar.intS, bendwavelength(i),...
handles.geovar.equallySpacedX,handles.geovar.equallySpacedY,handles.geovar.newInflectionPts,...
handles.geovar.sResample);
highlightx_arc(i,1:length(highlightX))=highlightX;
highlighty_arc(i,1:length(highlightY))=highlightY;
indi(i,1:2)=indi1(1,1:2);
end
%upload data
handles.highlightx_arc = num2str(highlightx_arc);
setappdata(0, 'highlightx_arc', handles.highlightx_arc);
handles.highlighty_arc = num2str(highlighty_arc);
setappdata(0, 'highlighty_arc', handles.highlighty_arc);
handles.indi = num2str(indi);
setappdata(0, 'indi', handles.indi);
guidata(hObject,handles)
elseif handles.minsin~=handles.maxsin & handles.minarc~=handles.maxarc
%Find values between min and max
inds = +not(abs(sign(sign(handles.minarc - handles.geovar.wavelengthOfBends) + sign(handles.maxarc - handles.geovar.wavelengthOfBends))));
inds1 = +not(abs(sign(sign(handles.minsin - handles.geovar.sinuosityOfBends) + sign(handles.maxsin - handles.geovar.sinuosityOfBends))));
for i=1:length(inds)
if inds(i)==1 & inds1(i)==1
d(i)=1;
else
d(i)=0;
end
end
inds=d';
%
bendwavelength=find(inds==1);
%upload data
handles.bendwavelength = num2str(bendwavelength);
setappdata(0, 'bendwavelength', handles.bendwavelength);
guidata(hObject,handles)
handles.filter=1;
% Apply Filter
% Call the "userSelectBend" function to get the index of intersection
% points and the highlighted bend limits.
highlightx_arc=nan(length(bendwavelength),200);
highlighty_arc=nan(length(bendwavelength),200);
%
%Find bends using the Filter
for i=1:length(bendwavelength)
[highlightX, highlightY, indi1] = userSelectBend(handles.geovar.intS, bendwavelength(i),...
handles.geovar.equallySpacedX,handles.geovar.equallySpacedY,handles.geovar.newInflectionPts,...
handles.geovar.sResample);
highlightx_arc(i,1:length(highlightX))=highlightX;
highlighty_arc(i,1:length(highlightY))=highlightY;
indi(i,1:2)=indi1(1,1:2);
end
%upload data
handles.highlightx_arc = num2str(highlightx_arc);
setappdata(0, 'highlightx_arc', handles.highlightx_arc);
handles.highlighty_arc = num2str(highlighty_arc);
setappdata(0, 'highlighty_arc', handles.highlighty_arc);
handles.indi = num2str(indi);
setappdata(0, 'indi', handles.indi);
guidata(hObject,handles)
elseif handles.minarc==0 & handles.maxarc==0 & handles.minsin==0 & handles.maxsin==0
handles.filter=0;
end
%%
%Function to plot
significance=get(handles.significance,'String');
if isempty(significance)
SIGLVL=0.95;
else
SIGLVL=str2num(significance)/100;
end
sel=get(handles.curvatureandangle,'Value');
Module=1;
vars=[];
mStat_plotWavel(handles.geovar,sel,SIGLVL,handles.filter,handles.axest,Module,vars)
end
% --------------------------------------------------------------------
function datacursor_ClickedCallback(hObject, eventdata, handles)
%empty
function mStat_PlotCurvature(handles)
% empty
% --------------------------------------------------------------------
function uitoggletool1_OnCallback(hObject, eventdata, handles)
% empty
% --------------------------------------------------------------------
function datacursor_OnCallback(hObject, eventdata, handles)
%data cursor
dcm_obj = datacursormode(gcf);
guidata(hObject,handles)
set(dcm_obj,'UpdateFcn',@mStat_myupdatefcn);
set(dcm_obj,'Displaystyle','Window','Enable','on');
c_info = getCursorInfo(dcm_obj);
if isempty(c_info)
else
% Graph
DeltaCentS=handles.geovar.sResample(2,1)-handles.geovar.sResample(1,1);
xmin=min(handles.geovar.sResample(:,1));
n = length(handles.geovar.sResample);
xlim = [xmin,(n-1)*DeltaCentS+xmin];
dt=1;
Abscise = [1:length(handles.geovar.cResample)]*dt + xmin ;
%[1] Plot curvature variation
axes(handles.curveandangle_axes)
%find equal
[row1,]= find(c_info.Position(1,1)==handles.geovar.equallySpacedX);
dimlessx=Abscise*DeltaCentS./handles.geovar.width;
dimlessy=handles.geovar.cResample.*handles.geovar.width;
plot(dimlessx,dimlessy,'black -','linewidth',1.0);
hold on
plot(dimlessx(row1),dimlessy(row1),'or');
set(gca,'XLim',xlim(:)./handles.geovar.width);
xlabel('S*','fontsize',10);
ylabel('C*','fontsize',10);
title('Signature of the channel curvature','fontsize',13);
grid on;
hold off;
end
% --- Executes during object creation, after setting all properties.
function datacursor_CreateFcn(hObject, eventdata, handles)
% empty
% --------------------------------------------------------------------
function datacursor_OffCallback(hObject, eventdata, handles)
datacursormode off
% --- Executes on slider movement.
function slidercurvature_Callback(hObject, eventdata, handles)
scurv=round(get(handles.slidercurvature,'Value'));
%upload data
handles.scurv = num2str(scurv);
setappdata(0, 'scurv', handles.scurv);
significance=get(handles.significance,'String');
if isempty(significance)
SIGLVL=0.95;
else
SIGLVL=str2num(significance)/100;
end
sel=get(handles.curvatureandangle,'Value');
Module=1;
vars=[];
handles.filter=2;
mStat_plotWavel(handles.geovar,sel,SIGLVL,handles.filter,handles.axest,Module,vars)
% axes(handles.curveandangle_axes)
% % Graph
% DeltaCentS=handles.geovar.sResample(2,1)-handles.geovar.sResample(1,1);
% xmin=min(handles.geovar.sResample(:,1));
% n = length(handles.geovar.sResample);
% xlim = [xmin,(n-1)*DeltaCentS+xmin];
% dt=1;
% Abscise = [1:length(handles.geovar.cResample)]*dt + xmin ;
% ssto= handles.geovar.cResample(:,1);
% hold on
% if scurv==0
% line((Abscise(scurv)*DeltaCentS)./handles.geovar.width,[1:length(handles.geovar.cResample)], 'color', 'r', 'LineWidth',5);
% else
% line((Abscise(scurv:scurv+1)*DeltaCentS)./handles.geovar.width,ssto(scurv:scurv+1).*handles.geovar.width, 'color', 'r', 'LineWidth',5);
% end
% hold off
%
% axes(handles.centerline_axes)
% --- Executes during object creation, after setting all properties.
function slidercurvature_CreateFcn(hObject, eventdata, handles)
% hObject handle to slidercurvature (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end