Home > vbmeg > functions > tool_box > dmri_processor > functions > dmri_vbmeg_vertex_select_old.m

dmri_vbmeg_vertex_select_old

PURPOSE ^

Choose verticies of VBMEG brain model by specifing num_vertex.

SYNOPSIS ^

function dmri_vbmeg_vertex_select(brain_file, fs_info_file, num_vertex, parcel_file)

DESCRIPTION ^

 Choose verticies of VBMEG brain model by specifing num_vertex.

 [Usage]
    dmri_vbmeg_vertex_select(brain_file, fs_info_file, num_vertex, parcel_file);

 [Input]
      brain_file : VBMEG BRAIN-MAT file(.brain.mat)
    fs_info_file : Freesurfer information file.
      num_vertex : The number of verticies.
     parcel_file : Parcel file.

 [Output]
    none

 [Example]
    

 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 dmri_vbmeg_vertex_select(brain_file, fs_info_file, num_vertex, parcel_file)
0002 % Choose verticies of VBMEG brain model by specifing num_vertex.
0003 %
0004 % [Usage]
0005 %    dmri_vbmeg_vertex_select(brain_file, fs_info_file, num_vertex, parcel_file);
0006 %
0007 % [Input]
0008 %      brain_file : VBMEG BRAIN-MAT file(.brain.mat)
0009 %    fs_info_file : Freesurfer information file.
0010 %      num_vertex : The number of verticies.
0011 %     parcel_file : Parcel file.
0012 %
0013 % [Output]
0014 %    none
0015 %
0016 % [Example]
0017 %
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 %
0023 % --- Previous check
0024 %
0025 if nargin ~= 4
0026     error('Please check input arguments');
0027 end
0028 if exist(brain_file, 'file') ~= 2
0029     error('brain_file not found.');
0030 end
0031 if exist(fs_info_file, 'file') ~= 2
0032     error('fs_info_file not found.');
0033 end
0034 if num_vertex <= 0
0035     error('Invalid num_vertex was specified.');
0036 end
0037 if ~ischar(parcel_file)
0038     error('parcel_file is not a filename.');
0039 end
0040 
0041 %
0042 % --- Main Procedure
0043 %
0044 
0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 % Select vertices on standard brain
0047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0048 disp(['Select ' num2str(num_vertex) ' vertices on standard brain.']);
0049 std_brain_file = which('mni_icbm152_t1_tal_nlin_asym_09c_20000.brain.mat');
0050 
0051 % Select specified number of verticies on the standard brain file.
0052 load(std_brain_file, 'V', 'Vmni');
0053 std_area_ix = vb_reduce_cortex(std_brain_file, 1:size(V,1), num_vertex);
0054 Vmni_std = Vmni(std_area_ix, :);
0055 
0056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0057 % Map selected vertices onto a subject brain
0058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0059 disp('Mapped selected vertices onto a single subject brain.');
0060 Vmni_sbj = vb_load_cortex(brain_file, 'MNI');
0061 ix_area = vb_find_nearest_point(Vmni_sbj, Vmni_std);
0062 
0063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0064 % Remove non cortical area index
0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066 disp('Remove non cortical area index from verticies.');
0067 load(fs_info_file);
0068 load(brain_file);
0069 
0070 % Devide left/right
0071 vbmeg_lh_area_ix = ix_area(ix_area<=Vinfo.NdipoleL);
0072 vbmeg_rh_area_ix = ix_area(ix_area>Vinfo.NdipoleL)- Vinfo.NdipoleL;
0073 
0074 % FreeSurfer vertex index of vbmeg_(lh/rh)_ix
0075 FS_lh_area_ix    = BV_index.Left(vbmeg_lh_area_ix);
0076 FS_rh_area_ix    = BV_index.Right(vbmeg_rh_area_ix) - Vinfo.NdipoleL0;
0077 
0078 % Remove non-cortical index
0079 if vb_matlab_version('>=', '8.1')
0080     [tmp, ix_l] = intersect(FS_lh_area_ix, FS_wm.lh_cortex_index, 'legacy');
0081     [tmp, ix_r] = intersect(FS_rh_area_ix, FS_wm.rh_cortex_index, 'legacy');
0082 else
0083     [tmp, ix_l] = intersect(FS_lh_area_ix, FS_wm.lh_cortex_index);
0084     [tmp, ix_r] = intersect(FS_rh_area_ix, FS_wm.rh_cortex_index);
0085 end
0086 ix_l = sort(ix_l);
0087 ix_r = sort(ix_r);
0088 
0089 vbmeg_lh_area_ix = vbmeg_lh_area_ix(ix_l);
0090 vbmeg_rh_area_ix = vbmeg_rh_area_ix(ix_r);
0091 FS_lh_area_ix    = FS_lh_area_ix(ix_l);
0092 FS_rh_area_ix    = FS_rh_area_ix(ix_r);
0093 
0094 vbmeg_area_ix = [vbmeg_lh_area_ix' vbmeg_rh_area_ix'+Vinfo.NdipoleL]';
0095 vb_fsave(parcel_file, 'vbmeg_area_ix');
0096 disp(['Saved:' parcel_file]);

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