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

bm_fileio_read_brain_file

PURPOSE ^

read brain file.

SYNOPSIS ^

function [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] =bm_fileio_read_brain_file(file_name, parts, analyze_info)

DESCRIPTION ^

 read brain file.
 [USAGE]
    [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] ...
             = bm_fileio_read_brain_file(<file_name>, <parts>);
 [IN]
    file_name : full path brain file(.brain.mat)
        parts : parts to read.  cell array
 [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_brain_file(file_name, parts, analyze_info)
0003 % read brain file.
0004 % [USAGE]
0005 %    [V_cell, F_cell, xx_cell, model_name_cell, conduct_cell] ...
0006 %             = bm_fileio_read_brain_file(<file_name>, <parts>);
0007 % [IN]
0008 %    file_name : full path brain file(.brain.mat)
0009 %        parts : parts to read.  cell array
0010 % [OUT]
0011 %             V_cell : cell array of vertex
0012 %             F_cell : cell array of face
0013 %            xx_cell : cell array of normal vector
0014 %    model_name_cell : cell array of model name
0015 %       conduct_cell : cell array of conductivity
0016 %
0017 % Copyright (C) 2011, ATR All Rights Reserved.
0018 % License : New BSD License(see VBMEG_LICENSE.txt)
0019 
0020 %
0021 % --- Previous check
0022 %
0023 if ~exist('file_name', 'var')
0024     error('file_name is a required parameter.');
0025 end
0026 if ~exist('parts', 'var')
0027     error('parts is a required parameter.');
0028 end
0029 
0030 if exist(file_name, 'file') ~= 2
0031     error(['specified brain file does not exist : ' file_name]);
0032 end
0033 
0034 %
0035 % --- Main Procedure
0036 %
0037 const = define_bm_edit_app;
0038 
0039 load(file_name);
0040 
0041 % Analyze information for coordinate change
0042 Vdim  = vb_analyze_info_get_voxdim(analyze_info);
0043 Vsize = vb_analyze_info_get_voxsize(analyze_info);
0044 V     = vb_spm_right_to_analyze_right_mm(V, Vdim, Vsize);
0045 step  = 2;
0046 Dim   = vb_mask_image_size(Vdim, Vsize, step);
0047 mask_mode = 0; % no morphology
0048 
0049 for k=1:length(parts)
0050     switch(parts{k})
0051         case const.str.BRAIN_FILE_IMPORT_LEFT_BRAIN
0052             B = vb_cortex_fill(V, F, step, [], 'L', Dim, mask_mode);
0053             model_name = const.str.BRAIN_FILE_IMPORT_LEFT_BRAIN;
0054         case const.str.BRAIN_FILE_IMPORT_RIGHT_BRAIN
0055             B = vb_cortex_fill(V, F, step, [], 'R', Dim, mask_mode);
0056             model_name = const.str.BRAIN_FILE_IMPORT_RIGHT_BRAIN;
0057         case const.str.BRAIN_FILE_IMPORT_WHOLE_BRAIN
0058             B = vb_cortex_fill(V, F, step, [], 'LR', Dim, mask_mode);
0059             model_name = const.str.BRAIN_FILE_IMPORT_WHOLE_BRAIN;
0060         otherwise
0061             error('specified type is invalid.');
0062     end
0063 
0064     [F_cell{k}, Vana, xx_cell{k}] = vb_surf_extract(B, step);
0065     V_cell{k} = vb_analyze_right_mm_to_spm_right(Vana, Vdim, Vsize);
0066     conduct_cell{k} = const.DEFAULT_CONDUCTIVITY;
0067     model_name_cell{k} = parts{k};
0068 
0069 end
0070

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