according to this invention , a normal atrial sense ( as ) template waveform is constructed from the atrial electrogram ( aegm ) signal that corresponds to normal intrinsic atrial depolarization . for implantable cardiac devices , the normal atrial template waveform can be constructed from the aegm corresponding to the as events detected outside the atrial refractory period ( arp ). as known in the art , the normal as events can be exposed by programming the device atrial pacing rate below the sinus rate of the heart . also according to this invention , a normal ventricular sense ( vs ) template waveform is constructed from the ventricular electrogram ( vegm ) signal that corresponds to antegrade conducted ventricular depolarization . for implantable cardiac devices , the normal vs template can be constructed from the vegm corresponding to vs event that is outside the ventricular refractory period ( vrp ) and is associated with preceding as event or atrial pace ( ap ) event . as known in the art , the normal vs events can be exposed by programming device atrio - ventricular ( av ) delay longer than the intrinsic av conduction time . further according to this invention , a retrograde as template waveform is constructed from the aegm signal that corresponds to retrograde atrial depolarization . for implantable cardiac devices , the retrograde as template can be constructed from the aegm corresponding to retrograde as events . as known in the art , the retrograde as events can be exposed by programming device in vdi mode , programming ventricular pacing rate higher than the intrinsic heart rate , and programming a long post - ventricular atrial refractory period ( pvarp ). the retrograde as events can be confirmed by relatively stable interval from the ventricular paces ( vp ) to the refractory atrial senses . fig1 shows a high - level flowchart diagram that illustrates the steps involved in automatic setup of the iegm templates in an implantable cardiac device . the iegm templates can be normal as template , normal vs template , or retrograde as template . preferably , the automatic template setup is performed during initial device implant , or during regular device follow - up , when the physician can verify the template signal is constructed from valid iegm signals . as described above , to construct the desired iegm templates ( normal as template , normal vs template , retrograde as template ), the device is programmed accordingly in order to expose the desired sense events ( normal as events , normal vs events , retrograde as events ). then the device collects multiple cycles of the iegm signals containing the desired sense events ( normal as , normal vs , retrograde as ). the iegm signals are then aligned based on predefined fiducial point , for example , the positive or negative peak , the maximum slope , the threshold crossing point , etc ., as known in the art . for each cycle , the iegm segment in a fixed window relative to the fiducial point is selected for creating the template signal . in a typical embodiment , the fiducial point is chosen as the dominant peak ( positive or negative ) of the iegm signal , and the iegm window spans from 50 ms before the fiducial point to 100 ms after the fiducial point . still refer to fig1 . according to this invention , for each pair of the aligned and windowed iegm signals , their morphological similarity is quantified by an adaptive signed correlation index ( asci ), which will be described in details in the following sections . if for any given cycle pair , the calculated asci is lower than a predefined threshold value , then the collected iegm signals are considered not stable . a warning is generated by the device indicating the template signal is not available at the moment , and the template setup may be retried at a later time . on the other hand , if for all cycle pairs , the calculated asci is greater than the predefined threshold value ( e . g ., 0 . 8 ), then all collected iegm cycles are considered similar , and the desired iegm template is created by averaging all these aligned iegm cycles . as discussed in more details later , the asci is calculated based on the definition of three subspaces that are dependent on the template signal . thus upon creation of the iegm template , the device further determines the three subspaces as discussed thereinafter . note that during the initial template setup phase when template waveform has not been available yet , to calculate the asci between a pair of iegm cycles , any one of the two iegm signals can be initialized as the tentative template signal . based on this tentative template signal , the three subspaces can be defined , and the similarity between these two signals can be quantified by asci . as discussed above , only if all pairs of the collected iegm cycles result in higher than predefined asci threshold , then these cycles are considered to have similar morphology , and the true template waveform can be created . fig2 shows a particular example of setting up normal as template and normal vs template . in this example , the aegm and the vegm are shown in the left for four cardiac cycles in sinus rhythm . each intrinsic atrial depolarization is followed by a conducted ventricular depolarization . both aegm and vegm morphology are consistent among the four cycles . for both aegm and vegm , the positive peak is chosen as the fiducial point , and the window size is set from 50 ms before the positive peak to 100 ms after the positive peak . then the four cycles of aegm are averaged to construct the normal as template and the four cycles of vegm are averaged to construct the normal vs template as shown in the right . according to this invention , after the initial template setup , the normal as template , the normal vs template , and the retrograde as template are preferably updated periodically or continuously to reflect the dynamic change of the corresponding iegm morphology . this template running update feature is important because the normal as , normal vs , and retrograde as waveforms may gradually change over time due to different factors such as heart rate variation , circadian pattern , changes of medication , changes of electrode - tissue interface , etc . fig3 shows a high - level flowchart that illustrates the steps involved in running update of the iegm templates ( normal as template , normal vs template , retrograde as template ). preferably , the template running update is activated only when a detected sense event is considered likely to be the desired event type . for example , a detected as event outside the arp is likely a normal as event , a detected vs event outside the vrs and preceded by an as or ap event is likely a normal vs event , and a detected as event following a vp event and inside the pvarp is likely a retrograde as event . upon detection of the likely desired sense event ( normal as , normal vs , or retrograde as ), the device acquires one cycle of the corresponding aegm ( for normal as or retrograde as ) or vegm ( for normal vs ) as the test signal , which is aligned with the corresponding template signal ( normal as template , normal vs template , retrograde as template ) based on predefined fiducial point as discussed above . then the device calculates the asci between the acquired test signal and the corresponding template signal . if the asci is lower than a predefined threshold ( e . g ., 0 . 8 ), then the test signal is considered different than the template signal , and no template update is performed for this test cycle . on the other hand , if the calculated asci is greater than the predefined threshold ( e . g ., 0 . 8 ), then the test signal is considered similar to the template signal , and the template signal is updated by taking the weighted average of the original template signal and the newly acquired test signal . in an exemplary embodiment , the new template is the sum of the old template signal scaled by 255 / 256 , and the newly acquired test signal scaled by 1 / 256 . by this means , it ensures the stability of the template waveform by retaining 255 / 256 of the old template signal , whereas it incorporates 1 / 256 of the test signal to factor in any gradual change of the iegm morphology of the corresponding event type . as discussed in more details later , the asci is calculated based on the definition of three subspaces which are dependent on the template signal . thus the device can further adjust the three subspaces based on newly updated template signal , if the adaptive subspace feature is enabled . one prerequisite for any morphology - based event classification algorithms is that the test signal must be properly aligned with the template signal . morphological analysis based on misaligned signals may yield misleading results . as discussed above , the common practice for signal alignment is based on a predefined fiducial point , such as the positive peak , the negative peak , etc . however , in some cases , the signal alignment based on a single fiducial point is not reliable . fig4 shows some examples . panels ( a ) and ( b ) show two signal complexes that have similar morphology . both signal complexes can be characterized by two positive peaks ( p 1 , p 2 ) that have similar amplitude and one negative peak ( n 1 ). if the dominant positive peak is chosen as the fiducial point , then the fiducial point will be p 1 for the signal complex shown in panel ( a ) but p 2 for the signal complex shown in panel ( b ). similarly , panels ( c ) and ( d ) show another pair of signal complexes that have similar morphology . both signal complexes can be characterized by two negative peaks ( n 1 , n 2 ) that have similar amplitude and one positive peak ( p 1 ). if the dominant negative peak is chosen as the fiducial point , then the fiducial point will be n 2 for the signal complex shown in panel ( c ) but n 1 for the signal complex shown in panel ( d ). according to this invention , multiple fiducial points are defined for signal alignment in adjunction with asci - based morphological analysis . specifically , for a given template signal representing the desired event type ( normal as , normal vs , retrograde as ), multiple fiducial points ( if available ) are defined in a sequential order , that is , 1 st fiducial point , 2 nd fiducial point , 3 rd fiducial point , etc . similar fiducial points ( if available ) are also identified for a test iegm signal . for example , for the signals shown in panels ( a ) and ( b ) of fig4 , the fiducial points can be defined in the following order : dominant positive peak ( 1 st fiducial point ; p 1 in ( a ) and p 2 in ( b )), dominant negative peak ( 2 nd fiducial point ; n 1 in both ( a ) and ( b )), secondary positive peak ( 3 rd fiducial point ; p 2 in ( a ) and p 1 in ( b )). similarly , for the signals shown in panels ( c ) and ( d ) of fig4 , the fiducial points can be defined in the following order : dominant positive peak ( 1 st fiducial point ; p 1 in both ( c ) and ( d )), dominant negative peak ( 2 nd fiducial point ; n 2 in ( c ) and n 1 in ( d )), secondary negative peak ( 3 rd fiducial point ; n 1 in ( c ) and n 2 in ( d )). to compare the morphology of a test signal and the corresponding template signal , the two signals are first aligned with the 1 st fiducial point , and their asci value is calculated . if the resulting asci value is higher than a predefined threshold ( e . g ., 0 . 8 ), then it indicates the two signals have similar morphology . the signal alignment is considered valid , and no further calculation is needed . on the other hand , if the resulting asci value is lower than the predefined threshold ( e . g ., 0 . 8 ), then it indicates the two signals have different morphology . then the signals are re - aligned with the 2 nd fiducial point ( if available for both signals ), and their asci value is re - calculated . if the re - calculated asci value is higher than the predefined threshold ( e . g ., 0 . 8 ), then it indicates misalignment for the 1 st fiducial point , but the alignment based on the 2 nd fiducial point is valid . the signals are considered to have similar morphology and no further calculation is needed . similar test can be performed for the 3 rd fiducial point ( if available for both signals ) if the asci value obtained for the 2 nd fiducial point is still lower than the predefined threshold ( e . g ., 0 . 8 ). no further test is needed if a fiducial point is only available for one signal but not the other signal . if all asci values are below the predefined threshold ( e . g ., 0 . 8 ), no matter which fiducial point is chosen , then it is determined that the test signal and the template signal have different morphology . according to the experience of the present inventors , using two fiducial points ( e . g ., dominant positive peak and dominant negative peak ) for signal alignment can effectively solve most of the signal misalignment problems caused by using a single fiducial point . refer to fig5 . let r denote the iegm signal space that spans from v min to v max , where v min is the minimum amplitude and v max is the maximum amplitude that could be measured by the sensing channel of the device . divide r into three subspaces r p , r z , and r n such that r = r p ∪ r z ∪ r n and r p ∩ r z = r p ∩ r n = r z ∩ r n = ø , where ∪ is the union operator , ∩ is the intersection operator , and ø represents the null space . that is , the three subspaces are non - overlapping yet all together they span the whole signal space . for convenient purpose , in the following descriptions , we term r p as the positive subspace , r z as the zero subspace , and r n as the negative subspace . still refer to fig5 . according to this invention , all three subspaces ( r p , r z , r n ) are adaptive to the template signal representing iegm morphology of the desired event type ( normal as , normal vs , or retrograde as ). in a preferred embodiment , four threshold vectors tl d , tl p , tu p , tu d are defined from the template signal x . denote x =[ x ( 1 ), x ( 2 ), . . . , x ( l )], where l is the number of samples in signal x . further denote tl p =[ tlp ( 1 ), tlp ( 2 ), . . . , tlp ( l )] as the proximal lower threshold vector , tl d =[ tld ( 1 ), tld ( 2 ), . . . , tld ( l )] as the distal lower threshold vector , tu p =[ tup ( 1 ), tup ( 2 ), . . . , tup ( l )] as the proximal upper threshold vector , and tu d =[ tud ( 1 ), tud ( 2 ), . . . , tud ( l )] as the distal upper threshold vector . these threshold vectors are defined such that tl d ≦ tl p ≦ x ≦ tu p ≦ tu d , or specifically , tld ( i )≦ tlp ( i )≦ x ( i )≦ tup ( i )≦ tud ( i ), for 1 ≦ i ≦ l . the positive subspace r p is defined as the region bounded by tl p and tu p , the negative subspace r n is defined as the region above tu d or below tl d , and the zero subspace r z is defined as the region bounded between tu p and tu d , and that between tl d and tl p . obviously , a sample in r p is proximal to the template , a sample in r n is distal to the template , and a sample in r z is at intermediate distance to the template . according to an exemplary embodiment of the present invention , the four threshold vectors are defined from the template signal according to the following equations : here , max ( abs ( x )) is the peak absolute amplitude of the template signal , α and β are programmable scaling coefficients that satisfy 0 & lt ; α & lt ; β . in a typical example , α = 0 . 25 and β = 0 . 5 , and the resulting threshold vectors are symmetric around the template signal . obviously , there are numerous other means to define the four threshold vectors so that they are adaptive to the template signal x , for example , either based on sample - by - sample amplitude of x , or based on specific features of x , such as its maximum , minimum , max absolute , mean , median , etc ., or their combinations . also , the upper threshold vectors and the lower threshold vectors can be symmetric or asymmetric around the template signal . as illustrated in fig1 , after automatic setup of the iegm template , the three subspaces can be defined from four threshold vectors that are adaptive to the template signal by means of the method described above . similarly , during the template running update as illustrated in fig3 , after the template signal is updated by taking the weighted average of the old template signal and the new test signal , the three subspaces can be adjusted by redefining the threshold vectors based on the new template . to calculate the asci between two iegm signals , both signals are first trichotomized based on three subspaces that are adaptive to the defined template signal . denote s as the three - value set {− 1 , 0 , 1 }. assume x =[ x ( 1 ), x ( 2 ), . . . , x ( l )] is an iegm signal , that is , x ( i ) ∈ r for i = 1 , 2 , . . . l , where l is the number of samples in signal x . trichotomization of signal x is an operation that maps the signal from r space to s space . specifically , denote tx =[ tx1 ), tx ( 2 ), . . . , tx ( l )] as the trichotomized signal of x , where tx ( i ) ∈ s for i = 1 , 2 , . . . l . then the trichotomization is formulated as : in other words , signal x is trichotomized to tx by converting all its data samples to values selected from {− 1 , 0 , 1 }, based on which subspace each data sample belongs to . in a typical embodiment , signal x is the template signal of the desired event type ( normal as , normal vs , or retrograde as ), and asci ( x , y ) measures the morphological similarity between a test iegm signal y and the template signal x . for the template signal x , all elements of its trichotomized signal tx are 1s because all samples of x are within the positive subspace r p . for another signal y , its trichotomized signal ty will have more 1s if more samples of y are close to the corresponding samples of x , i . e ., y is similar to x . as y gradually deviates from x , its trichotomized signal ty has less 1s , more 0s , and eventually more − 1s . assume x =[ x ( 1 ), x ( 2 ), . . . , x ( l )] and y =[ y ( 1 ), y ( 2 ), . . . , y ( l )] are two signals in r , and each has l samples . given defined subspaces r p , r z , and r n ( which are adaptive to the template signal ), x is trichotomized to tx =[ tx ( 1 ), tx ( 2 ), . . . , tx ( l )], and y is trichotomized to ty =[ ty ( 1 ), ty ( 2 ), . . . , ty ( l )]. the asci between x and y , or asci ( x , y ), which measures the similarity between x and y , is defined by the following formula : here , the symbol ∘ denotes the signed correlation ( sc ) of two trichotomized vectors , and is defined by the following formula : here , the symbol denotes the signed product ( sp ) between two trichotomized scalars , and is defined by the following formula : accordingly , if tx ( i )= ty ( i ), their sp is 1 . in this case , the sample pair x ( i ) and y ( i ) are considered concordant , meaning that they are in the same subspace . specifically , both are in the positive subspace if tx ( i )= ty ( i )= 1 ; or both are in the negative subspace if tx ( i )= ty ( i )=− 1 ; or both are in the zero subspace if tx ( i )= ty ( i )= 0 . on the other hand , if tx ( i )· ty ( i )=− 1 , their sp is − 1 . in this case , the sample pair x ( i ) and y ( i ) are considered discordant . specifically , it occurs when tx ( i )= 1 and ty ( i )=− 1 , or tx ( i )=− 1 and ty ( i )= 1 . in both cases , one sample is in the positive subspace whereas the other sample is in the negative subspace . otherwise , the case must be either tx ( i )= 0 and ty ( i )≠ 0 , or tx ( i )≠ 0 and ty ( i )= 0 , and their sp is 0 . in this case , the sample pair x ( i ) and y ( i ) are considered neither concordant , nor discordant . specifically , one sample is within the zero subspace , and the other sample is either in the positive subspace or in the negative subspace . according to the above definition , the sc of two trichotomized vectors ( tx ° ty ) is the sum of the sp of all sample pairs tx ( i ) ty ( i ), for i = 1 . . . l . therefore , the sc of two trichotomized signals will be increased by each pair of concordant samples (+ 1 ), decreased by each pair of discordant samples (− 1 ), and not affected otherwise ( neither concordant nor discordant sample pair ). for two identical signals , all corresponding sample pairs are concordant . therefore , for above defined tx and ty , it is evident that tx ∘ tx = l and ty ∘ ty = l . consequently , the formula for calculating asci ( x , y ) defined above can be simplified to : as discussed above , in a typical embodiment , signal x is the template signal of the desired sense event ( normal as , normal vs , or retrograde as ), and all elements of its trichotomized signal tx are 1s because all samples of x are within the positive subspace . thus , the formula for calculating asci ( x , y ) defined above can be further simplified to : in other words , the asci ( x , y ) can be simply calculated as the cumulative sum of all trichotomized samples of test signal y normalized by the number of samples . the definition of asci is compatible to the conventional definition of pearson &# 39 ; s correlation coefficient ( pcc ) similar to pcc , asci is a normalized index ranging from − 1 to + 1 . if signals x and y have similar morphology , they will have more concordant sample pairs , and asci ( x , y ) will approach + 1 . on the other hand , if signals x and y have different morphology , they will have fewer concordant sample pairs , and asci ( x , y ) will be less . if most sample pairs of x and y are discordant , then asci ( x , y ) will approach − 1 . however , asci is advantageous compared to pcc due to at least three reasons : first , the calculation of pcc requires extensive floating - point operation including multiplication , division , and square root . on the other hand , the calculation of asci only requires comparison and summation . the threshold vectors that are used to define subspaces can be automatically determined from the template signal , through simple operations such as scaling ( bit shifting ), adding / subtracting , thresholding , etc . the normalization operation ( divided by l ) can be omitted because the total number of samples ( l ) is a known constant . for the purpose of sense event classification in implantable cardiac devices , the asci will be mainly used for comparison with predefined or user - programmable threshold to determine if two iegm signals have similar morphology . in this case , the threshold can be defined in the form of x - out - of - y criterion , or by means of bit shifting operation ( e . g ., to obtain l / 2 , 3l / 4 , 7l / 8 , etc .). therefore , the calculation of asci is computationally much more efficient , and can be easily implemented in firmware or hardware of the implantable cardiac device . second , pcc is a parametric measure of linear relationship , and it does not account for the amplitude difference between signals . on the other hand , the calculation of asci takes amplitude information into consideration . for the examples shown in fig5 where the subspaces are defined by four threshold vectors which are adaptive to the template signal x , a high asci ( x , y ) value requires x and y must stay close and have similar amplitude throughout the signal length ( i . e ., y must be bounded by proximal upper and lower threshold vectors around x ); otherwise , low asci ( x , y ) value is obtained . thirdly , pcc is affected by each sample amplitude of each signal , thus is sensitive to additive noise such as impulse noise or continuous random noise , as well as sensitive to slight yet normal signal variation . on the other hand , the asci ( x , y ) is calculated based on trichotomized signals tx and ty , and signal trichotomization is further based on subspaces r p , r z , and r n that are adaptive to the template signal . different means to define these subspaces can provide different degrees of tolerance of signal variation . thus a noise - free signal and the same signal added with noise could have identical trichotomized vectors . therefore , by properly designing subspaces according to specific application and / or prior knowledge of the signal , the asci can be more tolerant to additive noise and normal signal variation than pcc . as described above , initial classification of a sense event in the implantable cardiac device can be made based on event timing information . however , misclassification between normal beat and ectopic beat may occur . for example , an as outside the arp may represent a normal intrinsic depolarization , or an atrial extra - systole ( aes ). in another example , an as inside the arp that is followed by a vs may also be a normal intrinsic depolarization , or an aes . yet in another example , a vs outside the vrp may represent an antegrade conducted ventricular depolarization , or a ventricular extra - systole ( ves ). to improve the classification accuracy , the asci - based morphological analysis can be used to facilitate the ectopic beat detection in implantable cardiac devices . now refer to fig6 , which shows four examples of calculating asci for particular application to ectopic beat detection in an implantable cardiac device . in these examples , traces labeled with b are the template signals representing the normal as template ( panel ( a ) and panel ( b )) or the normal vs template ( panel ( c ) and panel ( d )), and the traces labeled with r are the test aegm signals corresponding to as events ( panel ( a ) and panel ( b ) or the test vegm signals corresponding to vs events ( panel ( c ) and panel ( d )). all template signals and the test signals are aligned based on predefined fiducial points as described above . in each plot , the four threshold vectors are defined based on the corresponding template signal according to the method illustrated in fig5 . then the test signal is trichotomized , and the corresponding asci values are calculated . in panel ( a ), the calculated asci is 1 . 00 , whereas in panel ( b ), the resulting asci is − 0 . 03 . assuming a predefined asci threshold of 0 . 50 , then the supra - threshold asci obtained in panel ( a ) indicates the test aegm has similar morphology as the normal as template , thus indicating a normal intrinsic as event . contrarily , the sub - threshold asci obtained in panel ( b ) indicates the test aegm has different morphology than the normal as template , thus indicating an aes event . in panel ( c ), the calculated asci is 0 . 90 , whereas in panel ( d ), the resulting asci is 0 . 08 . assuming a predefined asci threshold of 0 . 50 , then the supra - threshold asci obtained in panel ( c ) indicates the test vegm has similar morphology as the normal vs template , thus indicating a normal intrinsic vs event . contrarily , the sub - threshold asci obtained in panel ( d ) indicates the test vegm has different morphology than the normal vs template , thus indicating a ves event . preferably , the asci - based morphology analysis is used in conjunction with the time interval analysis for ectopic beat detection . according to one typical embodiment of the present invention , the asci - based morphology analysis for ectopic beat detection is only activated when the time interval analysis could not definitely differentiate normal beat from ectopic beat . for example , a vs event without a preceding as or ap event can be classified as a ves with high confidence , thus no additional morphological analysis is necessary . yet according to another embodiment of the present invention , the asci - based morphology analysis conducts the ectopic beat detection , independent of the time interval analysis . the analysis results from both methods are combined , e . g ., through fuzzy logic , to reach the final classification results . yet according to a further embodiment of the present invention , the asci - based morphology analysis could be used in conjunction with other signal processing algorithms for ectopic beat detection in devices or systems ( e . g ., ecg monitors , ecg holters , etc .) involving measurement and analysis of surface ecg signals . retrograde p wave represents atrial depolarization caused by retrograde av conduction after vp or ves . as known in the art , to differentiate retrograde atrial depolarization from normal intrinsic atrial depolarization , an implantable cardiac device usually starts a pvarp window after a vp or ves event . an as event detected outside pvarp can be classified as intrinsic as event , whereas an as event detected inside pvarp can be classified as retrograde as event . however , this simple method often leads to misclassification between intrinsic as and retrograde as . in one example , false classification of retrograde as to intrinsic as may result in pacemaker mediated tachycardia in devices operating in ddd mode . in another example , false classification of intrinsic as to retrograde as may result in delayed or failed mode switch during atrial tachycardia . improved event classification algorithms have been implemented in some implantable cardiac devices . the general concept of these algorithms is that an as event inside the pvarp is likely as an intrinsic p wave if it is followed by a vs event within a predefined time interval , whereas an as event inside the pvarp is suspected as a retrograde as if the interval from vp to as is consistent over multiple cycles . however , the classification accuracy of these algorithms is still limited . to improve the classification accuracy between intrinsic as and retrograde as , the asci - based morphological analysis can be used in implantable cardiac devices . the basic concept is that the normal intrinsic atrial depolarization generally has distinct aegm morphology than that of the retrograde atrial depolarization , due to different atrial activation pathways . preferably , the asci - based morphology analysis is used in conjunction with the time interval analysis for retrograde p wave detection . according to this invention , for an as detected within the pvarp , a first asci value is calculated by comparing the morphology of the corresponding aegm with that of the normal as template . if the obtained first asci value is greater than a predefined threshold ( e . g ., 0 . 5 ), then the two signals are considered to have similar morphology , thus suggesting the event is a normal intrinsic as . otherwise , the two signals are considered to have different morphology . in such a case , a second asci value is calculated by comparing the morphology of the corresponding aegm with that of the retrograde as template . if the obtained second asci value is greater than a predefined threshold ( e . g ., 0 . 5 ), then the two signals are considered to have similar morphology , thus suggesting the event is a retrograde as . otherwise , the two signals are considered to have different morphology . this suggests that the detected as event is neither a normal intrinsic as , nor a retrograde as . this could happen when the detected as event is an aes , which could be confirmed if it is followed by a vs event within a predefined time interval . or this could happen when the detected as event is a far - field sense or a noise sense , and in both cases , the as event is preferably ignored by the device . far - field sensing in implantable cardiac devices can adversely affect arrhythmia detection and therapy . one common problem is the far - field sensing of the ventricular depolarization ( r wave ) in the atrial channel . another common problem is the far - field sensing of the ventricular repolarization ( t wave ) in the atrial channel . in biventricular pacing devices , there are also problems of far - field sensing of right ventricular ( rv ) depolarization or repolarization in the left ventricular ( lv ) channel , or far - field sensing of lv depolarization or repolarization in the rv . to prevent undesirable far - field sensing in one sense channel , a common method is to start a far - field blanking ( ffb ) window in the channel upon delivering a pace or detecting an intrinsic depolarization in other channels . the length of the ffb must be properly adjusted so that on one hand , it can cover the cross - channel far - field signal , while on the other hand , it does not blank the in - channel real activation signal . however , the ffb adjustment may not be always effective . in some circumstances , the far - field signal may fall outside the ffb window , causing false classification of the sense event . in other circumstances , intrinsic depolarization may occur inside the ffb window . this could happen due to extra - systole , or due to sub - threshold pacing in the channel that does not capture the chamber . to improve the classification accuracy of the far - field sense , the asci - based morphological analysis can be used in implantable cardiac devices . the basic concept is that the intrinsic cardiac depolarization generally has distinct iegm morphology than that of the far - field sense signal . preferably , the asci - based morphology analysis is used in conjunction with the time interval analysis for far - field sense classification . according to this invention , for an as detected within the ffb , a first asci value is calculated by comparing the morphology of the corresponding aegm with that of the normal as template . if the obtained first asci value is greater than a predefined threshold ( e . g ., 0 . 5 ), then the two signals are considered to have similar morphology , thus suggesting the event is a normal intrinsic as . otherwise , the two signals are considered to have different morphology . if the far - field as event is not preceded by a vp nor a ves event , no further check of retrograde as is needed . otherwise ( i . e ., the far - field as event is preceded by a vp or a ves event ), a second asci value is calculated by comparing the morphology of the corresponding aegm with that of the retrograde as template . if the obtained second asci value is greater than a predefined threshold ( e . g ., 0 . 5 ), then the two signals are considered to have similar morphology , thus suggesting the event is a retrograde as . otherwise , the two signals are considered to have different morphology . this suggests that the detected as event is neither a normal intrinsic as , nor a retrograde as . this could happen when the detected as event is an aes , which could be confirmed if it is followed by a vs event within a predefined time interval . or this could happen when the detected as event is a far - field sense or a noise sense , and in both cases , the as event is preferably ignored by the device . also according to this invention , a normal rv sense template and a normal lv sense template are respectively constructed and maintained in a biventricular pacing device . for an rv sense detected within the ffb of a preceding lv event , an asci value is calculated by comparing the morphology of the corresponding rv iegm with that of the normal rv sense template . if the obtained asci value is greater than a predefined threshold ( e . g ., 0 . 5 ), then the two signals are considered to have similar morphology , thus suggesting the event is a normal intrinsic rv sense . otherwise , the two signals are considered to have different morphology . this could happen when the detected rv sense event is a ves , or a far - field sense , or a noise sense , and in all these cases , the rv sense event is preferably ignored by the device . evidently , similar event classification can be conducted for an lv sense detected within the ffb of a preceding rv event .
an implantable cardiac device , e . g ., a pacemaker , defibrillator , cardioverter or biventricular pacing device , that can sense cardiac electrical signals and accurately classify the sensed events . the device provides a template signal and a test signal originated from an electrogram . the device further transforms at least the test signal into a representation of the test signal for example in numerical format where the sample values of the test signal take the form of integers . the device further determines a correlation between the template and test signals , and classifies the sense events based on the correlation . the electrogram may be an intracardiac electrogram , atrial electrogram , ventricular electrogram , surface electrocardiogram or subcutaneous electrogram .