0001 function [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] = ...
0002 bm_fileio_read_spm_norm_file(spm_norm_file, brain_part, analyze_info)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 if ~exist('spm_norm_file', 'var')
0022 error('spm_norm_file is a required parameter.');
0023 end
0024 if ~exist('brain_part', 'var')
0025 error('brain_part is a required parameter.');
0026 end
0027 if ~exist('analyze_info', 'var')
0028 error('analyze_info is a required parameter.');
0029 end
0030
0031
0032
0033
0034 analyze_file = vb_analyze_info_get_file_prefix(analyze_info);
0035 Vdim = vb_analyze_info_get_voxdim(analyze_info);
0036 Vsize = vb_analyze_info_get_voxsize(analyze_info);
0037
0038 standard_mask_file = 'brain_mask.mat';
0039
0040
0041 [avw, XYZspm] = vb_map_mask_image(...
0042 analyze_file, ...
0043 standard_mask_file, ...
0044 spm_norm_file);
0045 subject_mask = [tempname, '.mat'];
0046 vb_fsave([subject_mask], 'avw', 'XYZspm');
0047
0048 Para.Nvertex = 3000;
0049 Para.vstep = 2 ;
0050 Para.Nloop = 200;
0051 Para.Nlast = 10;
0052 Para.Radius = [2 4 -4 -2];
0053
0054
0055
0056
0057 const = define_bm_edit_app;
0058
0059 for k=1:length(brain_part)
0060 switch(brain_part{k})
0061 case const.str.SPM_NORM_FILE_IMPORT_CORTEX
0062 [avw, Xcenter] = vb_get_brain_mask(subject_mask, ...
0063 'cortex', ...
0064 '', ...
0065 Para.vstep);
0066 case const.str.SPM_NORM_FILE_IMPORT_BRAIN
0067 [avw, Xcenter] = vb_get_brain_mask(subject_mask, ...
0068 'brain', ...
0069 '', ...
0070 Para.vstep);
0071 end
0072
0073
0074 [V, F, xx] = vb_mask_to_surf_expand(avw.img, Para);
0075 V = vb_analyze_right_mm_to_spm_right(V, Vdim, Vsize);
0076
0077
0078 V_cell{k} = V;
0079 F_cell{k} = F;
0080 xx_cell{k} = xx;
0081 model_name_cell{k} = brain_part{k};
0082 conduct_cell{k} = const.DEFAULT_CONDUCTIVITY;
0083 end
0084 delete(subject_mask);