TUM-Logo

libRASCH

 

Home
 

General

About libRASCH/News
Design
Screen shots
Sample programs (with source code)
License
 

Download

libRASCH
Tools
 

Documentation

User
Developer
 

Resources

Mailing list
Supported Formats
Plugins
Status
Links
 
Contact
About this site
 
Last updated
Tue Mar 27 23:03:50 2007
Access evaluation

A.5. Access evaluation

A.5.1. C Version

//
#include <stdio.h>
#include <ra.h>

int main(int argc, char *argv[])
{
    ra_handle ra;
    value_handle vh;
    meas_handle meas;
    eval_handle eval;
    long l, num;

    /* initialize libRASCH */
    ra = ra_lib_init();
    if (ra == NULL)
    {
        printf("error initializing libRASCH\n");
        return -1;
    }

    /* open measurement */
    meas = ra_meas_open(ra, argv[1], 0);
    if (meas == NULL)
    {
        printf("can't open measurement %s\n", argv[1]);
        return -1;
    }

    /* get default evaluation */
    eval = ra_eval_get_def(meas);
    if (eval == NULL)
    {
        printf("no evaluation in measurement %s\n", argv[1]);
        return -1;
    }

    /* get some infos about evaluation */
    vh = ra_value_malloc();
    if (ra_info_get(eval, RA_INFO_EVAL_NAME_C, vh) == 0)
        printf("evaluation %s ", ra_value_get_string(vh));
    if (ra_info_get(eval, RA_INFO_EVAL_ADD_TS_C, vh) == 0)
        printf("was added at %s ", ra_value_get_string(vh));
    if (ra_info_get(eval, RA_INFO_EVAL_PROG_C, vh) == 0)
        printf("using the program %s", ra_value_get_string(vh));
    printf("\n\n");

    /* list event-properties */
    num = 0;
    if (ra_info_get(eval, RA_INFO_EVAL_PROP_NUM_L, vh) == 0)
        num = ra_value_get_long(vh);
    for (l = 0; l < num; l++)
    {
        prop_handle evprop;
        evset_handle evset;

        evprop = ra_prop_get_by_num(eval, l);
        evset = ra_evset_get_by_prop(evprop);

        if ((evprop == NULL) || (evset == NULL))
            continue;

        if (ra_info_get(evprop, RA_INFO_EVPROP_NAME_C, vh) == 0)
            printf("event-property %s ",
                   ra_value_get_string(vh));
        if (ra_info_get(evprop, RA_INFO_EVPROP_NAME_C, vh) == 0)
            printf("(%s) ", ra_value_get_string(vh));
        if (ra_info_get(evset, RA_INFO_EVSET_NAME_C, vh) == 0)
            printf("belongs to event-set %s ",
                   ra_value_get_string(vh));
        if (ra_info_get(evset, RA_INFO_EVSET_EV_NUM_L, vh) == 0)
            printf("and contains %d events",
                   ra_value_get_long(vh));
        printf("\n");
    }

    /* close */
    ra_value_free(vh);
    ra_meas_close(meas);
    ra_lib_close(ra);

    return 0;
}                               /* main() */

//

evaluation original was added at 27.05.2005  09:28:53 using
the program handle_eval

event-property qrs-pos (qrs-pos) belongs to event-set heartbeat
and contains 74 events
event-property qrs-class (qrs-class) belongs to event-set
heartbeat and contains 74 events
event-property qrs-temporal (qrs-temporal) belongs to event-set
heartbeat and contains 74 events
event-property rri (rri) belongs to event-set heartbeat and
contains 74 events
event-property rri-class (rri-class) belongs to event-set
heartbeat and contains 74 events
event-property rri-refvalue (rri-refvalue) belongs to event-set
heartbeat and contains 74 events
event-property rri-num-refvalue (rri-num-refvalue) belongs to
event-set heartbeat and contains 74 events

A.5.2. Perl Version

#
use strict;
use RASCH;

# initialize libRASCH
my $ra = new RASCH or die "error initializing libRASCH\n";

# open measurement
my $meas = $ra->open_meas($ARGV[0], 0) or 
    die "can't open measurement $ARGV[0]\n";

# get default evaluation
my $eval = $meas->get_default_eval() or
    die "no evaluation in measurement\n";

# get some general infos
my $v = $eval->get_info(info => 'eval_name');
my $eval_name = $v->value();
$v = $eval->get_info(info => 'eval_add_timestamp');
my $eval_add_ts = $v->value();
$v = $eval->get_info(info => 'eval_program');
my $eval_prg = $v->value();
print "evaluation $eval_name was added at $eval_add_ts" .
    " using the program $eval_prg\n\n";

# !!!!! eval handling will be changed in the next version !!!!!

# list event-properties
#my $evprops = $eval->get_props_all();
#for (@$evprops)
#{
#    my $prop = $eval->get_prop_by_name($_);
#    my ($name) = $prop->get_info(info => 'eval_prop_name');
#    my ($desc) = $prop->get_info(info => 'eval_prop_desc');
#
#    my $evset = $prop->get_evset();
#    my ($evset_name) = $evset->get_info(info => 'eval_set_name');
#    my ($n_ev) = $evset->get_info(info => 'eval_set_num_events');
#
#    print "event-property $name ($desc) belongs to event-set" .
#	" $evset_name and contains $n_ev events\n";
#}

exit 0;
#

evaluation original was added at 27.05.2005  09:28:53 using
the program perl


A.5.3. Python Version

#
import sys
from RASCH import *

# initialize libRASCH
ra = RASCH()
if not ra:
    print "can't initialize libRASCH"
    sys.exit()

