Mercurial > hg > ltpda
comparison m-toolbox/m/gui/ltpdv/ltpdv.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function ltpdv(varargin) | |
2 % LTPDV dataviewer based on AOs and functions in LTPDA. | |
3 % | |
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
5 % | |
6 % DESCRIPTION: LTPDV dataviewer based on classes and methods in LTPDA. | |
7 % | |
8 % | |
9 % VERSION: $Id: ltpdv.m,v 1.7 2008/09/02 07:51:48 hewitson Exp $ | |
10 % | |
11 % | |
12 % HISTORY: 22-04-08 M Hewitson | |
13 % Creation | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 | |
18 %% Check if I exist already | |
19 id = findobj('Tag', 'LTPDVmainfig'); | |
20 if ~isempty(id) | |
21 figure(id) | |
22 return | |
23 end | |
24 | |
25 %% Some initial setup | |
26 | |
27 Gproperties.Gcol = [240 240 240]/255; | |
28 Gproperties.Gwidth = 1100; | |
29 Gproperties.Gheight = 700; | |
30 Gproperties.Gborder = 10; | |
31 Gproperties.fontsize = 12; | |
32 | |
33 Gproperties.Screen = get(0,'screensize'); | |
34 Gproperties.Gposition = [Gproperties.Screen(3)/2-Gproperties.Gwidth/2 ... | |
35 Gproperties.Screen(4)/2-Gproperties.Gheight/2 ... | |
36 Gproperties.Gwidth... | |
37 Gproperties.Gheight]; | |
38 | |
39 % Initialize and hide the GUI as it is being constructed. | |
40 mainfig = figure('Name', 'LTPDA Dataviewer',... | |
41 'NumberTitle', 'off',... | |
42 'Visible','off',... | |
43 'Position',Gproperties.Gposition,... | |
44 'Color', Gproperties.Gcol,... | |
45 'Toolbar', 'none',... | |
46 'MenuBar', 'none',... | |
47 'Resize', 'on',... | |
48 'Tag', 'LTPDVmainfig'); | |
49 | |
50 % Set mainfig callbacks | |
51 set(mainfig, 'CloseRequestFcn', {'ltpdv_cb_mainfigClose', mainfig}); | |
52 | |
53 % Set Application data | |
54 setappdata(mainfig, 'Gproperties', Gproperties); | |
55 | |
56 %% Setup GUI elements | |
57 | |
58 Hmargin = Gproperties.Gborder/Gproperties.Gwidth; | |
59 Vmargin = Gproperties.Gborder/Gproperties.Gheight; | |
60 BottomMargin = 0.2; | |
61 SplitPoint = 0.35; | |
62 | |
63 %----------- Object list | |
64 | |
65 % Panel | |
66 pleft = Hmargin; | |
67 phght = 1-2*Vmargin; | |
68 pbot = (1 - Vmargin - phght); | |
69 pwid = SplitPoint - 2*Hmargin; | |
70 ph = uipanel(mainfig, 'Title','Object List','FontSize', Gproperties.fontsize,... | |
71 'BackgroundColor', [0.6 0.7 0.9],... | |
72 'Position',[pleft pbot pwid phght], 'Units', 'normalized'); | |
73 | |
74 % Object list | |
75 pmarg = 0.025; | |
76 Lleft = pmarg; | |
77 Lbottom = 0.4+pmarg; | |
78 Lwidth = 1-2*pmarg; | |
79 Lheight = 1-Lbottom-pmarg; | |
80 th = uitable(ph, ... | |
81 'Units', 'normalized',... | |
82 'ColumnName', {'Name','Type'}, ... | |
83 'ColumnWidth', {220, 100}, ... | |
84 'ColumnEditable', [true false], ... | |
85 'Position', [Lleft Lbottom Lwidth Lheight],... | |
86 'Tag', 'LTPDVobjList', ... | |
87 'CellSelectionCallback', {@ltpdv_objectList_select, mainfig}, ... | |
88 'CellEditCallback', {@ltpdv_objectList_edit, mainfig}); | |
89 | |
90 % Set column widths | |
91 set(th, 'Units', 'pixel'); | |
92 pos = get(th, 'Position'); | |
93 set(th, 'Units', 'normalized'); | |
94 set(th, 'ColumnWidth', {0.7*pos(3), 0.2*pos(3)}); | |
95 | |
96 % Delete objects button | |
97 pleft = pmarg; | |
98 phght = 0.05; | |
99 pbott = Lbottom - phght - pmarg; | |
100 pwidt = 0.2; | |
101 pbh = uicontrol(ph,'Style','pushbutton',... | |
102 'String','Delete',... | |
103 'Callback', {@ltpdv_delete_objects, mainfig}, ... | |
104 'Units', 'normalized', ... | |
105 'Position',[pleft pbott pwidt phght]); | |
106 | |
107 % Clear objects button | |
108 pleft = pmarg + pwidt + pmarg; | |
109 phght = 0.05; | |
110 pbott = Lbottom - phght - pmarg; | |
111 pwidt = 0.2; | |
112 pbh = uicontrol(ph,'Style','pushbutton',... | |
113 'String','Clear',... | |
114 'Callback', {@ltpdv_delete_objects, mainfig, 'all'}, ... | |
115 'Units', 'normalized', ... | |
116 'Position',[pleft pbott pwidt phght]); | |
117 | |
118 % Save objects button | |
119 pleft = pleft + pwidt + pmarg; | |
120 phght = 0.05; | |
121 pbott = Lbottom - phght - pmarg; | |
122 pwidt = 0.2; | |
123 pbh = uicontrol(ph,'Style','pushbutton',... | |
124 'String','Save',... | |
125 'Callback', {@ltpdv_save_objects, mainfig}, ... | |
126 'Units', 'normalized', ... | |
127 'Position',[pleft pbott pwidt phght]); | |
128 | |
129 % Load objects button | |
130 pleft = pleft + pwidt + pmarg; | |
131 phght = 0.05; | |
132 pbott = Lbottom - phght - pmarg; | |
133 pwidt = 0.2; | |
134 pbh = uicontrol(ph,'Style','pushbutton',... | |
135 'String','Load',... | |
136 'Callback', {@ltpdv_load_objects, mainfig}, ... | |
137 'Units', 'normalized', ... | |
138 'Position',[pleft pbott pwidt phght]); | |
139 | |
140 % Export objects button | |
141 pleft = pmarg; | |
142 phght = 0.05; | |
143 pbott = pbott - phght - pmarg; | |
144 pwidt = 0.2; | |
145 pbh = uicontrol(ph,'Style','pushbutton',... | |
146 'String','Export',... | |
147 'Callback', {@ltpdv_export_objects, mainfig}, ... | |
148 'Units', 'normalized', ... | |
149 'Position',[pleft pbott pwidt phght]); | |
150 | |
151 % Explore objects button | |
152 pleft = pleft + pwidt + pmarg; | |
153 pbh = uicontrol(ph,'Style','pushbutton',... | |
154 'String','Explore',... | |
155 'Callback', {@ltpdv_explore_objects, mainfig}, ... | |
156 'Units', 'normalized', ... | |
157 'Position',[pleft pbott pwidt phght]); | |
158 | |
159 | |
160 %------- | |
161 % Plot button | |
162 bw = 0.2; | |
163 bl = pmarg; | |
164 bh = 0.05; | |
165 bb = pmarg; | |
166 | |
167 pbh = uicontrol(ph,'Style','pushbutton',... | |
168 'String','Plot',... | |
169 'Callback', {@ltpdv_plot, mainfig}, ... | |
170 'Units', 'normalized', ... | |
171 'Position',[bl bb bw bh]); | |
172 | |
173 % Plot history button | |
174 bw = 0.2; | |
175 bl = bl+bw+pmarg; | |
176 bh = 0.05; | |
177 bb = pmarg; | |
178 | |
179 pbh = uicontrol(ph,'Style','pushbutton',... | |
180 'String','Plot History',... | |
181 'Callback', {@ltpdv_hist_plot, mainfig}, ... | |
182 'Units', 'normalized', ... | |
183 'Position',[bl bb bw bh]); | |
184 | |
185 | |
186 %----------- TAB PANEL | |
187 PanLeft = SplitPoint; | |
188 Tleft = PanLeft + Hmargin; | |
189 Theight = 1-2*Vmargin ; | |
190 Tbottom = (1 - Vmargin - Theight); | |
191 Twidth = (1-PanLeft)-2*Hmargin; | |
192 | |
193 htab = uitabgroup('Parent', mainfig, ... | |
194 'Units','normalized',... | |
195 'Position',[Tleft Tbottom Twidth Theight], 'SelectionChangeFcn', {@ltpdv_tabChanged}); | |
196 t1 = uitab(htab, 'title', 'Import'); | |
197 t2 = uitab(htab, 'title', 'Math'); | |
198 t3 = uitab(htab, 'title', 'Preprocessing'); | |
199 t4 = uitab(htab, 'title', 'Filter'); | |
200 t5 = uitab(htab, 'title', 'Spectral'); | |
201 t6 = uitab(htab, 'title', 'Object Properties'); | |
202 t7 = uitab(htab, 'title', 'Plot'); | |
203 | |
204 % Set app data | |
205 setappdata(mainfig, 'LTPDAobjects', {}); | |
206 setappdata(mainfig, 'ImportWorkspaceSelectedRows', []); | |
207 setappdata(mainfig, 'ObjectListSelectedRows', []); | |
208 setappdata(mainfig, 'Filters', []); | |
209 setappdata(mainfig, 'FilterPoles', []); | |
210 setappdata(mainfig, 'FilterZeros', []); | |
211 setappdata(mainfig, 'TimesList', {}); | |
212 | |
213 | |
214 % Build panels | |
215 ltpdv_buildImportPanel(t1, mainfig); | |
216 ltpdv_buildMathPanel(t2, mainfig); | |
217 ltpdv_buildPreprocessPanel(t3, mainfig); | |
218 ltpdv_buildFilterPanel(t4, mainfig); | |
219 ltpdv_buildSpectralPanel(t5, mainfig); | |
220 ltpdv_buildPropertiesPanel(t6, mainfig); | |
221 ltpdv_buildPlotPanel(t7, mainfig); | |
222 | |
223 | |
224 %% Start the GUI | |
225 | |
226 % Make the GUI visible. | |
227 set(mainfig,'Visible','on') | |
228 | |
229 | |
230 end | |
231 | |
232 | |
233 | |
234 | |
235 |