0001 function varargout = bayes_parm_basic_gui(fig, command, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0018 error('invalid figure handle is specified.');
0019 end
0020
0021
0022
0023
0024
0025
0026 data = guidata(fig);
0027 H = data.H;
0028
0029 switch(command)
0030
0031
0032
0033 case 'is_exist'
0034 if isfield(H, 'fig')
0035 varargout{1} = true;
0036 else
0037 varargout{1} = false;
0038 end
0039 case 'figure_pull_up_to_top'
0040 figure(H.fig);
0041 case 'gui_update'
0042 bayes_parm = varargin{1};
0043 data = set_gui_parms(data, bayes_parm);
0044 case 'get_project_root'
0045 project_root = get(H.project_root_edit, 'String');
0046 varargout{1} = project_root;
0047 case 'set_project_root'
0048 set(H.project_root_edit, 'String', varargin{1});
0049
0050
0051
0052
0053 case 'get_gui_handles'
0054 varargout{1} = H;
0055
0056
0057
0058 case 'call_back'
0059 hObj = varargin{1};
0060 data = callback(data, hObj);
0061 if ~ishandle(data.H.figure), return; end
0062
0063 bayes_parm = get_gui_parms(data);
0064
0065 bayes_parm_editor(data.main_obj, 'merge_bayes_parm', bayes_parm);
0066 end
0067
0068 function data = set_gui_parms(data, bayes_parm)
0069
0070
0071
0072
0073
0074
0075
0076
0077 H = data.H;
0078
0079
0080
0081
0082 if isfield(bayes_parm, 'proj_dir') && isempty(get(H.project_root_edit, 'String'))
0083 set(H.project_root_edit, 'String', bayes_parm.proj_dir);
0084 end
0085 data = set_gui_meg_file(data, bayes_parm.megfile);
0086 set_gui_basis_file(H, bayes_parm.basisfile);
0087 set(H.brain_file_edit, 'String', bayes_parm.brainfile);
0088
0089 [output_dir, filename, ext] = vb_get_file_parts(bayes_parm.bayesfile);
0090 set(H.result_file_outputdir_edit, 'String', output_dir);
0091 set(H.result_filename_edit, 'String', [filename, ext]);
0092 set_gui_act_file(H, bayes_parm.actfile);
0093 set_gui_area_file(H, bayes_parm.areafile);
0094
0095
0096
0097
0098 area_keys = get(H.area_key_listbox, 'String');
0099 if isempty(area_keys)
0100 set(H.area_key_listbox, 'String', bayes_parm.area_key);
0101 area_keys = bayes_parm.area_key;
0102 end
0103 idx = strmatch(bayes_parm.area_key, area_keys, 'exact');
0104 if ~isempty(idx)
0105 set(H.area_key_listbox, 'Value', idx);
0106 else
0107 set(H.area_key_listbox, 'Value', 1);
0108 end
0109
0110 act_keys = get(H.act_key_listbox, 'String');
0111 if isempty(act_keys)
0112 set(H.act_key_listbox, 'String', bayes_parm.act_key);
0113 act_keys = bayes_parm.act_key;
0114 end
0115 idx = [];
0116
0117 if ischar(bayes_parm.act_key)
0118 bayes_parm.act_key = cellstr(bayes_parm.act_key);
0119 end
0120 for k=1:length(bayes_parm.act_key)
0121 idx = [idx; strmatch(bayes_parm.act_key{k}, act_keys, 'exact')];
0122 end
0123 if ~isempty(idx)
0124 set(H.act_key_listbox, 'Value', idx);
0125 else
0126 set(H.area_key_listbox, 'Value', 1);
0127 end
0128
0129
0130
0131
0132
0133 if length(bayes_parm.twin_meg) == 2
0134 wtime_from_index = bayes_parm.twin_meg(1);
0135 wtime_to_index = bayes_parm.twin_meg(2);
0136
0137 wtime_from_msec = bayes_parm_editor(data.main_obj, ...
0138 'index_to_time',...
0139 wtime_from_index,...
0140 'meg');
0141 wtime_to_msec = bayes_parm_editor(data.main_obj, ...
0142 'index_to_time',...
0143 wtime_to_index,...
0144 'meg');
0145 set(H.whole_time_window_from_edit,...
0146 'String', sprintf('%.2f', wtime_from_msec));
0147 set(H.whole_time_window_to_edit,...
0148 'String', sprintf('%.2f', wtime_to_msec));
0149 end
0150
0151
0152
0153 set(H.time_shift_start_pos_edit, 'String', '');
0154 set(H.time_shift_end_pos_edit, 'String', '');
0155 set(H.time_shift_window_size_edit, 'String', '');
0156 set(H.time_shift_shift_length_edit, 'String', '');
0157
0158 if (length(bayes_parm.Tperiod) == 1) &&...
0159 (length(bayes_parm.Tnext) == 1)
0160 change_time_shift_mode(H, 'equally');
0161
0162 window_size = bayes_parm_editor(data.main_obj, ...
0163 'data_len_to_time_len',...
0164 bayes_parm.Tperiod,...
0165 'meg');
0166 shift_len = bayes_parm_editor(data.main_obj, ...
0167 'data_len_to_time_len',...
0168 bayes_parm.Tnext,...
0169 'meg');
0170 set(H.time_shift_window_size_edit,...
0171 'String', sprintf('%.2f', window_size));
0172 set(H.time_shift_shift_length_edit,...
0173 'String', sprintf('%.2f', shift_len));
0174 elseif (length(bayes_parm.Tperiod) ~= 0) &&...
0175 (length(bayes_parm.Tnext) ~= 0)
0176
0177 change_time_shift_mode(H, 'manual');
0178 start_idx = bayes_parm.Tnext + bayes_parm.twin_meg(1) -1;
0179 start_pos = bayes_parm_editor(data.main_obj, ...
0180 'index_to_time',...
0181 start_idx,...
0182 'meg');
0183 end_idx = bayes_parm.Tnext + bayes_parm.Tperiod + ...
0184 bayes_parm.twin_meg(1)-2;
0185 end_pos = bayes_parm_editor(data.main_obj, ...
0186 'index_to_time',...
0187 end_idx,...
0188 'meg');
0189 spos_comma_text = bayes_parm_gui_util('comma_text', start_pos);
0190 epos_comma_text = bayes_parm_gui_util('comma_text', end_pos);
0191 set(H.time_shift_start_pos_edit, 'String', spos_comma_text);
0192 set(H.time_shift_end_pos_edit, 'String', epos_comma_text);
0193 else
0194 change_time_shift_mode(H, 'equally');
0195 set(H.time_shift_window_size_edit, 'String', '');
0196 set(H.time_shift_shift_length_edit,'String', '');
0197 set(H.time_shift_start_pos_edit, 'String', '');
0198 set(H.time_shift_end_pos_edit, 'String', '');
0199 end
0200
0201
0202
0203
0204
0205
0206
0207 if IsTreatableEstimationModel(bayes_parm) == true
0208
0209
0210
0211 set_forward_model(H, bayes_parm.forward_model, true);
0212
0213
0214
0215
0216 model = bayes_parm.noise_estimation_model;
0217
0218
0219
0220
0221
0222
0223
0224
0225 set(H.noise_estimation_model_popup, 'Value', model);
0226 set_estimation_GUI_properties(H);
0227
0228
0229
0230
0231
0232 set(H.obsn_cov_popup, 'Value', bayes_parm.noise_model);
0233
0234
0235 if bayes_parm.update_sx == ON
0236 update_state = 1;
0237 else
0238 update_state = 0;
0239 end
0240 set(H.update_sx_checkbox, 'Value', update_state);
0241
0242
0243
0244
0245
0246
0247 if bayes_parm.update_v == ON
0248 update_state = 1;
0249 else
0250 update_state = 0;
0251 end
0252 set(H.update_v_checkbox, 'Value', update_state);
0253
0254 else
0255 error_str = sprintf(['Cannot read Estimation Model Parameters.\n', ...
0256 '(The combination not to be able to treat was specified.)\n', ...
0257 'Default Estimation Model parameters are set.']);
0258 errordlg(error_str, 'notice');
0259
0260
0261 set_forward_model(H, STR_FORWARD_MODEL_FOCAL, true);
0262 end
0263
0264
0265
0266 set(H.sensor_noise_file_listbox,'String',bayes_parm.megfile_baseline);
0267 data = set_noise_file_time_window(data, bayes_parm);
0268
0269
0270 set(H.Rfilt_edit, 'String', sprintf('%.2f', bayes_parm.Rfilt(1)*1e3));
0271
0272
0273 set(H.reduce_edit, 'String', sprintf('%.2f', bayes_parm.reduce(1)));
0274
0275
0276 set(H.magnification_edit, 'String', num2str(bayes_parm.a0_act));
0277
0278
0279 set(H.prior_weight_edit, 'String', num2str(bayes_parm.prior_weight));
0280
0281 function bayes_parm = get_gui_parms(data)
0282
0283
0284
0285
0286
0287
0288
0289 H = data.H;
0290
0291
0292
0293
0294
0295 bayes_parm.megfile = get(H.meg_file_listbox, 'String');
0296 bayes_parm.basisfile = get(H.basis_file_listbox, 'String');
0297 bayes_parm.brainfile = get(H.brain_file_edit, 'String');
0298 bayes_parm.bayesfile = [get(H.result_file_outputdir_edit, 'String'),...
0299 filesep,...
0300 get(H.result_filename_edit, 'String')];
0301 bayes_parm.actfile = get(H.act_file_edit, 'String');
0302 bayes_parm.areafile = get(H.area_file_edit, 'String');
0303
0304
0305
0306
0307 area_keys = get(H.area_key_listbox, 'String');
0308 if ischar(area_keys)
0309 bayes_parm.area_key = area_keys;
0310 else
0311 bayes_parm.area_key = area_keys{get(H.area_key_listbox, 'Value')};
0312 end
0313 act_keys = get(H.act_key_listbox, 'String');
0314
0315 if ischar(act_keys)
0316 bayes_parm.act_key = {act_keys};
0317 else
0318 bayes_parm.act_key = act_keys(get(H.act_key_listbox, 'Value'));
0319 end
0320
0321
0322
0323
0324
0325 Tperiod = [];
0326 Tnext = [];
0327 twin_meg = [];
0328 try
0329 if get(H.time_shift_equally_radiobutton, 'Value')
0330
0331
0332
0333
0334
0335 wtime_from_msec = str2double(...
0336 get(H.whole_time_window_from_edit, 'String'));
0337 wtime_to_msec = str2double(get(H.whole_time_window_to_edit, 'String'));
0338
0339
0340 wtime_from_index = bayes_parm_editor(data.main_obj, ...
0341 'time_to_index',...
0342 wtime_from_msec, 'meg');
0343 wtime_to_index = bayes_parm_editor(data.main_obj, ...
0344 'time_to_index',...
0345 wtime_to_msec, 'meg');
0346
0347 twin_meg = [wtime_from_index, wtime_to_index];
0348
0349 window_size = str2double(...
0350 get(H.time_shift_window_size_edit, 'String'));
0351 time_shift_len = str2double(...
0352 get(H.time_shift_shift_length_edit, 'String'));
0353
0354 Tperiod = bayes_parm_editor(data.main_obj, ...
0355 'time_len_to_data_len',...
0356 window_size, 'meg');
0357 Tnext = bayes_parm_editor(data.main_obj, ...
0358 'time_len_to_data_len',...
0359 time_shift_len, 'meg');
0360 else
0361
0362
0363
0364
0365
0366 command = ['[' get(H.time_shift_start_pos_edit, 'String') ']'];
0367 start_pos = eval(command);
0368 command = ['[' get(H.time_shift_end_pos_edit, 'String') ']'];
0369 end_pos = eval(command);
0370 [start_idx, err] = bayes_parm_editor(data.main_obj, ...
0371 'time_to_index',...
0372 start_pos, 'meg');
0373 if err, return, end;
0374 [end_idx, err] = bayes_parm_editor(data.main_obj, ...
0375 'time_to_index',...
0376 end_pos, 'meg');
0377 if err, return, end;
0378
0379
0380 twin_meg = [min(start_idx), max(end_idx)];
0381 Tperiod = end_idx - start_idx + 1;
0382 Tnext = [start_idx - twin_meg(1) + 1];
0383 if length(Tnext) == 1
0384 Tnext = Tperiod;
0385 end
0386 end
0387 catch
0388 end
0389
0390 bayes_parm.twin_meg = twin_meg;
0391 bayes_parm.Tnext = Tnext;
0392 bayes_parm.Tperiod = Tperiod;
0393
0394
0395
0396
0397
0398 bayes_parm.forward_model = get_forward_model(H);
0399 bayes_parm.noise_estimation_model = get_noise_estimation_model(H);
0400
0401
0402 if get(H.specified_checkbox, 'Value')
0403 num_files = length(bayes_parm.megfile);
0404 meg_file = get(H.sensor_noise_file_edit, 'String');
0405
0406
0407 bayes_parm.megfile_baseline = repmat(cellstr(meg_file), num_files, 1);
0408 else
0409
0410 bayes_parm.megfile_baseline = get(H.sensor_noise_file_listbox,'String');
0411 end
0412
0413
0414
0415
0416
0417 bayes_parm.noise_model = get(H.obsn_cov_popup, 'Value');
0418
0419
0420 twin_from_msec = str2double(get(H.obsn_time_window_from_edit, 'String'));
0421 twin_to_msec = str2double(get(H.obsn_time_window_to_edit, 'String'));
0422 twin_from_index = bayes_parm_editor(data.main_obj, ...
0423 'time_to_index',...
0424 twin_from_msec, 'meg');
0425 twin_to_index = bayes_parm_editor(data.main_obj, ...
0426 'time_to_index',...
0427 twin_to_msec, 'meg');
0428 bayes_parm.twin_noise = [twin_from_index twin_to_index];
0429
0430
0431 update_state = get(H.update_sx_checkbox, 'Value');
0432 if update_state
0433 bayes_parm.update_sx = ON;
0434 else
0435 bayes_parm.update_sx = OFF;
0436 end
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446 twin_from_msec = str2double(get(H.obsn_time_window_from_edit, 'String'));
0447 twin_to_msec = str2double(get(H.obsn_time_window_to_edit, 'String'));
0448 twin_from_index = bayes_parm_editor(data.main_obj, ...
0449 'time_to_index',...
0450 twin_from_msec, 'meg');
0451 twin_to_index = bayes_parm_editor(data.main_obj, ...
0452 'time_to_index',...
0453 twin_to_msec, 'meg');
0454
0455 bayes_parm.twin_baseline = [twin_from_index twin_to_index];
0456
0457
0458 update_state = get(H.update_v_checkbox, 'Value');
0459 if update_state
0460 bayes_parm.update_v = ON;
0461 else
0462 bayes_parm.update_v = OFF;
0463 end
0464
0465
0466
0467
0468 bayes_parm.flag_baseline = str2double(get(H.flag_baseline_edit, 'String'));
0469 bayes_parm.flag_noise_set = str2double(get(H.flag_noise_set_edit, 'String'));
0470
0471
0472 bayes_parm.Rfilt = str2num(get(H.Rfilt_edit, 'String'))*1e-3;
0473
0474
0475 bayes_parm.reduce = str2num(get(H.reduce_edit, 'String'));
0476
0477
0478 bayes_parm.a0_act = str2num(get(H.magnification_edit, 'String'));
0479
0480
0481 bayes_parm.prior_weight = str2num(get(H.prior_weight_edit, 'String'));
0482
0483
0484
0485
0486 function data = callback(data, hObj)
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496 global vbmeg_inst;
0497 define = vbmeg_inst.const;
0498
0499 H = data.H;
0500
0501 switch(hObj)
0502 case H.project_root_push
0503 dirname = dir_dialog(get(H.project_root_edit, 'String'));
0504 if dirname ~= 0
0505 set(H.project_root_edit, 'String', dirname);
0506 end
0507 case H.brain_file_push
0508 project_root = get(H.project_root_edit, 'String');
0509 [dirname fname selected] = bayes_parm_gui_util(...
0510 'filedlg_relative',...
0511 {define.BRAIN_EXTENSION},...
0512 0, project_root, ...
0513 'Select cortical model file');
0514 if selected
0515 brain_file = fullfile(dirname, fname{1});
0516 set(H.brain_file_edit, 'String', brain_file);
0517
0518 area_file = strrep(brain_file, define.BRAIN_EXTENSION, ...
0519 define.AREA_EXTENSION);
0520 area_file_abs = fullfile(project_root, area_file);
0521
0522 act_file = strrep(brain_file, define.BRAIN_EXTENSION, ...
0523 define.FMRI_EXTENSION);
0524 act_file_abs = fullfile(project_root, act_file);
0525 if exist(area_file_abs, 'file') == 2
0526 data = reload_gui_area_file(data, area_file);
0527 end
0528 if exist(act_file_abs, 'file') == 2
0529 set_gui_act_file(H, act_file);
0530 end
0531 end
0532 case H.basis_file_add_push
0533 project_root = get(H.project_root_edit, 'String');
0534 [dirname fname selected] = bayes_parm_gui_util(...
0535 'filedlg_relative',...
0536 {define.BASIS_EXTENSION},...
0537 0, project_root, ...
0538 'Select leadfield file');
0539 if selected
0540 num = length(fname);
0541 add_files = {};
0542 for n=1:num
0543 add_files = ...
0544 [add_files; cellstr([dirname filesep fname{n}])];
0545 end
0546 filenames = get(H.basis_file_listbox, 'String');
0547 set_gui_basis_file(H, [filenames; add_files]);
0548 end
0549 case H.basis_file_remove_push
0550 idx = get(H.basis_file_listbox, 'Value');
0551 filenames = get(H.basis_file_listbox, 'String');
0552 if ~isempty(filenames)
0553 filenames(idx) = [];
0554 list_focus = idx(1)-1;
0555 if idx(1)-1 == 0
0556 list_focus = 1;
0557 end
0558 set(H.basis_file_listbox, 'Value', list_focus);
0559 set_gui_basis_file(H, filenames);
0560 end
0561 case H.meg_file_add_push
0562 project_root = get(H.project_root_edit, 'String');
0563 [dirname fnames selected] = bayes_parm_gui_util(...
0564 'filedlg_relative',...
0565 {define.MEG2_EXTENSION, ...
0566 define.EEG_EXTENSION},...
0567 0, project_root, ...
0568 'Select MEG/EEG data');
0569 if selected
0570 num = length(fnames);
0571 add_files = {};
0572 for n=1:num
0573 add_files = ...
0574 [add_files; cellstr([dirname filesep fnames{n}])];
0575 end
0576 filenames = get(H.meg_file_listbox, 'String');
0577 data = set_gui_meg_file(data, [filenames; add_files]);
0578 end
0579 case H.meg_file_remove_push
0580 idx = get(H.meg_file_listbox, 'Value');
0581 filenames = get(H.meg_file_listbox, 'String');
0582
0583 if ~isempty(filenames)
0584 filenames(idx) = [];
0585 list_focus = idx(1)-1;
0586 if idx(1)-1 == 0
0587 list_focus = 1;
0588 end
0589
0590 set(H.meg_file_listbox, 'Value', list_focus);
0591 data = set_gui_meg_file(data, filenames);
0592 end
0593 case H.result_file_outputdir_push
0594 project_root = get(H.project_root_edit, 'String');
0595 dirname = dir_dialog(get(H.project_root_edit, 'String'), false);
0596 if (dirname ~= 0) & (~isempty(project_root))
0597 path_relative = vb_relativepath(dirname, project_root);
0598 path_relative = path_relative(1:length(path_relative)-1);
0599 set(H.result_file_outputdir_edit, 'String', path_relative);
0600 end
0601 case H.result_filename_edit
0602 result_file = get(hObj, 'String');
0603
0604 [path_name, fname, ext] = vb_get_file_parts(result_file);
0605 if isempty(ext)
0606 ext = define.BAYES_EXTENSION;
0607 end
0608 set(hObj, 'String', [fname ext]);
0609 case H.area_file_push
0610 project_root = get(H.project_root_edit, 'String');
0611 [dirname fname selected] = bayes_parm_gui_util(...
0612 'filedlg_relative',...
0613 {define.AREA_EXTENSION},...
0614 0, project_root, ...
0615 'Select cortical area file');
0616 if selected
0617 area_file = [dirname filesep fname{1}];
0618 data = reload_gui_area_file(data, area_file);
0619 end
0620 case H.act_file_push
0621 project_root = get(H.project_root_edit, 'String');
0622 [dirname fname selected] = bayes_parm_gui_util(...
0623 'filedlg_relative',...
0624 {define.FMRI_EXTENSION},...
0625 0, project_root, ...
0626 'Select cortical activity file');
0627 if selected
0628 act_file = [dirname filesep fname{1}];
0629 set_gui_act_file(H, act_file);
0630 end
0631 case { H.whole_time_window_from_edit, H.whole_time_window_to_edit }
0632 time = str2double(get(hObj, 'String'));
0633 [match_time, err] = time_match_sample_point(data, time, 'meg');
0634 if err == 1
0635 errordlg('select meg file.', 'error');
0636 set(hObj, 'String', '');
0637 elseif err == 2
0638 errordlg('Illigal input.', 'error');
0639 set(hObj, 'String', '');
0640 else
0641 set(hObj, 'String', sprintf('%.2f', match_time));
0642 end
0643 case H.time_shift_manual_radiobutton
0644 change_time_shift_mode(H, 'manual');
0645 case H.time_shift_equally_radiobutton
0646 change_time_shift_mode(H, 'equally');
0647 case {H.time_shift_window_size_edit, H.time_shift_shift_length_edit}
0648 time_len = str2double(get(hObj, 'String'));
0649 if time_len < 0
0650 errordlg('The value should be positive value.', 'Error');
0651 set(hObj, 'String', '');
0652 else
0653 [ceil_time_len, err] = ceil_time_length(data, time_len, 'meg');
0654 if err == 1
0655 errordlg('select meg file.', 'error');
0656 elseif err == 2
0657 errordlg('Illigal input.', 'error');
0658 else
0659 set(hObj, 'String', sprintf('%.2f', ceil_time_len));
0660 end
0661 end
0662 case { H.time_shift_start_pos_edit, H.time_shift_end_pos_edit }
0663
0664 command = ['[' get(hObj, 'String') ']'];
0665 try
0666 pos = eval(command);
0667 [match_time, err] = time_match_sample_point(data, pos, 'meg');
0668 catch
0669 errordlg('positions are invalid.', 'error');
0670 return;
0671 end
0672 match_time = sort(match_time);
0673 pos_text = bayes_parm_gui_util('comma_text', match_time);
0674 set(hObj, 'String', pos_text);
0675 case H.duration_check_push
0676
0677 [start_pos, end_pos, err] = get_interval(H);
0678 if err
0679 return;
0680 end
0681 time_window_string = [num2str(start_pos, '%-8.2f'),...
0682 repmat(' - ', length(start_pos), 1),...
0683 num2str(end_pos, '%-8.2f')];
0684
0685 set(H.duration_listbox, 'String', time_window_string);
0686
0687 set(H.duration_listbox, 'Value', 1);
0688 case H.noise_estimation_model_popup
0689 set_estimation_GUI_properties(H);
0690
0691
0692
0693 case H.specified_checkbox
0694 if get(hObj, 'Value')
0695 data = change_sensor_noise_file_selection_mode(data, ON);
0696 else
0697 data = change_sensor_noise_file_selection_mode(data, OFF);
0698 end
0699 case H.sensor_noise_file_edit
0700 data = set_noise_file_time_window(data);
0701 case H.sensor_noise_file_push
0702 project_root = get(H.project_root_edit, 'String');
0703 [dirname fname selected] = bayes_parm_gui_util('filedlg_relative',...
0704 {define.MEG2_EXTENSION},...
0705 0,...
0706 project_root);
0707 if selected
0708 set(H.sensor_noise_file_edit, 'String', [dirname filesep fname{1}]);
0709 data = set_noise_file_time_window(data);
0710 end
0711 case {H.obsn_time_window_from_edit, ...
0712 H.obsn_time_window_to_edit}
0713
0714
0715 value = str2double(get(hObj, 'String'));
0716 [match_time, err] = time_match_sample_point(data, value, 'noise');
0717 if err == 1
0718 errordlg('select meg file.', 'error');
0719 set(hObj, 'String', '');
0720 elseif err == 2
0721 errordlg('Illigal input.', 'error');
0722 set(hObj, 'String', '');
0723 else
0724 set(hObj, 'String', sprintf('%.2f', match_time));
0725 end
0726 case H.advanced_parm_push
0727 bayes_parm_editor_init_advanced_gui(data.main_obj);
0728 case H.save_push
0729
0730 bayes_parm = get_gui_parms(data);
0731
0732 bayes_parm_editor(data.main_obj, 'merge_bayes_parm', bayes_parm);
0733
0734 bayes_parm_editor(data.main_obj, 'save_bayes_parm');
0735 case H.load_push
0736
0737 bayes_parm_editor(data.main_obj, 'load_bayes_parm');
0738 case H.exec_push
0739 push_button_caption = get(H.exec_push, 'String');
0740 set(H.exec_push, 'String', 'Processing...');
0741 pause(0.01);
0742
0743
0744 bayes_parm = get_gui_parms(data);
0745
0746 bayes_parm_editor(data.main_obj, 'merge_bayes_parm', bayes_parm);
0747
0748 bayes_parm_editor(data.main_obj, 'exec_estimation');
0749
0750 set(H.exec_push, 'String', 'Exec');
0751
0752
0753 case {H.figure, H.menu_close}
0754 bayes_parm_basic_close(H.figure);
0755 case H.menu_current_variance_estimation
0756 url = vb_users_manual_url('Current variance estimation');
0757 vb_browser_show(url);
0758 end
0759
0760 function [start_pos, end_pos, err] = get_interval(H,data)
0761
0762
0763
0764
0765
0766
0767
0768
0769 start_pos = [];
0770 end_pos = [];
0771 err = false;
0772
0773 meg_info = data.meg_info;
0774
0775 if get(H.time_shift_manual_radiobutton, 'Value')
0776
0777 command = ['[' get(H.time_shift_start_pos_edit, 'String') ']'];
0778 start_pos = eval(command);
0779 start_pos = start_pos(:);
0780 command = ['[' get(H.time_shift_end_pos_edit, 'String') ']'];
0781 end_pos = eval(command);
0782 end_pos = end_pos(:);
0783
0784 if length(start_pos) ~= length(end_pos)
0785 errordlg('Check Start positions and End positions.', 'Error');
0786 err = true;
0787 end
0788 else
0789
0790 window_size = str2double(...
0791 get(H.time_shift_window_size_edit, 'String'));
0792 shift_length = str2double(...
0793 get(H.time_shift_shift_length_edit, 'String'));
0794 begin = str2double( ...
0795 get(H.whole_time_window_from_edit, 'String'));
0796 last = str2double(...
0797 get(H.whole_time_window_to_edit, 'String'));
0798
0799 index = vb_time_to_index([begin last],meg_info);
0800 Tsample = index(2)-index(1)+1;
0801 Tperiod = vb_time_to_numsamp(window_size,sample_freq);
0802 Tnext = vb_time_to_numsamp(shift_length,sample_freq);
0803 Twindow = vb_calc_timewindow(Tsample,Tperiod,Tnext);
0804
0805 start_pos = Twindow(:,1);
0806 end_pos = Twindow(:,2);
0807 start_pos = vb_index_to_time(start_pos,meg_info);
0808 end_pos = vb_index_to_time(end_pos,meg_info);
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834 end
0835
0836 function data = set_noise_file_time_window(data, bayes_parm)
0837
0838
0839
0840
0841
0842
0843 H = data.H;
0844
0845 project_root = get(H.project_root_edit, 'String');
0846 noise_file = [];
0847
0848 if get(H.specified_checkbox, 'Value')
0849 noise_file = get(H.sensor_noise_file_edit, 'String');
0850 else
0851 filenames = get(H.sensor_noise_file_listbox, 'String');
0852 if length(filenames)
0853 noise_file = filenames{1};
0854 end
0855 end
0856
0857
0858 filename = [];
0859 if ~isempty(noise_file)
0860 filename = [project_root filesep noise_file];
0861 end
0862 set_sensor_noise_file_info(data, filename);
0863
0864
0865
0866 meg_info = bayes_parm_editor(data.main_obj, 'get_sensor_noise_file_info');
0867 if isempty(meg_info)
0868 return;
0869 end
0870
0871 pretrigger = vb_meginfo_get_pre_trigger(meg_info);
0872
0873 if exist('bayes_parm', 'var') && ...
0874 isfield(bayes_parm, 'twin_noise') && ...
0875 size(bayes_parm.twin_noise, 2) == 2
0876
0877 time_window_noise_from = bayes_parm.twin_noise(1);
0878 time_window_noise_to = bayes_parm.twin_noise(2);
0879 else
0880 time_window_noise_from = 1;
0881 time_window_noise_to = pretrigger;
0882 end
0883 if exist('bayes_parm', 'var') && ...
0884 isfield(bayes_parm, 'twin_baseline') && ...
0885 size(bayes_parm.twin_baseline, 2) == 2
0886 time_window_global_from = bayes_parm.twin_baseline(1);
0887 time_window_global_to = bayes_parm.twin_baseline(2);
0888 else
0889 time_window_global_from = 1;
0890 time_window_global_to = pretrigger;
0891 end
0892
0893 [noise_from, err] = bayes_parm_editor(data.main_obj, ...
0894 'index_to_time', ...
0895 time_window_noise_from, ...
0896 'noise');
0897 [noise_to, err] = bayes_parm_editor(data.main_obj, ...
0898 'index_to_time', ...
0899 time_window_noise_to, ...
0900 'noise');
0901 noise_from_str = sprintf('%.2f', noise_from);
0902 noise_to_str = sprintf('%.2f', noise_to);
0903
0904 [global_from, err] = bayes_parm_editor(data.main_obj, ...
0905 'index_to_time', ...
0906 time_window_global_from, ...
0907 'noise');
0908 [global_to, err] = bayes_parm_editor(data.main_obj, ...
0909 'index_to_time', ...
0910 time_window_global_to, ...
0911 'noise');
0912 global_from_str = sprintf('%.2f', global_from);
0913 global_to_str = sprintf('%.2f', global_to);
0914
0915
0916 set(H.obsn_time_window_from_edit, 'String', noise_from_str);
0917 set(H.obsn_time_window_to_edit, 'String', noise_to_str);
0918
0919
0920
0921
0922
0923 function data = change_sensor_noise_file_selection_mode(data, mode)
0924
0925
0926
0927
0928
0929
0930
0931 H = data.H;
0932 switch(mode)
0933 case ON
0934 set(H.sensor_noise_file_edit, 'Visible', 'on');
0935 set(H.sensor_noise_file_push, 'Visible', 'on');
0936 set(H.sensor_noise_file_listbox, 'Visible', 'off');
0937 data = set_noise_file_time_window(data);
0938 case OFF
0939 set(H.sensor_noise_file_edit, 'Visible', 'off');
0940 set(H.sensor_noise_file_push, 'Visible', 'off');
0941 set(H.sensor_noise_file_listbox, 'Visible', 'on');
0942 data = set_noise_file_time_window(data);
0943 end
0944
0945 function change_time_shift_mode(H, mode)
0946
0947
0948
0949
0950
0951
0952 switch(mode)
0953 case 'manual'
0954 set(H.time_shift_equally_radiobutton, 'Value', 0);
0955 set(H.time_shift_manual_radiobutton, 'Value', 1);
0956
0957 set(H.time_shift_start_pos_label, 'Visible', 'on');
0958 set(H.time_shift_end_pos_label, 'Visible', 'on');
0959 set(H.time_shift_start_pos_edit, 'Visible', 'on');
0960 set(H.time_shift_end_pos_edit, 'Visible', 'on');
0961
0962 set(H.time_shift_window_size_label, 'Visible', 'off');
0963 set(H.time_shift_shift_length_label, 'Visible', 'off');
0964 set(H.time_shift_window_size_edit, 'Visible', 'off');
0965 set(H.time_shift_shift_length_edit, 'Visible', 'off');
0966
0967 set(H.analysis_time_range_text, 'Visible', 'off');
0968 set(H.whole_time_window_from_edit, 'Visible', 'off');
0969 set(H.whole_time_window_to_edit, 'Visible', 'off');
0970 set(H.whole_time_window_minus_text, 'Visible', 'off');
0971 otherwise
0972 set(H.time_shift_manual_radiobutton, 'Value', 0);
0973 set(H.time_shift_equally_radiobutton, 'Value', 1);
0974
0975 set(H.time_shift_start_pos_label, 'Visible', 'off');
0976 set(H.time_shift_end_pos_label, 'Visible', 'off');
0977 set(H.time_shift_start_pos_edit, 'Visible', 'off');
0978 set(H.time_shift_end_pos_edit, 'Visible', 'off');
0979
0980 set(H.time_shift_window_size_label, 'Visible', 'on');
0981 set(H.time_shift_shift_length_label, 'Visible', 'on');
0982 set(H.time_shift_window_size_edit, 'Visible', 'on');
0983 set(H.time_shift_shift_length_edit, 'Visible', 'on');
0984
0985 set(H.analysis_time_range_text, 'Visible', 'on');
0986 set(H.whole_time_window_from_edit, 'Visible', 'on');
0987 set(H.whole_time_window_to_edit, 'Visible', 'on');
0988 set(H.whole_time_window_minus_text, 'Visible', 'on');
0989 end
0990
0991 function H = change_forward_model(H, forward_model)
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005 forward_model = STR_FORWARD_MODEL_FOCAL;
1006
1007 switch(forward_model)
1008 case STR_FORWARD_MODEL_FOCAL
1009 models = { STR_COVARIANCE_NOISE,...
1010 STR_COVARIANCE_NOISE_NO_UPDATE };
1011 value = 1;
1012 case STR_FORWARD_MODEL_FOCAL_GLOBAL
1013 models = { STR_COVARIANCE_NOISE,...
1014 STR_COVARIANCE_NOISE_NO_UPDATE,...
1015 STR_ISOTROPIC_NOISE,...
1016 STR_ISOTROPIC_NOISE_NO_GLOBAL_UPDATE,...
1017 STR_ISOTROPIC_NOISE_NO_UPDATE };
1018 value = 1;
1019 end
1020
1021 set(H.noise_estimation_model_popup, 'String', models);
1022 set(H.noise_estimation_model_popup, 'Value', value);
1023
1024 set_estimation_GUI_properties(H);
1025
1026 function set_estimation_GUI_properties(H)
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036 forward_model= STR_FORWARD_MODEL_FOCAL;
1037
1038 estimation_models = get(H.noise_estimation_model_popup, 'String');
1039 ix = get(H.noise_estimation_model_popup, 'Value');
1040 estimation_model = estimation_models{ix};
1041
1042 switch(forward_model)
1043 case STR_FORWARD_MODEL_FOCAL
1044 switch(estimation_model)
1045 case STR_COVARIANCE_NOISE
1046 set(H.update_sx_checkbox, 'Value', 1);
1047 set(H.update_v_checkbox, 'Value', 0);
1048 set(H.obsn_cov_popup, 'Value', 3);
1049 set(H.flag_baseline_edit, 'String', '0');
1050 set(H.flag_noise_set_edit, 'String', '0');
1051 case STR_COVARIANCE_NOISE_NO_UPDATE
1052 set(H.update_sx_checkbox, 'Value', 0);
1053 set(H.update_v_checkbox, 'Value', 0);
1054 set(H.obsn_cov_popup, 'Value', 3);
1055 set(H.flag_baseline_edit, 'String', '0');
1056 set(H.flag_noise_set_edit, 'String', '0');
1057 end
1058 case STR_FORWARD_MODEL_FOCAL_GLOBAL
1059 switch(estimation_model)
1060 case STR_COVARIANCE_NOISE
1061 set(H.update_sx_checkbox, 'Value', 1);
1062 set(H.update_v_checkbox, 'Value', 0);
1063 set(H.obsn_cov_popup, 'Value', 3);
1064 set(H.flag_baseline_edit, 'String', '0');
1065 set(H.flag_noise_set_edit, 'String', '0');
1066 case STR_COVARIANCE_NOISE_NO_UPDATE
1067 set(H.update_sx_checkbox, 'Value', 0);
1068 set(H.update_v_checkbox, 'Value', 0);
1069 set(H.obsn_cov_popup, 'Value', 3);
1070 set(H.flag_baseline_edit, 'String', '0');
1071 set(H.flag_noise_set_edit, 'String', '0');
1072 case STR_ISOTROPIC_NOISE
1073 set(H.update_sx_checkbox, 'Value', 1);
1074 set(H.update_v_checkbox, 'Value', 1);
1075 set(H.obsn_cov_popup, 'Value', 1);
1076 set(H.flag_baseline_edit, 'String', '0');
1077 set(H.flag_noise_set_edit, 'String', '1');
1078 case STR_ISOTROPIC_NOISE_NO_GLOBAL_UPDATE
1079 set(H.update_sx_checkbox, 'Value', 1);
1080 set(H.update_v_checkbox, 'Value', 0);
1081 set(H.obsn_cov_popup, 'Value', 1);
1082 set(H.flag_baseline_edit, 'String', '0');
1083 set(H.flag_noise_set_edit, 'String', '1');
1084 case STR_ISOTROPIC_NOISE_NO_UPDATE
1085 set(H.update_sx_checkbox, 'Value', 0);
1086 set(H.update_v_checkbox, 'Value', 0);
1087 set(H.obsn_cov_popup, 'Value', 1);
1088 set(H.flag_baseline_edit, 'String', '0');
1089 set(H.flag_noise_set_edit, 'String', '1');
1090 end
1091 end
1092
1093 function data = set_gui_meg_file(data, filenames)
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104 H = data.H;
1105
1106 set(H.meg_file_listbox, 'String', filenames);
1107
1108
1109 if length(filenames)
1110
1111
1112
1113 project_root = get(H.project_root_edit, 'String');
1114 if ischar(filenames)
1115 filename = [project_root filesep, filenames];
1116 else
1117 filename = [project_root filesep filenames{1}];
1118 end
1119 err = set_meg_file_info(data, filename);
1120 if err, return; end
1121 meg_info = get_meg_file_info(data);
1122 [time_window_from, err] = bayes_parm_editor(data.main_obj, ...
1123 'index_to_time', ...
1124 1, 'meg');
1125 [time_window_to, err] = bayes_parm_editor(data.main_obj, ...
1126 'index_to_time', ...
1127 meg_info.Nsample, 'meg');
1128
1129 time_window_from_str = sprintf('%.2f', time_window_from);
1130 time_window_to_str = sprintf('%.2f', time_window_to);
1131
1132
1133 wsize_msec = bayes_parm_editor(data.main_obj, ...
1134 'data_len_to_time_len', ...
1135 meg_info.Nsample, 'meg');
1136 wsize_msec = sprintf('%.2f', wsize_msec);
1137 else
1138
1139
1140
1141
1142 err = set_meg_file_info(data, '');
1143 time_window_from_str = [];
1144 time_window_to_str = [];
1145 wsize_msec = [];
1146 end
1147
1148
1149 set(H.whole_time_range_from_edit, 'String', time_window_from_str);
1150 set(H.whole_time_range_to_edit, 'String', time_window_to_str);
1151
1152
1153 set(H.whole_time_window_from_edit, 'String', time_window_from_str);
1154 set(H.whole_time_window_to_edit, 'String', time_window_to_str);
1155
1156
1157 set(H.time_shift_window_size_edit, 'String', wsize_msec);
1158 set(H.time_shift_shift_length_edit, 'String', wsize_msec);
1159
1160 set(H.sensor_noise_file_listbox, 'String', filenames);
1161 set_noise_file_time_window(data);
1162
1163 function set_gui_basis_file(H, basis_files)
1164
1165
1166
1167
1168
1169
1170
1171 set(H.basis_file_listbox, 'String', basis_files);
1172
1173 function set_gui_act_file(H, act_file)
1174
1175
1176
1177
1178
1179
1180
1181
1182 set(H.act_file_edit, 'String', act_file);
1183
1184 keys = [];
1185 if ~isempty(act_file)
1186
1187 project_root = get(H.project_root_edit, 'String');
1188 act_file_full = fullfile(project_root, act_file);
1189 if exist(act_file_full, 'file') == 2
1190 load(act_file_full, 'Act');
1191 for n = 1 : length(Act)
1192 keys{n} = Act{n}.key;
1193 end
1194 end
1195 end
1196
1197
1198 set(H.act_key_listbox, 'String', keys);
1199
1200 function set_gui_area_file(H, area_file)
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210 set(H.area_file_edit, 'String', area_file);
1211
1212 keys = [];
1213 if ~isempty(area_file)
1214
1215 keys = {};
1216 project_root = get(H.project_root_edit, 'String');
1217 area_file_full = fullfile(project_root, area_file);
1218 if exist(area_file_full, 'file') == 2
1219 load([project_root filesep area_file], 'Area');
1220 for n = 1 : length(Area)
1221 keys{n} = Area{n}.key;
1222 end
1223 end
1224 end
1225
1226
1227 set(H.area_key_listbox, 'String', keys);
1228 set(H.area_key_listbox, 'Value', 1);
1229
1230 function data = reload_gui_area_file(data, area_file)
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240 H = data.H;
1241
1242
1243 set(H.area_file_edit, 'String', area_file);
1244
1245
1246 keys = {};
1247 project_root = get(H.project_root_edit, 'String');
1248 load([project_root filesep area_file], 'Area');
1249 for n = 1 : length(Area)
1250 keys{n} = Area{n}.key;
1251 end
1252
1253
1254 set(H.area_key_listbox, 'String', keys);
1255 set(H.area_key_listbox, 'Value', 1);
1256
1257
1258 bayes_parm.area_key_global = keys{1};
1259 bayes_parm_editor(data.main_obj, 'merge_bayes_parm', bayes_parm);
1260
1261 function [match_time, err] = time_match_sample_point(data, time, file_type)
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277 match_time = [];
1278 err = false;
1279
1280 [index, err] = bayes_parm_editor(data.main_obj, ...
1281 'time_to_index', ...
1282 time, file_type);
1283 if err, return; end
1284 [match_time, err] = bayes_parm_editor(data.main_obj, ...
1285 'index_to_time', ...
1286 index, file_type);
1287 if err, return; end
1288
1289 function [ceil_time_len, err] = ceil_time_length(data, time_len, file_type)
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302 ceil_time_len = [];
1303 err = false;
1304
1305 [data_len, err] = bayes_parm_editor(data.main_obj, ...
1306 'time_len_to_data_len',...
1307 time_len, ...
1308 file_type);
1309
1310
1311 analysis_time_from_msec = ...
1312 str2double(get(data.H.whole_time_window_from_edit, 'String'));
1313 analysis_time_to_msec = ...
1314 str2double(get(data.H.whole_time_window_to_edit, 'String'));
1315
1316 [analysis_time_from_sample, err] = bayes_parm_editor(data.main_obj, ...
1317 'time_len_to_data_len', ...
1318 analysis_time_from_msec, ...
1319 file_type);
1320
1321 if err, return; end
1322 [analysis_time_to_sample, err] = bayes_parm_editor(data.main_obj, ...
1323 'time_len_to_data_len', ...
1324 analysis_time_to_msec, ...
1325 file_type);
1326 analysis_time_sample = ...
1327 analysis_time_to_sample - analysis_time_from_sample + 1;
1328
1329
1330 [time_sample, err] = bayes_parm_editor(data.main_obj, ...
1331 'time_len_to_data_len', ...
1332 time_len, ...
1333 file_type);
1334
1335 if time_sample > analysis_time_sample
1336 time_sample = analysis_time_sample;
1337 end
1338 [ceil_time_len, err] = bayes_parm_editor(data.main_obj, ...
1339 'data_len_to_time_len', ...
1340 time_sample, ...
1341 file_type);
1342 if err, return;end;
1343
1344 function [meg_info, err] = get_meg_file_info(data)
1345
1346
1347
1348
1349
1350
1351
1352 err = false;
1353 meg_info = bayes_parm_editor(data.main_obj, 'get_megfile_info');
1354 if isempty(meg_info)
1355 errordlg('select meg file.', 'Error');
1356 err = true;
1357 end
1358
1359 function [err] = set_meg_file_info(data, meg_file)
1360
1361
1362
1363
1364
1365
1366
1367 err = false;
1368 try
1369 bayes_parm_editor(data.main_obj, 'set_megfile_info', meg_file);
1370 catch
1371 err = true;
1372 errordlg('file read error occured.', 'Error');
1373 end
1374
1375 function [s_noise_file_info, err] = get_sensor_noise_file_info(data)
1376
1377
1378
1379
1380
1381
1382
1383 err = false;
1384 s_noise_file_info = bayes_parm_editor(data.main_obj, ...
1385 'get_sensor_noise_file_info');
1386 if isempty(s_noise_file_info)
1387 errordlg('select meg file.', 'Error');
1388
1389 err = true;
1390 end
1391
1392 function [err] = set_sensor_noise_file_info(data, s_noise_file)
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402 err = false;
1403 try
1404 bayes_parm_editor(data.main_obj, ...
1405 'set_sensor_noise_file_info', s_noise_file);
1406 catch
1407 err = true;
1408 errordlg('file read error occured.', 'Error');
1409 end
1410
1411 function [forward_model] = get_forward_model(H)
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421 forward_model = STR_FORWARD_MODEL_FOCAL;
1422
1423 function H = set_forward_model(H, forward_model, force_update)
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433 if ~exist('force_update', 'var')
1434 force_update = false;
1435 end
1436
1437
1438
1439
1440
1441
1442 current_model = get_forward_model(H);
1443 if ((force_update == true) || ~(strcmp(current_model, forward_model)))
1444
1445 change_forward_model(H, forward_model);
1446 end
1447
1448 function [estimation_model_number] = get_noise_estimation_model(H)
1449
1450
1451
1452
1453
1454
1455
1456 models = get(H.noise_estimation_model_popup, 'String');
1457 noise_estimation_model = models{get(H.noise_estimation_model_popup, 'Value')};
1458
1459 switch(noise_estimation_model)
1460 case STR_COVARIANCE_NOISE
1461 estimation_model_number = 1;
1462 case STR_COVARIANCE_NOISE_NO_UPDATE
1463 estimation_model_number = 2;
1464 case STR_ISOTROPIC_NOISE
1465 estimation_model_number = 3;
1466 case STR_ISOTROPIC_NOISE_NO_GLOBAL_UPDATE
1467 estimation_model_number = 4;
1468 case STR_ISOTROPIC_NOISE_NO_UPDATE
1469 estimation_model_number = 5;
1470 end
1471
1472 function [treatable] = IsTreatableEstimationModel(bayes_parm)
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482 treatable = false;
1483
1484 switch(bayes_parm.forward_model)
1485 case STR_FORWARD_MODEL_FOCAL
1486 switch(bayes_parm.noise_estimation_model)
1487 case 1
1488 if (bayes_parm.update_sx == ON) && ...
1489 (bayes_parm.update_v == OFF) && ...
1490 (bayes_parm.noise_model == 3) && ...
1491 (bayes_parm.flag_baseline == 0) && ...
1492 (bayes_parm.flag_noise_set == 0)
1493
1494 treatable = true;
1495 end
1496 case 2
1497 if (bayes_parm.update_sx == OFF) && ...
1498 (bayes_parm.update_v == OFF) && ...
1499 (bayes_parm.noise_model == 3) && ...
1500 (bayes_parm.flag_baseline == 0) && ...
1501 (bayes_parm.flag_noise_set == 0)
1502
1503 treatable = true;
1504 end
1505 end
1506 case STR_FORWARD_MODEL_FOCAL_GLOBAL
1507 switch(bayes_parm.noise_estimation_model)
1508 case 1
1509 if (bayes_parm.update_sx == ON) && ...
1510 (bayes_parm.update_v == OFF) && ...
1511 (bayes_parm.noise_model == 3) && ...
1512 (bayes_parm.flag_baseline == 0) && ...
1513 (bayes_parm.flag_noise_set == 0)
1514
1515 treatable = true;
1516 end
1517 case 2
1518 if (bayes_parm.update_sx == OFF) && ...
1519 (bayes_parm.update_v == OFF) && ...
1520 (bayes_parm.noise_model == 3) && ...
1521 (bayes_parm.flag_baseline == 0) && ...
1522 (bayes_parm.flag_noise_set == 0)
1523
1524 treatable = true;
1525 end
1526 case 3
1527 if (bayes_parm.update_sx == ON) && ...
1528 (bayes_parm.update_v == ON) && ...
1529 (bayes_parm.noise_model == 1) && ...
1530 (bayes_parm.flag_baseline == 0) && ...
1531 (bayes_parm.flag_noise_set == 1)
1532
1533 treatable = true;
1534 end
1535 case 4
1536 if (bayes_parm.update_sx == ON) && ...
1537 (bayes_parm.update_v == OFF) && ...
1538 (bayes_parm.noise_model == 1) && ...
1539 (bayes_parm.flag_baseline == 0) && ...
1540 (bayes_parm.flag_noise_set == 1)
1541
1542 treatable = true;
1543 end
1544 case 5
1545 if (bayes_parm.update_sx == OFF) && ...
1546 (bayes_parm.update_v == OFF) && ...
1547 (bayes_parm.noise_model == 1) && ...
1548 (bayes_parm.flag_baseline == 0) && ...
1549 (bayes_parm.flag_noise_set == 1)
1550
1551 treatable = true;
1552 end
1553 end
1554 end
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564 function [v] = STR_FORWARD_MODEL_FOCAL
1565 v = 'focal';
1566 function [v] = STR_FORWARD_MODEL_FOCAL_GLOBAL
1567 v = 'focal+global';
1568
1569
1570
1571
1572 function [v] = STR_COVARIANCE_NOISE
1573 v = 'COVARIANCE NOISE';
1574 function [v] = STR_COVARIANCE_NOISE_NO_UPDATE
1575 v = 'COVARIANCE NOISE(NO UPDATE)';
1576 function [v] = STR_ISOTROPIC_NOISE
1577 v = 'ISOTROPIC NOISE';
1578 function [v] = STR_ISOTROPIC_NOISE_NO_GLOBAL_UPDATE
1579 v = 'ISOTROPIC NOISE(NO GLOBAL UPDATE)';
1580 function [v] = STR_ISOTROPIC_NOISE_NO_UPDATE
1581 v = 'ISOTROPIC NOISE(NO UPDATE)';
1582