# open measurement
meas = ra.open_meas(sys.argv[1], 0)
if not meas:
    print "can't open measurement", sys.argv[1]
    sys.exit()

# get default evaluation
eva = meas.get_def_eval()
if not eva:
    print "no evaluation in measurement"
    sys.exit()

# get some general infos
[eval_name, n, d] = eva.get_info(info='eval_name')
[eval_add_ts, n, d] = eva.get_info(info='eval_add_timestamp')
[eval_prg, n, d] = eva.get_info(info='eval_program')
print "evaluation", eval_name, "was added at", eval_add_ts,       "using the program", eval_prg, "\n"

# list event-properties
evprops = eva.get_evprops()
for elem in evprops:
    prop = eva.get_evprop_by_name(elem)
    [name, n, d] = prop.get_info(info='eval_prop_name')
    [desc, n, d] = prop.get_info(info='eval_prop_desc')

    evset = prop.get_evset()
    [evset_name, n, d] = evset.get_info(info='eval_set_name')
    [num_events, n, d] = evset.get_info(info='eval_set_num_events')

    print "event-property", name, "("+desc+") belongs to event-set",           evset_name, "and contains", num_events, "events";

#

evaluation original was added at 27.05.2005  09:28:53 using
the program python

event-property qrs-pos (position of fiducial point of
QRS-complex in sampleunits) belongs to event-set heartbeat
and contains 74 events
event-property qrs-class (classification of QRS complex)
belongs to event-set heartbeat and contains 74 events
event-property qrs-temporal (temporal setting of beat) belongs
to event-set heartbeat and contains 74 events
event-property rri (RR interval) belongs to event-set heartbeat
and contains 74 events
event-property rri-class (classification of RR interval)
belongs to event-set heartbeat and contains 74 events
event-property rri-refvalue (reference rri representing the
current heart-rate) belongs to event-set heartbeat and contains
74 events
event-property rri-num-refvalue (number of rri's used for
calculation of reference value) belongs to event-set heartbeat
and contains 74 events

A.5.4. Matlab/Octave Version

rasch@rasch:~> octave
GNU Octave, version 2.1.50 (i686-pc-linux-gnu).
...

octave:1> ra=ra_lib_init
ra = 145016856
octave:2> meas=ra_meas_open(ra, '/home/rasch/ecgs/AT011030_rdi.ART', 0)
meas = 145245344
octave:3> eva=ra_eval_get_def(meas)
eva = 145613352
octave:4> ra_eval_get_info(eva, 'eval_name')
ans = detect
octave:5> ra_eval_get_info(eva, 'eval_add_timestamp')
ans = 02.02.2004  15:14:06
octave:6> ra_eval_get_info(eva, 'eval_program')
ans = raschlab_qt
octave:7> props=ra_prop_get_all(eva);
octave:8> num=length(props)
num = 21
octave:9> for i=1:num
> prop=ra_prop_get_by_name(eva, props{i});
> evset=ra_evset_get_by_prop(prop);
> name=ra_prop_get_info(prop, 'eval_prop_name')
> desc=ra_prop_get_info(prop, 'eval_prop_desc')
> set_name=ra_evset_get_info(evset, 'eval_set_name')
> num_events=ra_evset_get_info(evset, 'eval_set_num_events')
> endfor
name = qrs-pos
desc = position of fiducial point of QRS-complex in sampleunits
set_name = heartbeat
num_events = 1807
name = qrs-ch
desc = bitmask of channels where qrs was detected
set_name = heartbeat
num_events = 1807
name = qrs-class
desc = classification of QRS complex
set_name = heartbeat
num_events = 1807
name = qrs-template
desc = QRS template number
set_name = heartbeat
num_events = 1807
name = qrs-template-corr
desc = correlation of qrs-complex with template
set_name = heartbeat
num_events = 1807
name = heartbeat-flags
desc = Flags for heartbeat events
set_name = heartbeat
num_events = 1807
name = qrs-temporal
desc = temporal setting of beat
set_name = heartbeat
num_events = 1807
name = rri
desc = RR interval
set_name = heartbeat
num_events = 1807
name = rri-class
desc = classification of RR interval
set_name = heartbeat
num_events = 1807
name = rri-refvalue
desc = reference rri representing the current heart-rate
set_name = heartbeat
num_events = 1807
name = rri-num-refvalue
desc = number of rri's used for calculation of reference value
set_name = heartbeat
num_events = 1807
name = rr-systolic
desc = systolic bloodpressure in mmHg
set_name = heartbeat
num_events = 1807
name = rr-diastolic
desc = diastolic bloodpressure in mmHg
set_name = heartbeat
num_events = 1807
name = rr-mean
desc = mean bloodpressure in mmHg
set_name = heartbeat
num_events = 1807
name = rr-systolic-pos
desc = position of systolic bloodpressure in sampleunits
set_name = heartbeat
num_events = 1807
name = rr-diastolic-pos
desc = position of diastolic bloodpressure in sampleunits
set_name = heartbeat
num_events = 1807
name = rr-flags
desc = flags for the rr-values
set_name = heartbeat
num_events = 1807
name = ibi
desc = inter-beat-interval
set_name = heartbeat
num_events = 1807
name = resp-chest-mean-rri
desc = mean chest measurement of the rr interval
set_name = heartbeat
num_events = 1807
name = resp-chest-mean-ibi
desc = mean chest measurement of the inter beat interval
set_name = heartbeat
num_events = 1807
name = rr-calibration-seq
desc = start- and end-value of event is start- and end-position 
       of calibration sequence
set_name = rr-calibration
num_events = 26
octave:10>