Esempio n. 1
0
void NOnlineInfo::ResetAll()
{
	ResetAccount();
	ResetDevice();
	ResetChannels();
	ResetChannelMigration();
	ResetOnline();
	ResetSceneMode();
	ResetMatch();
	ResetURLs();
}
Esempio n. 2
0
int Classify(int *newBeat,int rr, int noiseLevel, int *beatMatch, int *fidAdj,int *QrsOn,int *QrsOff,
	int init)
	{
	int rhythmClass, beatClass, i, beatWidth, blShift ;
	static int morphType, runCount = 0 ;
	double matchIndex, domIndex, mi2 ;
	int shiftAdj ;
	int domType, domWidth, onset, offset, amp ;
	int beatBegin, beatEnd, tempClass ;
	int hfNoise, isoLevel ;
	static int lastIsoLevel=0, lastRhythmClass = UNKNOWN, lastBeatWasNew = 0 ;

	// If initializing...
	
	if(init)
		{
		ResetRhythmChk() ;
		ResetMatch() ;
		ResetPostClassify() ;
		runCount = 0 ;
		DomMonitor(0, 0, 0, 0, 1) ;
		return(0) ;
		}

	hfNoise = HFNoiseCheck(newBeat) ;	// Check for muscle noise.
	rhythmClass = RhythmChk(rr) ;			// Check the rhythm.

	// Estimate beat features.


	AnalyzeBeat(newBeat, &onset, &offset, &isoLevel,
		&beatBegin, &beatEnd, &amp) ;
	
	*QrsOn=onset;
	*QrsOff=offset;

	blShift = abs(lastIsoLevel-isoLevel) ;
	lastIsoLevel = isoLevel ;

	// Make isoelectric level 0.

	for(i = 0; i < BEATLGTH; ++i)
		newBeat[i] -= isoLevel ;

	// If there was a significant baseline shift since
	// the last beat and the last beat was a new type,
	// delete the new type because it might have resulted
	// from a baseline shift.

	if( (blShift > BL_SHIFT_LIMIT)
		&& (lastBeatWasNew == 1)
		&& (lastRhythmClass == NORMAL)
		&& (rhythmClass == NORMAL) )
		ClearLastNewType() ;

	lastBeatWasNew = 0 ;

	// Find the template that best matches this beat.

	BestMorphMatch(newBeat,&morphType,&matchIndex,&mi2,&shiftAdj) ;

	// Disregard noise if the match is good. (New)

	if(matchIndex < MATCH_NOISE_THRESHOLD)
		hfNoise = noiseLevel = blShift = 0 ;

	// Apply a stricter match limit to premature beats.

	if((matchIndex < MATCH_LIMIT) && (rhythmClass == PVC) &&
		MinimumBeatVariation(morphType) && (mi2 > PVC_MATCH_WITH_AMP_LIMIT))
		{
		morphType = NewBeatType(newBeat) ;
		lastBeatWasNew = 1 ;
		}

	// Match if within standard match limits.

	else if((matchIndex < MATCH_LIMIT) && (mi2 <= MATCH_WITH_AMP_LIMIT))
		UpdateBeatType(morphType,newBeat,mi2,shiftAdj) ;

	// If the beat isn't noisy but doesn't match, start a new beat.

	else if((blShift < BL_SHIFT_LIMIT) && (noiseLevel < NEW_TYPE_NOISE_THRESHOLD)
		&& (hfNoise < NEW_TYPE_HF_NOISE_LIMIT))
		{
		morphType = NewBeatType(newBeat) ;
		lastBeatWasNew = 1 ;
		}

	// Even if it is a noisy, start new beat if it was an irregular beat.

	else if((lastRhythmClass != NORMAL) || (rhythmClass != NORMAL))
		{
		morphType = NewBeatType(newBeat) ;
		lastBeatWasNew = 1 ;
		}

	// If its noisy and regular, don't waste space starting a new beat.

	else morphType = MAXTYPES ;

	// Update recent rr and type arrays.

	for(i = 7; i > 0; --i)
		{
		RecentRRs[i] = RecentRRs[i-1] ;
		RecentTypes[i] = RecentTypes[i-1] ;
		}
	RecentRRs[0] = rr ;
	RecentTypes[0] = morphType ;

	lastRhythmClass = rhythmClass ;
	lastIsoLevel = isoLevel ;

	// Fetch beat features needed for classification.
	// Get features from average beat if it matched.

	if(morphType != MAXTYPES)
		{
		beatClass = GetBeatClass(morphType) ;
		beatWidth = GetBeatWidth(morphType) ;
		*fidAdj = GetBeatCenter(morphType)-FIDMARK ;

		// If the width seems large and there have only been a few
		// beats of this type, use the actual beat for width
		// estimate.

		if((beatWidth > offset-onset) && (GetBeatTypeCount(morphType) <= 4))
			{
			beatWidth = offset-onset ;
			*fidAdj = ((offset+onset)/2)-FIDMARK ;
			}
		}

	// If this beat didn't match get beat features directly
	// from this beat.

	else
		{
		beatWidth = offset-onset ;
		beatClass = UNKNOWN ;
		*fidAdj = ((offset+onset)/2)-FIDMARK ;
		}

	// Fetch dominant type beat features.

	DomType = domType = DomMonitor(morphType, rhythmClass, beatWidth, rr, 0) ;
	domWidth = GetBeatWidth(domType) ;

	// Compare the beat type, or actual beat to the dominant beat.

	if((morphType != domType) && (morphType != 8))
		domIndex = DomCompare(morphType,domType) ;
	else if(morphType == 8)
		domIndex = DomCompare2(newBeat,domType) ;
	else domIndex = matchIndex ;

	// Update post classificaton of the previous beat.

	PostClassify(RecentTypes, domType, RecentRRs, beatWidth, domIndex, rhythmClass) ;

	// Classify regardless of how the morphology
	// was previously classified.

	tempClass = TempClass(rhythmClass, morphType, beatWidth, domWidth,
		domType, hfNoise, noiseLevel, blShift, domIndex) ;

	// If this morphology has not been classified yet, attempt to classify
	// it.

	if((beatClass == UNKNOWN) && (morphType < MAXTYPES))
		{

		// Classify as normal if there are 6 in a row
		// or at least two in a row that meet rhythm
		// rules for normal.

		runCount = GetRunCount() ;

		// Classify a morphology as NORMAL if it is not too wide, and there
		// are three in a row.  The width criterion prevents ventricular beats
		// from being classified as normal during VTACH (MIT/BIH 205).

		if((runCount >= 3) && (domType != -1) && (beatWidth < domWidth+BEAT_MS20))
			SetBeatClass(morphType,NORMAL) ;

		// If there is no dominant type established yet, classify any type
		// with six in a row as NORMAL.

		else if((runCount >= 6) && (domType == -1))
			SetBeatClass(morphType,NORMAL) ;

		// During bigeminy, classify the premature beats as ventricular if
		// they are not too narrow.

		else if(IsBigeminy() == 1)
			{
			if((rhythmClass == PVC) && (beatWidth > BEAT_MS100))
				SetBeatClass(morphType,PVC) ;
			else if(rhythmClass == NORMAL)
				SetBeatClass(morphType,NORMAL) ;
			}
		}

	// Save morphology type of this beat for next classification.

	*beatMatch = morphType ;

	beatClass = GetBeatClass(morphType) ;
   
	// If the morphology has been previously classified.
	// use that classification.
  //	return(rhythmClass) ;

	if(beatClass != UNKNOWN)
		return(beatClass) ;

	if(CheckPostClass(morphType) == PVC)
		return(PVC) ;

	// Otherwise use the temporary classification.

	return(tempClass) ;
	}