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

bm_fileio_read_mask_file

PURPOSE ^

Read mask file and get specfied part of brain.

SYNOPSIS ^

function [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] =bm_fileio_read_mask_file(mask_file, brain_part, analyze_info)

DESCRIPTION ^

 Read mask file and get specfied part of brain.
 [IN]
        mask_file : personal brain mask file(.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_mask_file(mask_file, brain_part, analyze_info)
0003 % Read mask file and get specfied part of brain.
0004 % [IN]
0005 %        mask_file : personal brain mask file(.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('mask_file', 'var')
0022     error('mask_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 Para.Nvertex = 3000; % 出力頂点数
0039 Para.vstep = 2  ;   % イメージ処理ボクセルサイズ [mm]
0040 Para.Nloop = 200;     % マスク境界フィット繰り返し回数
0041 Para.Nlast = 10;     % バネモデル平滑化繰り返し回数
0042 Para.Radius = [2 4 -4 -2];% morphological smoothing for brain
0043 
0044 %
0045 % --- Get subject brain mask (voxel size = step [mm])
0046 %
0047 const = define_bm_edit_app;
0048 
0049 for k=1:length(brain_part)
0050     switch(brain_part{k})
0051         case const.str.MASK_FILE_IMPORT_CORTEX
0052             [avw, Xcenter] = vb_get_brain_mask(mask_file, ...
0053                                             'cortex', ...
0054                                             '', ...
0055                                             Para.vstep);
0056         case const.str.MASK_FILE_IMPORT_BRAIN
0057             [avw, Xcenter] = vb_get_brain_mask(mask_file, ...
0058                                             'brain', ...
0059                                             '', ...
0060                                             Para.vstep);
0061     end
0062 
0063     % make surface
0064     [V, F, xx] = vb_mask_to_surf_expand(avw.img, Para);
0065     V = vb_analyze_right_mm_to_spm_right(V, Vdim, Vsize);
0066 
0067     % make output data
0068     V_cell{k} = V;
0069     F_cell{k} = F;
0070     xx_cell{k} = xx;
0071     model_name_cell{k} = brain_part{k};
0072     conduct_cell{k} = const.DEFAULT_CONDUCTIVITY;
0073 end

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