本文整理汇总了C++中Signal::ReadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::ReadFile方法的具体用法?C++ Signal::ReadFile怎么用?C++ Signal::ReadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::ReadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadLearningSignals
bool MainWindow::loadLearningSignals(Signal& referenceSignal, Signal& distortedSignal)
{
QString referenceFileName = QFileDialog::getOpenFileName(this, tr("Open Reference Physionet ECG File"),
"", tr("Physionet ECG File (*.dat)"));
if(referenceFileName.isEmpty())
return false;
if(!referenceSignal.ReadFile(referenceFileName.toStdWString().c_str()))
{
QMessageBox::warning(this, "Warning", "Failed to load file " + referenceFileName);
return false;
}
QString distortedFileName = QFileDialog::getOpenFileName(this, tr("Open Distorted Physionet ECG File"),
"", tr("Physionet ECG File (*.dat)"));
if(distortedFileName.isEmpty())
return false;
if(!distortedSignal.ReadFile(distortedFileName.toStdWString().c_str()))
{
QMessageBox::warning(this, "Warning", "Failed to load file " + distortedFileName);
return false;
}
return true;
}
示例2: onLoad
void MainWindow::onLoad()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Physionet ECG File"),
"", tr("Physionet ECG File (*.dat)"));
if(fileName.isEmpty())
return;
Signal signal;
if(signal.ReadFile(fileName.toStdWString().c_str()))
{
int dataSize = signal.GetLength();
double* data = signal.GetData();
double sr = signal.GetSR();
float msec = float((double)dataSize / sr);
QVector<double> x(dataSize), y(dataSize);
for (int i=0; i<dataSize; ++i)
{
x[i] = i * msec / dataSize;
y[i] = data[i];
}
EcgAnnotation ann;
int** qrsAnn = ann.GetQRS(data, dataSize, sr, L"filters");
if (qrsAnn)
{
int** ANN = ann.GetPTU(data, dataSize, sr, L"filters",
qrsAnn, ann.GetQrsNumber());
if (ANN)
{
fillArrhytmiaPlot(ANN, ui->plot, ann, x, y, signal.GetSR());
fillMyocardialPlot(ANN, ui->mPlot, ann, x, y, signal.GetSR());
fillPericarditisPlot(ANN, ui->pPlot, ann, x, y, signal.GetSR());
}
else
{
QMessageBox::warning(this, "Warning", "Unknown error");
}
} else
{
QMessageBox::warning(this, "Warning", "Could not get QRS complexes");
}
ui->plot->replot();
} else
{
QMessageBox::warning(this, "Warning", "Failed to load file " + fileName);
}
}