Home > vbmeg > functions > device > meg > vb_megfile_remake_for_LF.m

vb_megfile_remake_for_LF

PURPOSE ^

make lightweight meg.mat file for calculating leadfield

SYNOPSIS ^

function vb_megfile_remake_for_LF(src_file, dst_file)

DESCRIPTION ^

 make lightweight meg.mat file for calculating leadfield
 [usage]
¡¡¡¡vb_megfile_remake_for_LF(src_file, dst_file)
 [input]
   src_file : <required> source MEG-MAT file
   dst_file : <optional> output file ['<src_path>/<src_name>.pos.meg.mat']
 [output]
   none
 [note]
   output file can be used as a template file the purpose of which is only
   updating position
   @see vb_posfile_remake_datafile.m
   This output MEG-MAT file is valid only for calculating lead field
 [history]
   2010-03-05 (Sako) initial version
   2011-06-01 (Sako) converted return values of vb_load_device to upper case

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_megfile_remake_for_LF(src_file, dst_file)
0002 % make lightweight meg.mat file for calculating leadfield
0003 % [usage]
0004 %¡¡¡¡vb_megfile_remake_for_LF(src_file, dst_file)
0005 % [input]
0006 %   src_file : <required> source MEG-MAT file
0007 %   dst_file : <optional> output file ['<src_path>/<src_name>.pos.meg.mat']
0008 % [output]
0009 %   none
0010 % [note]
0011 %   output file can be used as a template file the purpose of which is only
0012 %   updating position
0013 %   @see vb_posfile_remake_datafile.m
0014 %   This output MEG-MAT file is valid only for calculating lead field
0015 % [history]
0016 %   2010-03-05 (Sako) initial version
0017 %   2011-06-01 (Sako) converted return values of vb_load_device to upper case
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 % --- CHECK ARGUMENTS --- %
0023 if ~exist('src_file', 'var'), src_file = ''; end
0024 if ~exist('dst_file', 'var'), dst_file = ''; end
0025 [src_file, dst_file] = inner_check_arguments(src_file, dst_file);
0026 
0027 % --- MAIN PROCEDURE --------------------------------------------------------- %
0028 %
0029 [measurement] = vb_load_device(src_file);
0030 Measurement = upper(measurement);
0031 org_MEGinfo = vb_load_measurement_info(src_file);
0032 
0033 % --- copy minimum set to calculate leadfield
0034 MEGinfo.device        = org_MEGinfo.device;
0035 MEGinfo.MEGch_name    = org_MEGinfo.MEGch_name;
0036 MEGinfo.MEGch_id      = org_MEGinfo.MEGch_id;
0037 MEGinfo.ActiveChannel = org_MEGinfo.ActiveChannel;
0038 
0039 if isfield(org_MEGinfo, 'ChannelInfo')
0040   MEGinfo.ChannelInfo = org_MEGinfo.ChannelInfo;
0041 end
0042 
0043 save(dst_file, 'Measurement', 'MEGinfo');
0044 return;
0045 %
0046 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0047 
0048 % --- INNER FUNCTIONS -------------------------------------------------------- %
0049 %
0050 % --- inner_check_arguments()
0051 %
0052 function [src_file, dst_file] = inner_check_arguments(src_file, dst_file)
0053 func_ = mfilename;
0054 
0055 if isempty(src_file)
0056   error('(%s) src_file is a required parameter', func_);
0057 end
0058 if isempty(dst_file)
0059   [src_path, src_name] = vb_get_file_parts(src_file);
0060   offset_dot = strfind(src_name, '.');
0061   dst_name = src_name(1:(offset_dot-1));
0062   dst_file = [src_path '/' dst_name '.pos.meg.mat'];
0063 end
0064 
0065 if exist(src_file, 'file') ~= 2
0066   error('(%s) cannot find src_file %s', func_, src_file);
0067 end
0068 return;
0069 %
0070 % --- end of inner_check_arguments()
0071 %
0072 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0073 
0074 % --- END OF FILE --- %

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005