wolffd@0
|
1 function fig = som_show_gui(input,varargin)
|
wolffd@0
|
2
|
wolffd@0
|
3 %SOM_SHOW_GUI A GUI for using SOM_SHOW and associated functions.
|
wolffd@0
|
4 %
|
wolffd@0
|
5 % h = som_show_gui(sM);
|
wolffd@0
|
6 %
|
wolffd@0
|
7 % Input and output arguments:
|
wolffd@0
|
8 % sM (struct) a map struct: the SOM to visualize
|
wolffd@0
|
9 % h (scalar) a handle to the GUI figure
|
wolffd@0
|
10 %
|
wolffd@0
|
11 % This is a graphical user interface to make the usage of SOM_SHOW and
|
wolffd@0
|
12 % associated functions somewhat easier for beginning users of the SOM
|
wolffd@0
|
13 % Toolbox.
|
wolffd@0
|
14 %
|
wolffd@0
|
15 % How to use the GUI:
|
wolffd@0
|
16 % 1. Start the GUI by giving command som_show_gui(sM);
|
wolffd@0
|
17 % 2. Build a list of visualization planes using the buttons
|
wolffd@0
|
18 % ('Add components', etc.) on the right
|
wolffd@0
|
19 % - the options associated with each of the planes can be
|
wolffd@0
|
20 % modified by selecting a plane from the list, and pressing
|
wolffd@0
|
21 % the 'Plane options' button
|
wolffd@0
|
22 % - the controls below the list apply to all planes
|
wolffd@0
|
23 % - the subplot grid size can be controlled using the 'subplots'
|
wolffd@0
|
24 % field on top right corner, e.g. '4 3' to get 4 times 3 grid
|
wolffd@0
|
25 % 3. To visualize the planes, press the 'Visualize' button on the bottom.
|
wolffd@0
|
26 % 4. To add hits, labels, trajectories (or comets) to the
|
wolffd@0
|
27 % visualization, or clear them, or reset the colorbars,
|
wolffd@0
|
28 % see the tools available from the 'Tools' menu.
|
wolffd@0
|
29 % - the arguments to those tools are either given in the tool,
|
wolffd@0
|
30 % or read from the workspace ('Select variable' buttons)
|
wolffd@0
|
31 % - the tools always apply to the latest figure created
|
wolffd@0
|
32 % by the GUI
|
wolffd@0
|
33 % 5. To quit, press the 'Close' button on the bottom.
|
wolffd@0
|
34 %
|
wolffd@0
|
35 % Known bugs:
|
wolffd@0
|
36 % - Especially when using the adding tools, you can easily
|
wolffd@0
|
37 % give arguments which do not fit each other, and this
|
wolffd@0
|
38 % results in a lengthy (and often cryptic) error message.
|
wolffd@0
|
39 % In such a case, check the arguments you are giving to see
|
wolffd@0
|
40 % if there's something wrong with them. See function
|
wolffd@0
|
41 % SOM_SHOW_ADD for more information on how the options
|
wolffd@0
|
42 % can be set.
|
wolffd@0
|
43 % - The default values in the adding tools may not be
|
wolffd@0
|
44 % very reasonable: you may have to try out different
|
wolffd@0
|
45 % values for e.g. markersize before getting the kind of
|
wolffd@0
|
46 % result you want.
|
wolffd@0
|
47 %
|
wolffd@0
|
48 % SOM_SHOW_GUI has two subfunctions: VIS_SHOW_GUI_COMP and
|
wolffd@0
|
49 % VIS_SHOW_GUI_TOOL. These are for internal use of SOM_SHOW_GUI.
|
wolffd@0
|
50 %
|
wolffd@0
|
51 % See also SOM_SHOW, SOM_SHOW_ADD, SOM_SHOW_CLEAR, SOM_RECOLORBAR.
|
wolffd@0
|
52
|
wolffd@0
|
53 % Copyright (c) 2000 by Roman Feldman and Juha Vesanto
|
wolffd@0
|
54 % Contributed to SOM Toolbox on August 22nd, 2000
|
wolffd@0
|
55 % http://www.cis.hut.fi/projects/somtoolbox/
|
wolffd@0
|
56
|
wolffd@0
|
57 % Version 2.0beta roman 160800 juuso 220800
|
wolffd@0
|
58
|
wolffd@0
|
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
60 % MAIN %
|
wolffd@0
|
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
62
|
wolffd@0
|
63 warning off;
|
wolffd@0
|
64 if (nargin < 1)
|
wolffd@0
|
65 errordlg({'Make sure you have SOM as input argument'; ''; ...
|
wolffd@0
|
66 'example: som_show_gui(sMap)'},'Error in SOM_VIS: input arguments');
|
wolffd@0
|
67 return
|
wolffd@0
|
68 end
|
wolffd@0
|
69
|
wolffd@0
|
70 if isstruct(input)
|
wolffd@0
|
71 fig_h = create_main_gui(input);
|
wolffd@0
|
72 if (nargout > 0) fig = fig_h; end
|
wolffd@0
|
73 return;
|
wolffd@0
|
74
|
wolffd@0
|
75 elseif ischar(input)
|
wolffd@0
|
76 action = lower(input);
|
wolffd@0
|
77
|
wolffd@0
|
78 %
|
wolffd@0
|
79 udata = get(varargin{1},'UserData');
|
wolffd@0
|
80 plot_array = udata.plot_array;
|
wolffd@0
|
81 l = length(plot_array);
|
wolffd@0
|
82 list1_h = udata.h(1);
|
wolffd@0
|
83
|
wolffd@0
|
84 if (strcmp(action,''))
|
wolffd@0
|
85 errordlg('','Error in SOM_VIS: input arguments');
|
wolffd@0
|
86 return;
|
wolffd@0
|
87
|
wolffd@0
|
88 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
89 % add_selected_comp
|
wolffd@0
|
90 %
|
wolffd@0
|
91 elseif (strcmp(action,'add_selected_comp'))
|
wolffd@0
|
92 if isempty(plot_array(1).string), tmp = 1; else tmp = l+1; end
|
wolffd@0
|
93 [sel,ok] = listdlg('ListString',udata.sM.comp_names,...
|
wolffd@0
|
94 'Name','Component selection',...
|
wolffd@0
|
95 'PromptString','Select components to add');
|
wolffd@0
|
96 if ok & ~isempty(sel),
|
wolffd@0
|
97 for i=1:length(sel),
|
wolffd@0
|
98 plot_array(tmp+i-1).string = udata.sM.comp_names{sel(i)};
|
wolffd@0
|
99 plot_array(tmp+i-1).args = {'comp' sel(i)};
|
wolffd@0
|
100 udata.property{tmp+i-1} = {0};
|
wolffd@0
|
101 end
|
wolffd@0
|
102 set(list1_h,'Value',tmp+i-1, ...
|
wolffd@0
|
103 'String',{plot_array(:).string});
|
wolffd@0
|
104 end
|
wolffd@0
|
105
|
wolffd@0
|
106 udata.plot_array = plot_array;
|
wolffd@0
|
107 set(varargin{1},'UserData',udata);
|
wolffd@0
|
108
|
wolffd@0
|
109 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
110 % add_all_comps
|
wolffd@0
|
111 %
|
wolffd@0
|
112 elseif (strcmp(action,'add_all_comps'))
|
wolffd@0
|
113 if (strcmp(plot_array(1).string,''))
|
wolffd@0
|
114 tmp = 1;
|
wolffd@0
|
115 else
|
wolffd@0
|
116 tmp = l+1;
|
wolffd@0
|
117 end
|
wolffd@0
|
118 indx = length(udata.sM.comp_names);
|
wolffd@0
|
119 for (i=1:indx)
|
wolffd@0
|
120 plot_array(tmp+i-1).string = udata.sM.comp_names{i};
|
wolffd@0
|
121 plot_array(tmp+i-1).args = {'comp' i};
|
wolffd@0
|
122 udata.property{tmp+i-1} = {0};
|
wolffd@0
|
123 end
|
wolffd@0
|
124 % update list
|
wolffd@0
|
125 set(list1_h,'Value',tmp+indx-1, ...
|
wolffd@0
|
126 'String',{plot_array(:).string});
|
wolffd@0
|
127
|
wolffd@0
|
128 udata.plot_array = plot_array;
|
wolffd@0
|
129 set(varargin{1},'UserData',udata);
|
wolffd@0
|
130
|
wolffd@0
|
131 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
132 % add_u_matrix
|
wolffd@0
|
133 %
|
wolffd@0
|
134 elseif (strcmp(action,'add_u_matrix'))
|
wolffd@0
|
135 if (strcmp(plot_array(1).string,''))
|
wolffd@0
|
136 tmp = 1;
|
wolffd@0
|
137 else
|
wolffd@0
|
138 tmp = l+1;
|
wolffd@0
|
139 end
|
wolffd@0
|
140 plot_array(tmp).string = 'U-matrix';
|
wolffd@0
|
141 plot_array(tmp).args = {'umat' 'all'};
|
wolffd@0
|
142 udata.property{tmp} = {0 'U-matrix' 1:length(udata.sM.comp_names)};
|
wolffd@0
|
143 % update list
|
wolffd@0
|
144 set(list1_h,'Value',tmp, ...
|
wolffd@0
|
145 'String',{plot_array(:).string});
|
wolffd@0
|
146
|
wolffd@0
|
147 udata.plot_array = plot_array;
|
wolffd@0
|
148 set(varargin{1},'UserData',udata);
|
wolffd@0
|
149
|
wolffd@0
|
150 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
151 % add_colorplane
|
wolffd@0
|
152 %
|
wolffd@0
|
153 elseif (strcmp(action,'add_colorplane'))
|
wolffd@0
|
154 if (strcmp(plot_array(1).string,''))
|
wolffd@0
|
155 tmp = 1;
|
wolffd@0
|
156 else
|
wolffd@0
|
157 tmp = l+1;
|
wolffd@0
|
158 end
|
wolffd@0
|
159 plot_array(tmp).string = 'color plane';
|
wolffd@0
|
160 c = som_colorcode(udata.sM);
|
wolffd@0
|
161 plot_array(tmp).args = {'color' c};
|
wolffd@0
|
162 udata.property{tmp} = {0 'Color code' {'rgb1' 'rgb2' 'rgb3' 'rgb4' 'hsv' '-variable-'} 1};
|
wolffd@0
|
163 % update list
|
wolffd@0
|
164 set(list1_h,'Value',tmp, ...
|
wolffd@0
|
165 'String',{plot_array(:).string});
|
wolffd@0
|
166
|
wolffd@0
|
167 udata.plot_array = plot_array;
|
wolffd@0
|
168 set(varargin{1},'UserData',udata);
|
wolffd@0
|
169
|
wolffd@0
|
170 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
171 % add_empty
|
wolffd@0
|
172 %
|
wolffd@0
|
173 elseif (strcmp(action,'add_empty'))
|
wolffd@0
|
174 if (strcmp(plot_array(1).string,''))
|
wolffd@0
|
175 tmp = 1;
|
wolffd@0
|
176 else
|
wolffd@0
|
177 tmp = l+1;
|
wolffd@0
|
178 end
|
wolffd@0
|
179 plot_array(tmp).string = 'empty plane';
|
wolffd@0
|
180 plot_array(tmp).args = {'empty' ''};
|
wolffd@0
|
181 udata.property{tmp} = {''};
|
wolffd@0
|
182 % update list
|
wolffd@0
|
183 set(list1_h,'Value',tmp, ...
|
wolffd@0
|
184 'String',{plot_array(:).string});
|
wolffd@0
|
185
|
wolffd@0
|
186 udata.plot_array = plot_array;
|
wolffd@0
|
187 set(varargin{1},'UserData',udata);
|
wolffd@0
|
188
|
wolffd@0
|
189 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
190 % remove
|
wolffd@0
|
191 %
|
wolffd@0
|
192 elseif (strcmp(action,'remove'))
|
wolffd@0
|
193 rm_indx = get(list1_h,'Value');
|
wolffd@0
|
194 rm_l = length(rm_indx);
|
wolffd@0
|
195 % rebuild array
|
wolffd@0
|
196 incl_inds = setdiff(1:length(plot_array),rm_indx);
|
wolffd@0
|
197 if isempty(incl_inds),
|
wolffd@0
|
198 clear plot_array;
|
wolffd@0
|
199 plot_array(1).args = {};
|
wolffd@0
|
200 plot_array(1).string = '';
|
wolffd@0
|
201 udata.property = {};
|
wolffd@0
|
202 udata.property{1} = {};
|
wolffd@0
|
203 else
|
wolffd@0
|
204 plot_array = plot_array(incl_inds);
|
wolffd@0
|
205 udata.property = udata.property(incl_inds);
|
wolffd@0
|
206 end
|
wolffd@0
|
207 set(list1_h,'Value',length(plot_array), ...
|
wolffd@0
|
208 'String',{plot_array(:).string});
|
wolffd@0
|
209
|
wolffd@0
|
210 udata.plot_array = plot_array;
|
wolffd@0
|
211 set(varargin{1},'UserData',udata);
|
wolffd@0
|
212
|
wolffd@0
|
213 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
214 % remove_all
|
wolffd@0
|
215 %
|
wolffd@0
|
216 elseif (strcmp(action,'remove_all'))
|
wolffd@0
|
217 plot_array = [];
|
wolffd@0
|
218 plot_array(1).args = {};
|
wolffd@0
|
219 plot_array(1).string = '';
|
wolffd@0
|
220 udata.property = {};
|
wolffd@0
|
221 set(list1_h,'Value',1, ...
|
wolffd@0
|
222 'String',{plot_array(:).string});
|
wolffd@0
|
223
|
wolffd@0
|
224 udata.plot_array = plot_array;
|
wolffd@0
|
225 set(varargin{1},'UserData',udata);
|
wolffd@0
|
226
|
wolffd@0
|
227 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
228 % more_options
|
wolffd@0
|
229 %
|
wolffd@0
|
230 elseif (strcmp(action,'more_options'))
|
wolffd@0
|
231 vis_show_gui_comp(varargin{1},get(list1_h,'Value'),'init');
|
wolffd@0
|
232
|
wolffd@0
|
233 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
234 % close
|
wolffd@0
|
235 %
|
wolffd@0
|
236 elseif (strcmp(action,'close'))
|
wolffd@0
|
237 close(varargin{1});
|
wolffd@0
|
238
|
wolffd@0
|
239 %%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
240 % visualize
|
wolffd@0
|
241 %
|
wolffd@0
|
242 elseif (strcmp(action,'visualize')) %% s = {k k.^2}; plot(s{:});
|
wolffd@0
|
243 current_fig = varargin{1};
|
wolffd@0
|
244 figure;
|
wolffd@0
|
245 args = [{udata.sM} plot_array(:).args];
|
wolffd@0
|
246 % edge
|
wolffd@0
|
247 tmp = get(udata.h(2),'UserData');
|
wolffd@0
|
248 i = get(udata.h(2),'Value');
|
wolffd@0
|
249 args = [args {'edge' tmp{i}}];
|
wolffd@0
|
250 % bar
|
wolffd@0
|
251 tmp = get(udata.h(3),'UserData');
|
wolffd@0
|
252 i = get(udata.h(3),'Value');
|
wolffd@0
|
253 args = [args {'bar' tmp{i}}];
|
wolffd@0
|
254 % norm
|
wolffd@0
|
255 tmp = get(udata.h(4),'UserData');
|
wolffd@0
|
256 i = get(udata.h(4),'Value');
|
wolffd@0
|
257 args = [args {'norm' tmp{i}}];
|
wolffd@0
|
258 % size
|
wolffd@0
|
259 tmp = get(udata.h(5),'String');
|
wolffd@0
|
260 args = [args {'size' eval(tmp)}];
|
wolffd@0
|
261 % colormap
|
wolffd@0
|
262 tmp = get(udata.h(6),'String');
|
wolffd@0
|
263 if ~isempty(tmp)
|
wolffd@0
|
264 args = [args {'colormap' eval(tmp)}];
|
wolffd@0
|
265 end
|
wolffd@0
|
266 % footnote
|
wolffd@0
|
267 tmp = get(udata.h(7),'String');
|
wolffd@0
|
268 args = [args {'footnote' tmp}];
|
wolffd@0
|
269 % subplots
|
wolffd@0
|
270 tmp = get(udata.h(8),'String');
|
wolffd@0
|
271 if ~(strcmp(tmp,'default') | isempty(tmp))
|
wolffd@0
|
272 tmp2 = sscanf(tmp,'%i %i');
|
wolffd@0
|
273 if length(tmp2)<2, tmp2 = sscanf(tmp,'%ix%i'); end
|
wolffd@0
|
274 if length(tmp2)<2, tmp = eval(tmp);
|
wolffd@0
|
275 else tmp = tmp2';
|
wolffd@0
|
276 end
|
wolffd@0
|
277 if length(tmp)<2, tmp(2) = 1; end
|
wolffd@0
|
278 if tmp(1)*tmp(2)<length(get(udata.h(1),'string')),
|
wolffd@0
|
279 close(varargin{1});
|
wolffd@0
|
280 errordlg('Too small subplot size', ...
|
wolffd@0
|
281 'Error in SOM_VIS: subplot size');
|
wolffd@0
|
282 return;
|
wolffd@0
|
283 end
|
wolffd@0
|
284 args = [args {'subplots' tmp}];
|
wolffd@0
|
285 end
|
wolffd@0
|
286
|
wolffd@0
|
287 som_show(args{:});
|
wolffd@0
|
288
|
wolffd@0
|
289 % udata.vis_h = varargin{1};
|
wolffd@0
|
290 % first refresh plot info
|
wolffd@0
|
291 udata.vis_h = setdiff( ...
|
wolffd@0
|
292 udata.vis_h, ...
|
wolffd@0
|
293 setdiff(udata.vis_h,get(0,'children')));
|
wolffd@0
|
294 udata.vis_h = [udata.vis_h gcf];
|
wolffd@0
|
295 set(current_fig,'UserData',udata);
|
wolffd@0
|
296
|
wolffd@0
|
297 else
|
wolffd@0
|
298 ;
|
wolffd@0
|
299 end
|
wolffd@0
|
300
|
wolffd@0
|
301 else
|
wolffd@0
|
302 errordlg({'Make sure you have SOM as input argument'; ''; ...
|
wolffd@0
|
303 'example: som_show_gui(sMap)'},'Error in SOM_VIS: input arguments');
|
wolffd@0
|
304 end
|
wolffd@0
|
305
|
wolffd@0
|
306
|
wolffd@0
|
307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
308 % ---------------------- SUBFUNCTIONS ----------------------- %
|
wolffd@0
|
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
310
|
wolffd@0
|
311
|
wolffd@0
|
312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
313 % CREATE_MAIN_GUI %
|
wolffd@0
|
314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
315
|
wolffd@0
|
316 function fig_h = create_main_gui(sM)
|
wolffd@0
|
317
|
wolffd@0
|
318 oldFigNumber=watchon;
|
wolffd@0
|
319
|
wolffd@0
|
320 % init variables
|
wolffd@0
|
321 FIGURENAME = 'SOM_SHOW_GUI';
|
wolffd@0
|
322 plot_array = [];
|
wolffd@0
|
323 plot_array(1).args = {};
|
wolffd@0
|
324 plot_array(1).string = '';
|
wolffd@0
|
325
|
wolffd@0
|
326 % colors
|
wolffd@0
|
327 fig_color = [0.8 0.8 0.8];
|
wolffd@0
|
328 bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725];
|
wolffd@0
|
329 bg_color2 = [0.9 0.9 0.9];
|
wolffd@0
|
330
|
wolffd@0
|
331 %%%% positions %%%%%
|
wolffd@0
|
332 %--------- figure
|
wolffd@0
|
333 fig_i = [0.02 0.25];
|
wolffd@0
|
334 fig_s = [0.24 0.55];
|
wolffd@0
|
335 %---------
|
wolffd@0
|
336 ue = 0.02;
|
wolffd@0
|
337 th = 0.03;
|
wolffd@0
|
338 hint_text_pos = [0.05 0.94 0.8 th];
|
wolffd@0
|
339 big_frame_pos = [ue 0.38 (1-2*ue) 0.56];
|
wolffd@0
|
340 planes_listbox_text_pos = [0.07 0.87 0.3 th];
|
wolffd@0
|
341 planes_listbox_pos = [(ue+0.03) 0.395 0.46 0.47];
|
wolffd@0
|
342 subplots_text_pos = [0.53 0.885 0.2 th];
|
wolffd@0
|
343 subplots_pos = [0.73 0.88 0.22 0.05]; ah = 0.045; d = (planes_listbox_pos(4) - 10*ah)/7;
|
wolffd@0
|
344 add_components_pos = [0.53 (sum(planes_listbox_pos([2 4]))-ah) 0.42 ah]; tmp = add_components_pos(2)-(d+ah);
|
wolffd@0
|
345 add_all_components_pos = [0.53 tmp 0.42 ah]; tmp = add_all_components_pos(2)-(d+ah);
|
wolffd@0
|
346 add_u_matrix_pos = [0.53 tmp 0.42 ah]; tmp = add_u_matrix_pos(2)-(d+ah);
|
wolffd@0
|
347 add_colorplane_pos = [0.53 tmp 0.42 ah]; tmp = add_colorplane_pos(2)-(d+ah);
|
wolffd@0
|
348 add_empty_pos = [0.53 tmp 0.42 ah]; tmp = add_empty_pos(2)-2*(d+ah)+d;
|
wolffd@0
|
349 remove_pos = [0.53 tmp 0.42 ah]; tmp = remove_pos(2)-(d+ah);
|
wolffd@0
|
350 remove_all_pos = [0.53 tmp 0.42 ah]; tmp = remove_all_pos(2)-2*(d+ah)+d;
|
wolffd@0
|
351 plane_options_pos = [0.53 tmp 0.42 ah];
|
wolffd@0
|
352 ph = 0.041;
|
wolffd@0
|
353 dd = (ph-th)/2;
|
wolffd@0
|
354 tmp = big_frame_pos(2) - (planes_listbox_pos(2)-big_frame_pos(2)) - ph;
|
wolffd@0
|
355 ie1 = 0.25;
|
wolffd@0
|
356 tw = 0.21;
|
wolffd@0
|
357 iw = 0.28;
|
wolffd@0
|
358 unit_edges_text_pos = [ue (tmp+dd) tw th];
|
wolffd@0
|
359 unit_edges_pos = [ie1 tmp iw ph]; tmp = unit_edges_pos(2)-(d+ph) - d;
|
wolffd@0
|
360 unit_sizes_text_pos = [ue (tmp+dd) tw th];
|
wolffd@0
|
361 unit_sizes_pos = [ie1 tmp iw ph]; tmp = unit_sizes_pos(2)-(d+ph) - d;
|
wolffd@0
|
362 colorbar_dir_text_pos = [ue (tmp+dd) tw th];
|
wolffd@0
|
363 colorbar_dir_pos = [ie1 tmp iw ph]; tmp2 = sum(colorbar_dir_pos([1 3]));
|
wolffd@0
|
364 colorbar_norm_text_pos = [(tmp2) (tmp+dd) 0.11 th];
|
wolffd@0
|
365 colorbar_norm_pos = [(1-ue-(iw+0.06)) tmp (iw+0.06) ph]; tmp = colorbar_norm_pos(2)-(d+ph) - d;
|
wolffd@0
|
366 colormap_text_pos = [ue (tmp+dd) tw th];
|
wolffd@0
|
367 colormap_pos = [ie1 tmp iw ph]; tmp = colormap_pos(2)-(d+ph) - d;
|
wolffd@0
|
368 footnote_text_pos = [ue (tmp+dd) tw th];
|
wolffd@0
|
369 footnote_pos = [ie1 tmp (1-ue-ie1) ph];
|
wolffd@0
|
370 tmp = planes_listbox_pos(2)-big_frame_pos(2);
|
wolffd@0
|
371 tmp2 = ah+2*tmp;
|
wolffd@0
|
372 little_frame_pos = [ue tmp (1-2*ue) tmp2]; tmp2 = little_frame_pos(2)+tmp;
|
wolffd@0
|
373 ddd = 0.1;
|
wolffd@0
|
374 bw = (little_frame_pos(3)-2*0.03-ddd)/2;
|
wolffd@0
|
375 visualize_pos = [(ue+0.03) tmp2 bw ah];
|
wolffd@0
|
376 close_pos = [(sum(visualize_pos([1 3]))+ddd) tmp2 bw ah];
|
wolffd@0
|
377
|
wolffd@0
|
378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
379 % main figure
|
wolffd@0
|
380 %
|
wolffd@0
|
381 fig_h = figure( ...
|
wolffd@0
|
382 'Units','normalized', ...
|
wolffd@0
|
383 'Color',fig_color, ...
|
wolffd@0
|
384 'PaperPosition',[18 180 576 432], ...
|
wolffd@0
|
385 'PaperType','A4', ...
|
wolffd@0
|
386 'PaperUnits','normalized', ...
|
wolffd@0
|
387 'Position',[fig_i fig_s], ...
|
wolffd@0
|
388 'ToolBar','none', ...
|
wolffd@0
|
389 'NumberTitle','off', ...
|
wolffd@0
|
390 'Name',FIGURENAME, ...
|
wolffd@0
|
391 'Visible','off');
|
wolffd@0
|
392
|
wolffd@0
|
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
394 % hint text
|
wolffd@0
|
395 %
|
wolffd@0
|
396 uicontrol( ...
|
wolffd@0
|
397 'Units','normalized', ...
|
wolffd@0
|
398 'BackgroundColor',fig_color, ...
|
wolffd@0
|
399 'HorizontalAlignment','left', ...
|
wolffd@0
|
400 'Position',hint_text_pos, ...
|
wolffd@0
|
401 'String','Add planes and then visualize', ...
|
wolffd@0
|
402 'Style','text');
|
wolffd@0
|
403
|
wolffd@0
|
404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
405 % planes listbox
|
wolffd@0
|
406 %
|
wolffd@0
|
407 uicontrol( ...
|
wolffd@0
|
408 'Units','normalized', ...
|
wolffd@0
|
409 'Position',big_frame_pos, ...
|
wolffd@0
|
410 'Style','frame');
|
wolffd@0
|
411
|
wolffd@0
|
412 uicontrol( ...
|
wolffd@0
|
413 'Units','normalized', ...
|
wolffd@0
|
414 'BackgroundColor',bg_color1, ...
|
wolffd@0
|
415 'HorizontalAlignment','left', ...
|
wolffd@0
|
416 'Position',planes_listbox_text_pos, ...
|
wolffd@0
|
417 'String','Planes', ...
|
wolffd@0
|
418 'Style','text');
|
wolffd@0
|
419
|
wolffd@0
|
420 list1_h = uicontrol( ...
|
wolffd@0
|
421 'Units','normalized', ...
|
wolffd@0
|
422 'BackgroundColor',bg_color2, ...
|
wolffd@0
|
423 'Position',planes_listbox_pos, ...
|
wolffd@0
|
424 'String',{plot_array(:).string}, ...
|
wolffd@0
|
425 'Style','listbox', ...
|
wolffd@0
|
426 'Max',2, ...
|
wolffd@0
|
427 'Value',1);
|
wolffd@0
|
428
|
wolffd@0
|
429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
430 % edit subplots
|
wolffd@0
|
431 %
|
wolffd@0
|
432 uicontrol( ...
|
wolffd@0
|
433 'Units','normalized', ...
|
wolffd@0
|
434 'BackgroundColor',bg_color1, ...
|
wolffd@0
|
435 'HorizontalAlignment','center', ...
|
wolffd@0
|
436 'Position',subplots_text_pos, ...
|
wolffd@0
|
437 'String','subplots', ...
|
wolffd@0
|
438 'Style','text');
|
wolffd@0
|
439
|
wolffd@0
|
440 edit4_h = uicontrol( ...
|
wolffd@0
|
441 'Units','normalized', ...
|
wolffd@0
|
442 'BackgroundColor',bg_color2, ...
|
wolffd@0
|
443 'Position',subplots_pos, ...
|
wolffd@0
|
444 'FontSize',14, ...
|
wolffd@0
|
445 'String','', ...
|
wolffd@0
|
446 'Style','edit');
|
wolffd@0
|
447
|
wolffd@0
|
448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
449 % pushbutton 'Add components'
|
wolffd@0
|
450 %
|
wolffd@0
|
451 uicontrol( ...
|
wolffd@0
|
452 'Units','normalized', ...
|
wolffd@0
|
453 'BackgroundColor',bg_color1, ...
|
wolffd@0
|
454 'HorizontalAlignment','left', ...
|
wolffd@0
|
455 'Position',add_components_pos, ...
|
wolffd@0
|
456 'String',' Add components', ...
|
wolffd@0
|
457 'Callback',['som_show_gui(''add_selected_comp'',' mat2str(gcf) ')']);
|
wolffd@0
|
458
|
wolffd@0
|
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
460 % pushbutton 'Add all components'
|
wolffd@0
|
461 %
|
wolffd@0
|
462 uicontrol( ...
|
wolffd@0
|
463 'Units','normalized', ...
|
wolffd@0
|
464 'HorizontalAlignment','left', ...
|
wolffd@0
|
465 'Position',add_all_components_pos, ...
|
wolffd@0
|
466 'String',' Add all components', ...
|
wolffd@0
|
467 'Callback',['som_show_gui(''add_all_comps'',' mat2str(gcf) ')']);
|
wolffd@0
|
468
|
wolffd@0
|
469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
470 % pushbutton 'Add U-matrix'
|
wolffd@0
|
471 %
|
wolffd@0
|
472 uicontrol( ...
|
wolffd@0
|
473 'Units','normalized', ...
|
wolffd@0
|
474 'HorizontalAlignment','left', ...
|
wolffd@0
|
475 'Position',add_u_matrix_pos, ...
|
wolffd@0
|
476 'String',' Add U-matrix', ...
|
wolffd@0
|
477 'Callback',['som_show_gui(''add_u_matrix'',' mat2str(gcf) ')']);
|
wolffd@0
|
478
|
wolffd@0
|
479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
480 % pushbutton 'Add colorplane'
|
wolffd@0
|
481 %
|
wolffd@0
|
482 uicontrol( ...
|
wolffd@0
|
483 'Units','normalized', ...
|
wolffd@0
|
484 'HorizontalAlignment','left', ...
|
wolffd@0
|
485 'Position',add_colorplane_pos, ...
|
wolffd@0
|
486 'String',' Add colorplane', ...
|
wolffd@0
|
487 'Callback',['som_show_gui(''add_colorplane'',' mat2str(gcf) ')']);
|
wolffd@0
|
488
|
wolffd@0
|
489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
490 % pushbutton 'Add empty'
|
wolffd@0
|
491 %
|
wolffd@0
|
492 uicontrol( ...
|
wolffd@0
|
493 'Units','normalized', ...
|
wolffd@0
|
494 'HorizontalAlignment','left', ...
|
wolffd@0
|
495 'Position',add_empty_pos, ...
|
wolffd@0
|
496 'String',' Add empty', ...
|
wolffd@0
|
497 'Callback',['som_show_gui(''add_empty'',' mat2str(gcf) ')']);
|
wolffd@0
|
498
|
wolffd@0
|
499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
500 % pushbutton 'Remove'
|
wolffd@0
|
501 %
|
wolffd@0
|
502 uicontrol( ...
|
wolffd@0
|
503 'Units','normalized', ...
|
wolffd@0
|
504 'HorizontalAlignment','left', ...
|
wolffd@0
|
505 'Position',remove_pos, ...
|
wolffd@0
|
506 'String',' Remove', ...
|
wolffd@0
|
507 'Callback',['som_show_gui(''remove'',' mat2str(gcf) ')']);
|
wolffd@0
|
508
|
wolffd@0
|
509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
510 % creat pushbutton 'Remove all'
|
wolffd@0
|
511 %
|
wolffd@0
|
512 uicontrol( ...
|
wolffd@0
|
513 'Units','normalized', ...
|
wolffd@0
|
514 'BackgroundColor',bg_color1, ...
|
wolffd@0
|
515 'HorizontalAlignment','left', ...
|
wolffd@0
|
516 'Position',remove_all_pos, ...
|
wolffd@0
|
517 'String',' Remove all', ...
|
wolffd@0
|
518 'Callback',['som_show_gui(''remove_all'',' mat2str(gcf) ')']);
|
wolffd@0
|
519
|
wolffd@0
|
520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
521 % pushbutton 'Plane options'
|
wolffd@0
|
522 %
|
wolffd@0
|
523 uicontrol( ...
|
wolffd@0
|
524 'Units','normalized', ...
|
wolffd@0
|
525 'Position',plane_options_pos, ...
|
wolffd@0
|
526 'String',' Plane options', ...
|
wolffd@0
|
527 'Callback',['som_show_gui(''more_options'',' mat2str(gcf) ')']);
|
wolffd@0
|
528
|
wolffd@0
|
529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
530 % popupmenu unitedges
|
wolffd@0
|
531 %
|
wolffd@0
|
532 uicontrol( ...
|
wolffd@0
|
533 'Units','normalized', ...
|
wolffd@0
|
534 'BackgroundColor',fig_color, ...
|
wolffd@0
|
535 'HorizontalAlignment','left', ...
|
wolffd@0
|
536 'Position',unit_edges_text_pos, ...
|
wolffd@0
|
537 'String','unit edges are', ...
|
wolffd@0
|
538 'Style','text');
|
wolffd@0
|
539
|
wolffd@0
|
540 popup1_h = uicontrol( ...
|
wolffd@0
|
541 'Units','normalized', ...
|
wolffd@0
|
542 'Max',2, ...
|
wolffd@0
|
543 'Min',1, ...
|
wolffd@0
|
544 'Position',unit_edges_pos, ...
|
wolffd@0
|
545 'UserData',{'off' 'on'}, ...
|
wolffd@0
|
546 'String',{'off' 'on'}, ...
|
wolffd@0
|
547 'Style','popupmenu', ...
|
wolffd@0
|
548 'Value',1);
|
wolffd@0
|
549
|
wolffd@0
|
550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
551 % unit sizes edit
|
wolffd@0
|
552 %
|
wolffd@0
|
553 uicontrol( ...
|
wolffd@0
|
554 'Units','normalized', ...
|
wolffd@0
|
555 'BackgroundColor',fig_color, ...
|
wolffd@0
|
556 'HorizontalAlignment','left', ...
|
wolffd@0
|
557 'Position',unit_sizes_text_pos, ...
|
wolffd@0
|
558 'String','unit sizes', ...
|
wolffd@0
|
559 'Style','text');
|
wolffd@0
|
560
|
wolffd@0
|
561 edit1_h = uicontrol( ...
|
wolffd@0
|
562 'Units','normalized', ...
|
wolffd@0
|
563 'BackgroundColor',bg_color2, ...
|
wolffd@0
|
564 'Position',unit_sizes_pos, ...
|
wolffd@0
|
565 'FontSize',12, ...
|
wolffd@0
|
566 'String','1', ...
|
wolffd@0
|
567 'Style','edit');
|
wolffd@0
|
568
|
wolffd@0
|
569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
570 % popupmenu colorbardir
|
wolffd@0
|
571 %
|
wolffd@0
|
572 uicontrol( ...
|
wolffd@0
|
573 'Units','normalized', ...
|
wolffd@0
|
574 'BackgroundColor',fig_color, ...
|
wolffd@0
|
575 'HorizontalAlignment','left', ...
|
wolffd@0
|
576 'Position',colorbar_dir_text_pos, ...
|
wolffd@0
|
577 'String','colorbar is', ...
|
wolffd@0
|
578 'Style','text');
|
wolffd@0
|
579
|
wolffd@0
|
580 popup2_h = uicontrol( ...
|
wolffd@0
|
581 'Units','normalized', ...
|
wolffd@0
|
582 'Max',3, ...
|
wolffd@0
|
583 'Min',1, ...
|
wolffd@0
|
584 'Position',colorbar_dir_pos, ...
|
wolffd@0
|
585 'UserData', {'vert' 'horiz' 'none'}, ...
|
wolffd@0
|
586 'String','vert| horiz| none', ...
|
wolffd@0
|
587 'Style','popupmenu', ...
|
wolffd@0
|
588 'Value',1);
|
wolffd@0
|
589
|
wolffd@0
|
590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
591 % popupmenu colorbarnorm
|
wolffd@0
|
592 %
|
wolffd@0
|
593 uicontrol( ...
|
wolffd@0
|
594 'Units','normalized', ...
|
wolffd@0
|
595 'BackgroundColor',fig_color, ...
|
wolffd@0
|
596 'HorizontalAlignment','left', ...
|
wolffd@0
|
597 'Position',colorbar_norm_text_pos, ...
|
wolffd@0
|
598 'String',' and ', ...
|
wolffd@0
|
599 'Style','text');
|
wolffd@0
|
600
|
wolffd@0
|
601 popup3_h = uicontrol( ...
|
wolffd@0
|
602 'Units','normalized', ...
|
wolffd@0
|
603 'Max',2, ...
|
wolffd@0
|
604 'Min',1, ...
|
wolffd@0
|
605 'Position',colorbar_norm_pos, ...
|
wolffd@0
|
606 'UserData', {'d' 'n'}, ...
|
wolffd@0
|
607 'String',{'denormalized','normalized'}, ...
|
wolffd@0
|
608 'Style','popupmenu', ...
|
wolffd@0
|
609 'Value',1);
|
wolffd@0
|
610
|
wolffd@0
|
611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
612 % colormap edittext
|
wolffd@0
|
613 %
|
wolffd@0
|
614 uicontrol( ...
|
wolffd@0
|
615 'Units','normalized', ...
|
wolffd@0
|
616 'BackgroundColor',fig_color, ...
|
wolffd@0
|
617 'HorizontalAlignment','left', ...
|
wolffd@0
|
618 'Position',colormap_text_pos, ...
|
wolffd@0
|
619 'String','colormap', ...
|
wolffd@0
|
620 'Style','text');
|
wolffd@0
|
621
|
wolffd@0
|
622 edit2_h = uicontrol( ...
|
wolffd@0
|
623 'Units','normalized', ...
|
wolffd@0
|
624 'BackgroundColor',bg_color2, ...
|
wolffd@0
|
625 'Position',colormap_pos, ...
|
wolffd@0
|
626 'FontSize',12, ...
|
wolffd@0
|
627 'String','', ...
|
wolffd@0
|
628 'Style','edit');
|
wolffd@0
|
629
|
wolffd@0
|
630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
631 % footnote edittext
|
wolffd@0
|
632 %
|
wolffd@0
|
633 uicontrol( ...
|
wolffd@0
|
634 'Units','normalized', ...
|
wolffd@0
|
635 'BackgroundColor',fig_color, ...
|
wolffd@0
|
636 'HorizontalAlignment','left', ...
|
wolffd@0
|
637 'Position',footnote_text_pos, ...
|
wolffd@0
|
638 'String','footnote', ...
|
wolffd@0
|
639 'Style','text');
|
wolffd@0
|
640
|
wolffd@0
|
641 edit3_h = uicontrol( ...
|
wolffd@0
|
642 'Units','normalized', ...
|
wolffd@0
|
643 'BackgroundColor',bg_color2, ...
|
wolffd@0
|
644 'Position',footnote_pos, ...
|
wolffd@0
|
645 'FontSize',12, ...
|
wolffd@0
|
646 'String',sM.name, ...
|
wolffd@0
|
647 'Style','edit');
|
wolffd@0
|
648
|
wolffd@0
|
649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
650 % pushbutton 'Visualize'
|
wolffd@0
|
651 %
|
wolffd@0
|
652 uicontrol( ...
|
wolffd@0
|
653 'Units','normalized', ...
|
wolffd@0
|
654 'Position',little_frame_pos, ...
|
wolffd@0
|
655 'Style','frame');
|
wolffd@0
|
656
|
wolffd@0
|
657 uicontrol( ...
|
wolffd@0
|
658 'Units','normalized', ...
|
wolffd@0
|
659 'Position',visualize_pos, ...
|
wolffd@0
|
660 'String','Visualize', ...
|
wolffd@0
|
661 'Callback',['som_show_gui(''visualize'',' mat2str(gcf) ')']);
|
wolffd@0
|
662
|
wolffd@0
|
663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
664 % pushbutton 'Close'
|
wolffd@0
|
665 %
|
wolffd@0
|
666 uicontrol( ...
|
wolffd@0
|
667 'Units','normalized', ...
|
wolffd@0
|
668 'BackgroundColor',bg_color1, ...
|
wolffd@0
|
669 'Position',close_pos, ...
|
wolffd@0
|
670 'String','Close', ...
|
wolffd@0
|
671 'Callback',['som_show_gui(''close'',' mat2str(gcf) ')']);
|
wolffd@0
|
672
|
wolffd@0
|
673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
674 % menus
|
wolffd@0
|
675 %
|
wolffd@0
|
676 uimenu('Parent',fig_h','Label',' ','Enable','off');
|
wolffd@0
|
677 m = uimenu('Parent',fig_h,'Label','Tools');
|
wolffd@0
|
678 a = uimenu('Parent',m,'Label','Add');
|
wolffd@0
|
679 s = strcat('vis_show_gui_tool(',mat2str(gcf),',''add_label'')');
|
wolffd@0
|
680 uimenu('Parent',a,'Label','label','Callback',s);
|
wolffd@0
|
681 s = strcat('vis_show_gui_tool(',mat2str(gcf),',''add_hit'')');
|
wolffd@0
|
682 uimenu('Parent',a,'Label','hit','Callback',s);
|
wolffd@0
|
683 s = strcat('vis_show_gui_tool(',mat2str(gcf),',''add_traj'')');
|
wolffd@0
|
684 uimenu('Parent',a,'Label','traj','Callback',s);
|
wolffd@0
|
685 s = strcat('vis_show_gui_tool(',mat2str(gcf),',''add_comet'')');
|
wolffd@0
|
686 uimenu('Parent',a,'Label','comet','Callback',s);
|
wolffd@0
|
687 s = ['vis_show_gui_tool(',mat2str(gcf),',''clear'')'];
|
wolffd@0
|
688 c = uimenu('Parent',m,'Label','Clear','Separator','on','callback',s);
|
wolffd@0
|
689 s = strcat('vis_show_gui_tool(',mat2str(gcf),',''recolorbar'')');
|
wolffd@0
|
690 r = uimenu('Parent',m,'Label','Recolorbar','Separator','on', ...
|
wolffd@0
|
691 'Callback',s);
|
wolffd@0
|
692
|
wolffd@0
|
693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
694 % end
|
wolffd@0
|
695 %
|
wolffd@0
|
696
|
wolffd@0
|
697 ud.sM = sM;
|
wolffd@0
|
698 ud.plot_array = plot_array;
|
wolffd@0
|
699 ud.property = {};
|
wolffd@0
|
700 ud.vis_h = [];
|
wolffd@0
|
701 ud.h = [list1_h popup1_h popup2_h popup3_h ...
|
wolffd@0
|
702 edit1_h edit2_h edit3_h edit4_h];
|
wolffd@0
|
703
|
wolffd@0
|
704 watchoff(oldFigNumber);
|
wolffd@0
|
705 set(fig_h,'Visible','on', ...
|
wolffd@0
|
706 'UserData', ud, ...
|
wolffd@0
|
707 'handlevisibility','off');
|
wolffd@0
|
708
|