-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwoPhotonInit.m
71 lines (52 loc) · 1.86 KB
/
TwoPhotonInit.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
function TwoPhotonInit
TwoPhotonPath = which('TwoPhotonInit');
pi = find(TwoPhotonPath==filesep);
TwoPhotonPath = [TwoPhotonPath(1:pi(end)) ];
global TwoPhotonPlatform TwoPhotonSynchronization
TwoPhotonConfigurationSuccessful = 0;
try,
TwoPhotonConfiguration;
TwoPhotonConfigurationSuccessful = 1;
catch,
% either it did not exist or had an error
z = which('TwoPhotonConfiguration');
if ~isempty(z),
msgbox(['Error in ' z '; you will be prompted to re-initialize this file. This likely occurred because of a software upgrade or an attempt by the user to edit the TwoPhotonConfiguration.m file manually.']);
end;
end;
if ~VerifyTwoPhotonConfiguration | ~TwoPhotonConfigurationSuccessful,
TwoPhotonConfigurationInterview;
z = which('TwoPhotonConfiguration');
TwoPhotonConfiguration;
end;
% check for TwoPhotonUserInit
mypwd = which('TwoPhotonUserInit');
if isempty(mypwd),
configpath = config_dirname;
disp(['No TwoPhotonUserInit file was found in ' configpath '. We will add one for you; modify it at will.']);
copyfile([TwoPhotonPath filesep 'TwoPhotonUserInit--example.m'],[configpath filesep 'TwoPhotonUserInit.m']);
end;
mypwd = which('TwoPhotonUserInit');
if ~isempty(mypwd),
TwoPhotonUserInit;
end;
addpath(TwoPhotonPath);
SetTwoPhotonConfiguration(TwoPhotonPlatform, TwoPhotonSynchronization);
d = dir([TwoPhotonPath filesep 'analyzetpstack' filesep 'analyzetpstack_draw_devices' filesep 'standard_draw_devices']);
for i=1:length(d),
if ~d(i).isdir,
k = findstr(d(i).name,'.m');
if ~isempty(k),
analyzetpstack_draw_devices('register',d(i).name(1:k-1));
end;
end;
end;
d = dir([TwoPhotonPath filesep 'analyzetpstack' filesep 'analyzetpstack_drift_devices' filesep 'standard_drift_devices']);
for i=1:length(d),
if ~d(i).isdir,
k = findstr(d(i).name,'.m');
if ~isempty(k),
analyzetpstack_drift_devices('register',d(i).name(1:k-1));
end;
end;
end;