Click here to Skip to main content
15,884,472 members
Articles / Programming Languages / C++

ECG recording, storing, filtering and recognition

Rate me:
Please Sign up or sign in to vote.
4.72/5 (110 votes)
14 Apr 200411 min read 729.5K   38.4K   156  
Full open code project for making driver and application software for ECG medical measurements.
// ArrayMormalization.cpp: implementation of the ArrayMormalization class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ECG_1.h"
#include "ArrayNormalization.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

ArrayNormalization::ArrayNormalization()
{

}

ArrayNormalization::~ArrayNormalization()
{

}

void ArrayNormalization::SetArrToNormalize(double *dest, unsigned short *source, int lenght)
{
	double mean=0;
	mean = CalcMean(source,lenght);
	CalcNormalArray(dest,source,lenght,mean);	
}

double ArrayNormalization::CalcMean(unsigned short *source,int lenght)
{
	//Calculate the mean on a specific lenght of
	//unsugned short array and return it
	int MEAN=0;
	for(int i=0;i<4000;i++)
	{
		MEAN = MEAN + *(source+i);
	}
	MEAN = MEAN/4000;
	CString str;
	str.Format("%d",MEAN);
//	MessageBox(NULL,str,"MEAN",MB_OK);
	return MEAN;
}

void ArrayNormalization::CalcNormalArray(double *dest, unsigned short *source, int lenght, double mean)
{
	//Make the signal to be like diferential +-
	//Store it in to a dest array
	for(int i=0;i<lenght;i++)
	{
	*(dest+i)= double(*(source+i));
	/*	if(*(source+i)>mean)
			*(dest+i) = double(*(source+i)) - mean;

		if(*(source+i)==mean)
			*(dest+i) = 0;
		
		if(*(source+i)<mean)
			*(dest+i) = mean - double(*(source+i));
*/	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Systems Engineer
Bulgaria Bulgaria
PhD, Cum Laude in digital automation systems
M.S. in Telemommunication management
B.S. in Telecommunication systems engineering
Programming: CUDA, C/C++, VHDL
Software and Hardware development and consulting:
data acquisition, image processing, medical instrumentation

Comments and Discussions