Home > vbmeg > functions > plotfunc > vb_plot_area.m

vb_plot_area

PURPOSE ^

plot cortical model and cortical area.

SYNOPSIS ^

function vb_plot_area(brain_file, area_file, area_keys, area_colors, Inflate, LR)

DESCRIPTION ^

 plot cortical model and cortical area.
 [Usage]
    vb_plot_area(brain_file, area_file, [area_keys], [area_colors], [Inflate], [LR]);
 [Input]
     brain_file : VBMEG Cortical model file(.brain.mat)
      area_file : VBMEG Cortical area file(.area.mat)
      area_keys : (optional)plot area name list.                 {Narea x 1}
                  if not specified or empty, all the area are plotted.
    area_colors : (optional)color of area list([R G B] each from 0 to 1.)  [Narea x 3]
                  if not specified or empty, defined color map in the area_file is used.
                  if not defined in the area_file, colormap:hsv(Narea) is used.
        Inflate : (optioal)
                  1: Inflate model.  [default]
                  0: Original model.
             LR : (optional)
                  'LR' : Left and Right brain is plotted. [default]
                  'L'  : Left brain is plotted.
                  'R'  : Right brain is plotted.
 [Output]
    none
 [See also]
    area_keys = vb_get_keyset_area(area_file);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vb_plot_area(brain_file, area_file, area_keys, area_colors, Inflate, LR)
0002 % plot cortical model and cortical area.
0003 % [Usage]
0004 %    vb_plot_area(brain_file, area_file, [area_keys], [area_colors], [Inflate], [LR]);
0005 % [Input]
0006 %     brain_file : VBMEG Cortical model file(.brain.mat)
0007 %      area_file : VBMEG Cortical area file(.area.mat)
0008 %      area_keys : (optional)plot area name list.                 {Narea x 1}
0009 %                  if not specified or empty, all the area are plotted.
0010 %    area_colors : (optional)color of area list([R G B] each from 0 to 1.)  [Narea x 3]
0011 %                  if not specified or empty, defined color map in the area_file is used.
0012 %                  if not defined in the area_file, colormap:hsv(Narea) is used.
0013 %        Inflate : (optioal)
0014 %                  1: Inflate model.  [default]
0015 %                  0: Original model.
0016 %             LR : (optional)
0017 %                  'LR' : Left and Right brain is plotted. [default]
0018 %                  'L'  : Left brain is plotted.
0019 %                  'R'  : Right brain is plotted.
0020 % [Output]
0021 %    none
0022 % [See also]
0023 %    area_keys = vb_get_keyset_area(area_file);
0024 
0025 %
0026 % --- Previous check
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 % Load and plot cortex
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 % plot area
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

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005