Home > vbmeg > demo > sample_scripts > plot_area_flat_sample.m

plot_area_flat_sample

PURPOSE ^

---

SYNOPSIS ^

function vb_job_plot_area_flat_sample

DESCRIPTION ^

 ---
 This is a sample script for plotting cortical area onto flatten
 map. 

 2006-03-24 Taku Yoshioka
 ---

 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_job_plot_area_flat_sample
0002 % ---
0003 % This is a sample script for plotting cortical area onto flatten
0004 % map.
0005 %
0006 % 2006-03-24 Taku Yoshioka
0007 % ---
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 sbj_id = 'TY';
0013 area_key = {[sbj_id '_Neon-Fix'],[sbj_id '_Rev-Fix']};
0014 data_dir = [sbj_id '/data/'];
0015 brain_file = [data_dir sbj_id '.brain.mat'];
0016 flat_file = [data_dir sbj_id '_occip.flat.mat'];
0017 area_file = [data_dir sbj_id '.area.mat'];
0018 
0019 % Plot parameters
0020 plot_parm.LRflag = 'LR';
0021 plot_parm.mtype = 'o'; 
0022 plot_parm.clr_area = {'b','g'};
0023 
0024 % Area to be displayed (reduced vertex indices)
0025 for i=1:length(area_key)
0026   Area = vb_get_area(area_file,area_key{i});
0027   plot_parm.ix_area{i} = Area.Iextract; 
0028 end
0029 clear Area
0030 
0031 % Index transformation (reduced model to original model)
0032 [Ndipole,NdipoleL,BV_index] = vb_load_cortex_info(brain_file);
0033 BV_index = [BV_index.Left; BV_index.Right];
0034 for i=1:length(area_key)
0035   plot_parm.ix_area{i} = BV_index(plot_parm.ix_area{i});
0036 end
0037 clear Ndipole NdipoleL
0038 
0039 % Load flat map data
0040 S = load(flat_file,'Vflat','Cflat','Fflat','BV_index','Vinfo');
0041 plot_parm.V = S.Vflat; 
0042 plot_parm.C = S.Cflat; 
0043 BV_index_flat = [S.BV_index.Left; S.BV_index.Right];
0044 Vinfo = S.Vinfo;
0045 Fflat = S.Fflat; 
0046 clear S
0047 
0048 % Index transformation (original model to flat map)
0049 ix_trans = zeros(max([BV_index_flat; BV_index]),1);
0050 ix_trans(BV_index_flat) = 1:length(BV_index_flat);
0051 for i=1:length(area_key)
0052   plot_parm.ix_area{i} = ix_trans(plot_parm.ix_area{i});
0053 end
0054 
0055 % Check LR flag (this code should be moved into vb_plot_brain_flat.m)
0056 switch plot_parm.LRflag, 
0057  case 'L', 
0058   plot_parm.F = Fflat.F3L;
0059  case 'R', 
0060   plot_parm.F = Fflat.F3R; 
0061  case 'LR',
0062   plot_parm.F = [Fflat.F3L; Fflat.F3R]; 
0063   ix_L = 1:Vinfo.NdipoleL;
0064   ix_R = Vinfo.NdipoleL+1:size(plot_parm.V,1);
0065   mapsize = max(plot_parm.V(:,2))-min(plot_parm.V(:,2));
0066   plot_parm.V(ix_L,2) = plot_parm.V(ix_L,2)-mapsize/2;
0067   plot_parm.V(ix_R,2) = plot_parm.V(ix_R,2)+mapsize/2;
0068 end
0069 clear Fflat
0070 
0071 % Restriction of displayed points
0072 for i=1:length(area_key)
0073   switch plot_parm.LRflag, 
0074    case 'L', 
0075     ix = find(plot_parm.ix_area{i}<=Vinfo.NdipoleL ...
0076           & plot_parm.ix_area{i}~=0);
0077    case 'R', 
0078     ix = find(plot_parm.ix_area{i}>Vinfo.NdipoleL ...
0079           & plot_parm.ix_area{i}~=0);
0080    case 'LR',
0081     ix = find(plot_parm.ix_area{i}~=0);
0082   end
0083   plot_parm.ix_area{i} = plot_parm.ix_area{i}(ix);
0084 end
0085 clear Fflat
0086 
0087 % Invoke plot function
0088 vb_plot_brain_flat(plot_parm);
0089 view([90 90]);
0090 axis equal; 
0091 axis off;

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