Home > functions > job > job_plot_currentmap_dir > job_plot_cmap_update_spatialpattern.m

job_plot_cmap_update_spatialpattern

PURPOSE ^

Update brain activity map.

SYNOPSIS ^

function job_plot_cmap_update_spatialpattern(inst_id)

DESCRIPTION ^

 Update brain activity map. 

 [syntax]
 job_plot_cmap_update_spatialpattern(inst_id)

 [history]
 ????-??-?? Taku Yoshioka
 2008-09-04 Taku Yoshioka
 2008-12-16 Taku Yoshioka
 2009-05-01 Taku Yoshioka
  Debug (remove redundant code)
 2010-08-26 Taku Yoshioka
  Replace function (vb_plot_cortex->vb_plot_cortex)
 2010-12-01 taku-y
  [internal change] 'Jinfo' replaces 'MEGinfo'.
 2010-12-06 taku-y
  [enhancement] Jinfo.version>=0.9 supported. 
 2010-12-08 taku-y
  [internal change] vb_version_cmp used.
 2011-01-29 taku-y
  [enhancement] Activity map plot supported. 
 2011-02-16 taku-y
  [enhancement] Cortical area plot supported. 
 2011-03-16 taku-y
  [debug] Colorbar scale check is ignored when 'Fix' is checked on GUI.
 2011-04-01 taku-y
  [minor] Colorbar fnc argument changed depending on MATLAB version.
 2011-04-04 taku-y
  [enhancement] Multiple cortical area plot supported. 

 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_plot_cmap_update_spatialpattern(inst_id)
