You are on page 1of 6

4.4.

2018 Darwin Open Data - Toms Wiki

Darwin Open Data


From Toms Wiki

Darwin Open Data provides 3rd party programs like Matlab access to the Darwin2 recording data.

Contents
1 Install/Uninstall
1.1 Install
1.2 Uninstall
2 Use the interface with Matlab
2.1 Create an interface and connect to the database
2.2 Open a recording
2.3 Work with the recording
2.4 Work with a channel list
2.5 Work with the beat channel
2.5.1 Table of beat types
2.6 Work with the ecg channels
3 Documentation
3.1 DarwinDatabase functions
3.2 DarwinRecording functions
3.3 DarwinChannelList functions
3.4 DarwinBeatChannel functions
3.5 DarwinECGChannel functions

Install/Uninstall
If you wish to install or uninstall Darwin Open Data, follow the instructions below.

Install

Unpack the Darwin Open Data.zip archive to your DARWIN2 folder. (C:\ProgramFiles\Darwin2 by
default)

Run the Install.bat file. Administrator permissions are required.

Uninstall

To uninstall, run the Uninstall.bat file. Administrator permissions are required.

Use the interface with Matlab


In the following sections, the use of the Interface is explained. For a documentation of all functions, proceed to
Documentation.

Create an interface and connect to the database


http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 1/6
4.4.2018 Darwin Open Data - Toms Wiki

To connect to the Darwin database in Matlab, type the following lines of code.

