Home > functions > plotfunc > check_model > vb_check_brain_model.m

vb_check_brain_model

PURPOSE ^

Plot brain model in 3D & on MRI slice for checking

SYNOPSIS ^

function vb_check_brain_model(proj_root,brain_parm)

DESCRIPTION ^

 Plot brain model in 3D & on MRI slice for checking
  vb_check_brain_model(proj_root,brain_parm)

 2006/10/19 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_check_brain_model(proj_root,brain_parm)
0002 % Plot brain model in 3D & on MRI slice for checking
0003 %  vb_check_brain_model(proj_root,brain_parm)
0004 %
0005 % 2006/10/19 M. Sato
0006 %
0007 % Copyright (C) 2011, ATR All Rights Reserved.
0008 % License : New BSD License(see VBMEG_LICENSE.txt)
0009 
0010 %
0011 % Brain file
0012 %
0013 analyzefile = brain_parm.analyze_file;
0014 brainfile   = [proj_root '/' brain_parm.brain_file];
0015 
0016 
0017 %
0018 %---- Cortex 3D image
0019 %
0020 
0021 %---- Load vertex coordinate from brain file
0022 [V, F] = vb_load_cortex(brainfile);
0023 V = V .* 1000; % [m] to [mm]
0024 
0025 % View angle
0026 angle = [45 30; -45 30; -60 30; 60 30];
0027 
0028 Nfig  = 4;
0029 NY    = 2;
0030 NX    = 2;
0031 fclr  = [0.8 0.7 0.6];
0032 eclr  = 'none';
0033 
0034 light_mode = 1;
0035 max_mode   = 1;
0036 
0037 figure;
0038 subplot(NY,NX,1)
0039 vb_plot_surf(V, F.F3L, fclr,eclr,light_mode,max_mode)
0040 view(angle(1,:));
0041 title('Left brain')
0042 xlabel('[mm]'); ylabel('[mm]'); zlabel('[mm]');
0043 
0044 subplot(NY,NX,2)
0045 vb_plot_surf(V, F.F3R, fclr,eclr,light_mode,max_mode)
0046 view(angle(2,:));
0047 title('Right brain')
0048 xlabel('[mm]'); ylabel('[mm]'); zlabel('[mm]');
0049 
0050 subplot(NY,NX,3)
0051 vb_plot_surf(V, F.F3, fclr,eclr,light_mode,max_mode)
0052 view(angle(3,:));
0053 title('Both brain [Left angle]')
0054 xlabel('[mm]'); ylabel('[mm]'); zlabel('[mm]');
0055 
0056 subplot(NY,NX,4)
0057 vb_plot_surf(V, F.F3, fclr,eclr,light_mode,max_mode)
0058 view(angle(4,:));
0059 title('Both brain [Right angle]')
0060 xlabel('[mm]'); ylabel('[mm]'); zlabel('[mm]');
0061 
0062 V = V ./ 1000; % [mm] to [m]
0063 
0064 %
0065 %---- Cortex on the slice image
0066 %
0067 
0068 %
0069 %---- Load analyze left-handed image
0070 %     & flip to right-handed image
0071 if ~exist(analyzefile,'file'), 
0072     fprintf('There is no analyze file: %s\n',analyzefile)
0073     fprintf('Check of MRI and brain model is skipped\n')
0074     return
0075 end
0076 
0077 [B, Vdim, Vsize] = vb_load_analyze_to_right(analyzefile);
0078 
0079 % Transform vertex coordinate to analyze right-handed coordinate
0080 Vana   = vb_spm_right_to_analyze_right(V,Vdim,Vsize);
0081 
0082 Msize   = 1;        % marker size
0083 Mtype   = 'y-';        % marker type
0084 dz      = 5;        % search radius for intersection triangle
0085 vcut    = ['x','y','z','z'];    % slice cut direction
0086 %indx    = [80 120 130 170 ];    % slice number to cut
0087 indx    = fix([Vdim(1)*0.45 Vdim(2)/2 Vdim(3)*0.5 Vdim(3)*0.7]);% slice number
0088 xymode  = 0;
0089 
0090 label   = {'Sagittal cut'; 'Coronal cut'; 'Axial cut'; 'Axial cut'};
0091 
0092 Nfig = length(vcut);
0093 NX   = 2;
0094 NY   = 2;
0095 
0096 figure;
0097 
0098 for n= 1:Nfig
0099     subplot(NY,NX,n)
0100     vdim = vcut(n);
0101     [strX,strY] = vb_plot_3d_image(B, indx(n), vcut(n), xymode);
0102     xlabel(strX);
0103     ylabel(strY);
0104     
0105     hold on
0106     vb_plot_cross_section(Vana,F.F3,indx(n),vcut(n),dz,Msize,Mtype,xymode);
0107 %    vb_plot_vertex(Vana, vcut(n), indx(n), dz, Msize, Mtype, xymode);
0108     title(label{n})
0109 end
0110 
0111 % Slice index in Z-axis
0112 vcut  = 'z';
0113 zindx = fix(Vdim(3)* [0.3:0.1:0.8]);
0114 %zindx = [140:10:190];
0115 
0116 % Number of subplot
0117 NX   = 3;
0118 NY   = 2;
0119 Nfig = length(zindx);
0120 
0121 figure;
0122 
0123 for n= 1:Nfig
0124     subplot(NY,NX,n)
0125     vb_plot_3d_image(B, zindx(n), vcut, xymode);
0126     
0127     hold on
0128     vb_plot_cross_section(Vana,F.F3,zindx(n),vcut,dz,Msize,Mtype,xymode);
0129 %    vb_plot_vertex(Vana, vcut, zindx(n), dz, Msize, Mtype, xymode);
0130     title(['z-slice (' num2str(zindx(n),3) ')'])
0131     colormap(gray);
0132 end
0133 
0134 return

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005