java心电图心率计算_java如何画心电图?

这篇博客介绍了如何使用Java来绘制心电图并进行心率计算。通过示例代码展示了如何读取数据文件,然后利用Graphics类和Pen对象在pictureBox1组件上绘制心电图线条。代码中使用了BinaryReader读取二进制文件,并将数据转换为图形坐标进行绘制。
摘要由CSDN通过智能技术生成

匿名用户

1级

2016-10-08 回答

电数据图的代码:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Net;

using System.Net.Sockets;

using System.IO;

using System.Threading;

using System.Globalization;

using Server;

using ZedGraph;

namespace Server

{

public partial class Pic : Form

{

public Pic()

{

InitializeComponent();

//this.Size = new System.Drawing.Size(700,500);

this.AutoScrollMinSize = new Size(700, 500);//设置自动滚动的最小尺寸

}

public string OpenFilePath;

private void Pic_Load(object sender, EventArgs e)

{

// panel1.Width = 900;

// panel1.Height =500;

pictureBox1.Width =1440;

pictureBox1.Height =600;

// pictureBox1.Location = new Point(0, 0);

}

private void button1_Click(object sender, EventArgs e)

{

Graphics g = pictureBox1.CreateGraphics();

g.ScaleTransform(1.0f,-1.0f); //翻转函数(所有 Y轴的方面 记得 加负号)

Pen pen = new Pen(Color.Red);

byte[] rdata = new byte[2048];//设置2k的读取缓冲区

Stream stream = File.OpenRead(OpenFilePath);//流文件实例

BinaryReader bread = new BinaryReader(stream);//读取文件

bread.Read(rdata, 0, 1440);//读出的是10进制数据

bread.Close();

PointF[] pY = new PointF[1440];

PointF[] pL = new PointF[1440];

PointF pt;

for (int i = 0; i <1440; i++)

{

//pY[i] = new PointF(i , rdata[i]/10f+200);

pL[i] = new PointF(i, -200);

float fx = (float ) i;

float fy = (float ) rdata[i];

pt = new PointF(fx, fy-400);

pY[i] = pt;

}

g.DrawLines(pen,pY);

g.DrawLines(pen, pL);

g.Dispose();

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值