(Lines starting with "%" are comments, you don't need to enter them)

% Create interface to Darwin database


server = actxserver('DarwinOpenData.DarwinDataBase')

% and connect the interface to the darwin database


server.ConnectToDataBase('')

To check if the interface is connected and which functions it provides, you can call the Help function. Note that
the Help function is available for all interfaces you can create by using this package.

% print functions of DarwinDataBase interface and check,


% if it is connected to a database
server.Help

Open a recording
As soon as the interface is connected to a database, you can call further functions. ListRecordings prints a list of
all recordings that are marked as uploaded, analyzed, released or reviewed.

Each entry of the list consists of a GUID (necessary to open a recording) the state of the recording and the
patient’s first and surname.

Below you can see a call of the function and the function output.

% print out recordings in database


server.ListRecordings

ans =

'GUID: {92C9C99B-9789-486B-A252-D0B26CC8942C}; State: Analyzed'


'Surname: Patient; First Name: Example'
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'

With the GUID, it is possible to create an interface to a recording. All you need to do is to call the
OpenRecording function from the DarwinDataBase interface (In the example code variable server) with the
GUID of the recording you wish to open as a parameter.

% open Example Patient


rec = server.OpenRecording('{92C9C99B-9789-486B-A252-D0B26CC8942C}')

The newly created variable rec is now an interface to a Darwin recording.

Work with the recording


To simply get the length of a recording, you can call GetRecLength. It returns the length of the recording in
seconds.

To get data from the beat and ECG channels, use the function GetChannelList. The return value of this function
is an interface to a channel list. Again, a code sample below shows the use of these functions.

% get the record length in seconds


rec.GetRecLength

ans =

http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 2/6
4.4.2018 Darwin Open Data - Toms Wiki

6.5289e+004

% create a channel list


chanlist = rec.GetChannelList

Work with a channel list


With an interface to a channel list you can display all available channels.

With the functions GetBeatChannel or GetECGChannel you can create interfaces to a channel directly to acess
data stored there. GetECGChannel needs the channel number to be passed as a parameter.

% display available channels


chanlist.ListChannels

ans =

'ECG Channel 1'


'ECG Channel 2'
'ECG Channel 3'
'Beat Channel'

% create an interface to ecg channel 1


ecgchan = chanlist.GetECGChannel(1)

ans =

Interface.DarwinOpenData.IDarwinECGChannel

% create an interface to the beat channel


beatchan = chanlist.GetBeatChannel

ans =

Interface.DarwinOpenData.IDarwinBeatChannel

Work with the beat channel


The Beat Channel has stored all the beats of a recording. By using BeatCount you can get the total number of
beats stored.

% get number of beats


beatchan.BeatCount

ans =

55204

To get the time of a beat, call EventTime. The function needs the beat index as a parameter.

% get eventtime of beat number 100


beatchan.EventTime(100)

ans =

115.2568

http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 3/6
4.4.2018 Darwin Open Data - Toms Wiki

To get either the original or the user specified type of a beat at a specified index, call GetBeatType or
GetUserBeatType. These two functions additionally return the template number of the chosen beat. Both
functions need the index as a parameter. The first result value is the beat type, the second is the template
number.

% get original beat type (2 in this example)


% and then user specified beat type (also 2)
% the second return value (1) is the template number
beatchan.GetBeatType(100)

ans =

2 1

beatchan.GetUserBeatType(100)

ans =

2 1

As seen above, the beat types are returned as integer values. The table below describes how the returned values
correspond to the beat types from Darwin.

Table of beat types

Name Type
2 Normal
3 Ventricular
4 Atrial Paced
5 Ventricular Paced
6 Dual Chamber Paced
7 Bundle branch Block
8 Junctional
9 Fusion
10 Artefact
11 Paced
12 Breaking Artefact

Work with the ecg channels


To gain access to ecg data, the functions ReadDataInt, ReadDataIntTime, ReadConvBlock and
ReadConvBlockTime are provided. The ReadDataInt and ReadDataIntTime functions return arrays of integer
values, while the ReadConvBlock and ReadConvBlockTime functions return arrays of decimal values.

The ReadConvBlock and the ReadDataInt functions are called with the index of the first sample value to be
returned and the number of sample values to be read from the ecg channel, while the ReadConvBlockTime and
the ReadDataIntTime functions are called with the time relative to the recordings beginning and a duration
(both in seconds) to define a period, for which ecg sample values are returned.

To watch the ecg, you can directly call the plot function, like shown below.

http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 4/6
4.4.2018 Darwin Open Data - Toms Wiki

% plot the ecg from second 100 for the next 100 seconds
plot(ecgchan.ReadConvBlockTime(100, 100))

%plot the ecg from the time of beat 100 for the next 10 seconds
Plot(ecgchan.ReadConvBlockTime(beatchan.EventTime(100), 10))

Additionally, there are simple functions to access basic properties of an ecg channel: Call SampleRate,
SampleCount, Baseline or Gain to get these values returned.

Documentation
In the following section you can see a full documentation of all functions. To get help for an interface while
running Matlab, you can always call the Help functions.

DarwinDatabase functions
ConnectToDataBase(''): Connects to the darwin database
ListRecordings: lists all recording GUIDs of recording that cn be opened (uploaded, analyzed, released
and reviewed)
OpenRecording(RecordingGUID): returns an interface to a Darwin Recording. Returns null is Guid
was not valid.
Help: lists all functions in DarwinDataBase Interface and if the Interface is connected to a database

DarwinRecording functions
GetChannelList: returns interface to the recording's channel list
GetRecLength: returns length of the recording in seconds
Help: lists all functions in DarwinDataBase Interface

DarwinChannelList functions
ListChannels: returns list of all existing Channels (ECG or Beat Channels)

GetECGChanCount: returns number of ecg channels

GetECGChannel(Integer index): returns interface to ecg channel with specified index. Indices of
channels are from 1 up to number of ecg channels

GetBeatChannel: returns interface to beat channel of recording

Help: lists all functions in DarwinChannelList Interface

DarwinBeatChannel functions
Note: for a table of beat types go to Table of beat types.

GetBeatType(Integer index): returns beat type of beat with specified index. Additionally returns beat
template number.

GetUserBeatType(Integer index): returns user beat type of beat with specified index. Additionally
returns beat template number.

EventTime(Integer index): returns time, when beat with a specified index occured.

http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 5/6
4.4.2018 Darwin Open Data - Toms Wiki

BeatCount: returns number of beats.

BeatArray: returns three arrays with data for all beats in the beat channel. First returned array has stored
event times. Second returned array has stored beat types. Third returned array has stored template
numbers.

BeatArrayByIndex(Integer Index, Number): returns three arrays with data for a specified number of
beats beginning at a specified beat index. First returned array has stored event times. Second returned
array has stored beat types. Third returned array has stored template numbers.

Help: lists all functions in DarwinBeatChannel Interface.

DarwinECGChannel functions
ReadDataInt(Integer StartSamp, NumSamps): returns Numsamp integer ecg values beginning at
index StartSamp

ReadDataIntTime(Double StartTime, Length): returns all integer ecg values recorded within the time
span from start time to StartTime + Length

ReadConvBlock(Integer StartSamp, NumSamps): returns NumSamps double ecg values beginning at


index StartSamp

ReadConvBlockTime(Double StartTime, Length): returns all double ecg values recorded within the
time span from StartTime to StartTime + Length

Sample Rate: returns the sample rate of an ecg channel.

SampleCount: returns the count of ecg samples in an ecg channel.

Baseline: returns the baseline value for an ecg channel.

Gain: returns the gain value for an ecg channel:

Help: lists all functions in DarwinECGChannel Interface:

Retrieved from "http://schillermedilog.com/wiki/index.php?title=Darwin_Open_Data&oldid=3621"

This page was last modified 11:43, 6 August 2013.

http://schillermedilog.com/wiki/index.php/Darwin_Open_Data 6/6

You might also like