Home > functions > gui > bm_editor > bm_fileio > bm_fileio_read_spm_norm_file.m

bm_fileio_read_spm_norm_file

PURPOSE ^

Read spm_normalize file and get specfied part of brain.

SYNOPSIS ^

function [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] =bm_fileio_read_spm_norm_file(spm_norm_file, brain_part, analyze_info)

DESCRIPTION ^

 Read spm_normalize file and get specfied part of brain.
 [IN]
    spm_norm_file : spm normalization file(*_sn.mat)
       brain_part : want to get part of brain. ('brain', 'cortex')
     analyze_info : analyze file information
 [OUT]
             V_cell : cell array of vertex
             F_cell : cell array of face
            xx_cell : cell array of normal vector
    model_name_cell : cell array of model name
       conduct_cell : cell array of conductivity

 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 [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 % Read spm_normalize file and get specfied part of brain.
0004 % [IN]
0005 %    spm_norm_file : spm normalization file(*_sn.mat)
0006 %       brain_part : want to get part of brain. ('brain', 'cortex')
0007 %     analyze_info : analyze file information
0008 % [OUT]
0009 %             V_cell : cell array of vertex
0010 %             F_cell : cell array of face
0011 %            xx_cell : cell array of normal vector
0012 %    model_name_cell : cell array of model name
0013 %       conduct_cell : cell array of conductivity
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 %
0019 % --- Previous check
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 % --- Main Procedure
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'; % fixed
0039 
0040 % make personal mask file
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  ;   % イメージ処理ボクセルサイズ [mm]
0050 Para.Nloop = 200;     % マスク境界フィット繰り返し回数
0051 Para.Nlast = 10;     % バネモデル平滑化繰り返し回数
0052 Para.Radius = [2 4 -4 -2];% morphological smoothing for brain
0053 
0054 %
0055 % --- Get subject brain mask (voxel size = step [mm])
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     % make surface
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     % make output data
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);

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