本文整理汇总了C++中FileReader::getOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ FileReader::getOptions方法的具体用法?C++ FileReader::getOptions怎么用?C++ FileReader::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReader
的用法示例。
在下文中一共展示了FileReader::getOptions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex_gsr_arousal
bool ex_gsr_arousal(void *args) {
ITheEventBoard *board = Factory::GetEventBoard();
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data\\gsr");
reader->getOptions()->block = 0.2;
ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
GSRArousalEstimation *arousal = ssi_create(GSRArousalEstimation, 0, true);
ITransformable *arousal_p = frame->AddTransformer(gsr_p, arousal, "1");
ThresClassEventSender *classifier = ssi_create(ThresClassEventSender, 0, true);
classifier->getOptions()->setClasses("low,med,high");
classifier->getOptions()->setThresholds("0.01,0.3,0.7");
frame->AddConsumer(arousal_p, classifier, "1");
board->RegisterSender(*classifier);
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, "@");
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_p, plot, "0.2s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("arousal");
plot->getOptions()->size = 150.0;
frame->AddConsumer(arousal_p, plot, "0.2s");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例2: ex_simulator
bool ex_simulator(void *arg) {
if (!ssi_exists("cursor_txt.stream")) {
ex_writer(0);
}
ITheFramework *frame = Factory::GetFramework ();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
File::SetLogLevel (SSI_LOG_LEVEL_DEBUG);
FileReader *reader = ssi_create (FileReader, 0, true);
reader->getOptions()->setPath("cursor_txt");
reader->getOptions()->block = 0.05;
reader->getOptions()->loop = true;
reader->getOptions()->offset = 0.1;
ITransformable *cursor_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
FileWriter *writer = ssi_create (FileWriter, 0, true);
writer->getOptions()->type = File::ASCII;
frame->AddConsumer(cursor_p, writer, "0.05s");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
frame->Start();
reader->wait();
frame->Stop();
frame->Clear();
return true;
}
示例3: ex_framework
bool ex_framework (void *arg) {
TheFramework *frame = ssi_pcast (TheFramework, Factory::GetFramework ());
//frame->getOptions ()->monitor = true;
//frame->getOptions ()->setMonitorPos (800, 0, 400, 200);
//frame->getOptions ()->console = true;
//frame->getOptions ()->setConsolePos (800, 200, 400, 200);
//ThePainter *painter = ssi_pcast (ThePainter, Factory::GetPainter ());
double sample_rate = 200.0;
double frequency = 5.0;
double sine_len = 60.0;
double plot_dur = 11.1;
const ssi_char_t *print_dur = "1.0s";
double provide_size = 0.1;
bool repeat = true;
unsigned int len = static_cast<unsigned int> (sample_rate * sine_len);
double *data = new double [len];
data[0] = 0.0;
double delta = 1/sample_rate;
for (unsigned int i = 1; i < len; i++) {
data[i] = data[i-1] + delta;
}
for (unsigned int i = 0; i < len; i++) {
data[i] = sin (2.0 * PI * frequency * data[i]);
}
//Provider::SetLogLevel (SSI_LOG_LEVEL_DEBUG);
//Transformer::SetLogLevel (SSI_LOG_LEVEL_DEBUG);
//Consumer::SetLogLevel (SSI_LOG_LEVEL_DEBUG);
frame->SetLogLevel (SSI_LOG_LEVEL_DEBUG);
FileReader *simulator = ssi_create (FileReader, 0, true);
simulator->getOptions ()->setPath ("input");
simulator->getOptions ()->loop = true;
simulator->getOptions ()->block = provide_size;
ITransformable *provider = frame->AddProvider (simulator, SSI_FILEREADER_PROVIDER_NAME);
//simulator.setLogLevel (SSI_LOG_LEVEL_DEBUG);
frame->AddSensor (simulator);
AbsFilt<float> abs;
RampFilt<float> ramp;
IFilter *filter[2] = {&abs, &ramp};
MeanFeat<float> mean;
MinMaxFeat<float> minmax;
IFeature *feature[2] = {&mean, &minmax};
//Chain chain (2, filter, 2, feature);
Chain *chain = ssi_create (Chain, 0, true);
chain->set (2, filter, 2, feature);
ITransformable *chain_t = frame->AddTransformer (provider, chain, "0.05s", "0.05s");
MyConsumer my_consumer_;
//Chain chain_2 (2, filter, 2, feature);
Chain *chain_2 = ssi_create (Chain, 0, true);
chain_2->set (2, filter, 2, feature);
frame->AddConsumer (provider, &my_consumer_, "0.05s", "0.05s", chain_2);
/*
SignalPainter *signal_painter = ssi_create (SignalPainter, 0, true);
signal_painter->getOptions ()->setName ("signal");
signal_painter->getOptions ()->size = plot_dur;
frame->AddConsumer (provider, signal_painter, "0.1s");
SignalPainter *chain_painter = ssi_create (SignalPainter, 0, true);
chain_painter->getOptions ()->setName ("chain");
chain_painter->getOptions ()->size = plot_dur;
frame->AddConsumer (chain_t, chain_painter, "0.1s");
*/
FileWriter *signal_printer = ssi_create (FileWriter, 0, true);
signal_printer->getOptions ()->type = File::ASCII;
signal_printer->getOptions ()->setPath ("signal.txt");
frame->AddConsumer (provider, signal_printer, print_dur);
FileWriter *signal_bprinter = ssi_create (FileWriter, 0, true);
signal_bprinter->getOptions ()->setPath ("signal.dat");
frame->AddConsumer (provider, signal_bprinter, print_dur);
FileWriter *chain_printer = ssi_create (FileWriter, 0, true);
chain_printer->getOptions ()->type = File::ASCII;
chain_printer->getOptions ()->setPath ("chain.txt");
frame->AddConsumer (chain_t, chain_printer, print_dur);
FileWriter *chain_bprinter = ssi_create (FileWriter, 0, true);
chain_bprinter->getOptions ()->setPath ("chain.dat");
frame->AddConsumer (chain_t, chain_bprinter, print_dur);
frame->Start ();
//painter->Arrange (1, 2, 0, 0, 800, 400);
frame->Wait ();
frame->Stop ();
frame->Clear ();
//painter->Clear ();
delete[] data;
return true;
}
示例4: ex_qrs_hrv_event
bool ex_qrs_hrv_event(void *args) {
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
//raw
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data/ecg");
reader->getOptions()->block = 0.2;
ITransformable *ecg_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
//bandpass
Butfilt *ecg_band = ssi_create(Butfilt, 0, true);
ecg_band->getOptions()->type = Butfilt::BAND;
ecg_band->getOptions()->norm = false;
ecg_band->getOptions()->high = 15;
ecg_band->getOptions()->low = 5;
ecg_band->getOptions()->order = 13;
ITransformable *ecg_band_t = frame->AddTransformer(ecg_p, ecg_band, "0.75s");
//diff
Derivative *ecg_diff = ssi_create(Derivative, 0, true);
ssi_strcpy(ecg_diff->getOptions()->names, "1st");
ITransformable *ecg_diff_t = frame->AddTransformer(ecg_band_t, ecg_diff, "0.75s");
//qrs-pre-process
QRSPreProcess *ecg_QRSpre = ssi_create(QRSPreProcess, 0, true);
ITransformable *ecg_QRSpre_t = frame->AddTransformer(ecg_diff_t, ecg_QRSpre, "0.75s");
Butfilt *lowpass = ssi_create(Butfilt, 0, true);
lowpass->getOptions()->zero = true;
lowpass->getOptions()->norm = false;
lowpass->getOptions()->low = 6.4;
lowpass->getOptions()->order = 3;
lowpass->getOptions()->type = Butfilt::LOW;
ITransformable *ecg_QRSpre_low_t = frame->AddTransformer(ecg_QRSpre_t, lowpass, "0.75s");
//qrs-detect
QRSDetect *ecg_qrs = ssi_create(QRSDetect, 0, true);
ecg_qrs->getOptions()->sendEvent = true;
ITransformable *ecg_qrs_t = frame->AddTransformer(ecg_QRSpre_low_t, ecg_qrs, "0.75s");
board->RegisterSender(*ecg_qrs);
//visual
SignalPainter *plot = 0;
ssi_real_t p_size = 10.0f;
//raw
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("raw");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_p, plot, "0.2s");
//bandpass
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("bandpass");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_band_t, plot, "0.2s");
//diff
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("diff");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_diff_t, plot, "0.2s");
//qrs-pre
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("qrs-pre");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_QRSpre_low_t, plot, "0.2s");
//qrs
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("qrs");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_qrs_t, plot, "0.2s");
//events
QRSHrvEventListener *hrv = ssi_create(QRSHrvEventListener, 0, true);
hrv->getOptions()->span = 120000;
hrv->getOptions()->update_ms = 5000;
board->RegisterListener(*hrv, ecg_qrs->getEventAddress(), 10000);
board->RegisterSender(*hrv);
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, hrv->getEventAddress(), 10000);
//framework
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
//.........这里部分代码省略.........
示例5: ex_gsr_baseline_mean
bool ex_gsr_baseline_mean(void *args) {
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
//raw
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data/gsr");
reader->getOptions()->block = 0.2;
ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
//lowpass
Butfilt *lowpass = ssi_create(Butfilt, 0, true);
lowpass->getOptions()->low = 0.01;
lowpass->getOptions()->order = 3;
lowpass->getOptions()->type = Butfilt::LOW;
lowpass->getOptions()->zero = true;
ITransformable *gsr_low_t = frame->AddTransformer(gsr_p, lowpass, "0.25s");
//detrend
GSRRemoveBaseline *detrend = ssi_create(GSRRemoveBaseline, 0, true);
ITransformable *gsr_detrend_t = frame->AddTransformer(gsr_low_t, detrend, "0.25s");
//norm
MvgNorm *norm = ssi_create(MvgNorm, 0, true);
norm->getOptions()->norm = MvgNorm::SUBMIN;
norm->getOptions()->method = MvgNorm::SLIDING;
norm->getOptions()->win = 15.0;
ITransformable *gsr_detrend_norm_t = frame->AddTransformer(gsr_detrend_t, norm, "0.25s");
GSRBaselineMean *mean = ssi_create(GSRBaselineMean, 0, true);
mean->getOptions()->winsize = 15.0;
frame->AddConsumer(gsr_detrend_norm_t, mean, "0.25s");
board->RegisterSender(*mean);
//visual
SignalPainter *plot = 0;
ssi_real_t p_size = 100.0f;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(lowpassed)");
plot->getOptions()->size = p_size;
frame->AddConsumer(gsr_low_t, plot, "0.3s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(detrended)");
plot->getOptions()->size = p_size;
frame->AddConsumer(gsr_detrend_t, plot, "0.3s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(detrended & normed)");
plot->getOptions()->size = p_size;
frame->AddConsumer(gsr_detrend_norm_t, plot, "0.3s");
//events
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, mean->getEventAddress());
//framework
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例6: ex_gsr_peaks_online
bool ex_gsr_peaks_online(void *args) {
ITheEventBoard *board = Factory::GetEventBoard();
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data\\gsr");
reader->getOptions()->block = 0.2;
ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
Butfilt *lowpass = ssi_create(Butfilt, 0, true);
lowpass->getOptions()->low = 0.01;
lowpass->getOptions()->order = 3;
lowpass->getOptions()->type = Butfilt::LOW;
lowpass->getOptions()->zero = true;
ITransformable *gsr_low = frame->AddTransformer(gsr_p, lowpass, "0.2s");
GSREventSender *gsr_event = ssi_create(GSREventSender, 0, true);
gsr_event->getOptions()->tuple = true;
gsr_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);
frame->AddConsumer(gsr_low, gsr_event, "4.0s");
board->RegisterSender(*gsr_event);
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, gsr_event->getEventAddress());
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_p, plot, "0.2s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(lowpassed)");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_low, plot, "0.2s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("peak");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("slope");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("drop");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例7: ex_bvp_beat_events_raw
bool ex_bvp_beat_events_raw(void *args) {
ITheEventBoard *board = Factory::GetEventBoard();
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data\\bvp");
reader->getOptions()->block = 0.2;
reader->getOptions()->loop = false;
ITransformable *bvp_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("bvp");
plot->getOptions()->size = 10.0;
frame->AddConsumer(bvp_p, plot, "1");
BVPBeatEventSender *bvp_event = ssi_create(BVPBeatEventSender, 0, true);
bvp_event->getOptions()->beep = true;
bvp_event->getOptions()->mean_window = 1;
bvp_event->getOptions()->tuple = true;
bvp_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);
frame->AddConsumer(bvp_p, bvp_event, "0.2s");
board->RegisterSender(*bvp_event);
BVPBeatEventRawListener *event_listener = ssi_create(BVPBeatEventRawListener, 0, true);
event_listener->getOptions()->sr = 9;
ITransformable *heartRate = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_HEART_RATE_PROVIDER_NAME);
ITransformable *amp = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_AMPLITUDE_PROVIDER_NAME);
ITransformable *interBeat = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_INTERBEAT_INTERVAL_PROVIDER_NAME);
frame->AddSensor(event_listener);
board->RegisterListener(*event_listener, bvp_event->getEventAddress());
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("heartRate");
plot->getOptions()->size = 150.0;
frame->AddConsumer(heartRate, plot, "1");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("amp");
plot->getOptions()->size = 150.0;
frame->AddConsumer(amp, plot, "1");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("interBeat");
plot->getOptions()->size = 150.0;
frame->AddConsumer(interBeat, plot, "1");
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, bvp_event->getEventAddress());
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例8: ex_gsr_response_amplitude_events
bool ex_gsr_response_amplitude_events(void *args) {
ITheEventBoard *board = Factory::GetEventBoard();
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data\\gsr");
reader->getOptions()->block = 0.2;
reader->getOptions()->loop = false;
ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(lowpassed)");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_p, plot, "1");
GSRResponseEventSender *gsr_event = ssi_create(GSRResponseEventSender, 0, true);
gsr_event->getOptions()->tuple = true;
gsr_event->getOptions()->minRisingTime = 0;
gsr_event->getOptions()->minAllowedRegression = 0.1f;
gsr_event->getOptions()->minAmplitude = 0.5f;
gsr_event->getOptions()->print = false;
gsr_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);
frame->AddConsumer(gsr_p, gsr_event, "0.2s");
board->RegisterSender(*gsr_event);
GSREventListener *event_listener = ssi_create(GSREventListener, 0, true);
event_listener->getOptions()->statisticalFn = GSR_SUM;
event_listener->getOptions()->window = SSI_GSR_EVENTLISTENER_NO_WINDOW;
ITransformable *nr_of_responses = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_NUMBER_OF_RESPONSES_PROVIDER_NAME);
ITransformable *amp = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_AMPLITUDE_PROVIDER_NAME);
ITransformable *power = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_POWER_PROVIDER_NAME);
frame->AddSensor(event_listener);
board->RegisterListener(*event_listener, gsr_event->getEventAddress());
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("nr_of_responses");
plot->getOptions()->size = 150.0;
frame->AddConsumer(nr_of_responses, plot, "1");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("amp");
plot->getOptions()->size = 150.0;
frame->AddConsumer(amp, plot, "1");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("power");
plot->getOptions()->size = 150.0;
frame->AddConsumer(power, plot, "1");
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, gsr_event->getEventAddress());
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例9: ex_qrs_hr_features
bool ex_qrs_hr_features(void *args) {
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
//raw
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data/ecg");
reader->getOptions()->block = 0.2;
ITransformable *ecg_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
// qrs detection
QRSDetection *ecg_chain = ssi_create(QRSDetection, 0, true);
ecg_chain->getOptions()->sendEvent = false;
ITransformable *ecg_qrs_t = frame->AddTransformer(ecg_p, ecg_chain, "0.75s", "0", "60.0s");
// heart rate
QRSHeartRate *qrshr = ssi_create(QRSHeartRate, 0, true);
ITransformable *ecg_hr_t = frame->AddTransformer(ecg_qrs_t, qrshr, "1.0s", "0", "60.0s");
// heart rate features
Spectrogram *spectogram = ssi_create(Spectrogram, 0, true);
ssi_strcpy(spectogram->getOptions()->file, "hrspect.banks");
spectogram->getOptions()->nbanks = 3;
ITransformable *ecg_hr_spec_t = frame->AddTransformer(ecg_hr_t, spectogram, "1", "29", "60.0s");
//hrv_spectral
QRSHRVspectral *ecg_hr_spectralfeatures = ssi_create(QRSHRVspectral, 0, true);
ecg_hr_spectralfeatures->getOptions()->print = true;
ITransformable *ecg_hr_spectralfeatures_t = frame->AddTransformer(ecg_hr_spec_t, ecg_hr_spectralfeatures, "1", "0", "60.0s");
//hrv_time
QRSHRVtime *ecg_hr_timefeatures = ssi_create(QRSHRVtime, 0, true);
ecg_hr_timefeatures->getOptions()->print = true;
ITransformable *ecg_hr_timefeatures_t = frame->AddTransformer(ecg_qrs_t, ecg_hr_timefeatures, "1.0s", "6.5s", "60.0s");
//visual
SignalPainter *plot = 0;
ssi_real_t p_size = 100.0f;
//qrs
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("qrs");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_qrs_t, plot, "0.75s");
//heart rate
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("hr");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_hr_t, plot, "1");
//spectrgram
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("hr spect");
plot->getOptions()->size = p_size;
plot->getOptions()->type = PaintSignalType::IMAGE;
frame->AddConsumer(ecg_hr_spec_t, plot, "1");
//framework
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例10: ex_qrs_heartrate_mean
bool ex_qrs_heartrate_mean(void *args) {
if (!ssi_exists("data/ecg_qrs.stream")) {
ex_ecg_detection(args);
}
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
//raw
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data/ecg_qrs");
reader->getOptions()->block = 0.2;
ITransformable *qrs_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
// heart rate
QRSHeartRate *qrshr = ssi_create(QRSHeartRate, 0, true);
ITransformable *ecg_hr_t = frame->AddTransformer(qrs_p, qrshr, "0.25s");
//heart rate mean
QRSHeartRateMean *qrshr_mean = ssi_create(QRSHeartRateMean, 0, true);
qrshr_mean->getOptions()->winsize = 15.0;
frame->AddConsumer(ecg_hr_t, qrshr_mean, "0.25s");
board->RegisterSender(*qrshr_mean);
//visual
SignalPainter *plot = 0;
ssi_real_t p_size = 100.0f;
//qrs
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("qrs");
plot->getOptions()->size = p_size;
frame->AddConsumer(qrs_p, plot, "0.3s");
//heart rate
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("heartrate");
plot->getOptions()->size = p_size;
frame->AddConsumer(ecg_hr_t, plot, "0.3s");
//events
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, qrshr_mean->getEventAddress());
//framework
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}