⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scp-decode.cpp

📁 BIOSIG is an open source software library for biomedical signal processing. Library works well with
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	fgetpos(in,&filepos);
	des.acquiring.serial_number_device=FindString(dim-filepos COMPAT);
	if ((des.acquiring.protocol_revision_number==10) || (des.acquiring.protocol_revision_number==11))
													 // by E.C. may 2004 CARDIOLINE 1.0 & ESAOTE 1.1
		fseek(in,filepos_iniz COMPAT +dim_to_skip,0);   //  reposition file pointer
	else {
		fgetpos(in,&filepos);
		des.acquiring.device_system_software=FindString(dim-filepos COMPAT);
		fgetpos(in,&filepos);
		des.acquiring.device_SCP_implementation_software=FindString(dim-filepos COMPAT);
		fgetpos(in,&filepos);
		des.acquiring.manifacturer_trade_name=FindString(dim-filepos COMPAT);
	}
}//end section_1_14

void section_1_15(descriptive &des)
// section 1 tag 15
{
	U_int_M dim;
	U_int_S i, mask, code_;
	int_M pos;
	fpos_t filepos;

	ReadByte(dim);
	fgetpos(in,&filepos);
	dim+=filepos COMPAT;
	ReadByte(des.analyzing.institution_number);
	ReadByte(des.analyzing.department_number);
	ReadByte(des.analyzing.ID);
	ReadByte(des.analyzing.type);
	if(des.analyzing.type>1)
		des.analyzing.type=2;
	ReadByte(des.analyzing.manifacturer);
	if(des.analyzing.manifacturer>20 && des.analyzing.manifacturer!=255)
		des.analyzing.manifacturer=0;
	des.analyzing.model_description=ReadString(des.analyzing.model_description=NULL,6);
	ReadByte(des.analyzing.protocol_revision_number);
	ReadByte(des.analyzing.category);
	pos=Look(compatibility,0,3,des.analyzing.category);
	if(pos<0)
		pos=4;
	des.analyzing.category=pos;
	ReadByte(code_);
	if(code_<128U)
		pos=0;
	else if((code_<192U) && (code_>=128U))
		pos=1;
	else
	{
		pos=Look(language_code,2,15,code_);
		if(pos<0)
			pos=16;
	}
	des.analyzing.language=pos;
	ReadByte(code_);
	mask=0x10;
	for(i=0;i<4;i++)
	{
		if(code_&mask)
			des.analyzing.capability[i]=i+4;
		else
			des.analyzing.capability[i]=i;
		mask<<=1;
	}
	ReadByte(des.analyzing.AC);
	if(des.analyzing.AC>2)
		des.analyzing.AC=0;
	Skip(16);
	des.analyzing.analysing_program_revision_number="\0";
	des.analyzing.serial_number_device="\0";
	des.analyzing.device_system_software="\0";
	des.analyzing.device_SCP_implementation_software="\0";
	des.analyzing.manifacturer_trade_name="\0";

	ReadByte(i);
	if(!i)
		des.analyzing.analysing_program_revision_number="\0";
	else
		des.analyzing.analysing_program_revision_number=ReadString(des.analyzing.analysing_program_revision_number=NULL,i);

	fgetpos(in,&filepos);
	des.analyzing.serial_number_device=FindString(dim-filepos COMPAT);
	fgetpos(in,&filepos);
	des.analyzing.device_system_software=FindString(dim-filepos COMPAT);
	fgetpos(in,&filepos);
	des.analyzing.device_SCP_implementation_software=FindString(dim-filepos COMPAT);
	fgetpos(in,&filepos);
	des.analyzing.manifacturer_trade_name=FindString(dim-filepos COMPAT);
}//end section_1_15

void section_1_16(descriptive &des)
// section 1 tag 16
{
	U_int_M dim;

	ReadByte(dim);
	des.acquiring_institution=ReadString(des.acquiring_institution=NULL,dim);
}//end section_1_16

void section_1_17(descriptive &des)
// section 1 tag 17
{
	U_int_M dim;

	ReadByte(dim);
	des.analyzing_institution=ReadString(des.analyzing_institution=NULL,dim);
}//end section_1_17

void section_1_18(descriptive &des)
// section 1 tag 18
{
	U_int_M dim;

	ReadByte(dim);
	des.acquiring_department=ReadString(des.acquiring_department=NULL,dim);
}//end section_1_18

void section_1_19(descriptive &des)
// section 1 tag 19
{
	U_int_M dim;

	ReadByte(dim);
	des.analyzing_department=ReadString(des.analyzing_department=NULL,dim);
}//end section_1_19

