Home
User Manual for libRASCH-0.7.4
Contents
1. val ra_eval_get_def meas if eval NULL printf no evaluation in measurement s n return 1 49 Appendix A Examples for all supported lanuages systems get event properties for RR intervals and position of ORS complex prop_rri ra_prop_get_by_name eval rri if prop_rri NULL printf no event property rri in evaluation n return 1 prop_qrs_pos ra_prop_get_by_name eval qrs pos if prop_qrs_pos NULL printf no event property qrs pos in evaluation n return 1 get values for all RR intervals and ORS complexes vset ra evset get by prop prop rri number of events are the same for rri and qrs pos because both belongs to the sam vent set heartbeat num events ra evset get num events evset rri malloc sizeof double num events qrs pos malloc sizeof double num events for 1 0 1 lt num events 1 rri l ra_ev_get_value prop_rri 1 ars pos l ra_ev_get_value prop_qrs_pos 1 now do something with the RR intervals and ORS complex positions clean up LF Era free rri if qrs_pos free rri ra meas close meas ra lib close ra return 0 main 50 Appendix A Examples for all supported lanuages systems A 6 2 Perl Version use strict use RASCH initialize libRASCH my Sra new RASCH or die error initializing libRASCH n
2. 1 database JesusOlivan2003 12 EMG2 edf 2 database 100s hea A 1 4 Matlab Octave Version rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145016336 octave 2 gt err_num err_text ra_lib_get_error ra err_num 1 err_text libRASCH no error octave 3 gt value name desc ra lib get info ra num plugins value 25 name plugins 27 desc octave 4 gt meas ra_meas_find ra meas 1 1 2 1 database 100s hea octave 5 gt A 2 Open measurement A 2 1 C Version include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas initialize libRASCH ra if ra_lib_init ra NULL va_lib_get_error ra if ira Appendix A Examples for all supported lanuages systems database database JesusOlivan2003 12 EMG2 edf NULL 0 RA ERR NONE printf error initializing libRASCHin else char err_t 200 long err_num err_num occured n ra_lib_close ra return 1 open measurement ra lib get error ra printf while initializing libRASCH s n err_t 200 error d err_num err_t 28 Appendix A Examples for all supported lanuages systems meas ra_meas_open ra argv 1 0 if meas NULL char err_t 200 long err_num e
3. for l 0 1 lt n l ra_info_get_by_idx meas RA_INFO_OBJECT 1 vh printf s s ra_value_get_name wh ra value get desc vh switch ra value get type vh O case RA_VALUE_TYPE_LONG 11 Chapter 3 A Tutorial printf Sdin ra value get long vh break case RA VALUE TYPE DOUBLE printf Sfin ra value get double vh break case RA VALUE TYPE CHAR printf Ssin ra value get string vh break default printf not supported type n break close ra value free vh ra meas close meas ra lib close ra return 0 main O ra open meas opens a measurement The user do not need to specify the format in which the measurement was saved libRASCH selects the access plugin which can handle the format If no access plugin can handle the measurement the function fails The third parameter here it is set to 0 controls if a fast open should be done set to UL When a fast open is selected some time consuming initialization is skipped and only the object informations and some basic recording informations e g recording date are available With this call the number of available measurement objects is returned In the following loop we will get all available informations about the measurement object With the function ra_info_get_by_idx we select the information we want by a number Because we do not know
4. printf error initializing libRASCHin return 1 open measurement meas ra_meas_open ra argv 1 0 rec date 38 Appendix A Examples for all supported lanuages systems if meas NULL printf can t open measurement s n argv 1 return 1 get root recording rec ra_rec_get_first meas 0 if rec NULL printf can t get recording handle n return 1 get first 10000 samples for each channel vh ra_value_malloc if ra_info_get rec RA_INFO_REC_GEN_NUM_CHANNEL_L vh 0 num ch ra value get long vh buf malloc sizeof double 10000 for 1 0 1 lt num ch 1 long m num_read num read ra raw get unit rec 1 0 10000 buf for m 0 m lt num read m do something with every sample clean up free buf ra_value_free vh ra meas close meas ra lib close ra return 0 main A 4 2 Perl Version use strict use RASCH initialize libRASCH my Sra new RASCH or die error initializing libRASCH n 39 Appendix A Examples for all supported lanuages systems open measurement my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n get root recording my Srec meas gt get_first_session_rec 0 or die can t get root recording n get first 10000 samples for each channel my Snum_ch rec
5. 3 1 Screenshot after performing the commands in Octave as shown in the Octave session above and on the left side in 15 3 2 Screenshot after performing the commands in Octave as shown in the Octave session above and on the left side in 20 Forword Nothing yet vi Chapter 1 Introduction When analyzing biological signals access to the raw data is mandatory Because of different demands both the industry and the research community created a high number of different data formats for signal storage and signal distribution To analyze data stored in a new data format either a conversion program has to be written or the access functionality for the new data format has to be added to the analyzing program s One way to solve this problem is the use of a standard file format which is powerful enough to handle all needs for storing and distributing signals For physiological signals the File Exchange Format for Vital Signs FEF tries to accomplish this task If this format or a similar one is accepted by the research community and if the industry provides the possibility to export the signal data in this format the data access will be facilitated Our approach moreover is different We assume that there will be always different data formats some standard formats and a lot of proprietary formats Therefore libRASCH a programming library was developed which hides the differences of the data formats behind a common applicat
6. A Tutorial ra_handle ra struct ra_info inf meas_handle meas eval_handle eval plugin_handle pl struct proc_info pi 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 val ra_eval_get_def meas if eval NULL printf no evaluation in measurement s n argv 1 return 1 get plugin handle for hrv plugin pl ra plugin get by name ra hrv 0 9 if pl NULL printf can t find plugin hrv An return 1 calculate hrv values using the hrv plugin pi struct proc_info ra_proc_get pl pi gt mh meas pi gt rh ra rec get first meas 0 pi gt eh eval if ra proc do pi 0 O long num_results 1 value_handle vh get number of results vh ra_value_malloc if ra_info_get pl RA_INFO_PL_NUM_RESULTS_L vh 0 21 printf no results n return 1 num_results ra value get long vh for 1 0 1 lt num results 1 char out 200 t 100 set number of result in which we are interested ra_value_set_number vh 1 O test if result is a default value some non default results are arrays which we skip in this example ra_info_ge
7. Sv rec gt get_info info gt rec_num_channel my Snum_ch Sv gt value Sv Srec gt get info info gt rec name my S Srec name v gt value Sv Srec gt get info info gt rec date my Srec date v gt value print measurement rec nam recorded at S rec date Y devices num_dev channels num_ch n print name for every devic 2 print infos about the recording devices used n for my i 0 i lt num_dev i Sv rec gt get_info dev gt i info gt dev hw name my name Sv gt value print device i Sname n 13 Chapter 3 A Tutorial prints er Dos print name for every channel print infos about the channels n for my i 0 i lt Snum_ch i Sv rec gt get_info ch gt i info gt ch_name my name v gt value Sv rec gt get_info ch gt i info gt ch_unit my Sunit v gt value print channel Si name Sunit n print n exit 0 O The function get_first_session_rec s_num returns the root recording of the session s_num The sessions start with number 0 amp When asking for information about recording devices you need to set the device number In Perl this is done by setting the argument dev to the device number in C you do this in setting the variable dev in the ra info struct When asking for information about a channel you need to set the chan
8. while initializing libRASCH error err_num occured n err_text n exit 1 get some infos my value ra gt get_info info gt num_plugins if value gt is_ok print Svalue gt name 7 value gt desc 7 value gt value An find all measurements in a directory my Smeas Sra gt find_meas SARGV 0 print measurements found in SARGV 0 n my Scnt 1 for Smeas print Sent to o 5 gt filkename a Scnt ra close will be called when ra is being destroyed exit 0 plugins 30 measurements found in database 1 database JesusOlivan2003 12 EMG2 edf 2 database 100s hea A 1 3 Python Version import sys from RASCH import initialize libRASCH ra RASCH 26 Appendix A Examples for all supported lanuages systems if not ra print can t initialize libRASCH sys exit err_num rr text ra get error if err num 1 print while initializing libRASCH error d occured n o Ss n err_num err_text sys exit get some infos value name desc ra get info info num plugins if value print name desc value find all measurements in a directory meas ra get all meas sys argv l print measurements found in sys argv 1 n cnt 1 for item in meas o print Sd s cnt item cnt GP 1 plugins 30 measurements found in database
9. 145667632 tave 5 gt rri ra ev get values prop rri oc ra octav meas octav eva oc prop_rri oc 0 octave 6 gt whos rri local user variables cols type rows home rasch ecgs AT011030 rdi ART i686 pc linux gnu 0 eri 1 O name atrix d 1807 octave 7 gt prop_qrs ra_prop_get_by_name eva prop_qrs 145613912 rri qrs pos octave 8 gt qrs_pos ra_ev_get_values prop_qrs 0 1 octave 9 gt whos qrs_pos local user variables prot type rows cols name ead SE 1 1807 qrs_pos octave 10 gt samplerate ra_meas_get_info meas 1600 samplerate max samplerate 19 Chapter 3 A Tutorial octave 11 gt x qrs_pos samplerate 60 octave 12 gt plot x rri octave 13 gt Figure 3 2 shows a screenshot of Octave after performing the above steps Figure 3 2 Screenshot after performing the commands in Octave as shown in the Octave session above and on the left side in the screenshot ne onto 2 rene DECI LOR 2997308 3 7 Usage of process plugins The example will show how to calculate Heart Rate Variability HRV using the process plugin hrv We will perform the following steps e get hrv plugin e calculate HRV using the plugin e print the calculation results include lt stdio h gt include lt ra h gt int main int argc char argv 20 Chapter 3
10. be called when ra is being destroyed exit 0 After installing the Perl support for libRASCH the package RASCH pm is available Create a new RASCH object The function get info returns an array including 1 the value 2 the name and 3 a short description of the wanted information get all_meas returns an array with all the measurements found 3 1 3 Python Version in The Python script shown below produces exactly the same output as the C and Perl version therefore the output is not shown import sys from RASCH import O Chapter 3 A Tutorial initialize libRASCH ra RASCH O if not ra print can t initialize libRASCH sys exit err_num rr text ra get error if err num 1 print while initializing libRASCH error d occured n o Ss n err_num err_text sys exit get some infos value name desc ra get info info num plugins O if value print name desc value find all measurements in a directory meas ra get_all_meas sys argv 1 O print measurements found in sys argv 1 n cnt 1 for item in meas o print Sd s cnt item ent cnt 1 After installing the Python support for ibRASCH the module RASCH is available Create a new RASCH object e The function get_info returns an array including 1 the value 2 the name and 3 a short description of the wanted inform
11. ch all ch gt endfor octave 7 gt whos ch all kk local user variables prot type rows cols name rwd matrix 10000 5o ehsa Fh octave 8 gt samplerate ra_ch_get_info rec 0 ch samplerate samplerate 1600 OC OC OC OC OC OC OC OC tave 9 gt x 0 9999 tave 10 gt x x samplerate tave 11 gt figure 0 plot x ch all 1 tave 12 gt figure 1 plot x ch all 2 tave 13 gt figure 2 plot x ch all 3 tave 14 gt figure 3 plot x ch all 4 tave 15 gt figure 4 plot x ch all 5 tave 16 gt 41 A 5 Access evaluation A 5 1 C Version include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas eval_handle eval long 1 num initialize libRASCH ra if ra_lib_init ra NULL Appendix A Examples for all supported lanuages systems printf error initializing libRASCH n return 1 open measurement meas ra_meas_open ra RE NULL argv 1 meas printf can t open measurement s n return 1 get default evaluation val ra_eval_get_def meas if eval NULL printf no evaluation in measurement s n return 1 1 0 argv 1 argv 1 get some infos about evaluation vh ra value malloc if ra info get eval RA INFO EVAL NAME C vh 0 printf
12. evaluation s ra value get string vh if ra info get eval RA INFO EVAL ADD TS C vh 0 printf was added at Sa ra value get string vh if ra info get eval RA INFO EVAL PROG C wh 0 printf using the program Sait ra value get string vh printf Nn 42 Appendix A Examples for all supported lanuages systems eval 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 1 0 1 lt num 1 prop_handle evprop evset_handle evset evprop ra_prop_get_by_num eval 1 vset 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 EVSE 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 El maint uation 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
13. gt get_info info gt rec num channel for my i 0 i lt Snum_ch i my Sdata_ref rec gt get raw i 0 10000 for QSdata ref do something with every sample exit 0 A 4 3 Python Version import sys from RASCH import initialize libRASCH ra RASCH if nob ra print can t initialize libRASCH sys exit open measurement meas ra open meas sys argv l 0 if not meas print can t open measurement sys argv 1 sys exit get root recording rec meas get_first_session_rec 0 if not rec print can t get root recording sys exit get first 10000 samples for each channel num_ch n d rec get_info info rec_num_channel 40 if A ra GN OC ra OC me Appendix A Examples for all supported lanuages systems num ch gt 0 for i in range num ch data rec get raw i 0 10000 for elem in data elem f do something with every sample 4 4 Matlab Octave Version sch rasch gt octave U Octave version 2 1 50 i686 pc linux gnu tave 1 gt ra ra_lib_init 145017272 tave 2 gt meas ra meas open ra home rasch ecgs AT011030 rdi ART 0 as 145244336 octave 3 gt rec ra rec get first meas 0 rec 145421120 octave 4 gt num ch ra rec get info rec rec num channel num ch 5 octave 5 gt ch all octave 6 gt for i 0 num_ch 1 gt gt ch ra raw get rec i 0 10000 ch all
14. measurement data on disk Figure 2 1 Structure of libRASCH libRASCH API libRASCH i view process access plugins plugins plugins 2 2 Terminology Measurement A measurement is the topmost object in libRASCH Measurements consists of one or more sessions information about the measurement object e g name forename and birthday if the measurement object is a person and zero or more evaluations Session A Session is a recording for a specific time interval without any interruptions during this time interval In a measurement can be more than one session but the layout of the recording see below must not be changed Recording A recording contains the measured data e g ecg leads V1 V6 A recording has one or more channels or two or more sub recordings Sub recordings are used if more than one recording device 1s used For example when one ADC system records 3 ecg leads and one bloodpressure channel and Chapter 2 Concepts and Terminology another system records 12 eeg leeds the measurement consists of one top recording with two sub recordings The first sub recording contains 4 channels 3 ecg and 1 bloodpressure channel and the second sub recording contains 12 channels 12 eeg channels Evaluation The results of an analysis e g detection of qrs complexes in ecg s are stored in an evaluation An evaluation contains zero or more discrete events like occur
15. open measurement my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n get default evaluation my Seval Smeas gt get def eval or die no evaluation in the measurementln get event properties for RR intervals and position of ORS complex my Sprop rri Seval gt get_evprop by name rri or die no event property rri in the evaluation n my Sprop aqrs pos Seval gt get evprop by name qrs pos or die no event property qrs pos in the evaluationin get values for all RR intervals and ORS complexes my Srri ref prop_rri gt get_events my Bora pos ref Sprop grs pos gt get events now do something with the RR intervals and ORS complex positions exit 0 A 6 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 51 Appendix A Examples for all supported lanuages systems if not meas print can t open measurement sys argv 1 sys exit get default evaluation va meas get_def_eval if not eva print no evaluation in measurement sys exit get event properties for RR intervals and position of ORS complexs prop rri eva get_evprop_by_name rri if not prop_rri print no event property rri in the evaluation sys exit pr
16. result is a default value some non default results are arrays which we skip in 54 Appendix A Examples for all supported lanuages systems this example ra_info_get pl RA_INFO_PL_RES_DEFAULT_L wh 0 if ra_value_get_long vh continue out 0 NO if ra_info_get pl RA INFO PL RES NAME C vh 0 strepy t ra value get string vh strcat out t if ra_info_get pl RA_INFO_PL_RES_DESC_C vh 0 sprintf t s ra_value_get_string vh strcat out t if ra_proc_get_result pi vh 0 sprintf t 1f ra value get double vh strcat out t printf Ssin out ra value free vh close ra_proc_free pi ra meas close meas ra lib close ra return 0 main SDNN standard deviation of normal to normal intervals 30 876196 HRVI HRV Index 4 800000 SDANN standard deviation of averaged normal to normal intervals nan rmssd root mean of squared sucsessive differences 33 839537 pNN50 7 142857 TP total power 482 603096 ULF ultra low frequency power 0 000000 VLF very low frequency power of short term recordings 32 889150 55 Appendix A Examples for all supported lanuages systems LF low frequency power 157 213726 LF_NORM normalised low frequency power 34 958606 HF high freugency power 292 500220 HF_NORM normalised high frequency power 65 041394 LF_HF_RATIO LF
17. type rows cols name rwd matrix 10000 5 ch all octave 8 gt samplerate ra_ch_get_info rec 0 ch samplerate samplerate 1600 octave 9 gt x 0 9999 octave 10 gt x x samplerate octave 11 gt figure 0 plot x ch all 1 octave 12 gt figure 1 plot x ch all 2 octave 13 gt figure 2 plot x ch all 3 octave 14 gt figure 3 plot x ch all 4 octave 15 gt figure 4 plot x ch all 5 octave 16 gt O Returns 10 000 samples for channels 0 4 starting with sample 0 in each channel Figure 3 1 shows a screenshot of Octave after performing the above steps Each plot window on the right side shows a recording channel The x axis is in seconds 15 Chapter 3 A Tutorial Figure 3 1 Screenshot after performing the commande in Octave as shown in the Octave session above and on the left side in the screenshot Naa Ie LOR 2274600 10 e A y K f A a A lA A d D J Sch 5 J Y S CG SE re nog Bannere Zeenen RENTO al S t E E i T 10 Erroneo Newt Xop Grow gg D E Loa rouen ETT EETA Sept Jane 2 eil 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 e get default evaluation e get some general infos about the evaluation e get a list of event properties libRASCH supports different
18. 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 1f the current evalution went Wrong 16 Chapter 3 A Tutorial include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas eval_handle eval long 1 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 val ra_eval_get_def meas O if eval NULL printf no evaluation in measurement s n argv 1 return 1 get some i
19. 891498386073 LF low frequency power 157 21372565195 LF_NORM normalised low frequency power 34 9586058312928 HF high freugency power 292 500220066165 HF_NORM normalised high frequency power 65 0413941687072 LF_HF_RATIO LF HF ratio 0 537482418359847 POWER LAW power law behavior 0 TACHO_INDEX Event numbers used for HRV calculations ARRAY 0x815add8 USER_BAND frequency power in a user selected frequency band A 7 3 Python Version import sys from RASCH import initialize libRASCH ra RASCH if not ra print can t initialize libRASCH sys exit open measurement and get default evaluation meas ra open meas sys argv l 0 if not meas print can t open measurement sys argv 1 sys exit va meas get_def_eval if not eva print no evaluation in measurement sys exit get plugin handle for hrv plugin pl ra get plugin by name hrv if not pl print can t find plugin hrv sys exit calculate hrv values using the hrv plugin 57 Appendix A Examples for all supported lanuages systems proc pl init_process eva eva if not proc print can t initialize processing sys exit results proc process for item in results print item 1 item 2 item 0 SDNN standard deviation of normal to normal intervals 30 8761964331 HRVI HRV Index 4 8 SDANN standard deviation of averaged
20. HF ratio 0 537482 POWER_LAW power law behavior 0 000000 A 7 2 Perl Version use strict use RASCH initialize libRASCH my Sra new RASCH or die error initializing libRASCH n open measurement and get default evaluation my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n my Seval Smeas gt get default eval or die no evaluation in the measurementln get plugin handle for hrv plugin my Spl Sra gt get plugin by name hrv or die can t find plugin hrv n calculate hrv values using the hrv plugin my Sproc pl gt init_process eva gt Seval or die can t initialize processing n my Sresults Sproc gt process Sresults is a reference to an array each array element contains another array with three elements value name description for results print gt name gt desc gt value An exit 0 SDNN standard deviation of normal to normal intervals 30 8761964330589 HRVI HRV Index 4 8 56 Appendix A Examples for all supported lanuages systems SDANN standard deviation of averaged normal to normal intervals nan rmssd root mean of squared sucsessive differences 33 8395373153104 pNN50 7 14285714285714 TP total power 482 603095556721 ULF ultra low frequency power O VLF very low frequency power of short term recordings 32 8
21. 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 Chapter 3 A Tutorial event property rri refvalue rri refvalu heartbeat and contains 74 events belongs to event set event property rri num refvalu vent set heartbeat and contains 74 events 3 6 Get Events rri num refvalu belongs to The example will show how to get values associated with an event We will perform the following steps e get RR intervals and the postion of the QRS complexes e plot the tachogram of the measurement rasch rasch gt octave GNU Octave version 2 1 50 tave 1 gt ra ra_lib_init 145018424 2 gt meas ra_meas_open ra 145245184 3 gt eva ra_eval_get_def meas 145612904 tave 4 gt prop_rri ra_prop_get_by_name eva
22. Octave Version rrrrenrrnrornnnrrrrnenrnrrnrrenrnrsnrnannrnnsensnnrensnennnnensnennnnsnsnennnnssssnnnsnr 27 EE 28 A O NEE 28 AO A e tes 30 A 2 3 Python Version iaa EEN 31 A2 4 Matlab Octave VOM li aid ge Ae 32 A3 Handle recordin PSone Rapa T EE 32 SA A EE 33 ASS 2 S RVE TO 1 arket SEE 34 ALS Python Version erni o dE ite 36 A 3 4 Matlab Octave Version cccccccccessssscecessececcessseceeceessececeesceccessaeceecessaeececestseeecnenaes 37 AACA CCESS raw E EE 38 AASE Version EE 38 Se VETSION EE 39 A 4 3 Python Merite e ENEE ori 40 AAA Matlab Octave Version cccscccccesssscecesssececcessceceeceessaeeecsessaeccessaeceecessaeececessaeeeesenses 4 EE TO EE 41 AS Ths C Version aske esse 42 A 52 A Tee 44 AD Python Version nopal iia 45 A 5 4 Matlab Octave Version cccccccsccessssscecessececcessceceeceesssececseececcessaeceecessaeececessseeecsenaes 46 AO ACCESS EE 49 iii RE O VERSION EE 49 A 6 2 Perl Verito dead feats o e da datado es 50 Dr Python Version yuri 51 A 6 4 Matlab Octave Version rrrnerrrnrronnnrrersenrnrsrrrenrnrsrenannrersensnnrensnennnnensnennnnsnesennnnsessnnnsnr 52 AT DT E EE 53 A d sestecsecaesdueddestecddccdeeseceessessdoees 53 A 7 2 Perl VETSION A A 56 A 7 3 Python Verlo 57 A 7 4 Matlab Octave Version ccccssscccessesscecesscccecessseccescesnsecesessnscescenseeaescensesececeeceecsensee 58 List of Figures 2 1 Structure of IbRASCHeiuiiii ies 2
23. RA INFO REC GEN DATE C vh 0 33 Appendix A Examples for all supported lanuages systems printf recorded at s ra value get string vh printf devices d channels d n num_dev num ch print name for every device printf infos about the recording devices used n for 1 0 I lt num dev 1 set number of device from which the info is wanted ra_value_set_number vh 1 if ra info get rec RA INFO REC DEV HW NAME C vh 0 printf device d s n l ra value get string vh printf n print name and unit of every channel printf infos about the channels n for 1 0 1 lt num ch 1 set number of channel ra_value_set_number vh 1 if ra_info_get rec RA_INFO_REC_CH_NAME_C vh 0 printf ch d s l ra value get string vh if ra info get rec RA INFO REC CH UNIT C vh 0 printf s ra value get string vh printf n printf In close ra value free vh ra meas close meas ra lib close ra return 0 main measurement 100s recorded at 00 00 0 devices 0 channels 2 infos about the recording devices used infos about the channels ch 0 MLII ch 1 V5 34 Appendix A Examples for all supported lanuages systems A 3 2 Perl Version use strict use RASCH initialize libRASCH my Sra new RASCH or die e
24. RASCH ra ra_lib_init check if init was successful if ra NULL ra lib get error ra NULL 0 RA_ERR_NONE if ra printf error initializing libRASCHin else char err_t 200 long err_num err_num ra_lib_get_error ra err_t 200 printf while initializing libRASCH error d occured n s n err num ert t ra_lib_close ra return 1 get some infos vh ra_value_malloc 24 Appendix A Examples for all supported lanuages systems if ra_info_get ra RA_INFO_NUM_PLUGINS_L printf s s d n ra_value_get_name vh ra value get desc vh ra_value_get_long vh ra value free vh find all measurements in a directory f ra meas find first ra argv 1 amp fs if f int cnt 1 printf measurements found in s n do printf 2d s n cnt fs name cnt while ra_meas_find_next f amp fs ra_meas_close_find f close libRASCH ra_lib_close ra return 0 main plugins 30 measurements found in database 1 database JesusOlivan2003 12 EMG2 edf 2 database 100s hea A 1 2 Perl Version use strict use RASCH initialize libRASCH 25 Appendix A Examples for all supported lanuages systems my Sra new RASCH or die error initializing libRASCH n my Serr_num Serr_text ra gt get_error if Serr_num 1 print
25. User Manual for libRASCH 0 7 4 Raphael Schneider User Manual for libRASCH 0 7 4 by Raphael Schneider libRASCH User Manual Version 0 1 Edition Published 2004 Copyright 2004 Raphael Schneider Table of Contents FOrwWord E vi 1 ImtroductiON vias cccscecscscvesessscassersessvececveaseesscescvassscexscasssssactessecvesescaveeesussnasessosevesssvensasoncsesvaasosevesesasasoasoensexs 1 1 1 Overview of the next chapters conc on EE E crono nn conc Sar ana nenconncn nens 1 2 Concepts and Terminology seesssevevvssvevnvensennvenessvensenesnsennesnennsensennesnessesnnenneenssnsennesseensennesnnennensenseeneeene 2 2 1 General Structure of libRASCH rrsrornrrnonrrnrsernnrnersennnnrenssnnrensrensnnenssenannvernannrenenesennensnennnnsessennen 2 O NS 2 SEN VE 5 3 1 Initialize ibRASCH and Basic Usage neninn ineine nii e E e ERa 5 E 05 0 EE 5 31 2 Perl Version EE 7 3 1 3 A eneren 8 3 1 4 Matlab Octave Version rrrnnrrrrrrrnnrrnrrnnnnrensnennnrensnennnnnersanrnnnenesnnnessnssnnrensennnnrensnennnnenenen 9 3 2 Accesg Measurements anecep e EEN ENEE EEN 10 33 ACCESS Recordin Sen knr ne dE karene 12 34 Get Sample Data ii poo 14 3J ACCESS EE e EE 16 SD EE 19 3 7 Usage Of Process OT 20 A Examples for all supported lanuages Systems sevesvervevnevnnennenveenevnnennsennensennennsennennennesssensennesnssnneneeene 24 E Kette E CH ds data 24 AT AR EC A are 24 AZ Per Ee EE 25 Al 30 Pyth n Version a 26 A 1 4 Matlab
26. a find struct fs initialize libRASCH ra ra_lib_init O check if init was successful if ra NULL ra lib get error ra NULL 0 RA_ERR_NONE if ra printf error initializing libRASCH n else char err_t 200 long err_num 0 0 Chapter 3 A Tutorial err_num ra_lib_get_error ra err_t 200 printf while initializing libRASCH error f d occuredin s n err_num err_t ra_lib_close ra return 1 get some infos vh ra value malloc O if ra_info_get ra RA_INFO_NUM_PLUGINS_L vh 0 O printf s s d n ra value get name vh ra value get desc vh ra value get long vh ra_value_free vh O find all measurements in a directory f ra_meas_find_first ra argv 1 amp fs O if f int cnt 1 printf measurements found in s n argv 1 do printf 2d s n cnt fs name cnt while ra_meas_find_next f amp fs ra meas close find f O close libRASCH ra lib close ra 10 return 0 main To use libRASCH the header file ra h must be included In this example the include directory of libRASCH is in the INCLUDE path of the C compiler In ra h you will find all function prototypes of the API of libRASCH ra h includes the header file ra_defines h there you will find all define s and structure sg needed for the libRASCH API ra_lib_init initialize
27. at 00 00 0 devices channels 2 infos about the recording devices used infos about the channels channel 0 MLIT channel 1 V5 A 3 3 Python Version import sys from RASCH import initialize libRASCH ra RASCH if not Las print can t initialize libRASCH sys exit open measurement meas ra open meas sys argv l 0 if not meas print can t open measurement sys argv l sys exit get root recording rec meas get_first_session_rec 0 if not rec print can t get root recording sys exit get some infos about recording num_dev n d rec get info info rec num devices num_ch n d rec get_info info rec_num_channel rec_name n d rec get_info info rec_name rec_date n d rec get_info info rec_date print measurement rec_name recorded at rec_date H devices num_dev channels num_ch 36 Appendix A Examples for all supported lanuages systems print name for every devic print infos about the recording devices used if num_dev gt 0 for i in range num_dev name v d rec get_info dev i info dev_hw_name print device d s i name print ww print name for every channel print infos about the channels if nom oh gt Es for i in range num ch name n d rec get info ch i info ch name unit n d rec get info ch i info ch unit pr
28. ation get all_meas returns an array with all the measurements found 3 1 4 Matlab Octave Version Here an Octave session using the libRASCH support is shown The same tasks are performed as in the previous examples Most of the functions have in Matlab and Octave the same behaviour Differences are listed in the function reference section for Matlab and Octave rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init O ra 145016336 octave 2 gt err_num err_text ra_lib_get_error ra Chapter 3 A Tutorial err_num 1 err_text libRASCH no error octave 3 gt value name desc ra_lib_get_info ra num plugins O value 25 name plugins desc octave 4 gt meas ra_meas_find ra database O meas 1 1 database JesusOlivan2003 12 EMG2 edf 2 1 database 100s hea octave 5 gt O Initialize libRASCH If function call is successfull a value not 0 will be returned The function returns an array including 1 the value 2 the name and 3 a short description of the wanted information The function returns a cell array with all the measurements found 3 2 Access Measurements The example will show how to open a measurement and how to get some information from a measurement We will perform the following steps open a measurement e get the number of sessions and the maximum samplerate e print all available infos about t
29. changed in the next version list event properties my Sevprops eval gt get props all for evprops my Sprop Seval gt get_prop_by_name _ j my Sname prop gt get_info info gt eval prop name my Sdesc prop gt get_info info gt eval_prop_desc my Sevset Sprop gt get_evset my Sevset_name evset gt get info info gt eval set name my n ev evset gt get info info gt eval set num events 44 print exit 0 evaluation original was added at 27 05 2005 the program perl A 5 3 Python Version import sys from RASCH import initialize libRASCH RASCH if not ra as print sys exit open measurement event property name Sevset_name and contains n_ev events n Appendix A Examples for all supported lanuages systems desc belongs to event set 09 28 53 using can t initialize libRASCH meas ra open meas sys argv l 0 if not meas print sys exit get default evaluation va meas get_def_eval if not eva print sys exit get some general infos eval_name n d eval_add_ts n d eval_prg n d print evaluation eval_name using the program list event properties can t open measurement eval_prg sys argv 1 no evaluation in measurement eva get info info eval name eva get info info eval add ti
30. e lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra struct ra_info inf meas_handle meas eval_handle eval plugin_handle pl struct proc_info pi initialize libRASCH ra ra_lib_init if ra NULL printf error initializing libRASCHNn return 1 53 Appendix A Examples for all supported lanuages systems 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 val ra_eval_get_def meas if eval NULL printf no evaluation in measurement s n argv 1 return 1 get plugin handle for hrv plugin pl ra_plugin_get_by_name ra hrv 0 if pl NULL printf can t find plugin hrv An return 1 calculate hrv values using the hrv plugin pi struct proc_info ra_proc_get pl pi gt mh meas pi gt rh ra rec get first meas 0 pi gt eh eval if ra proc do pi 0 long num_results 1 value_handle vh get number of results vh ra_value_malloc if ra_info_get pl RA_INFO_PL_NUM_RESULTS_L vh 0 printf no results n return 1 num_results ra value get long vh for 1 0 1 lt num results 1 char out 200 t 100 set number of result in which we are interested ra_value_set_number vh 1 test if
31. ence of a qrs complex and or zero or more continous events like time interval with noise Event An event describes the occurence of something in a recording e g a heartbeat in an ecg An event has one or more event properties Event Property An event property is a specific property of the event e g the position of the event the type of the event A specific event property is allowed only once in an evaluation for example there can be not more than one qrs position property Event Set An event set describes a group of event properties For example the event set heartbeat contains all properties which belongs to a heart beat like position of qrs complex RR interval type of qrs complex systolic bloodpressure Plugins libRASCH makes heavy use of plugins Plugins are small programs which are loaded when libRASCH is initialized In the plugins the real work is done the library code coordinates that the correct plugin is used and does some other administrative tasks In libRASCH exits three principal types of plugins e signal plugins e view plugins e process plugins Access Plugin Access plugins handle the access to measurement files They hide the differences of the various types of formats and offer an consistent interface to the measurements Most of the times the direct usage of access plugins with the libRASCH API is not needed Process Plugin Process plugins perform a specifc task on the measu
32. gt endfor SDNN standard deviation of normal to normal intervals 39 136515 HRVI HRV Index 10 482558 SDANN standard deviation of averaged normal to normal intervals 11 164071 rmssd root mean of squared sucsessive differences 27 114662 pNN50 6 163243 TP total power 1347 525433 ULF ultra low frequency power 156 680947 VLF very low frequency power of short term recordings 491 156903 LF low frequency power 513 812519 LF_NORM normalised low frequency power 73 434563 HF high freugency power 185 875064 HF_NORM normalised high frequency power 26 565437 LF_HF_RATIO LF HF ratio 2 764290 POWER_LAW power law behavior 0 657030 TACHO_INDEX Event numbers used for HRV calculations 1 000000 octave 9 gt 59
33. he measurement object in this example it is a patient bf include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas initialize libRASCH ra ra_lib_init if ra NULL ra lib get error ra NULL 0 RA ERR NONE 10 Chapter 3 A Tutorial if ra printf error initializing libRASCH n else char err_t 200 long err_num err_num ra_lib_get_error ra err_t 200 printf while initializing libRASCH error f d occured n s n ert num ert t ra_lib_close ra return 1 open measurement meas ra_meas_open ra argv 1 0 O EF vh if if EE meas NULL char err_t 200 long err_num err num ra lib get error ra err_t 200 printf can t open measurement s nerror d s n argv 1 err_num err_t ra lib close ra return 1 get some infos ra_value_malloc ra_info_get meas RA_INFO_NUM_SESSIONS_L vh 0 printf s s d n ra value get name vh ra value get desc vh ra value get long vh ra info get meas RA INFO MAX SAMPLERATE D vh 0 printf s s f n ra value get name vh ra value get desc vh ra value get double vh get all measurement object infos ra info get meas RA INFO NUM OBJ INFOS L vh 0 long 1 long n ra value get long vh
34. 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 43 Appendix A Examples for all supported lanuages systems 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 vent set heartbeat and contains 74 events A 5 2 Perl Version use strict use RASCH initialize libRASCH my Sra new RASCH or die error initializing libRASCH n open measurement my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n get default evaluation my Seval Smeas gt get default eval or die no evaluation in measurement n get some general infos my Sv Seval gt get_info info gt eval name my Seval_name Sv gt value Sv Seval gt get_info info gt eval_add_timestamp my Seval_add_ts v gt value Sv Seval gt get_info info gt eval program my Seval_prg v gt value print evaluation Seval_name was added at Seval_add_ts using the program Seval_prg n n 11111 eval handling will be
35. ind_next returns true 0 if another measurement is available Again the info about the measurement will be in the ra_find_struct This function iterates over all found measurements O ra_meas_close_find frees all memory allocated during ra_meas_find_first and ra_meas_find_next 10 ra lib close unloads all plugins and frees all allocated memory Running the example in the examples directory with the command init_lib database produced the following output plugins 30 measurements found in database 1 database JesusOlivan2003 12 EMG2 edf 2 database 100s hea 3 1 2 Perl Version The Perl script shown below produces exactly the same output as the C version therefore the output is not shown use strict use RASCH O Chapter 3 A Tutorial initialize libRASCH my ra new RASCH or die error initializing libRASCHin my Serr_num Serr_text ra gt get_error if Serr_num 1 print while initializing libRASCH error Serr_num occured n Serr_text n exit 1 get some infos my Svalue ra gt get_info info gt num_plugins if value gt is_ok print Svalue gt name 7 value gt desc 7 Svalue gt value find all measurements in a directory my meas ra gt find_meas SARGV 0 D print measurements found in SARGV 0 n my Scnt 1 for Smeas print Sent Mit 5 o gt taltename O e TNn cnt ra close will
36. int channel d Ss s i name unit print TE measurement 100s recorded at 00 00 0 devices None channels 2 infos about the recording devices used infos about the channels channel 0 MLIT channel 1 V5 A 3 4 Matlab Octave Version rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145016952 octave 2 gt meas ra_meas_open ra home rasch ecgs AT011030_rdi ART 0 meas 145243840 octave 3 gt rec ra_rec_get_first meas 0 rec 145420840 octave 4 gt num_ch ra_rec_get_info rec rec_num_channel num_ch 5 octave 5 gt rec_name ra_rec_get_info rec rec_name rec name ATO11030_rdi 37 Appendix A Examples for all supported lanuages systems octave 6 gt rec_date ra_rec_get_info rec rec_date 30 10 2001 octave 7 gt for i 0 num_ch 1 gt name ra ch get info rec i ch name gt unit ra ch get info rec i ch unit gt endfor name EKGX unit uv name EKGY unit uv name EKGZ unit uv name ABP unit mmHg name RESP unit uv octave 8 gt A 4 Access raw data A 4 1 C Version include lt stdlib h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas rec_handle rec long 1 num_ch double buf NULL initialize libRASCH ra ra_lib_init if ra NULL
37. ion programming interface API Programs using libRASCH no longer need to be adapted to each new data format The implementation of a new data format needs only to be done once for libRASCH Than all libRASCH based programs can handle the new format Additionally libRASCH provides the infrastructure to perform processing algorithms in a standardized way and provide support to display the signal data on the computer screen 1 1 Overview of the next chapters concept terminology describes how a measurement is seen in libRASCH and describes the words used in ibRASCH installation more or less the INSTALL file use one source for both files tutorial short examples describing the primary functions of libRASCH Chapter 2 Concepts and Terminology This section gives a short overview about the concepts and terminology used in the manual 2 1 General Structure of libRASCH Figure 2 1 shows the operational area of libRASCH Programs from User space will call libRASCH to access measurements stored in files to display signals on the screen and to process the signal In the following User space means all programs which use the external interface of libRASCH the API of libRASCH Also programs like Matlab or Octave for which an interface is available are user space programs and the scripts used in this programs Library space describes the internal interfaces used in ibRASCH And Filesystem describes the real files used to store the
38. libRASCH my ra new RASCH or die open measurement my meas maximum samplrat Sra gt open_meas SARGV 0 Appendix A Examples for all supported lanuages systems main used in measurement error initializing libRASCH n 0 or die can t open measurement SARGV 0 n get some infos my Sv print Sv gt name Sv Smeas gt get info info print Sv gt name get all measurement obj Sv Smeas gt get info info Sv gt value 0 my num my i for print v gt name exit 0 Si lt num Smeas gt get info info gt num sessions Sv gt desc if EN IE gt max samplerate Sv gt desc LE t Sv gt value defined v Sv gt value n if defined v ct infos gt num obj infos i v Smeas gt get info idx index gt i Sv gt desc Edd Sv gt value n if defined v 30 Appendix A Examples for all supported lanuages systems sessions 1 max samplerate maximum samplrate used in measurement 360 A 2 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 some infos value name de
39. llbRASCH The function returns an ra handle Chapter 3 A Tutorial ra lib get error returns the last error occured in libRASCH To check if the initialization was successful check that no error occured If an error occured a short description of the error can be retrieved with the function ra_lib_get_error O ra value malloc returns an value object This object will be used in libRASCH to handle data To set get the data and to get informations about the stored data API functions in libRASCH are available The functions start with ra_value_ ra_info_get returns information about libRASCH and all objects handled by libRASCH RA_INFO_NUM_PLUGINS_L asks libRASCH for the the number of loaded plugins The last character of the info id L indicates that the returned value will be a long value Therefore the number of plugins will be returned by using the function ra_value_get_long See the descriptions of the ra_value_ functions in the reference manual what else can be done with an value object O ra value free frees the memory associated with the value object allocated above O ra meas find first returns a valid handle not NULL if at least one supported measurement this means that at least one measurement in the directory can be handled with one of the loaded access plugins The information about the found measurement will be set in the ra find struct for definition of structure see ra_defines h O ra_meas_f
40. ls where qrs was detected set name heartbeat num events 1807 name qrs class desc classification of ORS complex set_name heartbeat num_events 1807 nam ars templat desc ORS template number set_name heartbeat num_events 1807 nam qrs template corr desc correlation of gqrs 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 47 Appendix A Examples for all supported lanuages systems name rri class desc classification of RR interval set_name heartbeat num_events 1807 nam rri refvalu desc reference rri representing the current heart rat set_name heartbeat num_events 1807 nam rri num refvalu desc number of rri s used for calculation of reference valu 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 hea
41. mestamp eva get info info eval program was added at ryg eval add ts N 45 Appendix A Examples for all supported lanuages systems 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 ORS 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 prope
42. nel number In Perl this is done by setting the argument ch to the channel number in C you do this in setting the variable ch in the ra_info struct The output of the above example for the measurement 100s is shown here measurement 100s recorded at 00 00 0 devices channels 2 infos about the recording devices used infos about the channels channel 0 MLIT channel 1 V5 3 4 Get Sample Data The example will show how to get the root recording and some information about it We will perform the following steps e get root recording e get some general informations about the recording 14 Chapter 3 A Tutorial get some infos about all used recording devices get some infos about all recorded channels When more than one recording device was used the root recording provides access to the channels as if they were recorded with one device rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145017272 octave 2 gt meas ra_meas_open ra home rasch ecgs ATO11030_rdi ART 0 meas 145244336 octave 3 gt rec ra_rec_get_first meas 0 rec 145421120 octave 4 gt num_ch ra_rec_get_info rec rec_num_channel num_ch 5 octave 5 gt ch_all octave 6 gt for i 0 num_ch 1 gt ch ra_raw_get rec i 0 10000 O gt ch_all ch_all ch gt endfor octave 7 gt whos ch_all local user variables prot
43. nfos 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 Sa ra value get string vh if ra info get eval RA INFO EVAL PROG C wh 0 printf using the program Sait ra value get string vh printf Tnn 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 1 0 1 lt num 1 prop_handle evprop 17 Chapter 3 A Tutorial evset_handle evset evprop ra_prop_get_by_num eval 1 vset 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 EVSE NAME C vh 0 printf belongs to event set s ra_value_get_string vh if ra info get evset RA_INFO_EVSE 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 O Returns the default evaluation O
44. normal to normal intervals nan rmssd root mean of squared sucsessive differences 33 8395373153 pNN50 7 14285714286 TP total power 482 603095557 ULF ultra low frequency power 0 0 VLF very low frequency power of short term recordings 32 8891498386 LF low frequency power 157 213725652 LF_NORM normalised low frequency power 34 9586058313 HF high freugency power 292 500220066 HF_NORM normalised high frequency power 65 0413941687 LF_HF_RATIO LF HF ratio 0 53748241836 POWER_LAW power law behavior 0 0 TACHO_INDEX Event numbers used for HRV calculations None USER_BAND frequency power in a user selected frequency band None A 7 4 Matlab Octave Version rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145019552 octave 2 gt meas ra_meas_open ra home rasch ecgs ATO11030_rdi ART 0 meas 145245776 octave 3 gt eva ra_eval_get_def meas 58 Appendix A Examples for all supported lanuages systems eva 145613504 octave 4 gt pl ra plugin get by name ra hrv 0 pl 145340240 octave 5 gt proc ra proc init ra meas 0 eva pl 0 0 proc 146187632 octave 6 gt ra proc do proc ans 0 octave 7 gt v n d ra_result_get proc octave 8 gt num length v num 16 octave 9 gt for i 1 num gt printi Tss 8 SEND mtrs Ad MO
45. obtained using ra_get_info_id The value of the result will be obtained using ra get result The output of the above example for the ECG 100s is shown here SDNN standard deviation of normal to normal intervals 30 876196 HRVI HRV Index 4 800000 SDANN standard deviation of averaged normal to normal intervals nan rmssd root mean of squared sucsessive differences 33 839537 pNN50 7 142857 TP total power 482 603096 ULF ultra low frequency power 0 000000 VLF very low frequency power of short term recordings 32 889150 LF low frequency power 157 213726 LF_NORM normalised low frequency power 34 958606 HF high freugency power 292 500220 HF_NORM normalised high frequency power 65 041394 LF_HF_RATIO LF HF ratio 0 537482 POWER_LAW power law behavior 0 000000 Some access plugins do not differ between fast and normal open But it is recommended when writing access plugins to skip time consuming tasks when fast open was selected This decreases the time needed to list all measurements in a directory 23 Appendix A Examples for all supported lanuages systems This appendix shows the examples presented in Chapter 3 for all supported languages systems A 1 Init libRASCH A 1 1 C Version fil include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh ra_find_handle f struct ra_find_struct fs initialize lib
46. on measured 46 Age age of the person measured 196 Height height of the person measured in cm 99 Weight weight of the person measured in kg DD d DD gd OD a Oo D sg DD d OD d OD ll octave 7 gt 0 32 A 3 Handle recordings A 3 1 C Version Appendix A Examples for all supported lanuages systems include lt stdio h gt include lt ra h gt int main int argc char argv ra_handle ra value_handle vh meas_handle meas rec_handle rec long 1 num_dev num_ch initialize libRASCH ra ra_lib_init if ra NULL printf error initializing libRASCH n return 1 open measurement 0 meas ra_meas_open ra argv l1 if NULL meas printf can t open measurement s n return 1 get root recording rec ra_rec_get_first meas if rec NULL 0 argv 1 printf can t get recording handle n return 1 get some infos about recording num_dev num_ch 0 vh ra_value_malloc if ra_info_get rec RA_INFO_REC_GEN_NUM_DEVICES_L vh 0 num_dev ra value get long vh if ra info get rec RA INFO REC GEN NUM CHANNEL L vh 0 num ch ra value get long vh if ra info get rec RA INFO REC GEN NAME C vh 0 printf measurement s ra value get string vh if ra info get rec
47. op_qrs_pos eva get_evprop_by_name qrs pos if not prop_grs_pos print no event property qrs pos in the evaluation sys exit get values for all RR intervals and ORS complexes rri prop rri get events qrs pos ref prop aqrs pos get events now do something with the RR intervals and ORS complex positions A 6 4 Matlab Octave Version rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145018424 octave 2 gt meas ra meas open ra home rasch ecgs AT011030 rdi ART 0 meas 145245184 octave 3 gt eva ra eval get def meas eva 145612904 octave 4 gt prop rri ra prop get by name eva rri prop rri 145667632 octave 5 gt rri ra ev get values prop rri 0 1 octave 6 gt whos rri local user variables 52 Appendix A Examples for all supported lanuages systems prot type rows cols name rwd matrix alt 1807 Eri octave 7 gt prop_qrs ra_prop_get_by_name eva qrs pos prop_grs 145613912 octave 8 gt qrs_pos ra_ev_get_values prop_qrs 0 1 octave 9 gt whos qrs_pos Local user variables prot type rows cols name rwd matrix 1 1807 qrs_pos octave 10 gt samplerate ra_meas_get_info meas max_samplerate samplerate 1600 octave 11 gt x qrs_pos samplerate 60 octave 12 gt plot x rri octave 13 gt A 7 Use process plugin A 7 1 C Version includ
48. rement e g the HRT plugin calculates the Heart Rate Turbulence parameters for an ecg or the detect plugin performs a simple beat detection in ecg s The usage of these plugins View Plugin View plugins allow to display the measurements on the screen If you develop a program using a graphical user interface GUI all you need to display signals is to call the apropriate plugin At the Chapter 2 Concepts and Terminology moment the following GUI s are supported e Qt from Trolltech for Linux e MFC from Microsoft for Windows Notes 1 The signal plugins can be compared with device drivers in operating systems Chapter 3 A Tutorial The handling of evaluations will be changed in the next version of libRASCH Because we are working already on it the sections about evaluations event sets and event propertiey may not work with the current version 0 7 0 If you have any questions about the changes please send them to the mailing list 3 1 Initialize libRASCH and Basic Usage This section will show you how to start using libRASCH We will initialize the library and get some information about it So let s start with the first example We will perform the following steps e init libRASCH e get number of plugins e find all measurements in a directory 3 1 1 C Version include lt stdio h gt include lt ra h gt O int main int argc char argv ra_handle ra value_handle vh ra_find_handle f struct r
49. rr_num ra_lib_get_error ra err_t 200 printf can t open measurement s nerror d s n argv 1 err_num err_t ra lib close ra return 1 get some infos vh ra value malloc if ra info get meas RA INFO NUM SESSIONS L vh 0 printf s s din ra value get name vh ra value get desc vh ra value get long vh if ra info get meas RA INFO MAX SAMPLERATE D vh 0 printf s s f n ra value get name vh ra value get desc vh ra value get double vh get all measurement object infos if ra info get meas RA INFO NUM OBJ INFOS L wh 0 long 1 long n ra value get long vh for 1 0 1 lt n 1 ra_info_get_by_idx meas RA_INFO_OBJECT 1 vh printf s s ra_value_get_name wh ra value get desc vh switch ra value get type vh case RA_VALUE_TYPE_LONG printf e o A 5 Ya_value_get_long vh break case RA_VALUE_TYPE_DOUBLE printf Sf n ra value get double vh break case RA VALUE TYPE CHAR o printf Ssin ra_value_get_string vh break default printf not supported type n break close ra_value_free vh 29 ra meas close meas ra lib close ra return 0 sessions 1 max samplerate 360 000000 ID Patient ID 100s A 2 2 Perl Version use strict use RASCH initialize
50. rror initializing libRASCH n open measurement my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n get root recording my Srec Smeas gt get first rec 0 or die can t get root recording n get some infos about recording my Sv rec gt get_info info gt rec num devices my Snum_dev Sv gt value Sv rec gt get_info info gt rec_num_channel my Snum_ch Sv gt value Sv Srec gt get info info gt rec name my Srec name v gt value Sv Srec gt get info info gt rec date my Srec date v gt value print measurement rec nam recorded at S rec date D fdevices num_dev Hfchannels num_chin print name for every devic print infos about the recording devices used n for my i 0 i lt num_dev i Sv Srec gt get info dev gt i info gt dev hw name my name Sv gt value print device i Sname n print n print name for every channel print infos about the channels n for my i 0 i lt Snum_ch i Sv rec gt get_info ch gt i info gt ch_name my name Sv gt value Sv rec gt get_info ch gt i info gt ch_unit my Sunit Sv gt value print channel Si name Sunit n print An 35 Appendix A Examples for all supported lanuages systems exit 0 measurement 100s recorded
51. rtbeat 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 1807 num_events name ibi desc inter beat interval set_name heartbeat 1807 nam resp chest mean rri num_events desc mean chest measurement of the rr interval set_name heartbeat num_events 1807 nam 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 48 Appendix A Examples for all supported lanuages systems octave 10 gt A 6 Access events A 6 1 C Version include lt stdlib h gt include lt ra h gt int main int argc char argv ra_handle ra meas_handle meas eval_handle eval prop_handle prop_rri prop_qrs_pos evset_handle evset long 1 num_events double rri NULL double qrs_pos NULL 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 return 1 get default evaluation
52. rty 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 gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145016856 46 Appendix A Examples for all supported lanuages systems octave 2 gt meas ra_meas_open ra home rasch ecgs AT011030_rdi ART 0 meas 145245344 octave 3 gt eva ra_eval_get_def meas eva 145613352 octave 4 gt ra_eval_get_info eva eval name ans detect octave 5 gt ra_eval_get_info eva eval_add_timestamp ans 02 02 2004 15 14 06 octave 6 gt ra_eval_get_info eva ans eval program raschlab or octave 7 gt props ra prop get all eva octave 8 gt num length props num 21 octave 9 gt for i 1 num prop ra prop get by name eva vset ra props i name ra_prop_get_info prop vset_get_by_prop prop eval prop name eval prop desc set name ra evset get info evset num events ra evset get info evset val set name gt gt gt gt desc ra prop get info prop gt gt gt val set num events endfor name qrs pos desc position of fiducial point of ORS complex in sampleunits set name heartbeat num events 1807 name qrs ch desc bitmask of channe
53. sc meas get info info num sessions if value print name desc value value name desc meas get_info info max_samplerate if value print name desc value get all measurement object infos num n d meas get info info num obj infos for i in range num value name desc meas get_info_idx index i if value print name desc value sessions 1 max samplerate maximum samplrate used in measurement 360 0 ID Patient ID 100s 31 Appendix A Examples for all supported lanuages systems A 2 4 Matlab Octave Version rasch rasch gt octave GNU Octave version 2 1 50 1686 pc linux gnu octave 1 gt ra ra_lib_init ra 145016232 octave 2 gt meas ra_meas_open ra home rasch ecgs ATO11030_rdi ART meas 145244032 octave 3 gt v n d ra_meas_get_info meas num_sessions v 1 n sessions d octave 4 gt v n d ra_meas_get_info meas max samplerate v 1600 n max samplerate d maximum samplrate used in measurement octave 5 gt num ra_meas_get_info meas num obj infos num 7 octave 6 gt for i 0 num 1 gt v n d ra info get by idx meas meas i gt endfor vV As Name name of the person measured TE Forename forename of the person measured 16 01 1955 Birthday birthday of the person measured male gender gender of the pers
54. t pl RA_INFO_PL_RES_DEFAULT_L wh if ra_value_get_long vh 0 continue out 0 NO if ra info get pl RA INFO PL RES NAME C vh strepy t ra value get string vh streat out tl if ra_info_get pl RA_INFO_PL_RES_DESC_C vh sprintf t s ra_value_get_string vh strcat out t if ra_proc_get_result pi vh 0 O sprintf t 1f ra value get double vh strcat out t printf Ssin out ra value free vh close ra_proc_free pi ra meas close meas ra lib close ra return 0 main Chapter 3 A Tutorial 22 Notes Chapter 3 A Tutorial Returns the plugin handle for the plugin hrv Initialize the proc_info structure defined in ra_defines h In this structure must be the information set which will be needed for the processing the next 3 lines Not all process plugins need the information of the recording and or the evaluation Please check the plugin reference section which information is needed In case of doubt set all variables This function call starts the processing If the processing is successfull the function returns 0 To select the result in which you are interessted the variable res num in the ra info structure must be set The value of the result as well as information about the result will be returned using a ra_info structure Information about a result will be
55. which number is which information this function is only useful to display all available data in a list O Because we do not know which information is returned we do not know the type of the information Therefore we have to get the type of the information so we use the correct way to display the information The output of the above example for the measurement 100s is shown here sessions 1 max samplerate maximum samplrate used in measurement 360 000000 ID Patient ID 100s 12 Chapter 3 A Tutorial 3 3 Access Recordings The example will show how to get the root recording and some information about it We will perform the following steps e get root recording get some general informations about the recording e get some infos about all used recording devices get some infos about all recorded channels When more than one recording device was used the root recording provides access to the channels as if they were recorded with one device use strict use RASCH initialize libRASCH my Sra new RASCH or die error initializing libRASCH n open measurement my Smeas Sra gt open_meas SARGV 0 0 or die can t open measurement SARGV 0 n get root recording my rec meas gt get_first_rec 0 or D die can t get root recording n get some infos about recording my Sv rec gt get_info info gt rec num devices my num_dev Sv gt value
Download Pdf Manuals
Related Search
Related Contents
Samsung GT-E1190 Kullanıcı Klavuzu タイヤがブレーキのシューに引っかかりホイールをセットできなくなりました Radzubehör 4 FINAL RFI FINANCE SOLUTIONS ASUS Pad(TF701T) User's Manual Samsung CS-32500HEXA دليل المستخدم HASBRO Hunchback of Notre Dame User's Manual Hotpoint RSR50V Refrigerator User Manual Kompernass KH 4056 Operating Instructions mobiLink ISDN-2-GSM, 3G Copyright © All rights reserved.
Failed to retrieve file