Computer Programs in Biomedicine 8 (1978) 262-267 © Elsevier/North-Holland Biomedical Press
A MINICOMPUTER SYSTEM FOR DISPLAY AND RATE ANALYSIS IN VECTORCARDIOGRAPHY Bengt FELLSTROM, Lars N O R D G R E N * and Lars ANTONI ** Department of h~ternalMedicine, * Department of Clinical Physiology and ** Department of Clinical Neurophysiology, Unh'ersity tlospital, Uppsala, Sweden
A system has been constructed for recording vectorcardiographic signal with a FM taperecorder. Off-line AD-conversion and analysis of rates and magnitudes of partial vectors are made with a minicomputer. The reason for studying particularly initial vectorrates is that according to our hypothesis these contain valuable information for classification of certain cardiac arrythmias according to supraventricular or ventricular impulse focus. Preliminary results confirm the hypothesis. In vectorcardiography one difficulty is to give an easily comprehensible presentation of the vectorloop. In this study a method for '3-dimensional' display has been developed, using a graphic display processor and varying intensities of the beam. The system is to a high degree man-machine interactive. Vectorcardiography
Vector rate
Cardiac arrythmia
'3-dimensional' display
angular rates it would not be meaningful to use an other lead system than orthogonal projections. It would be far too time consuming to make these calculations manually - if possible at all - especially when considering the on-line arrythmian diagnostics situation. The system will after careful evaluation probably be adapted to on-line running.
1. I n t r o d u c t i o n
In vectorcardiography (VCG) 3 ortogonal projections o f the electrocardiogram (ECG) are recorded, X-, Y- and Z-projections. A vectorcardiogram is usually presented as 2-dimensional loops through a combination ~f 2 projections at a time. The result is 3 different 2-dimensional loops in the XY-, YZ- and XZplanes respectively. In order to improve this presentation and hopefully make the interpretation easier a '3-dimensional' display of the loop and possibility to rotate the loop around its axes was one of our aims with this system. In cardiac arrythmian diagnostics it is often difficult to differentiate between supraventricular extrasystoles with aberrant ventricular conduction and ventricular extrasystoles. This distinction is important to make, because the latter arrythmia can often be quite serious and require intense treatment whereas the former is usually harmless, or require an other treatment. Our hypothesis states that the initial electrocardiological rates are faster in the former group where there is a supraventricular impulse focus. When studying these rates it has been considered convenient to make calculations from VCG recordings. Concerning
2. System description 2.1. Hardware requirements
Recording and computer system is pictured in fig. 1. The recording set-up consists o f a HP Vectorsystem (1520A) which delivers VCG signals ad modum Frank [ 1 ]. The signals of the X-, Y- and Z-channels are recorded on a FM taperecorder - a Tandberg laboratory recorder (ser. 100) - with sufficient bandwidth. The recordings can be made either in the ECG laboratory or in the heart catheterization laboratory, as the equipment is easily mobile. The central processor unit is a PDP-11/40 (DEC). Run under the RT-11 Operating System there is a 28 K memory available. Two disc-memory stations (RK 05) and one Mag Tape station (DIGI DATA) for 262
263
B. Fellstr6m et al., Analysis and display of VCG
©
?
FMTAPE > FILTER I
C P U PDP-11//-,0
% PRo.__~
DISF m
DISf MON
I
ROTA . NGLES + TIMESTEP I CO R('N DN IEA TE C AO LC W )S
ADC + TORY I TRANSI DI SCSTORE ~ I
+iNTENSITIES
I L IGHTPEN '1 MARK I I CALIBRATION SIGNALSEGM. I STORAGE I
I I I I CALCULATI OINS
t DISPLAY VCG-LOOP
I
E
~
I I
READTTY: NEWROT. ANGLES
SMOOTHING
~TTTy Fig. 1. Schematic picture of the recording and computer configuration.
9 channel IBM compatible 800 BPI tapes are attached. The VT-I 1 Graphic Display Processor dynamically shares the main memory with the CPU and generates different characters and intensities on the display monitor. The 14 inch screen contains 1024 X 1024 adressable points. The whole picture or subpictures can be made lightpen sensitive. ADC is performed on a LPS-11 (DEC) which contains a 12-bit AD-converter and offers a possibility for 1-8 channel ADC by time multiplexing. The upper limit for conversion rate when using 1 channel is 3 . 5 - 4 kHz. Hardware filtering is performed before ADC in order to cut off high frequency noise at a level of 400 Hz. There is also a possibility to cut off low frequency noise such as base line variations.
2.2. Program descriptions 2.2.1. A D C and signal storage The present program for ADC is written in FORTRAN-IV and uses certain LPS library subroutines. The FORTRAN code makes it rather slow, however fast enough for this purpose. It can manage 3 channels at a frequency around 700 Hz and simul-
I CLASSIFIC.CODE FROM TTY
Y
S
ANALYSIS
I
I EoS T,tCEOOE ANDDATABASE
Fig. 2. Flowchart over the program structure.
taneously write on disc. The program offers a possibility to vary the conversion rate, the number of channels and the record length to be taken. For our pUrpose a conversion rate of 500 Hz has been used. The computer is fed with signal intervals of about 30 s at a time and a calibration signal for each channel from the tape recorder. These sequencies are displayed scalarly on the display monitor and are made lightpen sensitive. With the lightpen the operator chooses a subsequence that he is interested in analyzzing, calibrates it into mV, marks the beginning and the end of the QRS complex. Such a subsequence is usually about 1 - 2 s in length, but can be made
264
B. Fellstrdm et al., Analysis and display o f VCG
f
/~__j-]_ ×
._--.._A ¥
J Fig. 3. Three channel VCG display. One VCG cycle for all 3 channels plus corresponding calibration signals. The largest deflection of the signal is the QRS-complex, preceded by the P-wave and followed by the T-wave.
longer, and is stored in a random access file on disc. This VCG cycle can be read from disc subsequently for any of the purposes described below.
2.2.2. '3-Dimensional' display A display program is written in FORTRAN-IV to depict a pseudo 3-dimensional picture of the VCGloop. This is based on the possibility to dynamically change the intensity of the lightbeam. Eight different
/"
IS.
intensities can be used and they are easily changed through the graphic subroutines. The program calculates the 3rd dimension - the depth - and divides it into 8 equal parts. The highest intensity is assigned to the closest sling of the VCG-loop and the weakest intensity to the farthest sling. Moreover the program can perform a rotation of the loop and the X-, Y- and Z-axes. This is done by calculating new coordinates and intensities for every rotation. Rotation can be made in 2 directions. The degrees of rotation can either be given step by step from the TTY or the rotation is made automatically with the same degree of rotation after a certain time lag by using the internal clock. This possibility of rotating the loop and inspecting it from different directions has been used while screening for criteria to separate the 2 types of arrythmias that we are interested in.
2.2. 3. Measurements and calculations The program for signal analysis begins with a high frequency filter consisting of a 3-point smoothing algorithm [1 ]. An average procedure of several complexes cannot be done because the aim is to study extrasystoles and these are not necessarily repetitive and monoform: Xt : (WI " X t - - I + W 2 " X t
+W3. Xt+l)/~Wi
(1)
where in this case all weights are equal: wi = 1, i=1,3. In this study initial vectors means all vectors from the beginning of the QRS (Q) till the maximum spatial vector (R). By terminal vectors is meant those between R and the end of the QRS (S). The fundamental calculations made are: (i) Durations of Q - R , R - S and the whole QRS (ms). Furthermore the quotient Q - R/QRS durations. (ii) Spatial amplitude (mV) at the time t: Mt = (x] +yt2 + zt2)1/2
(2)
(iii) Direction of the maximum vector R calculated in polar coordinates.
J Fig. 4. A schematic '3-dimensional' VCG loop. A broader line corresponds to a higher intensity, which represents a closer position in the 3rd dimension - the depth. The numbers designate the degree of rotation around the X-axis and the Y-axis.
(iv) Spatial area defined as the area between consecutive partial vectors: yT t = l((Xt_dt.
Y t - X t • Yt_dt) 2
+ Oft-- dt " 2t -- X t " Z t - dt )2 + (Yt-dt"
Zt --
Yt" zt-ot)2) 1/2
(3)
265
B. Fellstr6m et al., Analysis and display o f VCG
(v) R a t e o f change in the absolute value of the spatial amplitude (mV/s): (4)
A R t = IM t - M t _ d r l / d t
(vi) Tangential rate along the VCG-loop (mV/s):
One way to compare rates in different QRS complexes is to calculate:
T R t = ((xt - X t - d t ) 2 + (Yt -- Y t - d t ) 2 + (Z t -- Zt_dt)2)l/2/dt
(5)
(vii) Spatial angular rate (radians/s), where 0 t is the spatial angle between consecutive vectors: cos(0 t) :-
M2t + M2t_dt - ( d t - TRt) 2 2 •Mt
•
(6)
M t - dt
(x) The n u m b e r o f changes between acceleration and retardation o f the rate measures, before and after R.
(xi) The mean and m a x i m u m rate for initial and terminal vectors. However, to make a more precise description o f a rate configuration the rate components can be rearranged to a:
(7)
A G R t = Ot/dt
Separate rate calculations for initial and terminal vectors are made. Secondary to these are also calculated certain asymmetri variables, which will be evaluated as estimates o f the degree o f irregularity and asynchrony in the activation o f the initial vectors: , (viii) Length o f the loop before and after R, both the absolute values and related to the magnitude o f R. (ix) Total area before and after R , also related to the magnitude o f R .
2.2.4. Database and statistics When all calculations have been done, which is a matter o f 30 s, all values are stored in a random access datarlle on disc together with a code that assigns the record to a corresponding group and diagnosis. In this way a database is built up, which will be
B.
mV/s 100
(xii) R a t e spectrum, which is the distribution o f the rate components in a certain time interval, characterized b y percentile values. This is made for all 3 types o f rates and both for initial and terminal vector rates. The principle is explained in fig. 5. A rate spect u m makes it possible to compare the rate configuration of Q R S complexes with different durations.
t~
X
-
~
50-
•
I
.
I
100-
".'t
_
.'.'1
%
o 50
100
msec
50
-
20
-
I
o
[--_----
mV/s
0
TRSO
TR20
Fig. 5. Principles for rate spectrum calculation and characterization. (A) Shows the spatial amplitude I (. . . . . . ) and the corresponding tangential rate curve II ( ) of a QRS complex. The total duration (Q-S interval) is 140 ms. The maximum amplitude appears after 60 ms ( Q - R interval). The dotted area shows the initial rate components that we are interested in (i.e., within Q - R interval). (B) After rearrangement of the rate components according to magnitude we get the rate spectrum. This is the distribution telling how large percentage of the components are above a certain rate level. The TR50 and TR20 values can be read directly from this distribution curve. MTR 20 is the arithmetic mean value of the fastest 20% of the rate components, i.e., within the stippled area.
266
B. FellstrOm et al., Analysis and display of VCG
used for statistical evaluation when the material has reached an appropriate size. A separate program has been made for searching in the database on required conditions. Statistical calculations such as meanvalues, variability, standard error, linear regression and Student's t-test can be made on required groups and variables. There are also plans to make a program
for a more elaborate multidimensional discriminatory analysis.
3. Sample run A sample run o f the analysis and calculation program is shown in fig. 6. It starts by giving the name o f
='LIN HER~:]
2 Z .1 :.ce~
a p g ~ .,M,,,,,:.:
me, or
• :~,1,".' ~' 5 6 a
: ,,~'., '.:' ." - . 9 7
c =.... r . ~'c'!7!,4 I t ~ ,_. r q ~.JG - - t ; ' £ T E
'3r.'E":
~. : ~ T ~'C" qT
25 5e
c, ,,? 9g
T':!T~L -: 9.-.-3
9
":-'.-,~
2
E',~9
5S lE".::
!"4£ 5~2
e c, e e
le-7
c,{2
z e,,e
:,-,, igl
,}g2 z:s9
2
94C"
,rE
Z
27
2
3e~; -:79
E 7
" :- '.'
2cat:
!C'2
5
:. H !.,':.: ! gg6
• i
TOTAL 94- ?
0
Lgg
",qSgT
2C' 5 t 5 7Z. E59
5E i07
79'? ':39~*
H .~ .Hz~ i7 292 65 i:lg
MERN ll i:7t3 7ca` 2 2 ~ :
.............. i. ?:37 i E*.!.9
44
iig
755
27
:-l
2
25!
"~ ~ T . - _.-.: . . . - - ~ . z-, T .z .r c. .." u ,, - ,,, R v,
5C';;
0 U 0 "r ! E ~" T
. : M ',..':": 9 277
3- a ,, -..~ A :< %}%' 2r,% i':a g g:.-- g L ? r, s g L-"
~c,~
9i}g
:£-!9
r ;'.' r ~ L $~,:.: -7_-. i L? 5
r'!~:< 2 q % 221 ? 72 7
!3£2
20%' 79 : 5 7 C'
F,A>:'. 2L.'C; !!5 g 9! I
~,- V,r,~r,,ET ~ ,¢- ~.:g,r. S U : g
I L'72
l~g
2
":d5 ~'!S
~L"
25
" !~
12
9Z9
L" r'!~"-?'!R:':
='qTE-STCT i E T :' ' : Z • : ~,,I., - '.! r~ .,: 5C,'; 2 '-' :2 "I z ':
T!]!T~L
R ;,.'E ~!R !3 E
"! q ', ' ?:~':
£~7
" M'..'-M ~ >i ,:,r ~:.'..'7
37,'2
'-7 [-'-c-
'? "!7"~
71E
!
~E
9-"
P
27
2
.'
-E
.:'
LZ.'-'. 7
:,!: .7 - =.E T c =.7, M~,_t,1
-
~ ,
t,;
*.
,
T~-
F,I~''
T~t
,7C,-
•
-
M ,.,_~,1~,,
- : :m'r r w~-r
"5.2 '3c-Z ELE u 5
tiE.T .... l~ ~77
~,j:~r E
qSi..~ g9
: . ' ., c.~ '.r ~. : ' , ~ . ..-. i ~ . . . .~,~..-:-r ._o TL'T. ; :~r:~=g: ~4V'.': F a T ' < C ~ - " T I t,! -:,:3 l.-:: 5-.-
,,'". 7Z ?~Z'
",-''rc-7-'_:ca
.g ,- ~ ::+-- T ~ ~...,'~ g g'-'-'7 227
.re
~':.'T
-
~ ': & [ ' - - ~E;'-: ' ~"=. 2
~':~7:rsT:"E
}
-.'27
9
"
?':-'
~"
4.~
_
2-':.-
.2.
".'L*'£
-L
Fig. 6. Sample run of the analysis program. After telling the name of the file where the signal is stored, it is displayed on the monitor. The calculations start after the beginning and at the end the QRS have been marked by the lightpen. At the end the calculated values are stored on the database.
B. Fellstr6m et al., Analysis and display of VCG the fide where the signal to be analyzed is stored. After delimiting the QRS-complex the calculations start. By the end the calculated values are stored on the database for subsequent statistical evaluations.
4. Mode of availability Listings o f F O R T R A N code can be made available upon request. Requests should be made to Dr Bengt Fellstr6m.
References [ 1] E. Frank, An Accurate, Clinically Practical System for Spatial Vectorcardiography, Circulation, XIII (1956) 737.
267
[2] O. Arvedsson, Methods for Data Acquisition and Evaluation of Electro- and Vectorcardiogram with Digital Computer (Ume~, Sweden, 1968). [3] H.C. Fryer, Concepts and Methods of Experimental Statistics (Allyn and Bacon, Boston, 1966). [4] P.A. Lynn, An Introduction to the Analysis and Processing of Signals (John Wiley and Sons, New York, 1973). [5] E. Lundqvist and A. Sj6berg, Numerisk Analys l - I I (Studentlitteratur, Lund, 1969). [6] B. Fellstr6m and L. Nordgren, Supraventricular Extrasystole with Aberration or Ventricular Extrasystole? A Study on Initial Vector Rates (1978) submitted. [7] Manuals: System Reference Manual (RT-11); FORTRANIV Manual (RT-11); Laboratory Extensions Manual (Digital Equipment Corp., Maynard, MA, 1972-75).