예제 #1
0
 public Graph(Size Size, ECGData Data)
 {
     InitializeComponent();
     this.Size = Size;
     this.Panel.Width = this.Width - 4;
     this.Data = Data;
     graph = this.Panel.CreateGraphics();
 }
예제 #2
0
        public Graph(Size Size, ECGData Data, string Name)
        {
            InitializeComponent();
            this.Label.Text = Name;

            this.Size = Size;
            this.Panel.Width = this.Width - 4;
            this.Data = Data;
            graph = this.Panel.CreateGraphics();
        }
예제 #3
0
        public UDPSendingProcess(string patientID, ECGData[] ECGDataArray)
        {
            patientID = "P20120001";
            serverIPString = "";
            readySendMsg = "ReadySend|" + patientID;
            stopSendMsg = "StopSend|" + patientID;

            this.ECGDataArray = ECGDataArray;
            this.patientID = patientID;
            subDataToSend = new ECGData[12];
        }
        public bool FindQRS(ECGData SessionData)
        {
            if (SessionData.Count == 0) return false;

            List<double> Sign_value = new List<double>();
            Sign_value = SessionData.Sign;
            //List<double> Sign_value   = SessionData.Sign;
            int          lenghtOfSign = Sign_value.Count;

            R_location = new List<int>();
            Q_location = new List<int>();
            S_location = new List<int>();

            Sign_value = cancelDC(Sign_value);
            Sign_value = LowPassFilter(Sign_value);
            Sign_value = HightPassFilter(Sign_value);
            Sign_value = derivativeFilter(Sign_value, lenghtOfSign);
            Sign_value = squaringFunction(Sign_value);
            Sign_value = applyFilter(Sign_value, lenghtOfSign);

            bool Detected = findQRSPoints(SessionData.Sign, Sign_value, Q_location, R_location, S_location);
            if  (Detected)
            {
                int cycle = (int)(SessionData.Time[1] - SessionData.Time[0]);

                if (R_location.Count == 1)
                {
                    HR  = (int)(60000 / (SessionData.Time[R_location[0]] - lastR));
                    QR  = (int)(R_location[0] - Q_location[0]) * cycle;
                    RS  = (int)(S_location[0] - R_location[0]) * cycle;
                    QRS = (int)(S_location[0] - Q_location[0]) * cycle;
                    R   = (int)(SessionData.Sign[R_location[0]] * 1000);

                    lastR = SessionData.Time[R_location[0]];

                    //SessionData = new ECGData();
                }
                else
                {
                    HR  = (int)(60000 / ((SessionData.Time[R_location[R_location.Count - 1]] - SessionData.Time[R_location[0]]) / (R_location.Count - 1)));
                    QR  = (int)(R_location[0] - Q_location[0]) * cycle;
                    RS  = (int)(S_location[0] - R_location[0]) * cycle;
                    QRS = (int)(S_location[0] - Q_location[0]) * cycle;
                    R   = (int)(SessionData.Sign[R_location[0]] * 1000);

                    lastR = SessionData.Time[R_location.Count - 1];
                }
            }

            return Detected;
        }
예제 #5
0
 public void Add(ECGData ECGData)
 {
     for (int i = 0; i < ECGData.Count; i++)
     {
         LastSign = ECGData.Sign[i];
         LastTime = ECGData.Time[i];
     }
 }
예제 #6
0
 public ECGData(ECGData Copy)
 {
     this.Sign = new List<float>(Copy.Sign);
     this.Time = new List<long>(Copy.Time);
 }
예제 #7
0
        public ECGData SubData(int StartIndex, int Length)
        {
            ECGData subdata = new ECGData();
            for (int i = StartIndex; (i < StartIndex + Length) && (i < Count); i++)
            {
                subdata.LastSign = Sign[i];
                subdata.LastTime = Time[i];
            }

            return subdata;
        }
 public ECGData(ECGData Copy)
 {
     this.Sign = new List<Double>(Copy.Sign);
     this.Time = new List<Double>(Copy.Time);
 }
 public QRSDetect(ECGData Data)
 {
     this.Data = Data;
 }
 private bool ReadInputFile(ECGData[] Data, string FileName)
 {
     try
     {
         StreamReader InputFile = new StreamReader(FileName);
         return GetDataFromString(Data, InputFile.ReadToEnd());
     }
     catch
     {
         return false;
     }
 }
 // get new Data
 private void InitializeData()
 {
     // ************************************* get new Data
     for (int i = 0; i < 12; i++) Data[i]          = new ECGData();
     for (int i = 0; i < 12; i++) SimulatorData[i] = new ECGData();
 }
        // ======================== read data from file
        private bool GetDataFromString(ECGData[] Data, string input)
        {
            try
            {
              //  input = input.Trim();
                input = input.Replace("\\t", "\t");

                // slit
                string[] source = input.Split('\t');

                // flag
                int i;
                for (i = 0; i < 12; i++) Flag[i] = (source[i].Trim() == "1");

                // data
                int count = source.Count() - 13;
                for (; i + 13 <= count; i += 13)
                {
                    // time. format 0:00.000
                    string temp = source[i].Trim();
                    int minute = int.Parse(temp.Substring(0, temp.IndexOf(":"))); temp = temp.Substring(temp.IndexOf(":") + 1);
                    int second = int.Parse(temp.Substring(0, temp.IndexOf("."))); temp = temp.Substring(temp.IndexOf(".") + 1);
                    //MessageBox.Show("Time = " + minute + " : " + second + " . " + temp);
                    foreach (ECGData data in Data) data.LastTime = (minute * 60 + second) * 1000 + int.Parse(temp);

                    // sign
                    for (int j = 0; j < 12; j++)
                        if (Flag[j]) Data[j].LastSign = double.Parse(source[i + j + 1].Trim());
                }

                return true;
            }
            catch
            {
                MessageBox.Show("record data error");
                return false;
            }
        }
예제 #13
0
 public Graph(ECGData Data)
 {
     InitializeComponent();
     this.Data = Data;
     graph = this.Panel.CreateGraphics();
 }