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

getFrequency() public method

public getFrequency ( ) : uint
return uint
        public uint getFrequency()
        {
            uint frequency = 0;
            foreach (XmlNode sequence in sequences)
            {
                XmlNode value = sequence["value"];
                if (value.Attributes["xsi:type"].Value == "GLIST_PQ")
                {
                    XmlNode increment = value["increment"];

                    string incrementValue = increment.Attributes["value"].Value;
                    double readIncrement = Convert.ToDouble(incrementValue, new System.Globalization.NumberFormatInfo());
                    frequency = (uint) (1 / readIncrement); //Hz

                    string incrementUnit = increment.Attributes["unit"].Value; //s
                }
            }
            return frequency;
        }

Usage Example

Beispiel #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();
        }