Example #1
0
 public void WriteSignal(EDFSignal signal)
 {
     Console.WriteLine("Write position before signal: " + this.BaseStream.Position);
     for (int i = 0; i < signal.NumberOfSamples.Value; i++)
     {
         this.Write(BitConverter.GetBytes(signal.Samples[i]));
     }
     Console.WriteLine("Write position after signal: " + this.BaseStream.Position);
 }
Example #2
0
        public EDFSignal[] ReadSignals()
        {
            EDFHeader header = ReadHeader();

            EDFSignal[] signals = new EDFSignal[header.NumberOfSignals.Value];

            for (int i = 0; i < signals.Length; i++)
            {
                signals[i]                       = new EDFSignal();
                signals[i].Label.Value           = header.Labels.Value[i];
                signals[i].NumberOfSamples.Value = header.NumberOfSamplesInDataRecord.Value[i];
            }

            //Read the signal sample values
            int readPosition = header.NumberOfBytesInHeader.Value;

            for (int i = 0; i < signals.Length; i++)
            {
                signals[i].Samples = ReadSignalSamples(readPosition, signals[i].NumberOfSamples.Value);
                readPosition      += signals[i].Samples.Length * 2; //2 bytes per integer.
            }

            return(signals);
        }