annotate aim-mat/gui/aim_gui.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % procedure for 'aim-mat'
tomwalters@0 2 % function varargout = aim(varargin)
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 % varargin: either a wave-file, a parameter file (m-file) or an
tomwalters@0 5 % parameter struct
tomwalters@0 6 % RETURN VALUE:
tomwalters@0 7 % with a parameter file, the result of the processing, otherwise none
tomwalters@0 8 %
bleeck@3 9 %
tomwalters@0 10 % (c) 2011, University of Southampton
bleeck@3 11 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 12 % download of current version is on the soundsoftware site:
bleeck@3 13 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 14 % documentation and everything is on http://www.acousticscale.org
bleeck@3 15
bleeck@3 16
tomwalters@0 17
tomwalters@0 18
tomwalters@0 19 function varargout = aim(varargin)
tomwalters@0 20
tomwalters@0 21 % check the version
tomwalters@0 22
tomwalters@0 23 gui_Singleton = 0;
tomwalters@0 24 gui_State = struct('gui_Name', mfilename, ...
tomwalters@0 25 'gui_Singleton', gui_Singleton, ...
tomwalters@0 26 'gui_OpeningFcn', @aim_OpeningFcn, ...
tomwalters@0 27 'gui_OutputFcn', @aim_OutputFcn, ...
tomwalters@0 28 'gui_LayoutFcn', [] , ...
tomwalters@0 29 'gui_Callback', []);
tomwalters@0 30 if nargin && isstr(varargin{1})
tomwalters@0 31 fistletter=varargin{1}(1);
tomwalters@0 32 % if ~isempty(str2num(fistletter))
tomwalters@0 33 % disp('matlab does not like wave files that start with numbers. Please change first letter!');
tomwalters@0 34 % return
tomwalters@0 35 % end
tomwalters@0 36 gui_State.gui_Callback = str2func(varargin{1});
tomwalters@0 37 end
tomwalters@0 38
tomwalters@0 39 % something for the eye:
tomwalters@0 40 if length(varargin)==1 % only at the first call
tomwalters@0 41 fpa=which('gen_gtfb'); % ugly hack to get the graphics... sorry!
tomwalters@0 42 [a,b,c]=fileparts(fpa);
tomwalters@0 43 where=strfind(a,'modules');
tomwalters@0 44 if ~isempty(where)
tomwalters@0 45 columnpath=fpa(1:where+7);
tomwalters@0 46 handles.info.columnpath=columnpath;
tomwalters@0 47 if ~isstruct(varargin{1})% no box for call with struct
tomwalters@0 48 prname=varargin{1};
tomwalters@0 49 prname=prname(1:end-4);
tomwalters@0 50 if exist(prname)==7 % is there a directory with the same name?
tomwalters@0 51 handles.abouttexttodisplay=sprintf('loading existing project ''%s'' ...',prname);
tomwalters@0 52 else
tomwalters@0 53 handles.abouttexttodisplay=sprintf('creating new project ''%s'' ...',prname);
tomwalters@0 54 end
tomwalters@0 55 f=aim_displayaboutbox(handles);
tomwalters@0 56 end
tomwalters@0 57 end
tomwalters@0 58 end
tomwalters@0 59 %%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 60 % Aufruf des guis:
tomwalters@0 61 if nargout
tomwalters@0 62 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
tomwalters@0 63 else
tomwalters@0 64 gui_mainfcn(gui_State, varargin{:});
tomwalters@0 65 end
tomwalters@0 66 %%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 67 %close the annoying about-box
tomwalters@0 68 if exist('f','var') && ishandle(f)
tomwalters@0 69 name=get(f,'name');
tomwalters@0 70 if ~isempty(strfind(name,'About'))
tomwalters@0 71 close(f);
tomwalters@0 72 end
tomwalters@0 73 end
tomwalters@0 74
tomwalters@0 75
tomwalters@0 76 function aim_OpeningFcn(hObject, eventdata, handles, varargin)
tomwalters@0 77 handles.output = hObject;
tomwalters@0 78
tomwalters@0 79 verstrst=ver;
tomwalters@0 80 nrproducts=length(verstrst);
tomwalters@0 81 for i=1:nrproducts
tomwalters@0 82 verstr=verstrst(i);
tomwalters@0 83 if strcmp(verstr.Name,'MATLAB') % just making sure...
tomwalters@0 84 vernr=str2num(verstr.Version);
tomwalters@0 85 if vernr<6.5
tomwalters@0 86 str='aim-mat requires MATLAB version 6.5 or higher!';
tomwalters@0 87 disp(str);
tomwalters@0 88 er=errordlg(str,'Version error');
tomwalters@0 89 set(er,'WindowStyle','modal');
tomwalters@0 90 return
tomwalters@0 91 end
tomwalters@0 92 end
tomwalters@0 93 end
tomwalters@0 94
tomwalters@0 95 % per default we work with graphic
tomwalters@0 96 handles.with_graphic=1;
tomwalters@0 97 % no error so far
tomwalters@0 98 handles.error=0;
tomwalters@0 99
tomwalters@0 100
tomwalters@0 101 % handles.screen_modus='paper'; % can be 'screen' or 'paper' - chooses the colors and styles
tomwalters@0 102 handles.screen_modus='screen'; %
tomwalters@0 103
tomwalters@0 104 if isstruct(varargin{1})
tomwalters@0 105 all_options=varargin{1};
tomwalters@0 106 filename=all_options.signal.signal_filename;
tomwalters@0 107 handles.autorun=1; % start running after loading
tomwalters@0 108 handles.initial_options=all_options; % start with these options
tomwalters@0 109 else
tomwalters@0 110 filename=varargin{1};
tomwalters@0 111 handles.autorun=0; % dont start running after loading
tomwalters@0 112 end
tomwalters@0 113
tomwalters@0 114 % initiate the parameters from an old version or do it new:
tomwalters@0 115 handles=init_aim_parameters(handles,filename);
tomwalters@0 116 if handles.error==1
tomwalters@0 117 close(handles.figure1);
tomwalters@0 118 return
tomwalters@0 119 end
tomwalters@0 120
tomwalters@0 121 % reset the graphic to standart values:
tomwalters@0 122 handles=init_aim_gui(handles);
tomwalters@0 123 movegui(handles.figure1,'south');
tomwalters@0 124
tomwalters@0 125 % set the close function to my own
tomwalters@0 126 set(handles.figure1,'CloseRequestFcn',{@quitprogram,handles})
tomwalters@0 127
tomwalters@0 128 if handles.autorun==1
tomwalters@0 129 if isfield(handles.initial_options,'pcp')
tomwalters@0 130 set(handles.checkbox0,'Value',1);
tomwalters@0 131 end
tomwalters@0 132 if isfield(handles.initial_options,'bmm')
tomwalters@0 133 set(handles.checkbox1,'Value',1);
tomwalters@0 134 end
tomwalters@0 135 if isfield(handles.initial_options,'nap')
tomwalters@0 136 set(handles.checkbox2,'Value',1);
tomwalters@0 137 end
tomwalters@0 138 if isfield(handles.initial_options,'strobes')
tomwalters@0 139 set(handles.checkbox3,'Value',1);
tomwalters@0 140 end
tomwalters@0 141 if isfield(handles.initial_options,'sai')
tomwalters@0 142 set(handles.checkbox4,'Value',1);
tomwalters@0 143 end
tomwalters@0 144 if isfield(handles.initial_options,'usermodule')
tomwalters@0 145 set(handles.checkbox8,'Value',1);
tomwalters@0 146 end
tomwalters@0 147 end
tomwalters@0 148
tomwalters@0 149 % do the changes and go on!
tomwalters@0 150 handles=update(hObject, eventdata, handles,2);
tomwalters@0 151
tomwalters@0 152 if handles.autorun==1
tomwalters@0 153 old_all_options=handles.all_options;
tomwalters@0 154 handles.all_options=all_options;
tomwalters@0 155 handles.info.no_automatic_parameter_update=1;
tomwalters@0 156 % now tell the info, which modules we want. This is the same routine as
tomwalters@0 157 % in the no-grafic version:
tomwalters@0 158
tomwalters@0 159 handles.info.calculate_signal=0;
tomwalters@0 160 handles.info.calculate_pcp=0;
tomwalters@0 161 handles.info.calculate_bmm=0;
tomwalters@0 162 handles.info.calculate_nap=0;
tomwalters@0 163 handles.info.calculate_strobes=0;
tomwalters@0 164 handles.info.calculate_sai=0;
tomwalters@0 165 handles.info.calculate_usermodule=0;
tomwalters@0 166 handles.info.calculate_movie=0;
tomwalters@0 167 % now find out, which column we want to calculate:
tomwalters@0 168 if isfield(all_options,'pcp')
tomwalters@0 169 handles.info.calculate_pcp=1;
tomwalters@0 170 module_names=fieldnames(all_options.pcp); % find out, which module name
tomwalters@0 171 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 172 handles.info.current_pcp_module=module_name; % this one is the current one
tomwalters@0 173 handles.all_options.pcp=all_options.pcp; % copy the parameters in place
tomwalters@0 174 end
tomwalters@0 175 if isfield(all_options,'bmm')
tomwalters@0 176 handles.info.calculate_bmm=1;
tomwalters@0 177 module_names=fieldnames(all_options.bmm); % find out, which module name
tomwalters@0 178 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 179 handles.info.current_bmm_module=module_name; % this one is the current one
tomwalters@0 180 handles.all_options.bmm=all_options.bmm; % copy the parameters in place
tomwalters@0 181 end
tomwalters@0 182 if isfield(all_options,'nap')
tomwalters@0 183 handles.info.calculate_nap=1;
tomwalters@0 184 module_names=fieldnames(all_options.nap); % find out, which module name
tomwalters@0 185 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 186 handles.info.current_nap_module=module_name; % this one is the current one
tomwalters@0 187 handles.all_options.nap=all_options.nap; % copy the parameters in place
tomwalters@0 188 end
tomwalters@0 189 if isfield(all_options,'strobes')
tomwalters@0 190 handles.info.calculate_strobes=1;
tomwalters@0 191 module_names=fieldnames(all_options.strobes); % find out, which module name
tomwalters@0 192 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 193 handles.info.current_strobes_module=module_name; % this one is the current one
tomwalters@0 194 handles.all_options.strobes=all_options.strobes; % copy the parameters in place
tomwalters@0 195 end
tomwalters@0 196 if isfield(all_options,'sai')
tomwalters@0 197 handles.info.calculate_sai=1;
tomwalters@0 198 module_names=fieldnames(all_options.sai); % find out, which module name
tomwalters@0 199 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 200 handles.info.current_sai_module=module_name; % this one is the current one
tomwalters@0 201 handles.all_options.sai=all_options.sai; % copy the parameters in place
tomwalters@0 202 end
tomwalters@0 203 if isfield(all_options,'usermodule')
tomwalters@0 204 handles.info.calculate_usermodule=1;
tomwalters@0 205 module_names=fieldnames(all_options.usermodule); % find out, which module name
tomwalters@0 206 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 207 handles.info.current_usermodule_module=module_name; % this one is the current one
tomwalters@0 208 handles.all_options.usermodule=all_options.usermodule; % copy the parameters in place
tomwalters@0 209 end
tomwalters@0 210 if isfield(all_options,'movie')
tomwalters@0 211 handles.info.calculate_movie=1;
tomwalters@0 212 module_names=fieldnames(all_options.movie); % find out, which module name
tomwalters@0 213 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 214 handles.info.current_movie_module=module_name; % this one is the current one
tomwalters@0 215 handles.all_options.movie=all_options.movie; % copy the parameters in place
tomwalters@0 216 end
tomwalters@0 217
tomwalters@0 218 % up to here copy of nowgrafic. If I ever have time, I think of something
tomwalters@0 219 % more elegant
tomwalters@0 220
tomwalters@0 221 handles=do_aim_calculate(handles);
tomwalters@0 222 handles.all_options=old_all_options;
tomwalters@0 223
tomwalters@0 224 if isfield(all_options,'pcp')
tomwalters@0 225 result=handles.data.pcp;
tomwalters@0 226 end
tomwalters@0 227 if isfield(all_options,'bmm')
tomwalters@0 228 result=handles.data.bmm;
tomwalters@0 229 end
tomwalters@0 230 if isfield(all_options,'nap')
tomwalters@0 231 result=handles.data.nap;
tomwalters@0 232 end
tomwalters@0 233 if isfield(all_options,'strobes')
tomwalters@0 234 result=handles.data.strobes;
tomwalters@0 235 end
tomwalters@0 236 if isfield(all_options,'sai')
tomwalters@0 237 result=handles.data.sai;
tomwalters@0 238 end
tomwalters@0 239 if isfield(all_options,'pitch_image')
tomwalters@0 240 result=handles.data.pitch_image;
tomwalters@0 241 end
tomwalters@0 242 if isfield(all_options,'usermodule')
tomwalters@0 243 result=handles.data.usermodule;
tomwalters@0 244 end
tomwalters@0 245
tomwalters@0 246 handles.output=result;
tomwalters@0 247 handles=update(hObject, eventdata, handles,2);
tomwalters@0 248 end
tomwalters@0 249
tomwalters@0 250 function varargout = aim_OutputFcn(hObject, eventdata, handles)
tomwalters@0 251 if isfield(handles,'output')
tomwalters@0 252 result.result=handles.output;
tomwalters@0 253 result.error=0;
tomwalters@0 254 result.all_options=handles.all_options;
tomwalters@0 255 result.info=handles.info;
tomwalters@0 256 % copy all data to the output, it is usefull sometimes!
tomwalters@0 257 if isfield(handles.info,'no_automatic_parameter_update')
tomwalters@0 258 if isfield(handles.all_options,'pcp')
tomwalters@0 259 result.result=handles.data.pcp;
tomwalters@0 260 end
tomwalters@0 261 if isfield(handles.all_options,'bmm')
tomwalters@0 262 result.result=handles.data.bmm;
tomwalters@0 263 end
tomwalters@0 264 if isfield(handles.all_options,'nap')
tomwalters@0 265 result.result=handles.data.nap;
tomwalters@0 266 end
tomwalters@0 267 if isfield(handles.all_options,'strobes')
tomwalters@0 268 result.result=handles.data.strobes;
tomwalters@0 269 end
tomwalters@0 270 if isfield(handles.all_options,'sai')
tomwalters@0 271 result.result=handles.data.sai;
tomwalters@0 272 end
tomwalters@0 273 if isfield(handles.all_options,'usermodule')
tomwalters@0 274 result.result=handles.data.usermodule;
tomwalters@0 275 end
tomwalters@0 276 end
tomwalters@0 277
tomwalters@0 278 varargout{1} = result;
tomwalters@0 279 end
tomwalters@0 280
tomwalters@0 281
tomwalters@0 282
tomwalters@0 283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 284 %% Menufunktions %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 286 function exit_Callback(hObject, eventdata, handles)
tomwalters@0 287 quitprogram(hObject, eventdata, handles);
tomwalters@0 288 function about_Callback(hObject, eventdata, handles)
tomwalters@0 289 aim_displayaboutbox(handles);
tomwalters@0 290 function file_Callback(hObject, eventdata, handles)
tomwalters@0 291 function help_Callback(hObject, eventdata, handles)
tomwalters@0 292
tomwalters@0 293 % load a new sound
tomwalters@0 294 function loadsound_Callback(hObject, eventdata, handles)
tomwalters@0 295 [signame,dirname]=uigetfile('*.wav');
tomwalters@0 296 if ~isnumeric(dirname)
tomwalters@0 297 cd(dirname);
tomwalters@0 298 if fexist(signame)
tomwalters@0 299 handles=init_aim_parameters(handles,signame);
tomwalters@0 300 handles=init_aim_gui(handles);
tomwalters@0 301 else
tomwalters@0 302 return
tomwalters@0 303 end
tomwalters@0 304 else
tomwalters@0 305 return
tomwalters@0 306 end
tomwalters@0 307 handles=update(hObject, eventdata, handles,2);
tomwalters@0 308
tomwalters@0 309 % exchange the soundfile and keep the rest
tomwalters@0 310 function exchange_Callback(hObject, eventdata, handles)
tomwalters@0 311 [signame,dirname]=uigetfile('*.wav');
tomwalters@0 312 if ~isnumeric(dirname)
tomwalters@0 313 cd(dirname);
tomwalters@0 314 if fexist(signame)
tomwalters@0 315 handles=aim_exchange_sound_file(handles,signame);
tomwalters@0 316 % handles=init_aim_gui(handles);
tomwalters@0 317 else
tomwalters@0 318 return
tomwalters@0 319 end
tomwalters@0 320 else
tomwalters@0 321 return
tomwalters@0 322 end
tomwalters@0 323 handles=update(hObject, eventdata, handles,2);
tomwalters@0 324
tomwalters@0 325
tomwalters@0 326
tomwalters@0 327 function edit_Callback(hObject, eventdata, handles)
tomwalters@0 328 function opencool_Callback(hObject, eventdata, handles)
tomwalters@0 329 wavename=sprintf('%s/%s',pwd,handles.info.signalwavename);
tomwalters@0 330 if ispc
tomwalters@0 331 winopen(wavename);
tomwalters@0 332 else
tomwalters@0 333 disp('sorry, cant open external file in unix...');
tomwalters@0 334 end
tomwalters@0 335
tomwalters@0 336 function internethelp_Callback(hObject, eventdata, handles)
tomwalters@0 337 helpname=sprintf('%shelp.html',handles.info.columnpath);
tomwalters@0 338 if ispc
tomwalters@0 339 winopen(helpname);
tomwalters@0 340 else
tomwalters@0 341 disp('sorry, cant open external file in unix...');
tomwalters@0 342 end
tomwalters@0 343
tomwalters@0 344 function Untitled_1_Callback(hObject, eventdata, handles)
tomwalters@0 345 function sptool_Callback(hObject, eventdata, handles)
tomwalters@0 346 sig=handles.data.signal;
tomwalters@0 347 adaptedspecgramdemo(getvalues(sig),getsr(sig));
tomwalters@0 348
tomwalters@0 349
tomwalters@0 350
tomwalters@0 351 %%%%%%% save standalone parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 352 function saveasparameters_Callback(hObject, eventdata, handles)
tomwalters@0 353 [fname,dirname]=uiputfile('*.m','Save stand alone parameter file');
tomwalters@0 354 if isempty(strfind(fname,'.m'))
tomwalters@0 355 fname=[fname '.m'];
tomwalters@0 356 end
tomwalters@0 357 filename=fullfile(dirname,fname);
tomwalters@0 358 aim_saveparameters(handles,filename,0); % the 0 indicates, that only the relevant parameters are important
tomwalters@0 359
tomwalters@0 360 %%%%%%% open personal default file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 361 function open_personal_Callback(hObject, eventdata, handles)
tomwalters@0 362 edit('personal_defaults.m');
tomwalters@0 363
tomwalters@0 364 %%%%%%% open current generating function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 365 function edit_genfunc_Callback(hObject, eventdata, handles)
tomwalters@0 366 [generating_module,generating_function,coptions]=aim_getcurrent_module(handles,handles.info.current_plot);
tomwalters@0 367 edit(generating_function);
tomwalters@0 368
tomwalters@0 369
tomwalters@0 370 %%%%%%% edit parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 371 function edit_params_Callback(hObject, eventdata, handles)
tomwalters@0 372 dir=handles.info.original_soundfile_directory;
tomwalters@0 373 filename=fullfile(dir,handles.info.parameterfilename);
tomwalters@0 374 edit(filename);
tomwalters@0 375 %%%%%%% diaplay versions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 376 function version_Callback(hObject, eventdata, handles)
tomwalters@0 377 aim_display_versions(handles);
tomwalters@0 378
tomwalters@0 379 function copydata_Callback(hObject, eventdata, handles)
tomwalters@0 380 assignin('base','data',handles.data);
tomwalters@0 381 assignin('base','info',handles.info);
tomwalters@0 382
tomwalters@0 383 % select the start point and the end point of the signal
tomwalters@0 384 function select_time_Callback(hObject, eventdata, handles)
tomwalters@0 385 oldoptions=handles.all_options.signal;
tomwalters@0 386 sig=handles.data.original_signal;
tomwalters@0 387 % out=adaptedspecgramdemo(getvalues(sig),getsr(sig),oldoptions.start_time,oldoptions.start_time+oldoptions.duration);
tomwalters@0 388 % handles.all_options.signal.start_time=out.start;
tomwalters@0 389 % handles.all_options.signal.duration=out.duration;
tomwalters@0 390
tomwalters@0 391 current_start=handles.all_options.signal.start_time;
tomwalters@0 392 current_duration=handles.all_options.signal.duration;
tomwalters@0 393 allowed_duration=handles.all_options.signal.original_duration;
tomwalters@0 394 text{1}='';
tomwalters@0 395 text{2}='';
tomwalters@0 396
tomwalters@0 397 [start,duration]=length_questionbox(current_start,current_duration,allowed_duration,text);
tomwalters@0 398 handles.all_options.signal.start_time=start;
tomwalters@0 399 handles.all_options.signal.duration=duration;
tomwalters@0 400
tomwalters@0 401 if ~structisequal(oldoptions,handles.all_options.signal)
tomwalters@0 402 aim_saveparameters(handles,handles.info.parameterfilename,1); % save the new parameters to the file
tomwalters@0 403 % handles.info.calculate_signal=1;
tomwalters@0 404 handles.all_options.signal=oldoptions; % tell him to use the new ones!
tomwalters@0 405 handles=do_aim_updateparameters(handles);
tomwalters@0 406 % handles=do_aim_calculate(handles);
tomwalters@0 407 handles=update(hObject, eventdata, handles,4);
tomwalters@0 408 end
tomwalters@0 409
tomwalters@0 410
tomwalters@0 411
tomwalters@0 412
tomwalters@0 413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 414 %% PushButtons %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 416
tomwalters@0 417 %%%%%%% play sound %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 418 function pushbutton23_Callback(hObject, eventdata, handles)
tomwalters@0 419 play(handles.data.signal);
tomwalters@0 420 % signal
tomwalters@0 421 function pushbutton22_Callback(hObject, eventdata, handles)
tomwalters@0 422 handles.info.current_plot=1;
tomwalters@0 423 handles=update(hObject, eventdata, handles,4);
tomwalters@0 424 %pcp
tomwalters@0 425 function pushbutton0_Callback(hObject, eventdata, handles)
tomwalters@0 426 handles.info.current_plot=2;
tomwalters@0 427 if get(handles.checkbox0,'Value')==1
tomwalters@0 428 handles=do_aim_calculate(handles);
tomwalters@0 429 end
tomwalters@0 430 handles=update(hObject, eventdata, handles,4);
tomwalters@0 431 % bmm
tomwalters@0 432 function pushbutton2_Callback(hObject, eventdata, handles)
tomwalters@0 433 handles.info.current_plot=3;
tomwalters@0 434 if get(handles.checkbox1,'Value')==1
tomwalters@0 435 handles=do_aim_calculate(handles);
tomwalters@0 436 end
tomwalters@0 437 handles=update(hObject, eventdata, handles,4);
tomwalters@0 438 % nap
tomwalters@0 439 function pushbutton3_Callback(hObject, eventdata, handles)
tomwalters@0 440 handles.info.current_plot=4;
tomwalters@0 441 if get(handles.checkbox2,'Value')==1
tomwalters@0 442 handles=do_aim_calculate(handles);
tomwalters@0 443 end
tomwalters@0 444 handles=update(hObject, eventdata, handles,4);
tomwalters@0 445 % strobes
tomwalters@0 446 function pushbutton4_Callback(hObject, eventdata, handles)
tomwalters@0 447 handles.info.current_plot=5;
tomwalters@0 448 if get(handles.checkbox3,'Value')==1
tomwalters@0 449 handles=do_aim_calculate(handles);
tomwalters@0 450 end
tomwalters@0 451 handles=update(hObject, eventdata, handles,4);
tomwalters@0 452 % sai
tomwalters@0 453 function pushbutton5_Callback(hObject, eventdata, handles)
tomwalters@0 454 handles.info.current_plot=6;
tomwalters@0 455 if get(handles.checkbox4,'Value')==1
tomwalters@0 456 handles=do_aim_calculate(handles);
tomwalters@0 457 end
tomwalters@0 458 sai=handles.data.sai;
tomwalters@0 459 nr_chan=getnrchannels(sai{1});
tomwalters@0 460 if nr_chan==1
tomwalters@0 461 set(handles.checkbox6,'Value',0); %switch off frequency profile
tomwalters@0 462 set(handles.checkbox7,'Value',0); %switch off temporal profile
tomwalters@0 463 else
tomwalters@0 464 set(handles.checkbox6,'Value',1); %switch on frequency profile
tomwalters@0 465 set(handles.checkbox7,'Value',1); %switch on temporal profile
tomwalters@0 466 end
tomwalters@0 467 handles=update(hObject, eventdata, handles,4);
tomwalters@0 468 % usermodule
tomwalters@0 469 function pushbutton21_Callback(hObject, eventdata, handles)
tomwalters@0 470 handles.info.current_plot=7;
tomwalters@0 471 if get(handles.checkbox8,'Value')==1
tomwalters@0 472 handles=do_aim_calculate(handles);
tomwalters@0 473 end
tomwalters@0 474 handles=update(hObject, eventdata, handles,2);
tomwalters@0 475 % movie
tomwalters@0 476 function pushbutton6_Callback(hObject, eventdata, handles)
tomwalters@0 477 if get(handles.checkbox5,'Value')==1
tomwalters@0 478 handles=do_aim_calculate(handles);
tomwalters@0 479 end
tomwalters@0 480 % generating_module_string=get(handles.listbox5,'String');
tomwalters@0 481 % generating_module=generating_module_string(get(handles.listbox5,'Value'));
tomwalters@0 482 % generating_module=generating_module{1};
tomwalters@0 483 % uniqueworkingname=handles.info.uniqueworkingname;
tomwalters@0 484 directoryname=handles.info.directoryname;
tomwalters@0 485 % moviename=sprintf('%s/%s/%s.%s.mov',pwd,directoryname,uniqueworkingname,generating_module);
tomwalters@0 486
tomwalters@0 487 handles=update(hObject, eventdata, handles,2);
tomwalters@0 488
tomwalters@0 489 moviename=fullfile(pwd,directoryname,handles.info.last_movie_name_generated);
tomwalters@0 490 if ispc
tomwalters@0 491 winopen(moviename);
tomwalters@0 492 else
tomwalters@0 493 disp('sorry, cant open external file in unix...');
tomwalters@0 494 end
tomwalters@0 495
tomwalters@0 496 % autoscale
tomwalters@0 497 function pushbuttonautoscale_Callback(hObject, eventdata, handles)
tomwalters@0 498 handles=do_aim_autoscale(handles);
tomwalters@0 499 handles=update(hObject, eventdata, handles,1);
tomwalters@0 500
tomwalters@0 501 % update
tomwalters@0 502 function pushbutton25_Callback(hObject, eventdata, handles)
tomwalters@0 503 handles=do_aim_updateparameters(handles);
tomwalters@0 504 handles=update(hObject, eventdata, handles,2);
tomwalters@0 505
tomwalters@0 506
tomwalters@0 507
tomwalters@0 508 % single channel
tomwalters@0 509 function pushbutton24_Callback(hObject, eventdata, handles)
tomwalters@0 510 if ~isfield(handles.info,'children')
tomwalters@0 511 fig=figure;
tomwalters@0 512 handles.info.children.single_channel.windowhandle=fig;
tomwalters@0 513 else
tomwalters@0 514 figure(handles.info.children.single_channel.windowhandle)
tomwalters@0 515 end
tomwalters@0 516
tomwalters@0 517 single_channel_gui(handles);
tomwalters@0 518 guidata(hObject, handles);
tomwalters@0 519
tomwalters@0 520
tomwalters@0 521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 522 %% Listboxes %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 524 function listbox0_CreateFcn(hObject, eventdata, handles)
tomwalters@0 525 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 526 function listbox1_CreateFcn(hObject, eventdata, handles)
tomwalters@0 527 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 528 function listbox2_CreateFcn(hObject, eventdata, handles)
tomwalters@0 529 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 530 function listbox3_CreateFcn(hObject, eventdata, handles)
tomwalters@0 531 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 532 function listbox4_CreateFcn(hObject, eventdata, handles)
tomwalters@0 533 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 534 function listbox5_CreateFcn(hObject, eventdata, handles)
tomwalters@0 535 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 536 function listbox6_CreateFcn(hObject, eventdata, handles)
tomwalters@0 537 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 538
tomwalters@0 539 % pcp
tomwalters@0 540 function listbox0_Callback(hObject, eventdata, handles)
tomwalters@0 541 % TODO:
tomwalters@0 542 % oldmodule=handles.info.current_pcp_module;
tomwalters@0 543 set(handles.checkbox0,'Value',1); % set the tick to indicate, that it has changed
tomwalters@0 544 handles=update(hObject, eventdata, handles,3);
tomwalters@0 545 % newmodule=handles.info.current_pcp_module;
tomwalters@0 546 % if strcmp(oldmodule,newmodule)
tomwalters@0 547 % set(handles.checkbox0,'Value',0); % remove the tick again
tomwalters@0 548 % end
tomwalters@0 549 % bmm
tomwalters@0 550 function listbox1_Callback(hObject, eventdata, handles)
tomwalters@0 551 set(handles.checkbox1,'Value',1);
tomwalters@0 552 handles=update(hObject, eventdata, handles,5);
tomwalters@0 553 % nap
tomwalters@0 554 function listbox2_Callback(hObject, eventdata, handles)
tomwalters@0 555 set(handles.checkbox2,'Value',1);
tomwalters@0 556 handles=update(hObject, eventdata, handles,5);
tomwalters@0 557 % strobes
tomwalters@0 558 function listbox3_Callback(hObject, eventdata, handles)
tomwalters@0 559 set(handles.checkbox3,'Value',1);
tomwalters@0 560 handles=update(hObject, eventdata, handles,5);
tomwalters@0 561 % sai
tomwalters@0 562 function listbox4_Callback(hObject, eventdata, handles)
tomwalters@0 563 set(handles.checkbox4,'Value',1);
tomwalters@0 564 handles=update(hObject, eventdata, handles,5);
tomwalters@0 565 %usermodule
tomwalters@0 566 function listbox6_Callback(hObject, eventdata, handles)
tomwalters@0 567 set(handles.checkbox8,'Value',1);
tomwalters@0 568 handles=update(hObject, eventdata, handles,5);
tomwalters@0 569 % movie
tomwalters@0 570 function listbox5_Callback(hObject, eventdata, handles)
tomwalters@0 571 set(handles.checkbox5,'Value',1);
tomwalters@0 572 handles=update(hObject, eventdata, handles,5);
tomwalters@0 573
tomwalters@0 574
tomwalters@0 575
tomwalters@0 576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 577 %% Checkboxes %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 579 %pcp
tomwalters@0 580 function checkbox0_Callback(hObject, eventdata, handles)
tomwalters@0 581 handles=aim_updatecheckboxes(hObject, eventdata, handles,1);
tomwalters@0 582 handles=update(hObject, eventdata, handles,3);
tomwalters@0 583 %bmm
tomwalters@0 584 function checkbox1_Callback(hObject, eventdata, handles)
tomwalters@0 585 handles=aim_updatecheckboxes(hObject, eventdata, handles,2);
tomwalters@0 586 handles=update(hObject, eventdata, handles,3);
tomwalters@0 587 %nap
tomwalters@0 588 function checkbox2_Callback(hObject, eventdata, handles)
tomwalters@0 589 handles=aim_updatecheckboxes(hObject, eventdata, handles,3);
tomwalters@0 590 handles=update(hObject, eventdata, handles,3);
tomwalters@0 591 %strobes
tomwalters@0 592 function checkbox3_Callback(hObject, eventdata, handles)
tomwalters@0 593 handles=aim_updatecheckboxes(hObject, eventdata, handles,4);
tomwalters@0 594 handles=update(hObject, eventdata, handles,3);
tomwalters@0 595 %sai
tomwalters@0 596 function checkbox4_Callback(hObject, eventdata, handles)
tomwalters@0 597 handles=aim_updatecheckboxes(hObject, eventdata, handles,5);
tomwalters@0 598 handles=update(hObject, eventdata, handles,3);
tomwalters@0 599 % usermodule
tomwalters@0 600 function checkbox8_Callback(hObject, eventdata, handles)
tomwalters@0 601 handles=aim_updatecheckboxes(hObject, eventdata, handles,6);
tomwalters@0 602 handles=update(hObject, eventdata, handles,3);
tomwalters@0 603 %movies
tomwalters@0 604 function checkbox5_Callback(hObject, eventdata, handles)
tomwalters@0 605 handles=aim_updatecheckboxes(hObject, eventdata, handles,7);
tomwalters@0 606 handles=update(hObject, eventdata, handles,3);
tomwalters@0 607
tomwalters@0 608 % show the time waveform on top
tomwalters@0 609 function checkbox10_Callback(hObject, eventdata, handles)
tomwalters@0 610 handles=update(hObject, eventdata, handles,2);
tomwalters@0 611 function checkbox6_Callback(hObject, eventdata, handles)
tomwalters@0 612 handles=update(hObject, eventdata, handles,2);
tomwalters@0 613 %show interval profile
tomwalters@0 614 function checkbox7_Callback(hObject, eventdata, handles)
tomwalters@0 615 handles=update(hObject, eventdata, handles,2);
tomwalters@0 616
tomwalters@0 617
tomwalters@0 618
tomwalters@0 619
tomwalters@0 620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 621 %% Sliders %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 623 function slider1_CreateFcn(hObject, eventdata, handles)
tomwalters@0 624 usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 625 function slider2_CreateFcn(hObject, eventdata, handles)
tomwalters@0 626 usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 627 function slider3_CreateFcn(hObject, eventdata, handles)
tomwalters@0 628 usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 629
tomwalters@0 630 function slider1_Callback(hObject, eventdata, handles)
tomwalters@0 631 handles=slider_scale(hObject, eventdata, handles);
tomwalters@0 632 handles=update(hObject, eventdata, handles,1);
tomwalters@0 633
tomwalters@0 634 function slider2_Callback(hObject, eventdata, handles)
tomwalters@0 635 handles=slider_start(hObject, eventdata, handles);
tomwalters@0 636 handles=update(hObject, eventdata, handles,1);
tomwalters@0 637
tomwalters@0 638 function slider3_Callback(hObject, eventdata, handles)
tomwalters@0 639 handles=slider_duration(hObject, eventdata, handles);
tomwalters@0 640 handles=update(hObject, eventdata, handles,1);
tomwalters@0 641
tomwalters@0 642
tomwalters@0 643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 644 %% Edits %%%%%%%%%%%%%%%%%%%%%
tomwalters@0 645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 646 function edit1_CreateFcn(hObject, eventdata, handles)
tomwalters@0 647 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 648 function edit2_CreateFcn(hObject, eventdata, handles)
tomwalters@0 649 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 650 function edit3_CreateFcn(hObject, eventdata, handles)
tomwalters@0 651 if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end
tomwalters@0 652
tomwalters@0 653 function edit1_Callback(hObject, eventdata, handles)
tomwalters@0 654 handles=edit_scale(hObject, eventdata, handles);
tomwalters@0 655 handles=update(hObject, eventdata, handles,1);
tomwalters@0 656 function edit2_Callback(hObject, eventdata, handles)
tomwalters@0 657 handles=edit_start(hObject, eventdata, handles);
tomwalters@0 658 handles=update(hObject, eventdata, handles,1);
tomwalters@0 659 function edit3_Callback(hObject, eventdata, handles)
tomwalters@0 660 handles=edit_duration(hObject, eventdata, handles);
tomwalters@0 661 handles=update(hObject, eventdata, handles,1);
tomwalters@0 662
tomwalters@0 663
tomwalters@0 664 function handles=update(hObject, eventdata, handles,action)
tomwalters@0 665
tomwalters@0 666 % check, if the singlechannel window was closed: (this is here, because it
tomwalters@0 667 % is checked most often
tomwalters@0 668 if isfield(handles.info,'children')
tomwalters@0 669 if ~ishandle(handles.info.children.single_channel.windowhandle)
tomwalters@0 670 rmfield(handles.info.children,'single_channel');
tomwalters@0 671 end
tomwalters@0 672 end
tomwalters@0 673
tomwalters@0 674 handles.calling_object=hObject;
tomwalters@0 675
tomwalters@0 676 if action>1
tomwalters@0 677 handles=aim_updategui(handles);
tomwalters@0 678 end
tomwalters@0 679
tomwalters@0 680 % if we want to see the interval profile:
tomwalters@0 681
tomwalters@0 682 if get(handles.checkbox7,'Value')==1
tomwalters@0 683 options.withtime=true;
tomwalters@0 684 else
tomwalters@0 685 options.withtime=false;
tomwalters@0 686 end
tomwalters@0 687 % and if we want to see the frequency profile:
tomwalters@0 688 if get(handles.checkbox6,'Value')==1
tomwalters@0 689 options.withfre=islogical(true);
tomwalters@0 690 else
tomwalters@0 691 options.withfre=islogical(0);
tomwalters@0 692 end
tomwalters@0 693 % do we want to see the signal?
tomwalters@0 694 if get(handles.checkbox10,'Value')==1
tomwalters@0 695 options.withsignal=islogical(true);
tomwalters@0 696 else
tomwalters@0 697 options.withsignal=islogical(0);
tomwalters@0 698 end
tomwalters@0 699 % if there has never been a figure, create a new one
tomwalters@0 700 if ~isfield(handles.info,'current_figure')
tomwalters@0 701 handles.info.current_figure=figure;
tomwalters@0 702 end
tomwalters@0 703 options.figure_handle=handles.info.current_figure;
tomwalters@0 704
tomwalters@0 705 switch action
tomwalters@0 706 case {1,2}
tomwalters@0 707 handles=aim_replotgraphic(handles,options);
tomwalters@0 708 aim_savecurrentstate(handles);% save the state of the project and the window to a file
tomwalters@0 709 guidata(hObject, handles);
tomwalters@0 710 case 3
tomwalters@0 711 aim_savecurrentstate(handles);% save the state of the project and the window to a file
tomwalters@0 712 guidata(hObject, handles);
tomwalters@0 713 case 4 % everything with autoscale (for click on button)
tomwalters@0 714 handles=do_aim_autoscale(handles);
tomwalters@0 715 handles=aim_replotgraphic(handles,options);
tomwalters@0 716 aim_savecurrentstate(handles);% save the state of the project and the window to a file
tomwalters@0 717 guidata(hObject, handles);
tomwalters@0 718 case 5
tomwalters@0 719 guidata(hObject, handles);
tomwalters@0 720 end
tomwalters@0 721
tomwalters@0 722