Home > vbmeg > external > mne > fiff_write_ctf_comp.m

fiff_write_ctf_comp

PURPOSE ^

SYNOPSIS ^

function fiff_write_ctf_comp(fid,comps)

DESCRIPTION ^

 fiff_write_ctf_comp(fid,comps)

 Writes the CTF compensation data into a fif file

     fid           An open fif file descriptor
     comps         The compensation data to write

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fiff_write_ctf_comp(fid,comps)
0002 %
0003 % fiff_write_ctf_comp(fid,comps)
0004 %
0005 % Writes the CTF compensation data into a fif file
0006 %
0007 %     fid           An open fif file descriptor
0008 %     comps         The compensation data to write
0009 %
0010 
0011 %
0012 %   Author : Matti Hamalainen, MGH Martinos Center
0013 %   License : BSD 3-clause
0014 %
0015 %   Revision 1.6  2006/09/08 19:27:13  msh
0016 %   Added KIT coil type to mne_load_coil_def
0017 %   Allow reading of measurement info by specifying just a file name.
0018 %
0019 %   Revision 1.5  2006/06/22 21:22:46  msh
0020 %   Take into account the possibility of calibrated compensation matrices
0021 %
0022 %   Revision 1.4  2006/05/03 19:09:03  msh
0023 %   Fixed even more compatibility issues.
0024 %
0025 %   Revision 1.3  2006/04/23 15:29:40  msh
0026 %   Added MGH to the copyright
0027 %
0028 %   Revision 1.2  2006/04/18 20:44:46  msh
0029 %   Added reading of forward solution.
0030 %   Use length instead of size when appropriate
0031 %
0032 %   Revision 1.1  2006/04/12 10:29:02  msh
0033 %   Made evoked data writing compatible with the structures returned in reading.
0034 %
0035 %
0036 
0037 me='MNE:fiff_write_ctf_comp';
0038 
0039 if nargin ~= 2
0040     error(me,'Incorrect number of arguments');
0041 end
0042 
0043 global FIFF;
0044 if isempty(FIFF)
0045     FIFF = fiff_define_constants();
0046 end
0047 
0048 if isempty(comps)
0049     return;
0050 end
0051 %
0052 %  This is very simple in fact
0053 %
0054 fiff_start_block(fid,FIFF.FIFFB_MNE_CTF_COMP);
0055 for k = 1:length(comps)
0056     comp = comps(k);
0057     fiff_start_block(fid,FIFF.FIFFB_MNE_CTF_COMP_DATA);
0058     %
0059     %    Write the compensation kind
0060     %
0061     fiff_write_int(fid,FIFF.FIFF_MNE_CTF_COMP_KIND, ...
0062         comp.ctfkind);
0063     fiff_write_int(fid,FIFF.FIFF_MNE_CTF_COMP_CALIBRATED,comp.save_calibrated);
0064     %
0065     %    Write an uncalibrated or calibrated matrix
0066     %
0067     comp.data.data = inv(diag(comp.rowcals))*comp.data.data*inv(diag(comp.colcals));
0068     fiff_write_named_matrix(fid,FIFF.FIFF_MNE_CTF_COMP_DATA,comp.data);
0069     fiff_end_block(fid,FIFF.FIFFB_MNE_CTF_COMP_DATA);
0070 end
0071 fiff_end_block(fid,FIFF.FIFFB_MNE_CTF_COMP);
0072 
0073 return;
0074 
0075 end

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