Home > vbmeg > functions > gui > project_mgr_dir > project_mgr_contextmenu_callback.m

project_mgr_contextmenu_callback

PURPOSE ^

callback function for history context menu.

SYNOPSIS ^

function project_mgr_contextmenu_callback(fig, hObj)

DESCRIPTION ^

 callback function for history context menu.
 [USAGE]
    project_mgr_contextmenu_callback(<fig>, <hObj>);
 [IN]
     fig : figure handle of project_mgr gui.
    hObj : event component handle.
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function project_mgr_contextmenu_callback(fig, hObj)
0002 % callback function for history context menu.
0003 % [USAGE]
0004 %    project_mgr_contextmenu_callback(<fig>, <hObj>);
0005 % [IN]
0006 %     fig : figure handle of project_mgr gui.
0007 %    hObj : event component handle.
0008 % [OUT]
0009 %    none
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 %
0015 % --- Previous check
0016 %
0017 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0018     error('invalid figure handle is specified.');
0019 end
0020 
0021 %
0022 % --- Main Procedure
0023 %
0024 drawnow;
0025 
0026 % load data (@see project_mgr)
0027 data = guidata(fig);
0028 H = data.H; % component handles
0029 
0030 % % protect application screen
0031 % set(fig, 'HandleVisibility', 'off');
0032 
0033 % project_root
0034 proj_root = get(H.project_root_edit, 'String');
0035 
0036 
0037 % - get selected parameter and type
0038 selected_line_no = get(H.history_listbox, 'Value');
0039 max_line_no      = length(get(H.history_listbox, 'String'));
0040 [parm, parm_type] = project_file_mgr('get_parameter', selected_line_no);
0041 func_type = vb_judge_function_name(parm, parm_type);
0042 switch(hObj)
0043     case H.submenu_launch_application
0044         % launch application
0045         switch(func_type)
0046             case 'vb_job_brain'
0047                 project_mgr_launch_module(fig, 'brain', parm);
0048             case 'vb_job_fmri'
0049                 project_mgr_launch_module(fig, 'fmri', parm);
0050             case 'vb_job_meg'
0051                 [Measurement, Device] = vb_meg_parm_get_measurement(parm);
0052                 if strcmp(Measurement, 'MEG') && strcmp(Device, 'YOKOGAWA')
0053                     project_mgr_launch_module(fig, 'yokogawa_meg', parm);
0054                 elseif strcmp(Measurement, 'EEG') && strcmp(Device, 'BIOSEMI')
0055                     project_mgr_launch_module(fig, 'biosemi_eeg', parm);
0056                 elseif strcmp(Measurement, 'EEG') && strcmp(Device, 'BRAINAMP');
0057                     project_mgr_launch_module(fig, 'brainamp_eeg', parm);
0058                 else
0059                     project_mgr_launch_module(fig, 'sbi_meg', parm);
0060                 end
0061             case 'vb_job_leadfield'
0062                 project_mgr_launch_module(fig, 'leadfield', parm);
0063             case 'vb_job_vb'
0064                 project_mgr_launch_module(fig, 'bayes', parm);
0065             case 'vb_job_current'
0066                 project_mgr_launch_module(fig, 'current', parm);
0067             case 'vb_job_head_3shell'
0068                 project_mgr_launch_module(fig, 'spm_curry_head', parm);
0069         end
0070     case H.submenu_export_script
0071         project_mgr_export_as_script(proj_root, parm, parm_type);
0072     case H.submenu_job_view_cortex
0073         % caution : I expect parameter field name is same.
0074         brain_file = fullfile(proj_root, parm.brain_file);
0075         area_file  = fullfile(proj_root, parm.area_file);
0076         act_file   = fullfile(proj_root, parm.act_file);
0077 
0078         vb_act_area_viewer(brain_file, act_file, area_file);
0079     case H.submenu_view_head
0080         head_file = fullfile(proj_root, parm.head_file);
0081         mri_file  = parm.analyze_file;
0082         vb_view_head_2d(mri_file, head_file);
0083     case H.submenu_job_select_area
0084         % caution : I expect parameter field name is same.
0085         brain_file = fullfile(proj_root, parm.brain_file);
0086         area_file  = fullfile(proj_root, parm.area_file);
0087         act_file   = fullfile(proj_root, parm.act_file);
0088 
0089         brain_exist = exist(brain_file, 'file');
0090         act_exist = exist(area_file, 'file');
0091         area_exist = exist(act_file,  'file');
0092 
0093         if ~brain_exist
0094             errordlg('cannot launch job_select_area', 'Cortical model file not found.');
0095             return;
0096         end
0097         if ~act_exist
0098             errordlg('cannot launch job_select_area', 'Cortical activity file not found.');
0099             return;
0100         end
0101         if ~area_exist
0102             errordlg('cannot launch job_select_area', 'Cortical area file not found.');
0103             return;
0104         end
0105         job_select_area(brain_file, area_file, act_file);
0106         
0107     case H.submenu_job_edit_area
0108         % caution : I expect parameter field name is same.
0109         brain_file = fullfile(proj_root, parm.brain_file);
0110         area_file  = fullfile(proj_root, parm.area_file);
0111         act_file   = fullfile(proj_root, parm.act_file);
0112 
0113         brain_exist = exist(brain_file, 'file');
0114         act_exist = exist(act_file, 'file');
0115         area_exist = exist(area_file,  'file');
0116 
0117         if ~brain_exist
0118             errordlg('cannot launch job_edit_area', 'Cortical model file not found.');
0119             return;
0120         end
0121         if ~act_exist
0122             errordlg('cannot launch job_edit_area', 'Cortical activity file not found.');
0123             return;
0124         end
0125         if ~area_exist
0126             errordlg('cannot launch job_edit_area', 'Cortical area file not found.');
0127             return;
0128         end
0129         job_edit_area(brain_file, area_file);
0130     case H.submenu_job_edit_act
0131         % caution : I expect parameter field name is same.
0132         brain_file = fullfile(proj_root, parm.brain_file);
0133         act_file   = fullfile(proj_root, parm.act_file);
0134         
0135         brain_exist = exist(brain_file, 'file');
0136         act_exist = exist(act_file, 'file');
0137         
0138         if ~brain_exist
0139             errordlg('cannot launch job_edit_act', 'Cortical model file not found.');
0140             return;
0141         end
0142         if ~act_exist
0143             errordlg('cannot launch job_edit_act', 'Cortical activity file not found.');
0144             return;
0145         end
0146         job_edit_act(brain_file, act_file);
0147     case H.submenu_job_plot_meg
0148         proj_root = get(H.project_root_edit, 'String');
0149         [Measurement, Device] = vb_meg_parm_get_measurement(parm);
0150         if strcmp(Measurement, 'MEG')
0151             meg_file = [proj_root, '/', parm.meg_file];
0152         elseif strcmp(Measurement, 'EEG') && ...
0153                 (strcmp(Device, 'BIOSEMI') || strcmp(Device, 'BRAINAMP'))
0154             meg_file = [proj_root, '/', parm.output_file];
0155         end
0156         job_plot_meg(meg_file);
0157 
0158     case H.submenu_job_plot_currentmap
0159         %current_parm.resultfile-->brain_file
0160         result_file  = fullfile(proj_root, parm.bayesfile);
0161         load(result_file, 'bayes_parm');
0162 
0163         brain_file   = fullfile(proj_root, bayes_parm.brainfile);
0164         current_file = fullfile(proj_root, parm.currfile);
0165         brain_exist   = exist(brain_file, 'file');
0166         current_exist = exist(current_file, 'file');
0167 
0168         if ~brain_exist
0169             errordlg('cannot launch job_plot_currentmap', 'Cortical model file not found.');
0170             return;
0171         end
0172         if ~current_exist
0173             errordlg('cannot launch job_plot_currentmap', 'Current file not found.');
0174             return;
0175         end
0176         job_plot_currentmap(brain_file, current_file);
0177 end
0178 drawnow;
0179 % protect application screen end
0180 set(H.figure, 'HandleVisibility', 'callback');

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005