forked from netstim/leaddbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ea_correctcoords.m
74 lines (62 loc) · 3.4 KB
/
ea_correctcoords.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 newmarkers=ea_correctcoords(oldmarkers,trajectory,command,options)
newmarkers=oldmarkers;
grone=[0.1,0.5,3]; % step-sizes
switch command.Key
case 'uparrow'
try
trajvector=gettraj(trajectory,options.elside);
newmarkers(options.elside).head=oldmarkers(options.elside).head+grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).tail=oldmarkers(options.elside).tail+grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).x=oldmarkers(options.elside).x+grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).y=oldmarkers(options.elside).y+grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
end
case 'downarrow'
try
trajvector=gettraj(trajectory,options.elside);
newmarkers(options.elside).head=oldmarkers(options.elside).head-grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).tail=oldmarkers(options.elside).tail-grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).x=oldmarkers(options.elside).x-grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
newmarkers(options.elside).y=oldmarkers(options.elside).y-grone(2+ismember('shift',command.Modifier)-ismember('alt',command.Modifier))*trajvector;
end
% case 'leftarrow'
% % side=2
% try
%
% trajvector=gettraj(trajectory,2);
% side=2;
% newmarkers(side).head=oldmarkers(side).head+grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).tail=oldmarkers(side).tail+grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).x=oldmarkers(side).x+grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).y=oldmarkers(side).y+grone(1+ismember('shift',command.Modifier))*trajvector;
%
% end
%
% case 'rightarrow'
% % side=2
% try
% trajvector=gettraj(trajectory,2);
% side=2;
% newmarkers(side).head=oldmarkers(side).head-grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).tail=oldmarkers(side).tail-grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).x=oldmarkers(side).x-grone(1+ismember('shift',command.Modifier))*trajvector;
% newmarkers(side).y=oldmarkers(side).y-grone(1+ismember('shift',command.Modifier))*trajvector;
%
% end
end
switch command.Character
case {'+','*'}
try
trajvector=gettraj(trajectory,options.elside);
newmarkers(options.elside).tail=oldmarkers(options.elside).tail+trajvector.*(0.3*(ismember('shift',command.Modifier)+1));
end
case {'-','_'}
try
trajvector=gettraj(trajectory,options.elside);
newmarkers(options.elside).tail=oldmarkers(options.elside).tail-trajvector.*(0.3*(ismember('shift',command.Modifier)+1));
end
case 's'
%newmarkers(side).x=rotate(
end
%disp(command);
function traj=gettraj(trajectory,side)
traj=mean(diff(trajectory{side}));