Skip to content

Using SierraEcgSharp

Christopher edited this page Aug 16, 2014 · 1 revision

How to use the .Net Framework Library

Introduction

Using the Sierra Ecg C# Library requires little effort on the part of the programmer. Currently two main strategies for working with Sierra ECG XML files are provided:

  • Preprocessing the file to remove XLI compression
  • Extracting the data for each of the leads stored

Preprocessing Sierra ECG XML Files

You can preprocess a Sierra ECG XML file to remove XLI compression in three ways:

  • Preprocess a Stream of XML into a resulting XDocument

    var xdoc = SierraEcgFile.Preprocess(File.Open("input.xml"), disableVersionCheck: false);
  • Preprocess an XDocument of the XML

    var xdoc = XDocument.Load("input.xml"); // or XDocument.Parse(...)
    xdoc = SierraEcgFile.Preprocess(xdoc, disableVersionCheck: false);
  • Preprocess an XElement representing the <restingecgdata> element

    var xelt = ...; // XDocument.Load(...).Root
    xelt = SierraEcgFile.Preprocess(xelt, disableVersionCheck: false);

Extracting Lead Data

You can extract the lead data from any valid Sierra ECG XML stored in an XDocument:

var xdoc = XDocument.Load("input.xml");

var leads = SierraEcgFile.ExtractLeads(xdoc);
foreach (var lead in leads)
{
   Console.WriteLine("{0} ({1} samples)", lead.Name, lead.Count);
   // use lead like:
   // foreach (var sample in lead) { ...
}