Exemplo n.º 1
0
        public void Save(ECG_Data data)
        {
            if (data is Heart_Axis_Data)
            {
                Heart_Axis_Data basicData = data as Heart_Axis_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                double HeartAxis = basicData.HeartAxis;
                XmlElement heartAxis = file.CreateElement(string.Empty, "HeartAxis", string.Empty);
                XmlText heartAxisValue = file.CreateTextNode(HeartAxis.ToString());
                heartAxis.AppendChild(heartAxisValue);
                module.AppendChild(heartAxis);

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
        public void Save(ECG_Data data)
        {
            if (data is Sleep_Apnea_Data)
            {
                Sleep_Apnea_Data basicData = data as Sleep_Apnea_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<string, List<Tuple<int, int>>>> list = basicData.Detected_Apnea;
                foreach (var tuple in list)
                {
                    XmlElement moduleNode = file.CreateElement(string.Empty, "Detected_Apnea", string.Empty);
                    module.AppendChild(moduleNode);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    moduleNode.AppendChild(lead);

                    List<Tuple<int, int>> internalList = tuple.Item2;
                    XmlElement internalListNode = file.CreateElement(string.Empty, "tupleList", string.Empty);
                    moduleNode.AppendChild(internalListNode);

                    foreach (var internalTuple in internalList)
                    {
                        XmlElement tupleNode = file.CreateElement(string.Empty, "tuple", string.Empty);
                        internalListNode.AppendChild(tupleNode);

                        XmlElement item1 = file.CreateElement(string.Empty, "item1", string.Empty);
                        XmlText item1Value = file.CreateTextNode(internalTuple.Item1.ToString());
                        item1.AppendChild(item1Value);
                        tupleNode.AppendChild(item1);

                        XmlElement item2 = file.CreateElement(string.Empty, "item2", string.Empty);
                        XmlText item2Value = file.CreateTextNode(internalTuple.Item2.ToString());
                        item2.AppendChild(item2Value);
                        tupleNode.AppendChild(item2);
                    }

                }

                List<Tuple<string, List<List<double>>>> list1 = basicData.h_amp;
                foreach (var tuple in list1)
                {
                    XmlElement moduleNode = file.CreateElement(string.Empty, "h_amp", string.Empty);
                    module.AppendChild(moduleNode);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    moduleNode.AppendChild(lead);

                    List<List<double>> internalList = tuple.Item2;
                    XmlElement internalListNode = file.CreateElement(string.Empty, "samplesList", string.Empty);
                    moduleNode.AppendChild(internalListNode);

                    foreach (var secondInternalList in internalList)
                    {
                        XmlElement samples = file.CreateElement(string.Empty, "samples", string.Empty);
                        string samplesText = null;
                        foreach (var value in secondInternalList)
                        {
                            samplesText += value.ToString() + " ";
                        }
                        XmlText samplesValue = file.CreateTextNode(samplesText);
                        samples.AppendChild(samplesValue);
                        internalListNode.AppendChild(samples);

                    }
                }

                List<Tuple<string, double>> list2 = basicData.il_Apnea;
                foreach (var tuple in list2)
                {
                    XmlElement moduleNode = file.CreateElement(string.Empty, "il_Apnea", string.Empty);
                    module.AppendChild(moduleNode);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    moduleNode.AppendChild(lead);

                    XmlElement item2 = file.CreateElement(string.Empty, "item2", string.Empty);
                    XmlText item2Value = file.CreateTextNode(tuple.Item2.ToString());
                    item2.AppendChild(item2Value);
                    moduleNode.AppendChild(item2);
                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
Exemplo n.º 3
0
        public void Save(ECG_Data data)
        {
            if (data is Flutter_Data)
            {
                Flutter_Data basicData = data as Flutter_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<int, int>> flutterAnnotations = basicData.FlutterAnnotations;
                foreach (var tuple in flutterAnnotations)
                {
                    XmlElement FlutterAnnotations = file.CreateElement(string.Empty, "FlutterAnnotations", string.Empty);
                    module.AppendChild(FlutterAnnotations);

                    XmlElement onset = file.CreateElement(string.Empty, "onset", string.Empty);
                    XmlText onsetValue = file.CreateTextNode(tuple.Item1.ToString());
                    onset.AppendChild(onsetValue);
                    FlutterAnnotations.AppendChild(onset);

                    XmlElement end = file.CreateElement(string.Empty, "end", string.Empty);
                    XmlText endValue = file.CreateTextNode(tuple.Item2.ToString());
                    end.AppendChild(endValue);
                    FlutterAnnotations.AppendChild(end);
                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
Exemplo n.º 4
0
        public void Save(ECG_Data data)
        {
            if (data is R_Peaks_Data)
            {
                R_Peaks_Data basicData = data as R_Peaks_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<string, Vector<double>>> rPeaks = basicData.RPeaks;
                foreach (var tuple in rPeaks)
                {
                    XmlElement RPeaks = file.CreateElement(string.Empty, "RPeaks", string.Empty);
                    module.AppendChild(RPeaks);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    RPeaks.AppendChild(lead);

                    XmlElement indices = file.CreateElement(string.Empty, "indices", string.Empty);
                    string indicesText = null;
                    foreach (var value in tuple.Item2)
                    {
                        indicesText += value.ToString() + " ";
                    }

                    XmlText indicesValue = file.CreateTextNode(indicesText);
                    indices.AppendChild(indicesValue);
                    RPeaks.AppendChild(indices);
                }

                List<Tuple<string, Vector<double>>> rrIntervals = basicData.RRInterval;
                foreach (var tuple in rrIntervals)
                {
                    XmlElement RRInterval = file.CreateElement(string.Empty, "RRInterval", string.Empty);
                    module.AppendChild(RRInterval);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    RRInterval.AppendChild(lead);

                    XmlElement intervals = file.CreateElement(string.Empty, "intervals", string.Empty);
                    string intervalsText = null;
                    foreach (var value in tuple.Item2)
                    {
                        intervalsText += value.ToString() + " ";
                    }

                    XmlText intervalsValue = file.CreateTextNode(intervalsText);
                    intervals.AppendChild(intervalsValue);
                    RRInterval.AppendChild(intervals);
                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
        public void Save(ECG_Data data)
        {
            if (data is ECG_Baseline_Data)
            {
                ECG_Baseline_Data basicData = data as ECG_Baseline_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<string, Vector<double>>> signalsFiltered = basicData.SignalsFiltered;
                foreach (var tuple in signalsFiltered)
                {
                    XmlElement signalFiltered = file.CreateElement(string.Empty, "signalFiltered", string.Empty);
                    module.AppendChild(signalFiltered);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1);
                    lead.AppendChild(leadValue);
                    signalFiltered.AppendChild(lead);

                    XmlElement samples = file.CreateElement(string.Empty, "samples", string.Empty);
                    string samplesText = null;
                    foreach (var value in tuple.Item2)
                    {
                        samplesText += value.ToString() + " ";
                    }

                    XmlText samplesValue = file.CreateTextNode(samplesText);
                    samples.AppendChild(samplesValue);
                    signalFiltered.AppendChild(samples);
                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
Exemplo n.º 6
0
        public void Save(ECG_Data data)
        {
            if (data is HRV_DFA_Data)
            {
                HRV_DFA_Data basicData = data as HRV_DFA_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                object[] Properties = { basicData.DfaNumberN, basicData.DfaValueFn, basicData.ParamAlpha};
                string[] Names = { "DfaNumberN", "DfaValueFn", "ParamAlpha"};
                int licznik = 0;

                foreach (var property in Properties)
                {
                    List<Tuple<string, Vector<double>>> list = (List<Tuple<string, Vector<double>>>)property;
                    foreach (var tuple in list)
                    {
                        XmlElement moduleNode = file.CreateElement(string.Empty, Names[licznik], string.Empty);
                        module.AppendChild(moduleNode);

                        XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                        XmlText leadValue = file.CreateTextNode(tuple.Item1);
                        lead.AppendChild(leadValue);
                        moduleNode.AppendChild(lead);

                        XmlElement samples = file.CreateElement(string.Empty, "samples", string.Empty);
                        string samplesText = null;
                        foreach (var value in tuple.Item2)
                        {
                            samplesText += value.ToString() + " ";
                        }

                        XmlText samplesValue = file.CreateTextNode(samplesText);
                        samples.AppendChild(samplesValue);
                        moduleNode.AppendChild(samples);
                    }

                    licznik++;
                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
        public void Save(ECG_Data data)
        {
            if (data is Heart_Class_Data)
            {
                Heart_Class_Data basicData = data as Heart_Class_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<int, int>> list = basicData.ClassificationResult;
                foreach (var tuple in list)
                {
                    XmlElement moduleNode = file.CreateElement(string.Empty, "ClassificationResult", string.Empty);
                    module.AppendChild(moduleNode);

                    XmlElement item1 = file.CreateElement(string.Empty, "item1", string.Empty);
                    XmlText item1Value = file.CreateTextNode(tuple.Item1.ToString());
                    item1.AppendChild(item1Value);
                    moduleNode.AppendChild(item1);

                    XmlElement item2 = file.CreateElement(string.Empty, "item2", string.Empty);
                    XmlText item2Value = file.CreateTextNode(tuple.Item2.ToString());
                    item2.AppendChild(item2Value);
                    moduleNode.AppendChild(item2);
                }

                bool ChannelMliiDetected = basicData.ChannelMliiDetected;
                XmlElement channelMliiDetected = file.CreateElement(string.Empty, "ChannelMliiDetected", string.Empty);
                XmlText channelMliiDetectedValue = file.CreateTextNode(ChannelMliiDetected.ToString());
                channelMliiDetected.AppendChild(channelMliiDetectedValue);
                module.AppendChild(channelMliiDetected);

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
        public void Save(ECG_Data data)
        {
            if (data is Atrial_Fibr_Data)
            {
                Atrial_Fibr_Data basicData = data as Atrial_Fibr_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                List<Tuple<bool, int[], string, string>> afDetection = basicData.AfDetection;
                foreach (var tuple in afDetection)
                {
                    XmlElement detectedAF = file.CreateElement(string.Empty, "detectedAF", string.Empty);
                    module.AppendChild(detectedAF);

                    XmlElement detected = file.CreateElement(string.Empty, "detected", string.Empty);
                    XmlText detectedValue = file.CreateTextNode(tuple.Item1.ToString());
                    detected.AppendChild(detectedValue);
                    detectedAF.AppendChild(detected);

                    XmlElement detectedPoints = file.CreateElement(string.Empty, "detectedPoints", string.Empty);
                    string detectedPointsText = null;
                    foreach (var value in tuple.Item2)
                    {
                        detectedPointsText += value.ToString() + " ";
                    }

                    XmlText detectedPointsValue = file.CreateTextNode(detectedPointsText);
                    detectedPoints.AppendChild(detectedPointsValue);
                    detectedAF.AppendChild(detectedPoints);

                    XmlElement detectedS = file.CreateElement(string.Empty, "detectedS", string.Empty);
                    XmlText detectedSValue = file.CreateTextNode(tuple.Item3);
                    detectedS.AppendChild(detectedSValue);
                    detectedAF.AppendChild(detectedS);

                    XmlElement timeofAF = file.CreateElement(string.Empty, "timeofAF", string.Empty);
                    XmlText timeofAFValue = file.CreateTextNode(tuple.Item4);
                    timeofAF.AppendChild(timeofAFValue);
                    detectedAF.AppendChild(timeofAF);

                }

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
Exemplo n.º 9
0
        public void Save(ECG_Data data)
        {
            if (data is Basic_Data)
            {
                Basic_Data basicData = data as Basic_Data;

                ECG_Worker ew = new ECG_Worker();
                ew.CreateFile();
                XmlDocument file = ew.InternalXMLFile;
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");
                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                XmlElement frequency = file.CreateElement(string.Empty, "frequency", string.Empty);
                XmlText frequencyValue = file.CreateTextNode(basicData.Frequency.ToString());
                frequency.AppendChild(frequencyValue);
                module.AppendChild(frequency);

                XmlElement sampleAmount = file.CreateElement(string.Empty, "sampleAmount", string.Empty);
                XmlText sampleAmountValue = file.CreateTextNode(basicData.SampleAmount.ToString());
                sampleAmount.AppendChild(sampleAmountValue);
                module.AppendChild(sampleAmount);

                List<Tuple<string, Vector<double>>> signals = basicData.Signals;
                foreach (var tuple in signals)
                {
                    XmlElement signal = file.CreateElement(string.Empty, "signal", string.Empty);
                    module.AppendChild(signal);

                    XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                    XmlText leadValue = file.CreateTextNode(tuple.Item1.ToString());
                    lead.AppendChild(leadValue);
                    signal.AppendChild(lead);

                    XmlElement samples = file.CreateElement(string.Empty, "samples", string.Empty);
                    string samplesText = null;
                    foreach (var value in tuple.Item2)
                    {
                        samplesText += value.ToString() + " ";
                    }

                    XmlText samplesValue = file.CreateTextNode(samplesText);
                    samples.AppendChild(samplesValue);
                    signal.AppendChild(samples);

                }

                ew.InternalXMLFile = file;

                string fileName = analysisName + "_Data.xml";
                //Console.WriteLine(System.IO.Path.Combine(directory, fileName));
                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }
Exemplo n.º 10
0
        public void Save(ECG_Data data)
        {
            if (data is QT_Disp_Data)
            {
                QT_Disp_Data basicData = data as QT_Disp_Data;

                ECG_Worker ew = new ECG_Worker();
                XmlDocument file = new XmlDocument();
                string fileName = analysisName + "_Data.xml";
                file.Load(System.IO.Path.Combine(directory, fileName));
                XmlNode root = file.SelectSingleNode("EKG");

                XmlElement module = file.CreateElement(string.Empty, "module", string.Empty);
                string moduleName = this.GetType().Name;
                moduleName = moduleName.Replace("_Data_Worker", "");

                XmlNodeList existingModules = file.SelectNodes("EKG/module");
                foreach (XmlNode existingModule in existingModules)
                {
                    if (existingModule.Attributes["name"].Value == moduleName)
                    {
                        root.RemoveChild(existingModule);
                    }
                }

                module.SetAttribute("name", moduleName);
                root.AppendChild(module);

                object[] Properties = {basicData.QT_disp_local, basicData.QT_mean, basicData.QT_std};
                string[] Names = { "QT_disp_local", "QT_mean", "QT_std" };
                int licznik = 0;

                foreach (var property in Properties)
                {
                    List<Tuple<String, double>> list = (List<Tuple<String, double>>)property;
                    foreach (var tuple in list)
                    {
                        XmlElement moduleNode = file.CreateElement(string.Empty, Names[licznik], string.Empty);
                        module.AppendChild(moduleNode);

                        XmlElement lead = file.CreateElement(string.Empty, "lead", string.Empty);
                        XmlText leadValue = file.CreateTextNode(tuple.Item1);
                        lead.AppendChild(leadValue);
                        moduleNode.AppendChild(lead);

                        XmlElement samples = file.CreateElement(string.Empty, "samples", string.Empty);
                        XmlText samplesValue = file.CreateTextNode(tuple.Item2.ToString());
                        samples.AppendChild(samplesValue);
                        moduleNode.AppendChild(samples);
                    }

                    licznik++;
                }

                XmlElement QT_disp_global = file.CreateElement(string.Empty, "QT_disp_global", string.Empty);
                XmlText value = file.CreateTextNode(basicData.QT_disp_global.ToString());
                QT_disp_global.AppendChild(value);
                module.AppendChild(QT_disp_global);

                ew.InternalXMLFile = file;

                file.Save(System.IO.Path.Combine(directory, fileName));

            }
        }