Home > functions > job > job_view_cortex_dir > job_view_cortex_callback.m

job_view_cortex_callback

PURPOSE ^

job_view_cortex_callback

SYNOPSIS ^

function job_view_cortex_callback( key )

DESCRIPTION ^

 job_view_cortex_callback

  GUIオブジェクトからのcallback呼出を処理
  
  * 各オブジェクトに対して一意な key を引数として呼び出される


 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 job_view_cortex_callback( key )
0002 % job_view_cortex_callback
0003 %
0004 %  GUIオブジェクトからのcallback呼出を処理
0005 %
0006 %  * 各オブジェクトに対して一意な key を引数として呼び出される
0007 %
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 if ~strcmp( get( gcf, 'Tag'), 'job_view_cortex main' )
0013   return;
0014 end
0015 
0016 H = get( gcf, 'UserData' );
0017 
0018 if isempty(H)
0019   return;
0020 end
0021 
0022 if isfield(H, 'fig')
0023   set( H.fig, 'Pointer', 'watch' );
0024 end
0025 
0026 
0027 switch key
0028 
0029  %%%%%%%%%%%%%%%%%%%%
0030  %%%  Brain Part  %%%
0031  %%%%%%%%%%%%%%%%%%%%
0032 
0033  %--------------------------------------------------------------------
0034  case 'brain load file button'
0035   err = job_view_cortex_file( 'load', 'brain', '' );
0036   if ~err
0037     job_view_cortex_aftereffect( 'file load brain' );
0038     job_view_cortex_plot( 'brain' );
0039   end
0040 
0041 
0042  %%%%%%%%%%%%%%%%%%%%%%%%%
0043  %%%  Activation Part  %%%
0044  %%%%%%%%%%%%%%%%%%%%%%%%%
0045 
0046  %--------------------------------------------------------------------
0047  case 'act load file button'
0048   err = job_view_cortex_file( 'load', 'act', '' );
0049   if ~err
0050     job_view_cortex_aftereffect( 'file load act' );
0051     job_view_cortex_plot( 'act' );
0052   end
0053 
0054  %--------------------------------------------------------------------
0055  case 'act list select'
0056   job_view_cortex_aftereffect( 'list act candidate select' );
0057 
0058  %--------------------------------------------------------------------
0059  case 'act plotted list select'
0060   job_view_cortex_aftereffect( 'list act plotted select' );
0061   job_view_cortex_plot( 'highlight act' );
0062 
0063  %--------------------------------------------------------------------
0064  case 'act add to plotted list button'
0065   selected = get( H.activation_list, 'Value' );
0066   err = job_view_cortex_list( 'add', 'act', 'plotted', selected );
0067   if ~err
0068     job_view_cortex_aftereffect( 'list act plotted add' );
0069     job_view_cortex_plot( 'act' );
0070   end
0071 
0072  %--------------------------------------------------------------------
0073  case 'act delete from plotted list button'
0074   selected = get( H.activation_plotted_list, 'Value' );
0075   err = job_view_cortex_list( 'delete', 'act', 'plotted', selected );
0076   if ~err
0077     job_view_cortex_aftereffect( 'list act plotted delete' );
0078     job_view_cortex_plot( 'act' );
0079   end
0080 
0081  %--------------------------------------------------------------------
0082  case 'act clear plotted list button'
0083   err = job_view_cortex_list( 'clear', 'act', 'plotted', [] );
0084   if ~err
0085     job_view_cortex_aftereffect( 'list act plotted delete' );
0086     job_view_cortex_plot( 'act' );
0087   end
0088 
0089   
0090  %%%%%%%%%%%%%%%%%%%
0091  %%%  Area Part  %%%
0092  %%%%%%%%%%%%%%%%%%%
0093 
0094  %--------------------------------------------------------------------
0095  case 'area load file button'
0096   err = job_view_cortex_file( 'load', 'area', '' );
0097   if ~err
0098     job_view_cortex_aftereffect( 'file load area' );
0099     job_view_cortex_plot( 'brain' );
0100   end
0101 
0102  %--------------------------------------------------------------------
0103  case 'area save file button'
0104   err = job_view_cortex_file( 'save', 'area', '' );
0105   if ~err
0106     job_view_cortex_aftereffect( 'file save area' );
0107   end
0108 
0109  %--------------------------------------------------------------------
0110  case 'area list select'
0111   job_view_cortex_aftereffect( 'list area candidate select' );
0112   
0113  %--------------------------------------------------------------------
0114  case 'area list delete button'
0115   data = get( H.areadata, 'UserData' );
0116   selected = get( H.area_list, 'Value' );
0117   keys = get( H.area_list, 'String' );
0118   delkey = []; for i = selected; delkey = [ delkey, ' ', keys{i} ]; end;
0119   deletep = questdlg( [ 'Are you sure to delete', delkey, '?' ] );
0120   if strcmp( deletep, 'Yes' )
0121     err = job_view_cortex_list( 'delete', 'area', 'candidate', selected );
0122     if ~err
0123       job_view_cortex_aftereffect( 'list area candidate delete' );
0124       job_view_cortex_plot( 'brain' );
0125     end
0126   end
0127   
0128  %--------------------------------------------------------------------
0129  case 'area plotted list select'
0130   job_view_cortex_aftereffect( 'list area plotted select' );
0131   job_view_cortex_plot( 'highlight area' );
0132 
0133  %--------------------------------------------------------------------
0134  case 'area masking list select'
0135   job_view_cortex_aftereffect( 'list area masking select' );
0136 
0137  %--------------------------------------------------------------------
0138  case 'area add to plotted list button'
0139   selected = get( H.area_list, 'Value' );
0140   err = job_view_cortex_list( 'add', 'area', 'plotted', selected );
0141   if ~err
0142     job_view_cortex_aftereffect( 'list area plotted add' );
0143     job_view_cortex_plot( 'area' );
0144   end
0145 
0146  %--------------------------------------------------------------------
0147  case 'area delete from plotted list button'
0148   selected = get( H.area_plotted_list, 'Value' );
0149   err = job_view_cortex_list( 'delete', 'area', 'plotted', selected );
0150   if ~err
0151     job_view_cortex_aftereffect( 'list area plotted delete' );
0152     job_view_cortex_plot( 'area' );
0153   end
0154 
0155  %--------------------------------------------------------------------
0156  case 'area clear plotted list button'
0157   err = job_view_cortex_list( 'clear', 'area', 'plotted', [] );
0158   if ~err
0159     job_view_cortex_aftereffect( 'list area plotted delete' );
0160     job_view_cortex_plot( 'area' );
0161   end
0162 
0163  %--------------------------------------------------------------------
0164  case 'area add to masking list button'
0165   selected = get( H.area_list, 'Value' );
0166   err = job_view_cortex_list( 'add', 'area', 'masking', selected );
0167   if ~err
0168     job_view_cortex_aftereffect( 'list area masking add' );
0169     job_view_cortex_plot( 'brain' );
0170   end
0171 
0172  %--------------------------------------------------------------------
0173  case 'area delete from masking list button'
0174   selected = get( H.area_masking_list, 'Value' );
0175   err = job_view_cortex_list( 'delete', 'area', 'masking', selected );
0176   if ~err
0177     job_view_cortex_aftereffect( 'list area masking delete' );
0178     job_view_cortex_plot( 'brain' );
0179   end
0180 
0181  %--------------------------------------------------------------------
0182  case 'area clear masking list button'
0183   err = job_view_cortex_list( 'clear', 'area', 'masking', [] );
0184   if ~err
0185     job_view_cortex_aftereffect( 'list area masking delete' );
0186     job_view_cortex_plot( 'brain' );
0187   end
0188 
0189 
0190  %%%%%%%%%%%%%%%%%%%%%%%%
0191  %%%  Selection Part  %%%
0192  %%%%%%%%%%%%%%%%%%%%%%%%
0193 
0194  %--------------------------------------------------------------------
0195  case 'selection add intersect act button'
0196   err = job_view_cortex_selection( 'add', 'act', 'intersect' );
0197   if ~err
0198     job_view_cortex_aftereffect( 'selection add' );
0199     job_view_cortex_plot( 'selection' );
0200   end
0201 
0202  %--------------------------------------------------------------------
0203  case 'selection delete intersect act button'
0204   err = job_view_cortex_selection( 'delete', 'act', 'intersect' );
0205   if ~err
0206     job_view_cortex_aftereffect( 'selection delete' );
0207     job_view_cortex_plot( 'selection' );
0208   end
0209 
0210  %--------------------------------------------------------------------
0211  case 'selection add union act button'
0212   err = job_view_cortex_selection( 'add', 'act', 'union' );
0213   if ~err
0214     job_view_cortex_aftereffect( 'selection add' );
0215     job_view_cortex_plot( 'selection' );
0216   end
0217 
0218  %--------------------------------------------------------------------
0219  case 'selection delete union act button'
0220   err = job_view_cortex_selection( 'delete', 'act', 'union' );
0221   if ~err
0222     job_view_cortex_aftereffect( 'selection delete' );
0223     job_view_cortex_plot( 'selection' );
0224   end
0225 
0226  %--------------------------------------------------------------------
0227  case 'selection add intersect area button'
0228   err = job_view_cortex_selection( 'add', 'area', 'intersect' );
0229   if ~err
0230     job_view_cortex_aftereffect( 'selection add' );
0231     job_view_cortex_plot( 'selection' );
0232   end
0233 
0234  %--------------------------------------------------------------------
0235  case 'selection delete intersect area button'
0236   err = job_view_cortex_selection( 'delete', 'area', 'intersect' );
0237   if ~err
0238     job_view_cortex_aftereffect( 'selection delete' );
0239     job_view_cortex_plot( 'selection' );
0240   end
0241 
0242  %--------------------------------------------------------------------
0243  case 'selection add union area button'
0244   err = job_view_cortex_selection( 'add', 'area', 'union' );
0245   if ~err
0246     job_view_cortex_aftereffect( 'selection add' );
0247     job_view_cortex_plot( 'selection' );
0248   end
0249 
0250  %--------------------------------------------------------------------
0251  case 'selection delete union area button'
0252   err = job_view_cortex_selection( 'delete', 'area', 'union' );
0253   if ~err
0254     job_view_cortex_aftereffect( 'selection delete' );
0255     job_view_cortex_plot( 'selection' );
0256   end
0257   
0258  %--------------------------------------------------------------------
0259  case 'selection undo button'
0260   err = job_view_cortex_selection( 'undo' );
0261   if ~err
0262     job_view_cortex_aftereffect( 'selection undo' );
0263     job_view_cortex_plot( 'selection' );
0264   end
0265 
0266  %--------------------------------------------------------------------
0267  case 'selection clear button'
0268   err = job_view_cortex_selection( 'clear' );
0269   if ~err
0270     job_view_cortex_aftereffect( 'selection delete' );
0271     job_view_cortex_plot( 'selection' );
0272   end
0273 
0274  %--------------------------------------------------------------------
0275  case 'selection dilation button'
0276   err = job_view_cortex_selection( 'add', 'dilation' );
0277   if ~err
0278     job_view_cortex_aftereffect( 'selection add' );
0279     job_view_cortex_plot( 'selection' );
0280   end
0281 
0282  %--------------------------------------------------------------------
0283  case 'selection erosion button'
0284   err = job_view_cortex_selection( 'delete', 'erosion' );
0285   if ~err
0286     job_view_cortex_aftereffect( 'selection delete' );
0287     job_view_cortex_plot( 'selection' );
0288   end
0289   
0290  %--------------------------------------------------------------------
0291  case 'selection register button'
0292   err = job_view_cortex_selection( 'register', 'area' );
0293   if ~err
0294     job_view_cortex_aftereffect( 'selection register' );
0295   end
0296 
0297  %--------------------------------------------------------------------
0298  case 'selection add mouse'
0299   err = job_view_cortex_selection( 'add', 'mouse' );
0300   if ~err
0301     job_view_cortex_aftereffect( 'selection add' );
0302     job_view_cortex_plot( 'selection' );
0303   end
0304   
0305  %--------------------------------------------------------------------
0306  case 'selection delete mouse'
0307   err = job_view_cortex_selection( 'delete', 'mouse' );
0308   if ~err
0309     job_view_cortex_aftereffect( 'selection delete' );
0310     job_view_cortex_plot( 'selection' );
0311   end
0312 
0313 
0314 
0315  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0316  %%%  Mouse Function Part  %%%
0317  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0318 
0319  %--------------------------------------------------------------------
0320  case 'mouse func'
0321   if get( H.mouse_func_radioZ, 'Value' ) == 1
0322     job_view_cortex_callback( 'mouse func Z' );
0323   end
0324   if get( H.mouse_func_radioR, 'Value' ) == 1
0325     job_view_cortex_callback( 'mouse func R' );
0326   end
0327   if get( H.mouse_func_radioS, 'Value' ) == 1
0328     job_view_cortex_callback( 'mouse func S' );
0329   end
0330   if get( H.mouse_func_radioU, 'Value' ) == 1
0331     job_view_cortex_callback( 'mouse func U' );
0332   end
0333 
0334  case 'mouse func Z'
0335   set( H.mouse_func_radioZ, 'Value', 1 );
0336   set( H.mouse_func_radioR, 'Value', 0 );
0337   set( H.mouse_func_radioS, 'Value', 0 );
0338   set( H.mouse_func_radioU, 'Value', 0 );
0339   zoom on;
0340   rotate3d off;
0341   set( findobj( H.plot_axes, 'Tag', 'brain' ), 'ButtonDownFcn', '' );
0342 
0343  case 'mouse func R'
0344   set( H.mouse_func_radioZ, 'Value', 0 );
0345   set( H.mouse_func_radioR, 'Value', 1 );
0346   set( H.mouse_func_radioS, 'Value', 0 );
0347   set( H.mouse_func_radioU, 'Value', 0 );
0348   zoom off;
0349   rotate3d on;
0350   set( findobj( H.plot_axes, 'Tag', 'brain' ), 'ButtonDownFcn', '' );
0351 
0352  case 'mouse func S'
0353   set( H.mouse_func_radioZ, 'Value', 0 );
0354   set( H.mouse_func_radioR, 'Value', 0 );
0355   set( H.mouse_func_radioS, 'Value', 1 );
0356   set( H.mouse_func_radioU, 'Value', 0 );
0357   zoom off;
0358   rotate3d off;
0359   set( findobj( H.plot_axes, 'Tag', 'brain' ), 'ButtonDownFcn',...
0360             'job_view_cortex_callback(''selection add mouse'');' );
0361 
0362  case 'mouse func U'
0363   set( H.mouse_func_radioZ, 'Value', 0 );
0364   set( H.mouse_func_radioR, 'Value', 0 );
0365   set( H.mouse_func_radioS, 'Value', 0 );
0366   set( H.mouse_func_radioU, 'Value', 1 );
0367   zoom off;
0368   rotate3d off;
0369   set( findobj( H.plot_axes, 'Tag', 'brain' ), 'ButtonDownFcn',...
0370             'job_view_cortex_callback(''selection delete mouse'');' );
0371 
0372 
0373 
0374 
0375  %%%%%%%%%%%%%%
0376  %%%  misc  %%%
0377  %%%%%%%%%%%%%%
0378  
0379  case 'list unselect'
0380   set( H.activation_plotted_list, 'Value', [] );
0381   set( H.area_plotted_list, 'Value', [] );
0382   set( H.area_masking_list, 'Value', [] );
0383   job_view_cortex_aftereffect( 'list act plotted unselect' );
0384   job_view_cortex_aftereffect( 'list area plotted unselect' );
0385   job_view_cortex_aftereffect( 'list area maksing unselect' );
0386   job_view_cortex_plot( 'highlight act' );
0387   job_view_cortex_plot( 'highlight area' );
0388 
0389 
0390  case 'print'
0391   h = figure;
0392   set(h, 'Units', 'normalized');
0393   ax_h = copyobj(H.plot_axes, h);
0394   set(ax_h, 'Units', 'normalized');
0395   set(ax_h, 'Position', [0.2, 0.11, 0.75, 0.85]);
0396   box off;
0397   axis equal;
0398   axis tight;
0399   set(h, 'Units', 'pixels');
0400   vb_epsfig(h,0.5,15);
0401   axis off;
0402 
0403   H.file_dialog.save_mode = 1;
0404   H.file_dialog.file_extensions = { '.eps' };
0405   [ pname fname ] = visible(H.file_dialog);
0406   if length(pname)
0407     print( h, '-depsc2', fullfile( pname, fname{1} ) );
0408   end
0409   delete(h);
0410  
0411  case 'close'
0412   closep = questdlg( 'Are you sure to close window ?', 'Close Window' );
0413   if strcmp( closep, 'Yes' );
0414     delete( H.fig );
0415   end
0416   
0417  case 'set param'
0418   param = get( H.paramdata, 'UserData' );
0419   param = job_view_cortex_param( param );
0420   if ~isempty(param)
0421     set( H.paramdata, 'UserData', param );
0422     job_view_cortex_aftereffect( 'param' );
0423     job_view_cortex_plot( 'brain' );
0424   end
0425 
0426 
0427  case 'mouse move'
0428   pntpos = get( 0, 'PointerLocation' );
0429   winpos = get( H.fig, 'Position' );
0430   axspos = get( H.plot_axes, 'Position' );
0431   pntpos = pntpos - winpos(1:2);
0432   if all( axspos(1:2) < pntpos & axspos(1:2) + axspos(3:4) > pntpos )
0433   else
0434     set( H.fig, 'Pointer', 'arrow' )
0435   end
0436 
0437 
0438 
0439 end
0440 
0441 if ishandle( H.fig )
0442   set( H.fig, 'Pointer', 'arrow' );
0443 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005