标题:请高手看一下,关于C#绘制心电图
取消只看楼主
spawn555
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-5-30
结帖率:0
已结贴  问题点数:20 回复次数:0 
请高手看一下,关于C#绘制心电图
我需要实现读取心电数据(.ecg格式,二进制文件),然后每读16位转成十进制存到一个short型的数组中(关于数据说一下,我要显示30秒的动态波形,每一秒有360个点,一个十进制数据代表一个点的纵坐标的值,也就是说要绘360*30个点),将这些点连接起来就是那条动态曲线。以下是我根据别人的代码修改过的,但是波形不动,请各位牛人帮我看一下,我在这里不胜感激!(网格部分无所谓,主要是波形)
namespace WindowsFormsApplication4
{
     public partial class Form8 : Form
     {
         public Form8()
         {
             InitializeComponent();
         }


         int 网格间距 = 12; //网格间距
         int 网格偏移 = 0;    //网格偏移
         Pen 网格颜色 = new Pen(Color.FromArgb(0x00, 0x80, 0x40));
         Pen 曲线颜色 = new Pen(Color.Lime);
        private void Form8_Paint(object sender, PaintEventArgs e)
         {
             short[] data = new short[10800];
             FileStream fs = new FileStream("c://a.ecg", FileMode.Open);
             BinaryReader r = new BinaryReader(fs);
             for (int i = 0; i < 10800; i++)
             {
                 data[i] = r.ReadInt16();
             }
             fs.Close();
            
             e.Graphics.FillRectangle(Brushes.Black, 0,0,800,640);
             for (int i = 800 - 网格偏移; i >= 0; i -= 网格间距)
                 e.Graphics.DrawLine(网格颜色, i, 0, i, 640);
             //绘制横线
             for (int i = 640; i >= 0; i -= 网格间距)
                 e.Graphics.DrawLine(网格颜色, 0, i, 800, i);
           
             short First = data[10800 - 1];
             for (int i = 10800 - 2; i >= 0; i--)
             {
                 short Second = data[i];

                 e.Graphics.DrawLine(曲线颜色,
                     800 - (10800 - i), First / 3,
                     800 - (10800 - i) - 1, Second / 3);

                 First = Second;
             }
         }

         private void Form8_Load(object sender, EventArgs e)
         {
             DoubleBuffered = true;
             this.timer1.Interval = 100;
             this.timer1.Start();
         }

         private void timer1_Tick(object sender, EventArgs e)
         {
             网格偏移 = (网格偏移 + 1) % 网格间距;
             Invalidate();
         }
        private void Form8_Resize(object sender, EventArgs e)
         {
              Invalidate();
         }
     }
}
我怀疑是不是private void timer_Tick这里少点东西??
搜索更多相关主题的帖子: 不胜感激 心电图 二进制 十进制 
2011-05-30 19:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-341440-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042728 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved