EKG_Project.IO.XMLConverter.getSignals C# (CSharp) Method

getSignals() public method

public getSignals ( ) : Vector>>.List
return Vector>>.List
        public List<Tuple<string, Vector<double>>> getSignals()
        {
            List<Tuple<string, Vector<double>>> Signals = new List<Tuple<string, Vector<double>>>();

            foreach (XmlNode sequence in sequences)
            {
                XmlNode code = sequence["code"];
                string readCode = null;

                if (code.Attributes["codeSystemName"].Value == "MDC")
                {
                    readCode = code.Attributes["code"].Value;
                    readCode = readCode.Replace("MDC_ECG_LEAD_", ""); //usunięcie z nazwy odprowadzenia dodatkowego kodu standardu HL7 aECG
                }

                XmlNode value = sequence["value"];
                Vector<double> readDigits = null;

                if (value.Attributes["xsi:type"].Value == "SLIST_PQ")
                {
                    string digits = value["digits"].InnerText;
                    readDigits = stringToVector(digits);
                    readDigits = normalizeSignal(readDigits);
                    getSampleAmount(readDigits);
                }

                if (readCode != null && readDigits != null)
                {
                    Tuple<string, Vector<double>> readSignal = Tuple.Create(readCode, readDigits);
                    Signals.Add(readSignal);
                }
            }
            return Signals;
        }

Usage Example

Example #1
0
        public static void Main()
        {
            IECGPath pathBuilder = new DebugECGPath();
            XMLConverter xml = new XMLConverter("TestAnalysis");
            xml.ConvertFile(System.IO.Path.Combine(pathBuilder.getDataPath(), "6.xml"));
            xml.SaveResult();

            //xml.loadXMLFile(@"C:\temp\6.xml");

            uint f = xml.getFrequency();
            Console.WriteLine("Frequency: " + f + " Hz");

            uint samples = xml.sampleAmount;
            Console.WriteLine("Sample amount: " + samples.ToString());
            Console.WriteLine();

            List<Tuple<string, Vector<double>>> signals = xml.getSignals();
            foreach (var tuple in signals)
            {
                Console.WriteLine("Lead name: " + tuple.Item1);
                Console.WriteLine("Signal Vector in uV: " + tuple.Item2);
                Console.WriteLine();

            }

            Console.Read();
        }