2013-06-21 10 views
0

我目前正在研究涉及在Android手機上使用心電信號的項目。在Android應用程序中的心電圖波形

我決定是否應該爲android或我的自己的信號處理庫,因爲我似乎無法找到任何在線。

是否有人知道我可以使用的圖書館,還是讓我自己更容易,更快捷?

謝謝

+0

你是什麼意思處理?分析還是繪圖? – Milan

+0

繪製心電圖波形在Android應用程序 – user2531493

回答

0

我用AndroidPlot來實時繪製ECG信號。我使用的傳感器是4導聯心電圖,可以通過藍牙提供RL和LL。這裏是繪圖的例子,但隨意修改它以滿足您的需求。如果最近的AndroidPlot不支持這裏使用的任何方法,請進行研究並更改它。最後這個方法是不是有效的,因爲,它一直重繪情節,我相信AndroidPlot支持新版本更好地執行:

這是你如何定義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" /> 

這是代碼繪製它:

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); 
} 
+0

謝謝你的回答。你的心電圖傳感器給了什麼樣的輸出? – user2531493

+0

有效載荷包括傳感器樣板版本,GPS,加速度和陀螺儀。我配置了我的傳感器只提供心電圖。正如你所看到的代碼,它包含2個浮點數。 – Milan

+0

我使用脈搏傳感器來獲取心電圖輸出,它會將模擬信號轉換爲模擬信號,並將其轉換爲數字信號並通過藍牙將其發送到手機 - 任何suggestios plsss – user2531493

相關問題