-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelf_paced_Tapping_Hand.m
934 lines (731 loc) · 32.4 KB
/
Self_paced_Tapping_Hand.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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
% Program : Repetitive Movement Analysis
% Version : 1.2
% Function: Self_paced_Tapping_Hand GUI
% Authors : Safwan Al-Qadhi, Dr. Mehmet Eylem Kirlangic
function varargout = Self_paced_Tapping_Hand(varargin)
%SELF_PACED_TAPPING_HAND M-file for Self_paced_Tapping_Hand.fig
% SELF_PACED_TAPPING_HAND, by itself, creates a new SELF_PACED_TAPPING_HAND or raises the existing
% singleton*.
%
% H = SELF_PACED_TAPPING_HAND returns the handle to a new SELF_PACED_TAPPING_HAND or the handle to
% the existing singleton*.
%
% SELF_PACED_TAPPING_HAND('Property','Value',...) creates a new SELF_PACED_TAPPING_HAND using the
% given property value pairs. Unrecognized properties are passed via
% varargin to Self_paced_Tapping_Hand_OpeningFcn. This calling syntax produces a
%
% SELF_PACED_TAPPING_HAND('CALLBACK') and SELF_PACED_TAPPING_HAND('CALLBACK',hObject,...) call the
% local function named CALLBACK in SELF_PACED_TAPPING_HAND.M with the given input
% arguments.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Self_paced_Tapping_Hand
% Last Modified by GUIDE v2.5 17-May-2019 15:15:11
% ---------Autors: Al-Qadhi Safwan, Dr. Mehmet Eylem Kirlangic
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Self_paced_Tapping_Hand_OpeningFcn, ...
'gui_OutputFcn', @Self_paced_Tapping_Hand_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 Self_paced_Tapping_Hand is made visible.
function Self_paced_Tapping_Hand_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
% Choose default command line output for Self_paced_Tapping_Hand
handles.output = hObject;
global d; d=0;
imgFile = 'logo_juelich_300x60.jpg';
img=imread(imgFile);
image(img,'parent',handles.LogoJuelich);
set(handles.LogoJuelich,'XTick',[],'YTick',[]);
set(handles.LogoJuelich,'box','off');
set(handles.LogoJuelich,'Visible','off');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Self_paced_Tapping_Hand wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%% --- Outputs from this function are returned to the command line.
function varargout = Self_paced_Tapping_Hand_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
%% --- Executes on button press in load_all_data.
function load_all_data_Callback(hObject, eventdata, handles)
% hObject handle to load_all_data (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Patient_ID_file d;
global Patient_Hand_Left Time_Hand_Tapping_Left sg_Hand_Tapping_HPF_left;
global Patient_Hand_Right Time_Hand_Tapping_Right sg_Hand_Tapping_HPF_Right;
hand_tapping_axes(1)=handles.axes1;
hand_tapping_axes(2)=handles.axes2;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
[directory_name,Patient_ID_file]=find_folder();
if isdir(directory_name) && ~isequal(directory_name,'');
look_for_this_file_Hand_Tapping_Left='Left_Hand_y_baseline.txt';
[Patient_Hand_Left,Patient_ID_file]=find_and_load_file_alone(look_for_this_file_Hand_Tapping_Left,directory_name);
if ~isempty(Patient_Hand_Left)
h = waitbar(0,'load data...');
for i=1:100, % computation here %
waitbar(i/100)
end
close(h)
d=0;
[Time_Hand_Tapping_Left,sg_Hand_Tapping_left,sg_Hand_Tapping_HPF_left]=hand_tapping_function(Patient_Hand_Left);
cla(hand_tapping_axes(1),'reset')
axes(hand_tapping_axes(1));
set(hand_tapping_axes(1),'XMinorTick','on')
plot(Time_Hand_Tapping_Left,sg_Hand_Tapping_left)
hold on
plot(Time_Hand_Tapping_Left,sg_Hand_Tapping_HPF_left,'r')
h=legend('Signal','BPF');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',7)
legend(hand_tapping_axes(1),'boxoff')
grid on
set(handles.filepath_left_tapping, 'String', Patient_Hand_Left,'Fontsize',7);
else
cla(hand_tapping_axes(1))
set(hand_tapping_axes(1),'XGrid','on','YGrid','on')
cla(hand_tapping_axes(3))
set(hand_tapping_axes(3),'XGrid','on','YGrid','on')
Time_Hand_Tapping_Left='';
sg_Hand_Tapping_HPF_left='';
end
look_for_this_file_Hand_Tapping_Right='Right_Hand_y_baseline.txt';
[Patient_Hand_Right,Patient_ID_file]=find_and_load_file_alone(look_for_this_file_Hand_Tapping_Right,directory_name);
if ~isempty(Patient_Hand_Right)
h = waitbar(0,'load data...');
for i=1:100, % computation here %
waitbar(i/100)
end
close(h)
[Time_Hand_Tapping_Right,sg_Hand_Tapping_Right,sg_Hand_Tapping_HPF_Right]=hand_tapping_function(Patient_Hand_Right);
cla(hand_tapping_axes(2),'reset')
axes(hand_tapping_axes(2));
set(hand_tapping_axes(2),'XMinorTick','on')
plot(Time_Hand_Tapping_Right,sg_Hand_Tapping_Right)
hold on
plot(Time_Hand_Tapping_Right,sg_Hand_Tapping_HPF_Right,'r')
h=legend('Signal','BPF');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',7)
legend(hand_tapping_axes(2),'boxoff')
grid on
set(handles.filepath_right_tapping, 'String', Patient_Hand_Right,'Fontsize',7);
else
cla(hand_tapping_axes(2))
set(hand_tapping_axes(2),'XGrid','on','YGrid','on')
cla(hand_tapping_axes(4))
set(hand_tapping_axes(4),'XGrid','on','YGrid','on')
Time_Hand_Tapping_Right='';
sg_Hand_Tapping_HPF_Right='';
end
set(handles.patient_number_hand_tapping,'String',Patient_ID_file)
end % if isdir
% Update handles structure
guidata(hObject, handles);
%% --- Executes on button press in load_file_left_hand.
function load_file_left_hand_Callback(hObject, eventdata, handles)
% hObject handle to load_file_left_hand (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Patient_Hand_Left Time_Hand_Tapping_Left sg_Hand_Tapping_HPF_left d;
hand_tapping_axes(1)=handles.axes1;
[Patient_Hand_Left] = Load_file();
if ~isempty(Patient_Hand_Left)
h = waitbar(0,'load data...');
for i=1:100, % computation here %
waitbar(i/100)
end
close(h)
d=0;
[Time_Hand_Tapping_Left,sg_Hand_Tapping_left,sg_Hand_Tapping_HPF_left]=hand_tapping_function(Patient_Hand_Left);
if ~isempty(sg_Hand_Tapping_left)
cla(hand_tapping_axes(1),'reset')
axes(hand_tapping_axes(1));
set(hand_tapping_axes(1),'XMinorTick','on')
plot(Time_Hand_Tapping_Left,sg_Hand_Tapping_left)
hold on
plot(Time_Hand_Tapping_Left,sg_Hand_Tapping_HPF_left,'r')
h=legend('Signal','BPF');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',7)
legend(hand_tapping_axes(1),'boxoff')
grid on
set(handles.patient_number_hand_tapping,'String','');
set(handles.filepath_left_tapping, 'String', Patient_Hand_Left,'Fontsize',7);
else
return;
end
else
end % if ~isempty(Patient_Hand_Left)
% Update handles structure
guidata(hObject, handles);
%% --- Executes on button press in load_file_right_hand.
function load_file_right_hand_Callback(hObject, eventdata, handles)
% hObject handle to load_file_right_hand (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Patient_Hand_Right Time_Hand_Tapping_Right sg_Hand_Tapping_HPF_Right d;
hand_tapping_axes(2)=handles.axes2;
[Patient_Hand_Right] = Load_file();
if ~isempty(Patient_Hand_Right)
h = waitbar(0,'load data...');
for i=1:100, % computation here %
waitbar(i/100)
end
close(h)
d=0;
[Time_Hand_Tapping_Right,sg_Hand_Tapping_Right,sg_Hand_Tapping_HPF_Right]=hand_tapping_function(Patient_Hand_Right);
if ~isempty(sg_Hand_Tapping_Right)
cla(hand_tapping_axes(2),'reset')
axes(hand_tapping_axes(2));
set(hand_tapping_axes(2),'XMinorTick','on')
plot(Time_Hand_Tapping_Right,sg_Hand_Tapping_Right)
hold on
plot(Time_Hand_Tapping_Right,sg_Hand_Tapping_HPF_Right,'r')
h=legend('Signal','BPF');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',7)
legend(hand_tapping_axes(2),'boxoff')
grid on
set(handles.patient_number_hand_tapping,'String','');
set(handles.filepath_right_tapping, 'String', Patient_Hand_Right,'Fontsize',7);
else
return;
end
else
end % if ~isempty(Patient_Hand_Right)
% Update handles structure
guidata(hObject, handles);
%% --- Executes on button press in analyse.
function analyse_Callback(hObject, eventdata, handles)
% hObject handle to analyse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Time_Hand_Tapping_Left sg_Hand_Tapping_HPF_left;
global Time_Hand_Tapping_Right sg_Hand_Tapping_HPF_Right;
global Left_measure_Time Right_measure_Time;
global VarNam_Left Valu_Left VarNam_Right Valu_Right;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
% if isempty(Patient_Hand_Left) & isempty(Patient_Hand_Right)
% errordlg('Please load data first ...','Error');
% return;
% end
if ~isempty(Time_Hand_Tapping_Left) && ~isempty(sg_Hand_Tapping_HPF_left)
[Tippingrate_Left_max,Tippingrate_Left_min,Left_mean_max,Left_mean_min,...
Left_std_max,Left_std_min,Time_ind_Left_max,Time_ind_Left_min,...
Left_mean_max_min,Left_std_min_max,Left_measure_Time,Time_plot1_Left,Time_plot2_Left]=...
hand_tapping_analys(Time_Hand_Tapping_Left,sg_Hand_Tapping_HPF_left);
VarNam_Left={'Mean maxima Tappingrate Hand Left in Hz','Mean minima Tappingrate Hand Left in Hz','Mean maxima Amplitude Hand Left in cm ',...
'Mean minima Amplitude Hand Left in cm ','std. maxima Tappingrate Hand Left','std. minima Tappingrate Hand Left',...
'Mean max and min Tappingrate Hand Left in Hz','std. max and min Tappingrate Hand Left','Duration in sec '};
Valu_Left=cell2mat({Tippingrate_Left_max,Tippingrate_Left_min,Left_mean_max, Left_mean_min,...
Left_std_max,Left_std_min,Left_mean_max_min, Left_std_min_max, Left_measure_Time});
cla(hand_tapping_axes(3))
axes(hand_tapping_axes(3));
set(hand_tapping_axes(3),'XMinorTick','on')
plot(Time_plot1_Left(1:end-1),Time_ind_Left_max,'r.','Markersize',15.0)
hold on
plot(Time_plot2_Left(1:end-1),Time_ind_Left_min,'.','Markersize',15.0)
h=legend('Max','Min');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',8)
legend(hand_tapping_axes(3),'boxoff')
grid on
set(handles.Tippingrate_Left_max,'String',Valu_Left(1),'Fontsize',8,'fontweight','b');
set(handles.Tippingrate_Left_min,'String',Valu_Left(2),'Fontsize',8,'fontweight','b');
set(handles.Left_mean_max,'String',Valu_Left(3),'Fontsize',8,'fontweight','b');
set(handles.Left_mean_min,'String',Valu_Left(4),'Fontsize',8,'fontweight','b');
set(handles.Left_std_max,'String',Valu_Left(5),'Fontsize',8,'fontweight','b');
set(handles.Left_std_min,'String',Valu_Left(6),'Fontsize',8,'fontweight','b');
set(handles.Left_mean_max_min,'String',Valu_Left(7),'Fontsize',8,'fontweight','b');
set(handles.Left_std_min_max,'String',Valu_Left(8),'Fontsize',8,'fontweight','b');
set(handles.Left_measure_Time,'String',Valu_Left(9),'Fontsize',8,'fontweight','b');
else
set(handles.Tippingrate_Left_max,'String','');
set(handles.Tippingrate_Left_min,'String','');
set(handles.Left_mean_max,'String','');
set(handles.Left_mean_min,'String','');
set(handles.Left_std_max,'String','');
set(handles.Left_std_min,'String','');
set(handles.Left_mean_max_min,'String','');
set(handles.Left_std_min_max,'String','');
set(handles.Left_measure_Time,'String','');
end
if ~isempty(Time_Hand_Tapping_Right) && ~isempty(sg_Hand_Tapping_HPF_Right)
[Tippingrate_Right_max,Tippingrate_Right_min,Right_mean_max,Right_mean_min,...
Right_std_max,Right_std_min,Time_ind_Right_max,Time_ind_Right_min,...
Right_mean_max_min,Right_std_min_max,Right_measure_Time,Time_plot1_Right,Time_plot2_Right]=...
hand_tapping_analys(Time_Hand_Tapping_Right,sg_Hand_Tapping_HPF_Right);
VarNam_Right={'Mean maxima Tappingrate Hand Right in Hz ','Mean minima Tappingrate Hand Right in Hz','Mean maxima Amplitude Hand Right in cm ',...
'Mean minima Amplitude Hand Right in cm ','std. maxima Tippingrate Hand Right','std. minima Tappingrate Hand Right',...
'Mean max and min Tappingrate Hand Right in Hz','std. max and min Tappingrate Hand Right','Duration in sec '};
Valu_Right=cell2mat({Tippingrate_Right_max,Tippingrate_Right_min,Right_mean_max,Right_mean_min,...
Right_std_max,Right_std_min,Right_mean_max_min, Right_std_min_max,Right_measure_Time});
cla(hand_tapping_axes(4))
axes(hand_tapping_axes(4));
set(hand_tapping_axes(4),'XMinorTick','on')
plot(Time_plot1_Right(1:end-1),Time_ind_Right_max,'r.','Markersize',15.0)
hold on
plot(Time_plot2_Right(1:end-1),Time_ind_Right_min,'.','Markersize',15.0)
h=legend('Max','Min');
set(h,'Location','NorthEast','Orientation','vertical','Fontsize',8)
legend(hand_tapping_axes(4),'boxoff')
grid on
set(handles.Tippingrate_Right_max,'String',Valu_Right(1),'Fontsize',8,'fontweight','b');
set(handles.Tippingrate_Right_min,'String',Valu_Right(2),'Fontsize',8,'fontweight','b');
set(handles.Right_mean_max,'String',Valu_Right(3),'Fontsize',8,'fontweight','b');
set(handles.Right_mean_min,'String',Valu_Right(4),'Fontsize',8,'fontweight','b');
set(handles.Right_std_max,'String',Valu_Right(5),'Fontsize',8,'fontweight','b');
set(handles.Right_std_min,'String',Valu_Right(6),'Fontsize',8,'fontweight','b');
set(handles.Right_mean_max_min,'String',Valu_Right(7),'Fontsize',8,'fontweight','b');
set(handles.Right_std_min_max,'String',Valu_Right(8),'Fontsize',8,'fontweight','b');
set(handles.Right_measure_Time,'String',Valu_Right(9),'Fontsize',8,'fontweight','b');
else
set(handles.Tippingrate_Right_max,'String','');
set(handles.Tippingrate_Right_min,'String','');
set(handles.Right_mean_max,'String','');
set(handles.Right_mean_min,'String','');
set(handles.Right_std_max,'String','');
set(handles.Right_std_min,'String','');
set(handles.Right_mean_max_min,'String','');
set(handles.Right_std_min_max,'String','');
set(handles.Right_measure_Time,'String','');
end
% Update handles structure
guidata(hObject, handles);
%%
function x_start_Callback(hObject, eventdata, handles)
% hObject handle to x_start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of x_start as text
% str2double(get(hObject,'String')) returns contents of x_start as a double
global X_start X_end;
X_end=str2double(get(handles.x_end,'String'));
X_start=str2double(get(handles.x_start,'String'));
hand_tapping_axes(1)=handles.axes1;
hand_tapping_axes(2)=handles.axes2;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
str=get(handles.select_graph, 'String');
val=str2double(str{get(handles.select_graph, 'value')});
if isnan(val)
errordlg('please select graph first','Error');
return;
end
if X_start >= X_end
errordlg('Input must be smaller than end','Error');
set(hObject, 'String', 0);
X_start=str2double(get(hObject,'String'));
set(handles.axes1,'Xlim',[X_start X_end]);
elseif isnan(X_start)
errordlg('Input must be a number','Error');
set(hObject, 'String', 0);
X_start=str2double(get(hObject,'String'));
set(handles.axes1,'Xlim',[X_start X_end]);
else
set(hand_tapping_axes(val),'Xlim',[X_start X_end]);
end
% Update handles structure
guidata(hObject, handles);
%% --- Executes during object creation, after setting all properties.
function x_start_CreateFcn(hObject, eventdata, handles)
% hObject handle to x_start (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 x_end_Callback(hObject, eventdata, handles)
% hObject handle to x_end (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of x_end as text
% str2double(get(hObject,'String')) returns contents of x_end as a double
global X_start X_end;
X_end=str2double(get(handles.x_end,'String'));
X_start=str2double(get(handles.x_start,'String'));
hand_tapping_axes(1)=handles.axes1;
hand_tapping_axes(2)=handles.axes2;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
str=get(handles.select_graph, 'String');
val=str2double(str{get(handles.select_graph, 'value')});
if isnan(val)
errordlg('please select graph first','Error');
return;
end
if X_end <= X_start
errordlg('Input must be bigger than start','Error');
set(hObject, 'String', 25);
X_end=str2double(get(hObject,'String'));
set(hand_tapping_axes(val),'Xlim',[X_start Right_measure_Time+2]);
elseif isnan(X_end)
set(hObject, 'String', 25);
errordlg('Input must be a number','Error');
X_end=str2double(get(hObject,'String'));
set(hand_tapping_axes(val),'Xlim',[X_start X_end]);
else
set(hand_tapping_axes(val),'Xlim',[X_start X_end]);
end
% Update handles structure
guidata(hObject, handles);
%% --- Executes during object creation, after setting all properties.
function x_end_CreateFcn(hObject, eventdata, handles)
% hObject handle to x_end (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 patient_number_hand_tapping_Callback(hObject, eventdata, handles)
% hObject handle to patient_number_hand_tapping (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of patient_number_hand_tapping as text
% str2double(get(hObject,'String')) returns contents of patient_number_hand_tapping as a double
global Patient_ID Patient_ID_file;
Patient_ID=get(hObject,'String');
% if ~isempty(Patient_ID)
% Patient_ID='';
% else
% Patient_ID=Patient;
% end
% --- Executes during object creation, after setting all properties.
function patient_number_hand_tapping_CreateFcn(hObject, eventdata, handles)
% hObject handle to patient_number_hand_tapping (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 save.
function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% global TA SA;
% SS=[TA,SA];
% save(strcat(saveFilePath, saveFileName),'SS','-ASCII');
% SS = struct('textdata', 'x_start Patient_Paced_Tapping', 'data', [TA,SA]);
% hier konnte struct mit save nicht gespeichert werden.
global Patient_ID Patient_ID_file;
global VarNam_Left Valu_Left VarNam_Right Valu_Right;;
try
Patient_ID=get(handles.patient_number_hand_tapping,'String');
catch
end
if isempty(Patient_ID),
pause(0.2);
uiwait(errordlg('Please enter Patient ID and press save ...', 'Error', 'modal'))
return;
else
% set(handles.load_all_data, 'Visible', 'off');
% set(handles.load_file_left_hand, 'Visible', 'off');
% set(handles.load_file_right_hand, 'Visible', 'off');
% set(handles.axes_tools, 'Visible', 'off');
% set(handles.forward, 'Visible', 'off');
% set(handles.backward, 'Visible', 'off');
% set(handles.analyse, 'Visible', 'off');
% set(handles.home, 'Visible', 'off');
% set(handles.print, 'Visible', 'off');
% set(handles.save, 'Visible', 'off');
% set(handles.exit, 'Visible', 'off');
frame = getframe(Self_paced_Tapping_Hand);
% set(handles.load_all_data, 'Visible', 'on');
% set(handles.load_file_left_hand, 'Visible', 'on');
% set(handles.load_file_right_hand, 'Visible', 'on');
% set(handles.axes_tools, 'Visible', 'on');
% set(handles.forward, 'Visible', 'on');
% set(handles.backward, 'Visible', 'on');
% set(handles.analyse, 'Visible', 'on');
% set(handles.home, 'Visible', 'on');
% set(handles.print, 'Visible', 'on');
% set(handles.save, 'Visible', 'on');
% set(handles.exit, 'Visible', 'on');
Name=Patient_ID;
[saveFileName, saveFilePath] = uiputfile({...
'*.bmp','bmp-Image(*.bmp)';...
% '*.txt','txt-Files (*.txt)';...
% '*.*', 'All Files (*.*)'
},...
'Save data as', Name);
if isequal(saveFileName,0) || isequal(saveFilePath,0)
uiwait(warndlg('No data was saved','filename error'));
else
try
% mkdir(saveFilePath,Name); Newpath=strcat(saveFilePath,Name)
fid = fopen(strcat(saveFilePath,Name,'_HandTappingLeft.txt'), 'wt');
for i=1:numel(Valu_Left);
fprintf(fid,'%-50s\t % 5.3f\n',VarNam_Left{i},Valu_Left(i));
end
fclose(fid)
% fid = fopen(strcat(saveFilePath,Name,'_HandTappingLeft.csv'), 'wt');
% for i=1:numel(Valu_Left);
% fprintf(fid,'%s %10.4f\n',VarNam_Left{i},Valu_Left(i));
% end
% fclose(fid)
fid = fopen(strcat(saveFilePath,Name,'_HandTappingRight.txt'), 'wt');
for i=1:numel(Valu_Right);
fprintf(fid,'%-50s\t % 5.3f\n',VarNam_Right{i},Valu_Right(i));
end
fclose(fid)
imwrite(frame.cdata,strcat(saveFilePath,Name,'_Hand_Tapping.bmp'));
uiwait(msgbox('Data was saved successfully: ', 'Data saved', 'modal'));
catch
warndlg('Could not save data', 'Data error', 'modal')
rethrow(lasterror);
end;
end;
try
% Update handles structure
guidata(hObject, handles);
catch
return;
end;
end
%% --- Executes on button press in print.
function print_Callback(hObject, eventdata, handles)
% hObject handle to print (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GUI_HANDLE=Self_paced_Tapping_Hand();
set(handles.load_all_data, 'Visible', 'off');
set(handles.load_file_left_hand, 'Visible', 'off');
set(handles.load_file_right_hand, 'Visible', 'off');
set(handles.axes_tools, 'Visible', 'off');
set(handles.forward, 'Visible', 'off');
set(handles.backward, 'Visible', 'off');
set(handles.analyse, 'Visible', 'off');
set(handles.home, 'Visible', 'off');
set(handles.print, 'Visible', 'off');
set(handles.save, 'Visible', 'off');
set(handles.exit, 'Visible', 'off');
set(GUI_HANDLE, 'PaperType', 'A4');
set(GUI_HANDLE, 'PaperOrientation', 'landscape');
set(GUI_HANDLE, 'PaperPositionMode','auto');
set(GUI_HANDLE, 'InvertHardCopy', 'off');
set(GUI_HANDLE, 'InvertHardCopy', 'off');
print(GUI_HANDLE);
set(handles.load_all_data, 'Visible', 'on');
set(handles.load_file_left_hand, 'Visible', 'on');
set(handles.load_file_right_hand, 'Visible', 'on');
set(handles.axes_tools, 'Visible', 'on');
set(handles.forward, 'Visible', 'on');
set(handles.backward, 'Visible', 'on');
set(handles.analyse, 'Visible', 'on');
set(handles.home, 'Visible', 'on');
set(handles.print, 'Visible', 'on');
set(handles.save, 'Visible', 'on');
set(handles.exit, 'Visible', 'on');
gui_data.print = 0;
try
% Update handles structure
guidata(hObject, handles);
catch
return;
end;
%% --- Executes on button press in home.
function home_Callback(hObject, eventdata, handles)
% hObject handle to home (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Repetitive_Movement_Analysis()
%% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata, handles)
% hObject handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Patient_ID Patient_ID_file;
Patient_ID=get(handles.patient_number_hand_tapping,'String');
str1='Yes';
str2='No';
str3='';
Qd=questdlg('do you want to save data ','Save Date',str1,str2,str1);
switch Qd
case str1
save_Callback()
pause(0.2)
return;
case str2
close(Self_paced_Tapping_Hand)
clear all
clc
fclose('all');
disp(' ');
disp('***** END Self-paced Tapping Analysis - Hand GUI *****');
disp(' ');
disp(' ');
clear all;
end
%% --- Executes on selection change in select_graph.
function select_graph_Callback(hObject, eventdata, handles)
% hObject handle to select_graph (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns select_graph contents as cell array
% contents{get(hObject,'Value')} returns selected item from select_graph
global d;
d=0;
str=get(handles.select_graph, 'String');
val=get(handles.select_graph, 'value');
switch str{val}
case '' % User select.
case '1' % User select.
case '2' % User select.
case '3' % User select.
case '4' % User select.
end
% --- Executes during object creation, after setting all properties.
function select_graph_CreateFcn(hObject, eventdata, handles)
% hObject handle to select_graph (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
set(hObject, 'String', {'',...
'1',...
'2',...
'3',...
'4'});
%%
function show_Callback(hObject, eventdata, handles)
% hObject handle to show (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of show as text
% str2double(get(hObject,'String')) returns contents of show as a double
global d;
d=0;
% --- Executes during object creation, after setting all properties.
function show_CreateFcn(hObject, eventdata, handles)
% hObject handle to show (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 forward.
function forward_Callback(hObject, eventdata, handles)
% hObject handle to forward (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global d;
global Left_measure_Time Right_measure_Time;
a=get(hObject,'value');
d=a+d;
hand_tapping_axes(1)=handles.axes1;
hand_tapping_axes(2)=handles.axes2;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
intervall=str2double(get(handles.show,'String'));
if intervall==0
intervall=1;
end
str=get(handles.select_graph, 'String');
val=str2double(str{get(handles.select_graph, 'value')});
if isnan(val)
errordlg('please select graph first','Error');
return;
elseif isequal(val,3) || isequal(val,4)
return;
end
switch val
case 1
dauer=Left_measure_Time;
case 2
dauer=Right_measure_Time;
end
cond=round(dauer/intervall);
if d*intervall>0 & d*intervall<=round(dauer)+intervall
set(hand_tapping_axes(val),'Xlim',[ (d-1)*intervall (d-1)*intervall+intervall]);
end
if d<0
d=0;
end
if d>=cond
d=cond;
end
% Update handles structure
guidata(hObject, handles);
%% --- Executes on button press in backward.
function backward_Callback(hObject, eventdata, handles)
% hObject handle to backward (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global d;
global Left_measure_Time Right_measure_Time;
a=get(hObject,'value');
d=d-a;
if sign(d)==-1
d=0;
end
hand_tapping_axes(1)=handles.axes1;
hand_tapping_axes(2)=handles.axes2;
hand_tapping_axes(3)=handles.axes3;
hand_tapping_axes(4)=handles.axes4;
intervall=str2double(get(handles.show,'String'));
if intervall==0
intervall=1;
end
str=get(handles.select_graph, 'String');
val=str2double(str{get(handles.select_graph, 'value')});
if isnan(val)
errordlg('please select graph first','Error');
return;
elseif isequal(val,3) || isequal(val,4)
return;
end
switch val
case 1
dauer=Left_measure_Time;
case 2
dauer=Right_measure_Time;
end
cond=round(dauer/intervall);
if d*intervall>=0 & d*intervall<=round(dauer)+intervall
set(hand_tapping_axes(val),'Xlim',[ (d+1)*intervall-intervall (d+1)*intervall]);
end
if d<0
d=0;
end
if d>cond
d=cond;
end
% Update handles structure
guidata(hObject, handles);