void section_1_20(clinic &cli)
// section 1 tag 20
{
	U_int_M dim;

	ReadByte(dim);
	cli.referring_physician=ReadString(cli.referring_physician=NULL,dim);
}//end section_1_20

void section_1_21(clinic &cli)
// section 1 tag 21
{
	U_int_M dim;

	ReadByte(dim);
	cli.latest_confirming_physician=ReadString(cli.latest_confirming_physician=NULL,dim);
}//end section_1_21

void section_1_22(clinic &cli)
// section 1 tag 22
{
	U_int_M dim;

	ReadByte(dim);
	cli.technician_description=ReadString(cli.technician_description=NULL,dim);
}//end section_1_22

void section_1_23(descriptive &des)
// section 1 tag 23
{
	U_int_M dim;

	ReadByte(dim);
	des.room=ReadString(des.room=NULL,dim);
}//end section_1_23

void section_1_24(descriptive &des)
// section 1 tag 24
{
	U_int_M dim;

	ReadByte(dim);
	ReadByte(des.stat_code);
}//end section_1_24

void section_1_25(device &dev)
// section 1 tag 25
{
	U_int_M dim;
	char data[18], temp[18];
	U_int_S m, g, num;
	U_int_M a;

	ReadByte(dim);
	ReadByte(a);
	ReadByte(m);
	ReadByte(g);
	ultoa(g,data,10);
	strcat(data,_month[m].sentence);
	ultoa(a,temp,10);
	strcat(data,temp);
	num=strlen(data);                                               // by E.C. may 2004
	if(num!=0 && (dev.date_acquisition=(char*)mymalloc(num+1))==NULL)
	{
		fprintf(stderr,"Not enough memory");  // no, exit //
		exit(2);
	}
	strcpy(dev.date_acquisition,data);

        struct tm tmf;                      // by E.C. feb 2006
        tmf.tm_year = a - 1900;
        tmf.tm_mon  = m - 1;
        tmf.tm_mday = g;
        tmf.tm_hour = 0;
        tmf.tm_min  = 0;
        tmf.tm_sec  = 0;
        tmf.tm_isdst = 0;
        dev.date_acquisition2 = mktime(&tmf);    // store date in native format

}//end section_1_25

void section_1_26(device &dev)
// section 1 tag 26
{
	U_int_M dim;
	char hour[9], temp[9];
	U_int_S h, m, s, num;

	ReadByte(dim);
	ReadByte(h);
	ReadByte(m);
	ReadByte(s);
	ultoa(h,hour,10);
	strcat(hour,":");
	ultoa(m,temp,10);
	strcat(hour,temp);
	strcat(hour,":");
	ultoa(s,temp,10);
	strcat(hour,temp);
	num=strlen(hour);                                               // by E.C. may 2004
	if(num!=0 && (dev.time_acquisition=(char*)mymalloc(num+1))==NULL)
	{
		fprintf(stderr,"Not enough memory");  // no, exit //
		exit(2);
	}
	strcpy(dev.time_acquisition,hour);
        dev.time_acquisition2 = (time_t) (s + m*(60 + h*24));   // by E.C. feb 2006 time in seconds
}//end section_1_26

void section_1_27(device &dev)
// section 1 tag 27
{
	U_int_M dim;

	ReadByte(dim);
	ReadByte(dev.baseline_filter);
}//end section_1_27

void section_1_28(device &dev)
// section 1 tag 28
{
	U_int_M dim;

	ReadByte(dim);
	ReadByte(dev.lowpass_filter);
}//end section_1_28

void section_1_29(device &dev)
// section 1 tag 29
{
	U_int_M dim;
	U_int_S mask=0x1, val, i, max=4, ris=0;

	ReadByte(dim);
	ReadByte(val);
	for(i=0;i<max;i++)
	{
		if(val&mask)
			dev.other_filter[i]=i+1;
		else
			dev.other_filter[i]=0;
		ris|=val&mask;
		mask<<=1;
	}
	int w=dim;
	while (--w) ReadByte(val);        // by E.C. may 2004 CARDIOLINE 1.0
}//end section_1_29

