Home > vbmeg > demo > test_scripts > sbi > readSBI_meg.m

readSBI_meg

PURPOSE ^

--- Input

SYNOPSIS ^

function [meg_info,pick1,pick2,bexp]=readSBI_meg(meg_dir,meg_id,param)

DESCRIPTION ^

 --- Input
 meg_dir  : MEG data dir
 meg_id   : MEG system ID
 --- Optional Input
 param.time_win = [Tstart Tend]: [ms]
 param.trials   = trial index to extract
 param.Pos_chk  : if 1, pick are converted to DICOM cordinate.

 --- Output: 
 meg_info : structure with following field
    .nch,       % number of active gardiometers
    .nch0          % number of gardiometers
    .nsamp,     % sampling number of measurement
    .nprsamp,   % sampling number for pre-trigger
    .sampf,     % sampling frequency
    .nrept,     % repeat number
    .active_ch  % Active channel index
    .ch_name    % Active channel name
    .ch_name0   % All channel name
    .ad_factor  % AD multiplicative factor to convert MEG data to [T]

 pick1(ch,:)         % position and direction of detection coils
                           on DICOM cord.  [m],[normal unit vector]
 pick2(ch,:)         % position and direction of compensation coils
                           on DICOM cord.  [m],[normal unit vector]
 bexp( Nchannel, Tsample, Nrepeat)  % measured fields  [T]
 New ver :2005-12-22 M. Sato 

 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 [meg_info,pick1,pick2,bexp]=readSBI_meg(meg_dir,meg_id,param)
0002 % --- Input
0003 % meg_dir  : MEG data dir
0004 % meg_id   : MEG system ID
0005 % --- Optional Input
0006 % param.time_win = [Tstart Tend]: [ms]
0007 % param.trials   = trial index to extract
0008 % param.Pos_chk  : if 1, pick are converted to DICOM cordinate.
0009 %
0010 % --- Output:
0011 % meg_info : structure with following field
0012 %    .nch,       % number of active gardiometers
0013 %    .nch0          % number of gardiometers
0014 %    .nsamp,     % sampling number of measurement
0015 %    .nprsamp,   % sampling number for pre-trigger
0016 %    .sampf,     % sampling frequency
0017 %    .nrept,     % repeat number
0018 %    .active_ch  % Active channel index
0019 %    .ch_name    % Active channel name
0020 %    .ch_name0   % All channel name
0021 %    .ad_factor  % AD multiplicative factor to convert MEG data to [T]
0022 %
0023 % pick1(ch,:)         % position and direction of detection coils
0024 %                           on DICOM cord.  [m],[normal unit vector]
0025 % pick2(ch,:)         % position and direction of compensation coils
0026 %                           on DICOM cord.  [m],[normal unit vector]
0027 % bexp( Nchannel, Tsample, Nrepeat)  % measured fields  [T]
0028 % New ver :2005-12-22 M. Sato
0029 %
0030 % Copyright (C) 2011, ATR All Rights Reserved.
0031 % License : New BSD License(see VBMEG_LICENSE.txt)
0032 
0033 
0034 if ~exist('param','var'), param = []; end;
0035 
0036 %
0037 % Read header info
0038 %
0039 [meg_info, pick1, pick2] = read_sbi_meg_header(meg_dir, meg_id);
0040 
0041 ix_ch = meg_info.active_ch ;% Active channel index
0042 amp   = meg_info.ad_factor ;% AD factor to convert MEG data to [T]
0043 
0044 %
0045 % Read MEG data
0046 %
0047 bexp = read_sbi_meg_data(meg_dir, meg_id, meg_info, param);
0048 
0049 %
0050 % Select active channel & AD conversion
0051 %
0052 nch   = length(ix_ch);  
0053 bexp  = bexp(ix_ch,:,:);
0054 
0055 for i=1:nch,
0056     bexp(i,:,:) = bexp(i,:,:) * amp(i);
0057 end
0058 
0059 if isfield(param,'Pos_chk') & param.Pos_chk == OFF, return; end;
0060 
0061 %
0062 % Convert coil position to MRI-space
0063 %
0064 [pick1, pick2, meg_info] = ...
0065      trans_coord_sbi(meg_dir, meg_id, pick1, pick2, meg_info);
0066

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