[译]Windows XP的ECG(将数据导出到TXT文件)
By robot-v1.0
本文链接 https://www.kyfws.com/applications/ecg-for-windows-xp-export-data-to-txt-files-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 9 分钟阅读 - 4103 个词 阅读量 0[译]Windows XP的ECG(将数据导出到TXT文件)
原文地址:https://www.codeproject.com/Articles/8095/ECG-for-Windows-XP-Export-data-to-TXT-files
原文作者:Georgi Petrov
译文由本站 robot-v1.0 翻译
前言
This is ECG_1.1 project version. Now the program can save medical records in to TXT files and can run on Windows XP.
这是ECG_1.1项目版本.现在,该程序可以将医疗记录保存到TXT文件中,并且可以在Windows XP上运行.
- 下载数据文件(数据文件是EEG记录,而不是ECG)-1.02 MB(Download data file (data file is an EEG record, not ECG) - 1.02 MB)
- 下载源代码99.8 Kb(Download source code - 99.8 Kb)
- 下载演示项目-58.8 Kb(Download demo project - 58.8 Kb)
介绍(Introduction)
最终,我找到了一些空闲时间来使ECG_1更加有用.因此,现在,ECG_1应用程序正在Windows NT,XP和2000操作系统上运行,并且可以实时收集数据.为此,您必须下载并安装免费驱动程序才能进行低级进/出端口访问.但是功能是预定义的.因为这不是最终版本,所以我推荐给需要将医疗记录中的数据转换为TXT格式的朋友.(Finally I found some free time to make ECG_1 more useful. So now, ECG_1 application is running on Windows NT, XP, and 2000 operating systems, and can collect data in real time. To accomplish this, you must download and install free driver for low level in/out ports access. But functions are predefined. Because this is not the end version, I made it for friends who have to convert data from medical records in to TXT format.)
而且,走吧…如果您有任何疑问,请参阅我的第一篇文章,(And, let’s go… If you have questions, refer to my first article,) 心电图记录,存储,过滤和识别(ECG recording, storing, filtering and recognition) .(.)
新功能包括:具有将数据存储在TXT文件中的功能的drvECG_1.dll和ECG_1.exe.首先下载并编译源文件,或者只是下载一个演示项目.要运行NT Windows支持,您首先需要下载"(The new things are: drvECG_1.dll and ECG_1.exe with capabilities to store data in a TXT file. First download and compile source files, or just download a demo project. To run NT Windows support you will need first to download a “)用于Win95和WinNT的DriverLINX端口I/O驱动程序(DriverLINX Port I/O Driver for Win95 and WinNT)" –它是免费的,可以在注册后完成(” – it is free, and can be done after a registration) 这里(here) .(.)
之后,您可能需要安装驱动程序,只需单击刚刚下载的文件即可.将来,我计划构建自己的驱动程序,但目前,该驱动程序运行良好.按照说明进行操作,并单击"下一步"按钮确认安装.(After this, you may need to install the driver, simply click on just downloaded file. In future I’m planning to build my own driver, but for this moment this one works well. Follow the instructions and confirm installation by clicking on Next button.)
不要更改任何内容,只需单击"下一步".(Do not change anything, just click Next.)
安装端口访问驱动程序后,您需要重新启动PC,这将自动完成.重新启动PC后,您可以通过单击ECG_1应用程序的图标-(After installing the port access driver, you need to restart the PC, this will be done automatically. After restarting the PC, you can start ECG_1 application by clicking on its icon -)ECG_1.exe(ECG_1.exe).(.)
要使用该程序,您可能需要打开包含数据的文件.因此,请使用下载链接获取(To use the program, you may need to open files with data. So use the download link to get an)*数据心电图(data.ecg)*文件.之后,使用菜单File-> Open打开打开的文件名对话框.(file. After this, use the menu File->Open to open the open file name dialog.)
选择一个文件(Select a file)*数据心电图(data.ecg)*然后单击确定或打开.此后,将要求您确认记录,因此执行此操作.(and click OK or Open. After this, you will be asked to confirm the record, so do this.)
完成此操作后,(After this operation, the)*数据心电图(data.ecg)*文件将被打开,您可以在记录内移动:(file will be opened and you can move inside the records:)
要将所有记录保存为TXT格式,您需要使用:File-> ExportData-> Export All Records to TXT,或者如果您仅要将所选记录导出到TXT文件,请使用:File-> ExportData-> Export Current Record.到TXT.(To save all records in to TXT format you need to use: File->ExportData->Export All Records to TXT, or if you want to export only the selected record to TXT file, use: File->ExportData->Export Current Record to TXT.)
如果您使用"导出当前记录",程序将为您显示所选记录的确切编号,因此请单击"确定".(If you use Export Current Record, the program will show you the exact number of the selected records, so click OK.)
之后,将打开"保存文件"对话框,要求您指定硬盘上的文件名和位置.(After this, Save File dialog will be opened to ask you to specify the file name and location on the HDD.)
因此,编写一个测试文件名,然后单击"确定"将当前记录或所有记录保存到TXT文件中.记录中每个点之间的分隔符为"; “.打开TXT文件时请注意这一点.现在,您可以打开刚刚保存的TXT文件以在其中查看(So write a test file name and click OK to save the current record, or all the records to a TXT file. The separator between each point in the record is “ ; ”. Note this when opening TXT file. Now you can open the just saved TXT file to view it in)记事本(notepad).(.)
您会看到分隔符–"; “.(You can see the separators – “ ; “.)
现在,要使用Microsoft Excel程序中的数据对它执行一些额外的计算,请打开MS Excel程序,然后单击"文件”->“打开”,然后选择刚刚保存的(Now to use your data in Microsoft Excel program to perform some extra calculations on it, open MS Excel program and click on File->Open and select your just saved)*test.txt(test.txt)*来自ECG_1程序的数据文件,并跟随图片.因为此TXT是文本文件,并且MS Excel不直接支持此类文件.您可能需要在"打开文件"对话框中指定需要查看所有文件,因此请执行此操作.之后,在刚保存的硬盘上查找(data file from ECG_1 program and follow the pictures. Because this TXT is a text file, and MS Excel does not support such files directly. You may need to specify in the Open File dialog that you need to see all files, so do it. After this, find on your HDD just saved)*data.txt(data.txt)*文件,然后单击打开.(file and click Open.)
您需要执行一些步骤以将TXT文件容纳到Excel文件中.因此,在上方的屏幕上单击"确定”.(You need to go on a little procedure to accommodate TXT file in to Excel file. So click OK on the upper screen.)
检查定界符属性,然后单击下一步按钮.(Check the Delimiter properties and click Next button.)
选择复选框其他,然后在输入字段中输入";". “.单击完成以完成该过程.(Select the check box Other and in the input field write a “ ; “. Click Finish to accomplish the procedure.)
现在,您的Excel将只包含一行值.要从中绘制图表,请进入"插入"菜单,然后选择"图表”.(Now your Excel will contain a single row of values. To make a graph from them go in the Insert Menu and select Chart.)
选择上图所示的图表类型,然后您需要单击下一步并指定要绘制的数据.(Select chart type as it is shown on the upper picture, then you will need to click next and specify the data to draw.)
为此,请在数据范围字段中单击一个图块,然后在第1行之前单击以选择第一行中的所有记录.单击完成.(To do this, click one tile in the data range field, and after this, click before row 1 to select all records in the first row. Click Finish.)
现在,您可以对文件进行其他计算.由于Excel不支持较大的数据字段,因此您可能需要使用Math Cad将TXT数据用于其他计算.我现在不讨论这个.但是尝试一下.现在是时候编写一些代码了.要查看完整的解释,请在ECG_1代码上搜索我在CodeProject中的第一篇文章.在ECG_1中,我添加了一些新功能来支持(Now you can make additional calculations on your file. Because Excel do not support larger data fields, you may need to use Math Cad to use TXT data for additional calculations. I’m not going to discuss this now. But try it. Now is time for some code. To see the full explanations, on ECG_1 code search for my first article in CodeProject. In ECG_1, I added some new functions to support)*数据(data.TXT)*文件保存.(file saving.)
//This function takes CString as a file name - "C:/mydocuments/data.ecg"
void CECG_Data::SaveDataTXT(CString File_Name)
{
CFile sFile(File_Name,CFile::modeCreate|CFile::modeWrite);
CArchive dArchive(&sFile,CArchive::store);
//Serialize the arrays
Serialize_DATA_TXT(&dArchive);
}
此函数使用创建的下一个函数进行转换(This function uses the next one function which is created to make the conversion to) CString
从(from) CWordArray DATA
用于的数组(array that is used in)*心电图程序(ECG.exe)*存储病历数据.(to store the medical records data.)
void CECG_Data::Serialize_DATA_TXT(CArchive *ar)
{
int i=0;
CString str;
CString stmp;
DATA_TXT.RemoveAll();
//This string is addet to te begining of the
//TXT file so to know what is the exact data in
//this file if someone else open the txt file.
str = "Start from ECG_1 data file;";
//Now we go through the loop to convert
//each one CWordArray DATA value
//in int variable.
for(int j=0;j<DATA.GetSize();j++)
{
stmp.Empty();
char ch[5];
i = int(short(DATA.GetAt(j)));
//This function converts an integer to a char array
_itoa(i, ch, 10 );
for(int k=0;k<4;k++)
{
//To fit each one char value in a
//CString variable we make a
//short loop across char array
stmp = stmp + ch[k];
}
//Current value is set in to a char array and
//now we can add a separator - " ; "
stmp = stmp + ";";
//befor the end we add the stmp CString value
//in the end aff str array
str = str + stmp;
}
//because DATA_TXT is a CStringArray, I use this to make
//easy serializing the txt data
DATA_TXT.Add(str);
//DATA_TXT is Serialized and saved in to a TXT file
DATA_TXT.Serialize(*ar);
}
**重要:(Important:)**此循环可能需要很多时间!(This loop can take a lot of time!)
这个转换(This one converts) CWordArray DATA
排列成一个(array into one) CStringArray DATA_TXT
数组.我正在使用(array. I’m using) CStringArray
而不是一个(instead of a single) CString
变量,因为它不支持(variable, because it doesn’t support) Serialize
直接起作用但是(function directly but) CStringArray
支持它.一项附加功能是:(support it. One additional function is:)
void CECG_Data::SaveCurDataRecTXT(CString File_Name)
{
CFile sFile(File_Name,CFile::modeCreate|CFile::modeWrite);
CArchive dArchive(&sFile,CArchive::store);
//Serialize the arrays
Serialize_Cor_DATA_TXT(&dArchive);
}
它仅保存选定的记录!但是在使用它之前,我们在数据字段中设置了当前位置-选定的记录.(It saves the selected records only! But before using it, we set the current position in the data field – selected record.)
void CECG_Data::SetCurSaveTXTPos(int pos)
{
//sets the current record number
save_to_txt_cur_rec_pos = pos;
}
现在我们可以将数据序列化为TXT格式.此功能仅将选定的病历保存到TXT文件中,因此所需时间比上一个要短得多.(Now we can serialize data in to TXT format. This function saves only the selected medical records into TXT file, so it takes much shorter time than the upper one.)
void CECG_Data::Serialize_Cor_DATA_TXT(CArchive *dArchive)
{
//Saves only selected data in a TXT file
if(save_to_txt_cur_rec_pos+2500<=GetAllDataLenght())
{
int i=0;
CString str;
CString stmp;
DATA_TXT.RemoveAll();
str = "Start from ECG_1 data file;";
for(int j=save_to_txt_cur_rec_pos;j<
save_to_txt_cur_rec_pos+2500;j++)
{
stmp.Empty();
char ch[5];
i = int(short(DATA.GetAt(j)));
_itoa(i, ch, 10 );
for(int k=0;k<4;k++)
{
stmp = stmp + ch[k];
}
stmp = stmp + ";";
str = str + stmp;
}
DATA_TXT.Add(str);
DATA_TXT.Serialize(*dArchive);
}
else
MessageBox(NULL,"Selected record to save out of data lenth.",
NULL,MB_OK);
}
计算TXT文件需要花费很多时间,因此我在(Calculations on TXT files take a lot of time, so I made this feature in)心电图程序(ECG.exe)可以在Mat Lab,Mat Cad,Excel和您可能每天使用的其他程序中使用我的数据文件,从而为某些人提供支持.但是我认为txt文件不是存储数据的好选择.许多程序都提供了此功能,我发现在(to support some of you with the ability to use my data files in Mat Lab, Mat Cad, Excel and other programs that you may use every day. But my opinion is that txt files are not a good choice for storing data. Many programs offer this capabilities and I found it useful to make this feature in)心电图程序(ECG.exe).(.)
历史(History)
- 2004年1月1日(01.09.2004)我在中添加了一些有用的功能(I added some useful features in)心电图程序(ECG.exe),现在您可以看到信号频谱.为此,请使用复选框(FFT),请参见下图.(, so now you can see signal spectrum. To do this, use check box (FFT) see the picture below.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 Windows WinXP Visual-Studio Dev 新闻 翻译