Home > vbmeg > external > mne > fiff_write_dig_point.m

fiff_write_dig_point

PURPOSE ^

SYNOPSIS ^

function fiff_write_dig_point(fid,dig)

DESCRIPTION ^

 fiff_write_dig_point(fid,dig)
 
 Writes a digitizer data point into a fif file

     fid           An open fif file descriptor
     dig           The point to write

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fiff_write_dig_point(fid,dig)
0002 %
0003 % fiff_write_dig_point(fid,dig)
0004 %
0005 % Writes a digitizer data point into a fif file
0006 %
0007 %     fid           An open fif file descriptor
0008 %     dig           The point to write
0009 %
0010 
0011 %
0012 %   Author : Matti Hamalainen, MGH Martinos Center
0013 %   License : BSD 3-clause
0014 %
0015 %   Revision 1.4  2006/04/23 15:29:40  msh
0016 %   Added MGH to the copyright
0017 %
0018 %   Revision 1.3  2006/04/12 10:29:02  msh
0019 %   Made evoked data writing compatible with the structures returned in reading.
0020 %
0021 %   Revision 1.2  2006/04/10 23:26:54  msh
0022 %   Added fiff reading routines
0023 %
0024 %   Revision 1.1  2005/12/05 16:01:04  msh
0025 %   Added an initial set of fiff writing routines.
0026 %
0027 %
0028 
0029 me='MNE:fiff_write_dig_point';
0030 
0031 if nargin ~= 2
0032         error(me,'Incorrect number of arguments');
0033 end
0034 
0035 FIFF_DIG_POINT=213;
0036 FIFFT_DIG_POINT_STRUCT=33;
0037 FIFFV_NEXT_SEQ=0;
0038 
0039 %?typedef struct _fiffDigPointRec {
0040 %  fiff_int_t kind;               /*!< FIFF_POINT_CARDINAL,
0041 %                                  *   FIFF_POINT_HPI, or
0042 %                                  *   FIFF_POINT_EEG */
0043 %  fiff_int_t ident;              /*!< Number identifying this point */
0044 %  fiff_float_t r[3];             /*!< Point location */
0045 %} *fiffDigPoint,fiffDigPointRec; /*!< Digitization point description */
0046 
0047 datasize=5*4;
0048 count = fwrite(fid,int32(FIFF_DIG_POINT),'int32');
0049 if count ~= 1
0050     error(me,'write failed');
0051 end
0052 count = fwrite(fid,int32(FIFFT_DIG_POINT_STRUCT),'int32');
0053 if count ~= 1
0054     error(me,'write failed');
0055 end
0056 count = fwrite(fid,int32(datasize),'int32');
0057 if count ~= 1
0058     error(me,'write failed');
0059 end
0060 count = fwrite(fid,int32(FIFFV_NEXT_SEQ),'int32');
0061 if count ~= 1
0062     error(me,'write failed');
0063 end
0064 %
0065 %   Start writing fiffDigPointRec
0066 %
0067 count = fwrite(fid,int32(dig.kind),'int32');
0068 if count ~= 1
0069     error(me,'write failed');
0070 end
0071 count = fwrite(fid,int32(dig.ident),'int32');
0072 if count ~= 1
0073     error(me,'write failed');
0074 end
0075 count = fwrite(fid,single(dig.r(1:3)),'single');
0076 if count ~= 3
0077     error(me,'write failed');
0078 end
0079 
0080 return;
0081 
0082

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