예제 #1
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);
        }