Click here to Skip to main content
15,867,594 members
Articles / Programming Languages / C#
Article

Storing ECG to a PACS

Rate me:
Please Sign up or sign in to vote.
4.80/5 (10 votes)
16 Oct 2008Apache1 min read 106.7K   7.2K   48   18
An article on a service that will store an ECG copied to a directory at a PACS. (supported formats SCP-ECG, DICOM-ECG and a recent version of HL7 aECG)

Introduction

The application in this article will allow easy storing of electrocariographs (ECGs) to a DICOM PACS.

Background

Many ECG Cart manufacturers have got their own closed format. For Medical Images, the DICOM standard has provided hospitals with manufacturer independent solutions. Some manufacturers recently started adopting DICOM for ECG systems.

In 2008, an ECG Toolkit has been released which provides support for 3 major open ECG formats: SCP-ECG, HL7 aECG and DICOM-ECG. The Toolkit is available here.

Besides providing an ECG Library, the ECG Toolkit also has got some handy applications including a basic ECG viewer:

ECG Viewer provided by the C# ECG Toolkit

Using the Application

The application can be used as a Service or as a command line application.

To use the application as a service, use installutil to register the service. Start application manually from the management console.

To use the application from the command line, use:

> ECGtoPACS.exe runcmd

To configure the application, change the values specified in ECGtoPACS.exe.config:

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<appSettings>
		<add key="ImportDir" value="C:\ecg2pacs" />
		<add key="EraseOnSuccess" value="true" />
		<!-- configuration items for the DICOM-ECG format -->
		<add key="Mortara Compatibility" value="true" />
		<!-- configuration items for the DICOM PACS -->
		<add key="Server" value="127.0.0.1" />
		<add key="AESCU" value="ANYSCU" />
		<add key="AESCP" value="STORESCP" />
		<add key="Port" value="104" />
	</appSettings>
</configuration>

Place a SCP-ECG, HL7 aECG or DICOM-ECG file into the ImportDir. Example ECG files can be found here.

Using the Code

Reading an ECG of unknown type can be done by:

C#
UnknownReader reader = new UnknownReader();
IECGFormat src = reader.Read(sFilePath);

if (reader.getError() != 0)
{
	ServiceLogger.Instance.Log("Reading ECG error: " + 
		reader.getErrorMessage() + "!", EventLogEntryType.FailureAudit);
	return;
}

if ((src == null)
||  !src.Works())
{
	ServiceLogger.Instance.Log("Unknown error during reading of ECG!", 
				EventLogEntryType.FailureAudit);
	return;
}

Sending ECG to PACs is performed by:

C#
IECGManagementSystem pacs = ECGConverter.Instance.getECGManagementSystem("PACS");

pacs.Config.Set(_SystemConfig); // set configuration of PACS

// save ECG to PACS providing an PatientID (null) and DICOM format configuration.
if (pacs.SaveECG(src, null, _FormatConfig) != 0) 
{
	ServiceLogger.Instance.Log("Storing ECG to PACS failed!", 
				EventLogEntryType.FailureAudit);
	return;
}

Points of Interest

Retrieving of ECG information can be achieved by using five properties provided by IECGFormat interface. The five properties are:

  • Demographics
  • Signals
  • Diagnostics
  • GlobalMeasurements
  • LeadMeasurements

History

  • 13th October, 2008: First version of ECGtoPACS

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Software Developer Erasmus MC
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 3 Pin
HammadTariq23-Sep-13 0:33
HammadTariq23-Sep-13 0:33 
GeneralRe: My vote of 3 Pin
MJB van Ettinger23-Sep-13 1:34
MJB van Ettinger23-Sep-13 1:34 
GeneralRe: My vote of 3 Pin
HammadTariq21-Jan-14 2:49
HammadTariq21-Jan-14 2:49 
Questionsave dicom files to pc without pacs Pin
VincentZh11-Apr-13 20:54
VincentZh11-Apr-13 20:54 
AnswerRe: save dicom files to pc without pacs Pin
MJB van Ettinger3-Jun-13 1:18
MJB van Ettinger3-Jun-13 1:18 
Questionsupport for Mortara XML files? Pin
alwittta29-Feb-12 23:09
alwittta29-Feb-12 23:09 
AnswerRe: support for Mortara XML files? Pin
MJB van Ettinger3-Jun-13 1:23
MJB van Ettinger3-Jun-13 1:23 
QuestionUnable to open the sample .xml file. Pin
vib_mun@indiatimes.com23-Jan-11 1:42
vib_mun@indiatimes.com23-Jan-11 1:42 
AnswerRe: Unable to open the sample .xml file. Pin
vib_mun@indiatimes.com31-Jul-11 18:54
vib_mun@indiatimes.com31-Jul-11 18:54 
Generalnice Pin
Bayram Üçüncü20-Dec-09 4:59
Bayram Üçüncü20-Dec-09 4:59 
GeneralWrong storing ECG to PACS Pin
Member 19947322-Jan-09 1:02
Member 19947322-Jan-09 1:02 
GeneralRe: Wrong storing ECG to PACS [modified] Pin
MJB van Ettinger22-Jan-09 1:58
MJB van Ettinger22-Jan-09 1:58 
Off course the Server and port should be configured right, but you should also take a look at the following issues.

1 The AESCU and AESCP should be correct, because an PACS might reject your request based on these values.

2. The PACS should also be configured to accept the SOP Class UIDs:
to be safe allow these four on the PACS:
WaveformStorageTrialRetired
HemodynamicWaveformStorage
TwelveLeadECGWaveformStorage
GeneralECGWaveformStorage

3. The DICOM TransferSyntaxUID used should be supported by the PACS:
a. If Mortara Compatibility = true then ImplicitVRLittleEndian is used.
b. If Mortara Compatibility = false then ExplicitVRLittleEndian is used.

Hope this will help you solve the issues.

modified on Friday, January 30, 2009 5:19 AM

GeneralHOW TO CONNECT ECG TO PC? Pin
cuthkid24-Jun-09 19:55
cuthkid24-Jun-09 19:55 
AnswerRe: HOW TO CONNECT ECG TO PC? Pin
MJB van Ettinger24-Jun-09 21:07
MJB van Ettinger24-Jun-09 21:07 
GeneralRe: HOW TO CONNECT ECG TO PC? Pin
cuthkid24-Jun-09 22:34
cuthkid24-Jun-09 22:34 
GeneralGood Pin
Uroš Šmon19-Oct-08 22:30
professionalUroš Šmon19-Oct-08 22:30 
GeneralNice.. Pin
hughd16-Oct-08 5:51
hughd16-Oct-08 5:51 
GeneralRe: Nice.. Pin
MJB van Ettinger16-Oct-08 21:14
MJB van Ettinger16-Oct-08 21:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.