/// <summary>
        /// Sets (resizes) the EDF+ signal number of data for selected signal number.
        /// This method only handles one signal, zero datablock duration.
        /// </summary>
        /// <param name="tal">The annotations list.</param>
        /// <param name="newBufferSize">The new size of the buffer.</param>
        private static void DoResizeBuffer_OneSignalZeroDuration(EdfPlusAnnotationList tal, int newBufferSize)
        {
            // By using the annotation sizes, the block onsets are set; this will make sure that all annotations will fit into
            int blockIdx  = 0;
            int byteCount = 0;

            for (int i = 0; i < tal.Count; i++)
            {
                // Check if this annotation fits into current buffer
                byteCount += tal[i].ToString().Length;
                // if this annotation fits into buffer, check next
                if (byteCount < newBufferSize)
                {
                    continue;
                }

                // This annotation does not fit into the current datablock, so move it to the next one
                blockIdx++;

                // Set the block onset to current annotation onset
                if (blockIdx >= tal.BlockCount)
                {
                    tal.AddBlock(blockIdx, tal[i].Onset);
                }
                else
                {
                    tal.Block(blockIdx).DataRecOnset = tal[i].Onset;
                }

                // initialise byteCount
                byteCount = tal[i].ToString().Length;
            }
            tal.RedistributeAnnotations();
        }
 protected EdfPlusFileBase()
 {
     _talPrereadError = new ErrorMessage();
     _prereadTALs     = PrereadTALs.None;
     _tal             = new EdfPlusAnnotationList(0)
     {
         OnTALGetData = ReadTALs
     };
 }
 protected EdfPlusFileBase()
 {
     _talPrereadError = new ErrorMessage();
       _prereadTALs = PrereadTALs.None;
       _tal = new EdfPlusAnnotationList(0) { OnTALGetData = ReadTALs };
 }
Beispiel #4
0
        /// <summary>
        /// Sets (resizes) the EDF+ signal number of data for selected signal number.
        /// This method only handles one signal, zero datablock duration.
        /// </summary>
        /// <param name="tal">The annotations list.</param>
        /// <param name="newBufferSize">The new size of the buffer.</param>
        private static void DoResizeBuffer_OneSignalZeroDuration(EdfPlusAnnotationList tal, int newBufferSize)
        {
            // By using the annotation sizes, the block onsets are set; this will make sure that all annotations will fit into
              int blockIdx = 0;
              int byteCount = 0;
              for (int i = 0; i < tal.Count; i++)
              {
            // Check if this annotation fits into current buffer
            byteCount += tal[i].ToString().Length;
            // if this annotation fits into buffer, check next
            if (byteCount < newBufferSize) continue;

            // This annotation does not fit into the current datablock, so move it to the next one
            blockIdx++;

            // Set the block onset to current annotation onset
            if (blockIdx >= tal.BlockCount)
              tal.AddBlock(blockIdx, tal[i].Onset);
            else
              tal.Block(blockIdx).DataRecOnset = tal[i].Onset;

            // initialise byteCount
            byteCount = tal[i].ToString().Length;
              }
              tal.RedistributeAnnotations();
        }