Home > functions > job > vb_job_reduced_cortex.m

vb_job_reduced_cortex

PURPOSE ^

Make reduced cortex without corpus region

SYNOPSIS ^

function [Vindx ,V, F] = vb_job_reduced_cortex(proj_root,brain_parm);

DESCRIPTION ^

 Make reduced cortex without corpus region
  vb_job_reduced_cortex(proj_root,brain_parm);
 --- Optional input
 brain_parm.reduce_brain : reduced ratio
 brain_parm.R_normal : Max radius of neighbor search
 --- Output
 The following area is saved to original brain area_file
 areakey = 'reduced_cortex' : reduced cortex without corpus region
 
 Reduced brain file is also saved
  'F','V','xx', ...
 normal_stat.neighbor_org : BV original brain neighbor for specified vertex
 normal_stat.normal_org   : BV original brain normal vector
 
 original_info.parent_ix   = original vertex index for 'reduced_cortex'
 original_info.neighbor_ix = original neighbor index  for 'reduced_cortex'
 
 M. Sato 2006-7-21
 2008-12-24 Taku Yoshioka
  vb_disp() is used for displaying message

 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 [Vindx ,V, F] = vb_job_reduced_cortex(proj_root,brain_parm);
0002 % Make reduced cortex without corpus region
0003 %  vb_job_reduced_cortex(proj_root,brain_parm);
0004 % --- Optional input
0005 % brain_parm.reduce_brain : reduced ratio
0006 % brain_parm.R_normal : Max radius of neighbor search
0007 % --- Output
0008 % The following area is saved to original brain area_file
0009 % areakey = 'reduced_cortex' : reduced cortex without corpus region
0010 %
0011 % Reduced brain file is also saved
0012 %  'F','V','xx', ...
0013 % normal_stat.neighbor_org : BV original brain neighbor for specified vertex
0014 % normal_stat.normal_org   : BV original brain normal vector
0015 %
0016 % original_info.parent_ix   = original vertex index for 'reduced_cortex'
0017 % original_info.neighbor_ix = original neighbor index  for 'reduced_cortex'
0018 %
0019 % M. Sato 2006-7-21
0020 % 2008-12-24 Taku Yoshioka
0021 %  vb_disp() is used for displaying message
0022 %
0023 % Copyright (C) 2011, ATR All Rights Reserved.
0024 % License : New BSD License(see VBMEG_LICENSE.txt)
0025 
0026 proj_root = vb_rm_trailing_slash(proj_root);
0027 
0028 const = vb_define_verbose;
0029 VERBOSE_LEVEL_NOTICE = const.VERBOSE_LEVEL_NOTICE;
0030 
0031 % switch flag to plot resulted reduced cortex
0032 plot_mode = 1;
0033 
0034 brain_file = [proj_root filesep brain_parm.brain_file];
0035 area_file  = [proj_root filesep brain_parm.area_file ];
0036 act_file   = [proj_root filesep brain_parm.act_file  ];
0037 
0038 % ID for MRI image data
0039 [udir, fname] = fileparts(brain_parm.analyze_file);
0040 MRI_ID = fname;
0041 
0042 % Reduce ratio
0043 if isfield(brain_parm,'reduce_brain')
0044     reduce_brain = brain_parm.reduce_brain; 
0045 else
0046     reduce_brain = 1/3;    
0047 end
0048 
0049 % Max radius of neighbor search
0050 if isfield(brain_parm,'R_normal')
0051     Rmax = brain_parm.R_normal; 
0052 else
0053     Rmax = 0.004;    % 4mm
0054 end
0055 
0056 %
0057 % --- Make reduced brain
0058 %
0059 tic
0060 vb_disp('Make reduced cortex', VERBOSE_LEVEL_NOTICE);
0061 Vindx = [];
0062 [Vindx ,V, F, xx, Vinfo] = vb_reduce_cortex(brain_file,Vindx,reduce_brain);
0063 vb_ptime(toc)
0064 
0065 % Add 'reduced_cortex' area to original areafile
0066 area_key    = 'reduced_cortex';
0067 AreaNew.key = area_key;
0068 AreaNew.Iextract = Vindx(:);
0069 vb_add_area(area_file,AreaNew,[],OFF);
0070 
0071 %
0072 % --- Search next-point index and distance
0073 %
0074 tic;
0075 vb_disp_nonl('Search next-point index and distance: ', VERBOSE_LEVEL_NOTICE);
0076 
0077 [xxD, xxF, xxT] = vb_next_distance( F.F3, V ); % unit : m
0078 
0079 vb_disp(sprintf('%f[sec]',toc), VERBOSE_LEVEL_NOTICE);
0080 
0081 %
0082 % --- Calculate area assigned to the vertex
0083 %
0084 tic
0085 
0086 [xxA] = vb_calc_patch_area(V, F.F3, xxT);
0087 
0088 vb_disp(sprintf('%f[sec]',toc), VERBOSE_LEVEL_NOTICE);
0089 
0090 %
0091 % --- Generate the neighbor information of reduced cortex
0092 %
0093 [nextDD, nextIX] = vb_load_cortex_neighbour(brain_file) ;
0094 [nextIX, nextDD] = vb_reduce_neighbor_data(Vindx,nextIX,nextDD);
0095 
0096 % make new file name
0097 add_name   = '_reduce';
0098 brain_file2 = vb_change_file_basename(brain_file,add_name);
0099 area_file2  = vb_change_file_basename(area_file,add_name);
0100 act_file2   = vb_change_file_basename(act_file,add_name);
0101 
0102 vb_disp('Save brain model ', VERBOSE_LEVEL_NOTICE);
0103 vb_disp(sprintf('     filename = %s', brain_file2), ...
0104         VERBOSE_LEVEL_NOTICE);
0105 
0106 vb_save([brain_file2], 'F','V','xx','xxF','xxD','xxA', ...
0107      'Vinfo','nextIX','nextDD','MRI_ID');
0108 
0109 % total number of vertex
0110 Ndipole = size(V,1);
0111 
0112 % Make activity map file
0113 act_new.key     = 'Uniform';
0114 act_new.xxP     = ones(Ndipole,1);
0115 act_new.comment = 'artificial data';
0116 
0117 vb_add_act([act_file2], act_new, MRI_ID, OFF);
0118 
0119 % Make Area file
0120 AreaNew.key      = 'Cortex';
0121 AreaNew.Iextract = [1:Ndipole]'; 
0122 
0123 vb_add_area([area_file2], AreaNew, MRI_ID, OFF);
0124 
0125 if plot_mode == 1,
0126     
0127     % View angle
0128     angle = [45 30; -45 30];
0129     
0130     figure;
0131     subplot(1,2,1)
0132     vb_plot_surf(V, F.F3L, [],'k', 1, 1);
0133     view(angle(1,:));
0134     title('Reduced left brain')
0135     
0136     subplot(1,2,2)
0137     vb_plot_surf(V, F.F3R, [],'k', 1, 1);
0138     view(angle(2,:));
0139     title('Reduced right brain')
0140 end
0141 
0142 %
0143 % --- Normal statuctics
0144 %
0145 vb_disp('Find normal statics in brain file', VERBOSE_LEVEL_NOTICE);
0146 
0147 [normal_stat , original_info] = ...
0148           vb_cortex_normal_statics(brain_file,area_file,area_key,Rmax);
0149 
0150 original_info.brain_file = brain_parm.brain_file;
0151 
0152 %
0153 % --- Save reduced brain model
0154 %
0155 vb_disp('Save normal statics ', VERBOSE_LEVEL_NOTICE);
0156 
0157 vb_save([brain_file2], 'original_info','normal_stat');

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