0002 % Update brain activity map.
0003 %
0004 % [syntax]
0005 % job_plot_cmap_update_spatialpattern(inst_id)
0006 %
0007 % [history]
0008 % ????-??-?? Taku Yoshioka
0009 % 2008-09-04 Taku Yoshioka
0010 % 2008-12-16 Taku Yoshioka
0011 % 2009-05-01 Taku Yoshioka
0012 %  Debug (remove redundant code)
0013 % 2010-08-26 Taku Yoshioka
0014 %  Replace function (vb_plot_cortex->vb_plot_cortex)
0015 % 2010-12-01 taku-y
0016 %  [internal change] 'Jinfo' replaces 'MEGinfo'.
0017 % 2010-12-06 taku-y
0018 %  [enhancement] Jinfo.version>=0.9 supported.
0019 % 2010-12-08 taku-y
0020 %  [internal change] vb_version_cmp used.
0021 % 2011-01-29 taku-y
0022 %  [enhancement] Activity map plot supported.
0023 % 2011-02-16 taku-y
0024 %  [enhancement] Cortical area plot supported.
0025 % 2011-03-16 taku-y
0026 %  [debug] Colorbar scale check is ignored when 'Fix' is checked on GUI.
0027 % 2011-04-01 taku-y
0028 %  [minor] Colorbar fnc argument changed depending on MATLAB version.
0029 % 2011-04-04 taku-y
0030 %  [enhancement] Multiple cortical area plot supported.
0031 %
0032 % Copyright (C) 2011, ATR All Rights Reserved.
0033 % License : New BSD License(see VBMEG_LICENSE.txt)
0034 
0035 global vbmeg_inst; 
0036 if isempty(vbmeg_inst.plotcmap{inst_id}.V), return; end
0037 
0038 %
0039 % Global variables
0040 %
0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 h_fig      = vbmeg_inst.plotcmap{inst_id}.h_fig; 
0043 h_space    = vbmeg_inst.plotcmap{inst_id}.h_space;
0044 F          = vbmeg_inst.plotcmap{inst_id}.F;
0045 plot_parm  = vbmeg_inst.plotcmap{inst_id}.plot_parm;
0046 Jinfo      = vbmeg_inst.plotcmap{inst_id}.Jinfo;
0047 Jmin       = vbmeg_inst.plotcmap{inst_id}.Jmin;
0048 Jmax_plot  = vbmeg_inst.plotcmap{inst_id}.Jmax_plot;
0049 Jmin_plot  = vbmeg_inst.plotcmap{inst_id}.Jmin_plot;
0050 TFinfo     = vbmeg_inst.plotcmap{inst_id}.TFinfo;
0051 TFmin      = vbmeg_inst.plotcmap{inst_id}.TFmin;
0052 TFmax_plot = vbmeg_inst.plotcmap{inst_id}.TFmax_plot;
0053 TFmin_plot = vbmeg_inst.plotcmap{inst_id}.TFmin_plot;
0054 ix_peak    = vbmeg_inst.plotcmap{inst_id}.ix_peak;
0055 cb2        = vbmeg_inst.plotcmap{inst_id}.cb2;
0056 cb3        = vbmeg_inst.plotcmap{inst_id}.cb3;
0057 cb7        = vbmeg_inst.plotcmap{inst_id}.cb7;
0058 cb8        = vbmeg_inst.plotcmap{inst_id}.cb8;
0059 cb5        = vbmeg_inst.plotcmap{inst_id}.cb5;
0060 ed5        = vbmeg_inst.plotcmap{inst_id}.ed5;
0061 lb1        = vbmeg_inst.plotcmap{inst_id}.lb1;
0062 act_file   = vbmeg_inst.plotcmap{inst_id}.act_file;
0063 model_type_original_rb = ...
0064     vbmeg_inst.plotcmap{inst_id}.model_type_original_rb;
0065 Vtal       = vbmeg_inst.plotcmap{inst_id}.Vtal;
0066 nextDD     = vbmeg_inst.plotcmap{inst_id}.nextDD;
0067 nextIX     = vbmeg_inst.plotcmap{inst_id}.nextIX;
0068 Jmax_plot_edit = vbmeg_inst.plotcmap{inst_id}.Jmax_plot_edit;
0069 Jmin_plot_edit = vbmeg_inst.plotcmap{inst_id}.Jmin_plot_edit;
0070 area_file = vbmeg_inst.plotcmap{inst_id}.area_file;
0071 area_key  = vbmeg_inst.plotcmap{inst_id}.area_key;
0072 
0073 %
0074 % Preparation for cortical surface plot
0075 %
0076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077 set(h_fig,'Pointer','arrow');
0078 drawnow;
0079 
0080 % Original/Inflated model
0081 if get(model_type_original_rb,'Value')==1,  
0082   V = vbmeg_inst.plotcmap{inst_id}.V;
0083   inf_C = [];
0084 else
0085   V = vbmeg_inst.plotcmap{inst_id}.Vinf;
0086   inf_C = vbmeg_inst.plotcmap{inst_id}.inf_C;
0087 end
0088 
0089 % Get display parameters
0090 LRflag = [];
0091 if get(cb2,'Value')==get(cb2,'Max'), LRflag = 'L'; end
0092 if get(cb3,'Value')==get(cb3,'Max'), LRflag = [LRflag 'R']; end;
0093 if isempty(LRflag), 
0094   set(cb2,'Value',get(cb2,'Max')); 
0095   LRflag = 'L';
0096 end
0097 plot_parm.LRflag = LRflag; 
0098 
0099 % Get ROI vertices
0100 if get(cb5,'Value')==get(cb5,'Max'), 
0101   R = str2num(get(ed5,'String'))*1e-3;
0102   ix_area = find(nextDD{ix_peak}<=R);
0103   ix_area = nextIX{ix_peak}(ix_area);
0104 else
0105   ix_area = [];
0106 end
0107 
0108 %
0109 % Get spatial pattern of data using current TOI (and FOI)
0110 %
0111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0112 J0 = job_plot_cmap_get_spatialpattern(inst_id);
0113 
0114 if isempty(J0), 
0115   isact = 0; 
0116 else 
0117   isact=1; 
0118 end
0119 plot_parm.isact = isact; 
0120 
0121 % Color scale
0122 Jmax_plot = str2num(get(Jmax_plot_edit,'String'));
0123 Jmin_plot = str2num(get(Jmin_plot_edit,'String'));
0124 
0125 if isempty(Jmax_plot), 
0126   Jmax_plot = max(J0(:));
0127   set(Jmax_plot_edit,'String',num2str(Jmax_plot));
0128 end
0129 
0130 if isempty(Jmin_plot),
0131   Jmin_plot = Jmax_plot*0.1;
0132   set(Jmin_plot_edit,'String',num2str(Jmin_plot));
0133 end
0134 
0135 %
0136 % Plot brain activities superimposed on the cortical surface model
0137 %
0138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0139 if ~isempty(Jinfo),
0140   if Jmin<0, 
0141     plot_parm.wmode = 0;
0142   else
0143     plot_parm.wmode = 1;
0144   end
0145 elseif ~isempty(TFinfo),
0146   if TFmin<0,
0147     plot_parm.wmode = 0;
0148   else
0149     plot_parm.wmode = 1;
0150   end
0151 end
0152 
0153 % Set cortical area
0154 if ~isempty(area_key) && get(cb8,'Value'),
0155   area_colors = [ 1 0 0; 0 1 0; 0 0 1; 1 1 0; 1 0 1; 0 1 1;
0156                   1 1 0.5; 0.5 0 0; 0 0.5 1; 0.5 1 0; 1 0.5 1; 0 0 0.5;
0157                   1 0.5 0; 0 1 0.5; 0.5 0 1; 0 0.5 0; 0.5 1 1; 1 0 0.5;
0158                   1 0.5 0.5; 0 0.5 0.5; 0.5 1 0.5;
0159                   0.5 0 0.5; 0.5 0.5 1; 0.5 0.5 0 ];
0160   
0161   if ~iscell(area_key), area_key = {area_key}; end
0162   plot_parm.area.area_file   = area_file;
0163   plot_parm.area.key         = area_key;
0164   plot_parm.area.transparent = true;
0165   
0166   for i=1:length(area_key)
0167     plot_parm.area.clr{i} ...
0168         = area_colors(1+mod(i-1,length(area_colors)),:);
0169   end
0170 end
0171 
0172 set(h_fig,'CurrentAxes',h_space);
0173 cla;
0174 vb_plot_cortex(plot_parm,V,F,inf_C,J0,Jmin_plot,Jmax_plot,ix_area);
0175 axis off;
0176 axis tight;
0177 axis equal;
0178 colormap(jet);
0179 
0180 if datenum(version('-date'))<=733071, % January 29, 2007 or older
0181   reset(vbmeg_inst.plotcmap{inst_id}.h_cbar);
0182   colorbar(vbmeg_inst.plotcmap{inst_id}.h_cbar);
0183 else
0184   pos = get(vbmeg_inst.plotcmap{inst_id}.h_cbar,'Position');
0185   delete(vbmeg_inst.plotcmap{inst_id}.h_cbar);
0186   vbmeg_inst.plotcmap{inst_id}.h_cbar = colorbar('Position',pos);
0187 end
0188 
0189 %
0190 % Plot indicator for selected Vertex
0191 %
0192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0193 plot3(V(ix_peak,1),V(ix_peak,2),V(ix_peak,3),'gx',...
0194       'MarkerSize',15,'LineWidth',3);
0195 
0196 %
0197 % Update standard brain coordinate
0198 %
0199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0200 job_plot_cmap_update_talcoord(inst_id);
0201 
0202 set(h_fig,'Pointer','arrow');
0203 
0204 job_plot_cmap_push_rotate_button(inst_id);
0205 
0206 return;

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