-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisNavGUI.asv
More file actions
123 lines (96 loc) · 5.66 KB
/
VisNavGUI.asv
File metadata and controls
123 lines (96 loc) · 5.66 KB
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
function VisNavGUI(savedParamsFile)
% GUI to analyze electrophys and behavioural data. VisNavGUI can be called with or
% without a path to a previously saved preference file. The preference file
% should contain a structure with parmeters related to loading and
% analyzing the data. See CreateParamsStructure for details on the field of
% this parameter structure.
% To make easier the transfer of data from callback to callbacks VisNavGUI
% uses handle objects called Tstructure which is nothing but a handle
% with properties that can be added dynamically using the addprop method.
% Therefore, Tstructure behaves pretty much like a structure except that
% there is a pointer to it.
if nargin < 1
savedParamsFile = [];
end
%***************** Create and fill the parameter structure P ************************%
P = Tstructure('Params');
P = CreateParamsStructure(P, savedParamsFile);
%*********************** Create the data structure EXP ******************************%
EXP = Tstructure('Data');
EXP = CreateEXPStructure(EXP);
%************************* Create the main GUI window *******************************%
%3 pages created right away
%Later change this so that the number of cereated page depends on the
%type of data that are loaded
GUI = TMultigraph('VisNav');
GUI.addPage;
GUI.addPage;
%********************** Rename pages and create dialogs ****************************%
%3 dialogs created right away
%Later change this so that the dialogs are created depending on the type of
%data that are loaded
GUI.RenamePage(P.PlotParamsMaps.Page,P.PlotParamsMaps.PageTitle);
GUI.Hdividepage(P.PlotParamsMaps.Page, 2, [1 9]);
SpatialMapsDialog = Tdialog(GUI.window{P.PlotParamsMaps.Page,P.PlotParamsMaps.DialogWindow});
GUI.RenamePage(P.PlotParamsDecoder.Page,P.PlotParamsDecoder.PageTitle);
GUI.Hdividepage(P.PlotParamsDecoder.Page, 2, [1 9]);
DecodingDialog = Tdialog(GUI.window{P.PlotParamsDecoder.Page,P.PlotParamsDecoder.DialogWindow});
GUI.RenamePage(P.PlotParamsBehavior.Page,P.PlotParamsBehavior.PageTitle);
GUI.Hdividepage(P.PlotParamsBehavior.Page, 2, [1 9]);
BehaviorDialog = Tdialog(GUI.window{P.PlotParamsBehavior.Page,P.PlotParamsBehavior.DialogWindow});
%***************** UIcontrols of the top menus of the main figure ************************%
uimenu('Parent',GUI.FileMenu,'Label','load VR session',...
'Callback', @(source,event)GUI_LoadVRMenu_Callback(source, event, GUI, EXP, P, SpatialMapsDialog, DecodingDialog, BehaviorDialog));
uimenu('Parent',GUI.FileMenu,'Label','save file',...
'Callback',@(source,event)GUI_SaveMenu_Callback(source,event,EXP, P));
uimenu('Parent',GUI.FileMenu,'Label','load processed file',...
'Callback',@(source,event)GUI_LoadProcessedMenu_Callback(source, event, GUI, EXP, P, SpatialMapsDialog, DecodingDialog, BehaviorDialog));
uimenu('Parent',GUI.AnalysisMenu,'Label','Analysis Options','Callback',@(source,event)GUI_AnalysisOptions_Callback(source,event,P));
uimenu('Parent',GUI.AnalysisMenu,'Label','Compute 1D maps','Callback',@(source,event)GUI_Compute1Dmaps_Callback(source,event,P));
uimenu('Parent',GUI.AnalysisMenu,'Label','Compute 2D maps','Callback',@(source,event)GUI_Compute2Dmaps_Callback(source,event,P));
uimenu('Parent',GUI.AnalysisMenu,'Label','Run Bayesian decoder','Callback',@(source,event)GUI_BayesDecoder_Callback(source,event,P));
uimenu('Parent',GUI.PlotMenu,'Label','Save Figure','Callback',@(source,event)GUI_SaveFigure_Callback(source,event));
uimenu('Parent',GUI.PlotMenu,'Label','Save Plot','Callback',@(source,event)GUI_SavePlot_Callback(source,event));
uimenu('Parent',GUI.PlotMenu,'Label','Add colorbar','Callback',@(source,event)GUI_Colorbar_Callback(source,event));
end
%************************* Callback functions of the top menus ***************************** %
function GUI_LoadVRMenu_Callback(source, event, GUI, EXP, P, SpatialMapsDialog, DecodingDialog, BehaviorDialog)
%
%S = FAFF(arg);
% LoadandRun(EXP, animalname, iseries, iexplist, processedfiles);
% if ~Fprocessed
% end
S.animalname = 'M151104A_JF';
P.LoadParams.series = 126;
P.LoadParams.exp = S.explist;
for iexp = 1:5
S.Nav_path{1,1} = ['C:\Users\justj\Documents\DATA\M151104\behavior\126\10' num2str(iexp) filesep 'VRdata_M151104A_JF_126_session_10' num2str(iexp) '_trial001.mat'];
S.Nav_path{1,2} = ['C:\Users\justj\Documents\DATA\M151104\behavior\126\10' num2str(iexp) filesep 'Synch_VR_M151104A_JF_126_session_10' num2str(iexp) '_trial001.mat'];
S.Spk_path{1,1} = ['C:\Users\justj\Documents\DATA\M151104\ephys\126\10' num2str(iexp) filesep 'Spkdata_M151104A_JF_126_10' num2str(iexp) '.mat'];
S.Spk_path{1,2} = ['C:\Users\justj\Documents\DATA\M151104\ephys\126\10' num2str(iexp) filesep 'Synch_BR_M151104A_JF_126_10' num2str(iexp) '.mat'];
end
LoadData_VisNav(EXP, P, S);
figstr = [num2str(P.LoadParams.LoadParams.animal) ' ' num2str(P.LoadParams.LoadParams.iseries)];
GUI.updateTitle(figstr);
InstallSpatialMapsDialog(GUI, EXP, P, SpatialMapsDialog);
InstallDecodingDialog(GUI, EXP, P, DecodingDialog);
InstallBehaviorDialog(GUI, EXP, P, BehaviorDialog);
end
function GUI_SaveMenu_Callback(source,event,EXP,P)
end
function GUI_LoadProcessedMenu_Callback(source, event, GUI, EXP, P, SpatialMapsDialog, DecodingDialog, BehaviorDialog)
dirname = '';
[filename, dirname] = uigetfile(dirname);
S = load([dirname filename]);
exp = TVRData;
exp.Copyobj(S.EXP);
CreateDataStructure(exp, EXP);
figstr = [num2str(EXP.animal) ' ' num2str(EXP.series)];
GUI.updateTitle(figstr);
InstallSpatialMapsDialog(GUI, EXP, P, SpatialMapsDialog);
% InstallDecodingDialog(GUI, EXP, P, DecodingDialog);
% InstallBehaviorDialog(GUI, EXP, P, BehaviorDialog);
end
function GUI_AnalysisOptions_Callback(source,event,P)
AnalysisOptionsDialog = Tdialog([],'Analysis Options',[0.3 0.1 0.4 0.8]);
end