Home > functions > gui > bm_editor > bm_manager > bm_manager_import_file.m

bm_manager_import_file

PURPOSE ^

import brain model

SYNOPSIS ^

function [obj, result, index] = bm_manager_import_file(obj, file_type, model_file, analyze_file, varargin)

DESCRIPTION ^

 import brain model
 [USAGE]
    bm_manager_import_file(<obj>, <file_type>, <model_file>, <analyze_file>);
 [IN]
             obj : bm_manager object
       file_type : import file type
      model_file : import file name
    analyze_file : analyze file
        varargin : other paramters
 [OUT]
       obj : bm_manager object
    result : brain model import result.
             (SUCESS or FAILURE)
     index : imported brain model list index


 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 [obj, result, index] = bm_manager_import_file(...
0002                                     obj, file_type, model_file, analyze_file, varargin)
0003 % import brain model
0004 % [USAGE]
0005 %    bm_manager_import_file(<obj>, <file_type>, <model_file>, <analyze_file>);
0006 % [IN]
0007 %             obj : bm_manager object
0008 %       file_type : import file type
0009 %      model_file : import file name
0010 %    analyze_file : analyze file
0011 %        varargin : other paramters
0012 % [OUT]
0013 %       obj : bm_manager object
0014 %    result : brain model import result.
0015 %             (SUCESS or FAILURE)
0016 %     index : imported brain model list index
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 ~exist('obj', 'var'), error('obj is a required parameter.'); end
0026 if ~strcmp(obj.class_type, 'bm_manager')
0027     error('class type is invalid.');
0028 end
0029 if ~exist('file_type', 'var')
0030     error('file_type is a required parameter.');
0031 end
0032 if ~exist('model_file', 'var')
0033     error('model_file is a required parameter.');
0034 end
0035 if ~exist('analyze_file', 'var') || isempty(analyze_file) || ...
0036    exist(analyze_file, 'file') ~= 2
0037     error('analyze_file is a required parameter.');
0038 end
0039 
0040 %
0041 % --- Main Procedure
0042 %
0043 
0044 % read analyze information to convert coordinate
0045 [obj.analyze_info, result] = vb_analyze_info_new(analyze_file);
0046 if result == FAILURE
0047     error('analyze file read failed.');
0048 else
0049     % set analyze information to processor to convert coordinate.
0050     obj.processor = bm_processor_set_analyze_info(obj.processor,...
0051                                                      obj.analyze_info);
0052 end
0053 
0054 % Data import
0055 bm_fileio = bm_fileio_new;
0056 [bm_fileio, result] = bm_fileio_import_file(bm_fileio, ...
0057                                                 file_type, ...
0058                                                 model_file, ...
0059                                                 obj.analyze_info, ...
0060                                                 varargin);
0061 if result == SUCCESS
0062     imported_bm_list = bm_fileio_get_bm_list(bm_fileio);
0063     % merge bm_list and imported bm_list
0064     obj.bm_list = bm_list_merge_bm_list(obj.bm_list, imported_bm_list);
0065     index = bm_list_get_brain_model_index(obj.bm_list);
0066 else
0067     index = [];
0068     return;
0069 end
0070 
0071 %
0072 % --- After check
0073 %
0074 if nargout == 0
0075     error('function caller should receive obj.');
0076 end

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