0001 function job_plot_cmap_print_spatialpattern(inst_id)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 global vbmeg_inst;
0040 if isempty(vbmeg_inst.plotcmap{inst_id}.V), return; end
0041
0042
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 cb1 = vbmeg_inst.plotcmap{inst_id}.cb1;
0055 cb2 = vbmeg_inst.plotcmap{inst_id}.cb2;
0056 cb3 = vbmeg_inst.plotcmap{inst_id}.cb3;
0057 cb8 = vbmeg_inst.plotcmap{inst_id}.cb8;
0058 model_type_original_rb = ...
0059 vbmeg_inst.plotcmap{inst_id}.model_type_original_rb;
0060 Jmax_plot_edit = vbmeg_inst.plotcmap{inst_id}.Jmax_plot_edit;
0061 Jmin_plot_edit = vbmeg_inst.plotcmap{inst_id}.Jmin_plot_edit;
0062 area_file = vbmeg_inst.plotcmap{inst_id}.area_file;
0063 area_key = vbmeg_inst.plotcmap{inst_id}.area_key;
0064
0065
0066
0067
0068 if get(model_type_original_rb,'Value')==1,
0069 V = vbmeg_inst.plotcmap{inst_id}.V;
0070 inf_C = [];
0071 else
0072 V = vbmeg_inst.plotcmap{inst_id}.Vinf;
0073 inf_C = vbmeg_inst.plotcmap{inst_id}.inf_C;
0074 end
0075
0076
0077 LRflag = [];
0078 if get(cb2,'Value')==get(cb2,'Max'), LRflag = 'L'; end
0079 if get(cb3,'Value')==get(cb3,'Max'), LRflag = [LRflag 'R']; end;
0080 if isempty(LRflag),
0081 set(cb2,'Value',get(cb2,'Max'));
0082 LRflag = 'L';
0083 end
0084 plot_parm.LRflag = LRflag;
0085
0086
0087 J0 = job_plot_cmap_get_spatialpattern(inst_id);
0088
0089 if isempty(J0),
0090 isact = 0;
0091 else
0092 isact=1;
0093 end
0094 plot_parm.isact = isact;
0095 [az,el] = view(h_space);
0096
0097
0098 Jmax_plot = str2num(get(Jmax_plot_edit,'String'));
0099 Jmin_plot = str2num(get(Jmin_plot_edit,'String'));
0100
0101 if isempty(Jmax_plot),
0102 Jmax_plot = max(J0(:));
0103 set(Jmax_plot_edit,'String',num2str(Jmax_plot));
0104 end
0105
0106 if isempty(Jmin_plot),
0107 Jmin_plot = Jmax_plot*0.1;
0108 set(Jmin_plot_edit,'String',num2str(Jmin_plot));
0109 end
0110
0111
0112 property_names = {'Colorbar','Max','Min','Colorbar', ...
0113 'Light intensity','Print option'};
0114 default_values{1} = num2str(plot_parm.flag_colorbar);
0115 default_values{2} = num2str(Jmax_plot);
0116 default_values{3} = num2str(Jmin_plot);
0117 if plot_parm.cmap==1,
0118 default_values{4} = 'hot';
0119 else
0120 default_values{4} = 'jet';
0121 end
0122 if isempty(inf_C),
0123 default_values{5} = '0.6';
0124 else
0125 default_values{5} = '1.0';
0126 end
0127 default_values{6} = plot_parm.str_print_format;
0128
0129
0130 vb_disp(['job_plot_cmap_print_spatialpattern'],'DEBUG');
0131 for i=1:6
0132 tmp_str = sprintf('default_values{%d}=%s',i,default_values{i});
0133 vb_disp(tmp_str,'DEBUG');
0134 end
0135
0136
0137 description ...
0138 = {'Colorbar is attached (1) or not (0).', ...
0139 'Maximum value of the absolute value plotted.', ...
0140 ['Minimum threshold; vertices with values lower than ' ...
0141 'the threshold are not plotted.'], ...
0142 'Colormap', ...
0143 'Relative intensity from 0 to 1', ...
0144 'Print option (such as ''-dpng'')'};
0145 values = vb_property_dlg(property_names,default_values,description);
0146
0147 if isempty(values),
0148 return;
0149 end
0150
0151 iscbar = str2num(values{1});
0152 Jmax_plot = str2num(values{2});
0153 Jmin_plot = str2num(values{3});
0154 cmap_str = values{4};
0155 intensity = str2num(values{5});
0156 opt_print = values{6};
0157
0158
0159 if ~isempty(Jinfo),
0160 if Jmin<0,
0161 plot_parm.wmode = 0;
0162 else
0163 plot_parm.wmode = 1;
0164 end
0165 elseif ~isempty(TFinfo),
0166 if TFmin<0,
0167 plot_parm.wmode = 0;
0168 else
0169 plot_parm.wmode = 1;
0170 end
0171 end
0172
0173
0174 if ~isempty(area_key) && get(cb8,'Value'),
0175 area_colors = [ 1 0 0; 0 1 0; 0 0 1; 1 1 0; 1 0 1; 0 1 1;
0176 1 1 0.5; 0.5 0 0; 0 0.5 1; 0.5 1 0; 1 0.5 1; 0 0 0.5;
0177 1 0.5 0; 0 1 0.5; 0.5 0 1; 0 0.5 0; 0.5 1 1; 1 0 0.5;
0178 1 0.5 0.5; 0 0.5 0.5; 0.5 1 0.5;
0179 0.5 0 0.5; 0.5 0.5 1; 0.5 0.5 0 ];
0180
0181 if ~iscell(area_key), area_key = {area_key}; end
0182 plot_parm.area.area_file = area_file;
0183 plot_parm.area.key = area_key;
0184 plot_parm.area.transparent = true;
0185
0186 for i=1:length(area_key)
0187 plot_parm.area.clr{i} ...
0188 = area_colors(1+mod(i-1,length(area_colors)),:);
0189 end
0190 end
0191
0192 h_fig = figure;
0193 vb_plot_cortex(plot_parm,V,F,inf_C,J0,Jmin_plot,Jmax_plot);
0194 axis off;
0195 axis equal;
0196 axis tight;
0197
0198 if strcmp(cmap_str,'hot'),
0199 colormap(hot);
0200 else
0201 colormap(jet);
0202 end
0203
0204 if iscbar & Jmax_plot>0,
0205 h = colorbar;
0206 if plot_parm.wmode==0,
0207 set(h,'YLim',[-1*Jmax_plot Jmax_plot]);
0208 else
0209 set(h,'YLim',[0 Jmax_plot]);
0210 end
0211 end
0212
0213
0214 view([az el]);
0215 if ~isempty(inf_C),
0216 lh = camlight('headlight');
0217 else
0218 c = get(gca,'Children');
0219 for i=1:length(c)
0220 if strcmp(get(c(i),'Type'),'light'),
0221 lh = c(i);
0222 camlight(lh,'headlight');
0223 end
0224 end
0225 end
0226
0227
0228 cl = get(lh,'Color');
0229 set(lh,'Color',intensity*cl);
0230
0231 vb_epsfig(gcf,0.5,15);
0232
0233 if ~isempty(findstr(opt_print,'-dpng')),
0234 [fig_dir,fig_file] = vb_file_select({'.png'},'Save figure',true);
0235 else
0236 [fig_dir,fig_file] = vb_file_select({'.eps'},'Save figure',true);
0237 end
0238
0239 if ~isempty(fig_file),
0240 figfile = [fig_dir filesep fig_file{1}];
0241 print(h_fig,opt_print,figfile);
0242 end
0243
0244 if ishandle(h_fig)
0245 delete(h_fig);
0246 end
0247
0248 return;