void section_1_30(clinic &cli, U_int_M &dim)
// section 1 tag 30
{
	U_int_M val;
	char *temp_string, *pos_char;

	ReadByte(val);
	if(val)
	{
		if((cli.free_text=(numeric*)realloc(cli.free_text,sizeof(numeric)*(cli.number_text+1)))==NULL)
		{
			fprintf(stderr,"Not enough memory");  // no, exit //
			exit(2);
		}
		cli.free_text[cli.number_text].unit=cli.number_text+1;
		cli.free_text[cli.number_text].value=val;
		temp_string=ReadString(temp_string=NULL,cli.free_text[cli.number_text].value);
		strcat(temp_string,STR_END);
		dim+=strlen(temp_string);
		if((cli.text_free_text=(char*)realloc(cli.text_free_text,dim+1))==NULL)
		{
			fprintf(stderr,"Not enough memory");  // no, exit //
			exit(2);
		}
		pos_char=cli.text_free_text;
		pos_char+=dim-strlen(temp_string);
		strcpy(pos_char,temp_string);
		free(temp_string);
		cli.number_text++;
	}
}//end section_1_30

void section_1_31(device &dev)
// section 1 tag 31
{
	U_int_M dim;

	ReadByte(dim);
	if(dim)
		dev.sequence_number=ReadString(dev.sequence_number=NULL,dim);
	else
		dev.sequence_number=STR_NULL;
}//end section_1_31

void section_1_32(clinic &cli, U_int_M &dim, int_S version)
// section 1 tag 32
{
	U_int_M val;
	U_int_S pos;
	int_M ris;

	ReadByte(val);
	if(val)
	{
		dim+=val;
		//first byte designates the Diagnostic Code Table which is applied; if 0 then the codes used are documented in the standard book.
		// second byte is the code
		if((cli.medical_hystory=(numeric*)realloc(cli.medical_hystory,sizeof(numeric)*(cli.number_hystory+1)))==NULL)
		{
			fprintf(stderr,"Not enough memory");  // no, exit //
			exit(2);
		}
		ReadByte(pos);
		cli.medical_hystory[cli.number_hystory].value=pos;
		if (version != 10) {
			ReadByte(pos);                 // 1 byte vers. 1.0; 2 byte vers. 2.0 by E.C. may 2004
			ris=Look(_hystory,0,26,pos);
			if(ris<0)
				pos=26;
			else
				pos=ris;
			cli.medical_hystory[cli.number_hystory].unit=pos;
		}
		cli.number_hystory++;
	}
}//end section_1_32

void section_1_33(device &dev)
// section 1 tag 33
{
	U_int_M dim;
	U_int_S pos;

	ReadByte(dim);
	ReadByte(pos);
	if(pos>6)
		pos=0;
	dev.electrode_configuration.value=pos;

	ReadByte(pos);
	if(pos>6)
		pos=0;
	dev.electrode_configuration.unit=pos;
}//end section_1_33

void section_1_34(device &dev)
// section 1 tag 34
{
	U_int_M dim;

	ReadByte(dim);
	ReadByte(dev.TZ.offset); //complemented if negative
	ReadByte(dev.TZ.index);
	if(dim-4)
		dev.TZ.description=FindString(dim-4);
	else
		dev.TZ.description="-";
}//end section_1_34

void section_1_35(clinic &cli, U_int_M &dim)
// section 1 tag 35
{
	U_int_M val;
	char *temp_string, *pos_char;

	ReadByte(val);
	if(val)
	{
		if((cli.free_medical_hystory=(numeric*)realloc(cli.free_medical_hystory,sizeof(numeric)*(cli.number_free_hystory+1)))==NULL)
		{
			fprintf(stderr,"Not enough memory");  // no, exit //
			exit(2);
		}
		cli.free_medical_hystory[cli.number_free_hystory].unit=cli.number_free_hystory+1;
		cli.free_medical_hystory[cli.number_free_hystory].value=val;
		temp_string=ReadString(temp_string=NULL,cli.free_medical_hystory[cli.number_free_hystory].value);
		strcat(temp_string,STR_END);
		dim+=strlen(temp_string);
		if((cli.text_free_medical_hystory=(char*)realloc(cli.text_free_medical_hystory,dim+1))==NULL)
		{
			fprintf(stderr,"Not enough memory");  // no, exit //
			exit(2);
		}
		pos_char=cli.text_free_medical_hystory;
		pos_char+=dim-strlen(temp_string);
		strcpy(pos_char,temp_string);
		free(temp_string);
		cli.number_free_hystory++;
	}
}//end section_1_35

void section_1_()
// section 1 tag 36..254 are manufacturer specifics and are not utilized
{
	U_int_M dim;

	ReadByte(dim);
	Skip(dim);
}//end section_1_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -