Example #1
0
 public Hdf5AcquisitionFileWriter(string aFilename, string groupName = "EEG")
 {
     fileId       = Hdf5.CreateFile(aFilename);
     _groupName   = groupName;
     _header      = new Hdf5AcquisitionFile();
     _nrOfRecords = 0;
     _sampleCount = 0;
 }
        // private readonly ReaderWriterLockSlim lock_ = new ReaderWriterLockSlim();

        public Hdf5AcquisitionFileWriter(string filename, string groupName = "ROOT")
        {
            H5E.set_auto(H5E.DEFAULT, null, IntPtr.Zero);
            //lock_.EnterWriteLock();
            _filename  = filename;
            fileId     = Hdf5.CreateFile(filename);
            _groupName = groupName;
            _groupId   = Hdf5.CreateGroup(fileId, _groupName);

            Header       = new Hdf5AcquisitionFile();
            _nrOfRecords = 0;
            _sampleCount = 0;
            //lock_.ExitWriteLock();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Hdf5AcquisitionFileReader"/> class.
        /// </summary>
        /// <param name="filename">A filename.</param>
        /// <param name="groupName">a root group. If not specified used "ROOT</param>
        public Hdf5AcquisitionFileReader(string filename, string[] labels = null, string groupName = "ROOT")
        {
            fileId     = Hdf5.OpenFile(filename, readOnly: true);
            _header    = Hdf5.ReadObject <Hdf5AcquisitionFile>(fileId, groupName);
            _groupName = groupName;

            _usedChannels = new Dictionary <string, short>();
            for (short i = 0; i < _header.Recording.NrOfChannels; i++)
            {
                _usedChannels.Add(_header.Channels[i].Label, i);
            }
            if (labels == null)
            {
                _labels = _header.Channels.Select(c => c.Label).ToList();
            }
            else
            {
                _labels = labels;
            }
            _readChannelCnt = _labels.Count;
            _signals        = new List <short[]>(_readChannelCnt);
        }