0001 function vb_plot_area(brain_file, area_file, area_keys, area_colors, Inflate, LR)
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 if ~exist('area_file', 'var') || isempty(area_file)
0029 error('area_file not specified.');
0030 end
0031 if ~isempty(area_file) && exist(area_file, 'file') ~= 2
0032 error('Specified area file not found.');
0033 end
0034 if ~exist('area_keys', 'var')
0035 area_keys = [];
0036 end
0037 if ischar(area_keys)
0038 area_keys = {area_keys};
0039 end
0040
0041 if ~exist('Inflate', 'var')
0042 Inflate = true;
0043 end
0044 if ~exist('LR', 'var')
0045 LR = 'LR';
0046 end
0047
0048 if ~exist('area_colors', 'var') || isempty(area_colors)
0049 area_colors = [];
0050 end
0051
0052
0053 plot_parm = vb_set_plot_parm;
0054 plot_parm.LRflag = LR;
0055
0056 if Inflate == true
0057 [V, F, tmp, inf_C] = vb_load_cortex(brain_file, 'Inflate');
0058 vb_plot_cortex(plot_parm, V, F, inf_C);
0059 else
0060 [V,F] = vb_load_cortex(brain_file);
0061 vb_plot_cortex(plot_parm, V, F);
0062 end
0063 axis equal;
0064 hold on;
0065
0066
0067 switch upper(plot_parm.LRflag)
0068 case 'L'
0069 F0 = F.F3L;
0070 case 'R'
0071 F0 = F.F3R;
0072 case 'LR'
0073 F0 = F.F3;
0074 end
0075
0076 if area_file
0077 if isempty(area_keys)
0078 area_keys = vb_get_keyset_area(area_file);
0079 end
0080
0081 for k=1:length(area_keys)
0082 area = vb_get_area(area_file, area_keys{k});
0083 if isempty(area_colors) && ~isfield(area, 'clr')
0084 area_colors = hsv(length(area_keys));
0085 else
0086 area_colors = [area_colors; area.clr];
0087 end
0088 FF = vb_patch_select2(area.Iextract, F0, size(V,1));
0089 if isempty(FF), continue; end
0090 alpha = 0.7;
0091 patch('Faces',FF,'Vertices',V, 'FaceAlpha', alpha, ...
0092 'FaceColor',area_colors(k, :),'EdgeColor','none','FaceLighting','none');
0093 end
0094 end