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