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 Evaluations

3.5. Access Evaluations

The example will show how to get the evaluation belonging to a measurement and to get some information about it. We will perform the following steps:

  • get default evaluation

  • get some general infos about the evaluation

  • get a list of event-properties

libRASCH supports different "types" of evaluations, these are 'original evaluation', 'default evaluation' and '"old" evaluations. The 'original evaluation' is the evaluation performed with the recording system (e.g. commercial Holter systems). In a measurement there can be only one 'original evaluation', but there can be none.

The 'default evaluation' is the evaluation which should be used as default. If a measurement has only a 'original evaluation', than this will also be the 'default evaluation'.

Old evaluations are like a history of evaluations. When a new evaluation is added to a measurement, than this will be the new 'default evaluation' and the previous 'default evaluation' will become a 'old evaluation'. This enables the user to go back to a previous evaluation, if the current evalution went wrong.

//
#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); (1)
    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++) (2)
    {
        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() */

//
(1)
Returns the 'default evaluation'.
(2)
In the function ra_info_get() we got the number of available event properties. Now we return some informations about each event property.

The output of the above example for ECG '100s' is shown here:

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