Home > vbmeg > functions > tool_box > atlas2vb_dir > vb_plot_atlas.m

vb_plot_atlas

PURPOSE ^

Plot atlas region in brain

SYNOPSIS ^

function vb_plot_atlas(brainfile,atlasfile,atlas_id,mode)

DESCRIPTION ^

 Plot atlas region in brain
  vb_plot_atlas(brainfile,atlasfile,atlas_id)
  vb_plot_atlas(brainfile,atlasfile,atlas_id,mode)
 --- Input
 brainfile
 atlasfile
 atlas_id
 --- Optional Input
 mode = 0 : Plot Inflate-model
      = 1 : Plot real brain in 3D-space

 2006-11-12 M. Sato

 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    vb_plot_atlas(brainfile,atlasfile,atlas_id,mode)
0002 % Plot atlas region in brain
0003 %  vb_plot_atlas(brainfile,atlasfile,atlas_id)
0004 %  vb_plot_atlas(brainfile,atlasfile,atlas_id,mode)
0005 % --- Input
0006 % brainfile
0007 % atlasfile
0008 % atlas_id
0009 % --- Optional Input
0010 % mode = 0 : Plot Inflate-model
0011 %      = 1 : Plot real brain in 3D-space
0012 %
0013 % 2006-11-12 M. Sato
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 
0019 %
0020 % ---------- Plot atlas region in brain
0021 %
0022 
0023 if ~exist('mode','var'), mode=0; end
0024 
0025 switch    mode
0026 case    0
0027     [V, F] = vb_load_cortex(brainfile,'Inflate');
0028 case    1
0029     [V, F] = vb_load_cortex(brainfile);
0030 end
0031 
0032 Act    = vb_get_act(atlasfile,atlas_id);
0033 Vlabel = Act.xxP  ;
0034 label  = Act.label;
0035 
0036 fclr = [0.8 0.7 0.6];
0037 eclr = 'none';
0038 
0039 angl = [ 35  20; -35  20];
0040 %angl = [ -90 -20; 90 -20];
0041 
0042 NL     = F.NdipoleL;
0043 FL     = F.F3L;
0044 FR     = F.F3R;
0045 NV   = size(V,1);
0046 
0047 Lmax = max(V(1:NL,:));
0048 Lmin = min(V(1:NL,:));
0049 Rmax = max(V((NL+1):end,:));
0050 Rmin = min(V((NL+1):end,:));
0051 
0052 NX=2;
0053 NY=1;
0054 
0055 figure;
0056 
0057 Maxlabel = length(label);
0058 
0059 cmap = vb_get_class_color(Maxlabel);
0060 %
0061 % ---- Plot labeled region in Left brain
0062 %
0063 subplot(NY,NX,1);
0064 
0065 ix = find( Vlabel == 0 );
0066 Fx = vb_patch_select(ix,FL,NV);
0067 vb_plot_surf(V,Fx,'w');
0068 hold on;
0069 
0070 ncolor = 0;
0071 
0072 for n=1:Maxlabel
0073     ix = find( Vlabel == label(n) );
0074     if ~isempty(ix)
0075         ncolor = ncolor + 1;
0076         Fx = vb_patch_select2(ix,FL,NV);
0077         vb_plot_surf(V,Fx,cmap(ncolor,:));
0078     end
0079 end
0080 
0081 view(angl(1,:));
0082 title('Anatomic region in left brain')
0083 
0084 xlim([Lmin(1) Lmax(1)]);
0085 ylim([Lmin(2) Lmax(2)]);
0086 zlim([Lmin(3) Lmax(3)]);
0087 
0088 %
0089 % ---- Plot labeled region in Right brain
0090 %
0091 subplot(NY,NX,2);
0092 
0093 ix = find( Vlabel == 0 );
0094 Fx = vb_patch_select(ix,FR,NV);
0095 vb_plot_surf(V,Fx,'w');
0096 hold on;
0097 
0098 ncolor = 0;
0099 
0100 for n=1:Maxlabel
0101     ix = find( Vlabel == label(n) );
0102     if ~isempty(ix)
0103         ncolor = ncolor + 1;
0104         Fx = vb_patch_select2(ix,FR,NV);
0105         vb_plot_surf(V,Fx,cmap(ncolor,:));
0106     end
0107 end
0108 
0109 view(angl(2,:));
0110 title('Anatomic region in right brain')
0111 
0112 xlim([Rmin(1) Rmax(1)]);
0113 ylim([Rmin(2) Rmax(2)]);
0114 zlim([Rmin(3) Rmax(3)]);
0115 
0116 
0117 return

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