在Android应用心电图波形 [英] ECG wave form in android application

查看:676
本文介绍了在Android应用心电图波形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作涉及的Andr​​oid手机上使用ECG信号的一个项目。

I am currently working on a project that involves the use of ECG signals on an android mobile phone.

我决定我是否应该作出自己的信号处理库,用于Android或不是因为我似乎无法找到任何线上。

I am deciding if I should make my own signal processing library for android or not because I can't seem to find any online.

有谁知道我可以使用或会更容易,更快地使库我自己?

Does anybody know of a library that I can use or would it be easier and faster to make my own?

感谢

推荐答案

我用AndroidPlot在实时绘制心电图信号。我所使用的传感器是4导联心电图它可以通过蓝牙提供RL和LL。下面是绘制样品,但随意对其进行修改您的需要。而如果最近AndroidPlot不支持任何的此处使用请查询它,并改变它的方法。最后这个方法是不是有效的,因为,它一直重绘情节,我相信AndroidPlot支持新版本更好地执行:

I used AndroidPlot for plotting ECG signals in real-time. The sensors I used was a 4 lead ECG which could provide RL and LL through Bluetooth. Here's the sample for the plotting but, feel free to modify it to your need. And if the recent AndroidPlot doesn't support any of the methods used here please research it and change it. And finally this method is not efficient since, it keeps redrawing plot, I believe AndroidPlot supports better implementation in new versions :

这是你如何定义XML中的情节:

This is how you define the plot in XML:

<com.androidplot.xy.XYPlot
android:id="@+id/ecgSPlot"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
title="ECG History" /> 

这是code阴谋吧:

And this is the code to plot it:

 public static XYPlot ecgHistoryPlot = null; 
 public static SimpleXYSeries ecgLevelsSeries = new SimpleXYSeries( 
        "ECG History");

private static LinkedList<Integer> ecgRaLlHistory = new LinkedList<Integer>(); 
private static LinkedList<Integer> ecgLaLlHistory = new LinkedList<Integer>(); 

/**
 * This method will set plot paramaters including look and label 
 */
private void setMergedPlotParam() { 
    ecgHistoryPlot = (XYPlot) viewRTPlotting.findViewById(R.id.ecgSPlot); 
    ecgHistoryPlot 
        .setRangeBoundaries(-180, 359, XYPlot.BoundaryMode.FIXED); 
    ecgHistoryPlot.setDomainBoundaries(0, 60, XYPlot.BoundaryMode.FIXED); 
    ecgHistoryPlot.addSeries(ecgRaLlHistorySeries, 
        LineAndPointRenderer.class, 
        new LineAndPointFormatter(Color.rgb(0, 0, 255), Color.BLACK)); 

    ecgHistoryPlot.addSeries(ecgLaLlHistorySeries, 
        LineAndPointRenderer.class, 
        new LineAndPointFormatter(Color.rgb(255, 0, 0), Color.BLACK)); 
    ecgHistoryPlot.setDomainStepValue(5); 
    ecgHistoryPlot.setTicksPerRangeLabel(3); 
    ecgHistoryPlot.setDomainLabel("Time"); 
    ecgHistoryPlot.getDomainLabelWidget().pack(); 
    ecgHistoryPlot.setRangeLabel("Level"); 
    ecgHistoryPlot.getRangeLabelWidget().pack(); 
    ecgHistoryPlot.disableAllMarkup(); 
} 

/**
 * This method will update plot data
 */
private static void drawMergedPlot(int EcgRaLl, int EcgLaLl) { 
    Number[] seriesRNumbers = { EcgRaLl, EcgLaLl }; 
    ecgLevelsSeries.setModel(Arrays.asList(seriesRNumbers), 
        SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED); 

    if (ecgRaLlHistory.size() > HISTORY_SIZE 
        || ecgLaLlHistory.size() > HISTORY_SIZE) { 
        ecgRaLlHistory.removeFirst(); 
        ecgLaLlHistory.removeFirst(); 
    } 

    ecgRaLlHistory.addLast(EcgRaLl); 
    ecgLaLlHistory.addLast(EcgLaLl); 

    ecgRaLlHistorySeries.setModel(ecgRaLlHistory, 
        SimpleXYSeries.ArrayFormat.Y_VALS_ONLY); 
    ecgLaLlHistorySeries.setModel(ecgLaLlHistory, 
        SimpleXYSeries.ArrayFormat.Y_VALS_ONLY); 
    ecgSHistoryPlot.redraw(); 
} 

/**
* This method should be called when there's new data.
*/
private static void onSensorReading(int EcgRaLl, int EcgLaLl) { 
    drawMergedPlot(EcgRaLl, EcgLaLl); 
}

这篇关于在Android应用心电图波形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