Пример #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ecgFile) || String.IsNullOrEmpty(segmentStartFile) || String.IsNullOrEmpty(segmentStopFile))
            {
                MessageBox.Show("Load all neccesary files", "Missing files", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //"D:\\Fax\\Diplomski\\3.Semestar\\ISS\\data\\S_04_ecg.csv"
                reader            = new CSVReader(ecgFile, bufferSize, samplingFrequency);
                reader.DataReady += new EventHandler <Herz.Common.DataReadyEventArgs>(reader_DataReady);

                PanTompkins = new Pipeline <ECGSample>(reader.Frequency);
                PanTompkins.Register(lp);
                PanTompkins.Register(derivative);
                PanTompkins.Register(square);
                PanTompkins.Register(integrator);
                PanTompkins.Register(new Delay(PanTompkins.FilterDelay));

                detector  = new Detector(samplingFrequency, bufferSize);
                estimator = EstimatorFactory.CreateEstimatorFromFile(segmentStartFile, segmentStopFile, samplingFrequency);

                cBoxSegments.DataSource    = estimator.Segments;
                cBoxSegments.DisplayMember = "Index";
                cBoxSegments.ValueMember   = "Index";



                // Plot data with 50 samples per second.
                plotFrequency = reader.Frequency / 50;

                TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
                Task.Factory.StartNew(() => reader.Read());
                Task.Factory.StartNew(() => PlotRaw(uiScheduler));
                //Task.Factory.StartNew(() => PlotProcessed(uiScheduler));
                Task.Factory.StartNew(() => PlotDetectedQRS(uiScheduler));
            }
        }
Пример #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ecgFile) || String.IsNullOrEmpty(segmentStartFile) || String.IsNullOrEmpty(segmentStopFile))
            {
                MessageBox.Show("Load all neccesary files", "Missing files", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //"D:\\Fax\\Diplomski\\3.Semestar\\ISS\\data\\S_04_ecg.csv"
                reader = new CSVReader(ecgFile, bufferSize, samplingFrequency);
                reader.DataReady += new EventHandler<Herz.Common.DataReadyEventArgs>(reader_DataReady);

                PanTompkins = new Pipeline<ECGSample>(reader.Frequency);
                PanTompkins.Register(lp);
                PanTompkins.Register(derivative);
                PanTompkins.Register(square);
                PanTompkins.Register(integrator);
                PanTompkins.Register(new Delay(PanTompkins.FilterDelay));

                detector = new Detector(samplingFrequency, bufferSize);
                estimator = EstimatorFactory.CreateEstimatorFromFile(segmentStartFile, segmentStopFile, samplingFrequency);

                cBoxSegments.DataSource = estimator.Segments;
                cBoxSegments.DisplayMember = "Index";
                cBoxSegments.ValueMember = "Index";

                // Plot data with 50 samples per second.
                plotFrequency = reader.Frequency / 50;

                TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
                Task.Factory.StartNew(() => reader.Read());
                Task.Factory.StartNew(() => PlotRaw(uiScheduler));
                //Task.Factory.StartNew(() => PlotProcessed(uiScheduler));
                Task.Factory.StartNew(() => PlotDetectedQRS(uiScheduler));
            }
        }