1 function [HDR]=
bni2hdr(arg1,arg3,arg4,arg5,arg6)
2 % BNI2HDR converts BNI header information into BioSig Header information
6 % HDR.H1 contains ascii header
15 % $Id:
bni2hdr.m 2205 2009-10-27 12:18:15Z schloegl $
16 % Copyright (c) 2007,2008 by Alois Schloegl <a.schloegl@ieee.org>
17 % This is part of the BIOSIG-toolbox http:
19 % This program is free software; you can redistribute it and/or
20 % modify it under the terms of the GNU General Public License
21 % as published by the Free Software Foundation; either version 3
22 % of the License, or (at your option) any later version.
24 % This program is distributed in the hope that it will be useful,
25 % but WITHOUT ANY WARRANTY; without even the implied warranty of
26 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 % GNU General Public License
for more details.
29 % You should have received a copy of the GNU General Public License
30 % along with
this program;
if not, write to the Free Software
31 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 elseif exist(arg1,
'file');
37 [HDR.FILE.Path,HDR.FILE.Name,HDR.FILE.Ext]=fileparts(arg1);
40 fid = fopen(fullfile(HDR.FILE.Path,HDR.FILE.Name,'.bni'),'rt');
41 HDR.H1 =
char(fread(fid,[1,inf],'uint8'));
46 if ~strcmp(s(1:28),'FileFormat = BNI-1-BALTIMORE')
47 fprintf(HDR.FILE.stderr,'WARNING BNI2HDR: Header information is not Nicolet BNI format.\n');
51 [t,s]=strtok(s,[10,13]);
52 [t1,t2]=strtok(t,' =');
53 [t2,t3]=strtok(t2,' =');
54 if strcmp(t1,'PatientId')
56 elseif strcmpi(t1,'Sex')
57 HDR.Patient.Sex = t2; % strncmpi(t2,'m',1)+2*strncmpi(t2,'f',1);
58 elseif strncmpi(t1,'medication',10)
59 HDR.Patient.Medication = t2;
60 elseif strncmpi(t1,'diagnosis',10)
61 HDR.Patient.Diagnosis = t2;
62 elseif strcmpi(t1,'MontageRaw')
64 elseif strcmpi(t1,'Age')
66 elseif strcmp(t1,'Date')
71 elseif strcmp(t1,'Time')
74 elseif strcmp(t1,'Rate')
76 elseif strcmp(t1,'NchanFile')
78 elseif strcmp(t1,'UvPerBit')
80 elseif strcmp(t1,'[Events]')