mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
PRS1 Apnea Flagging Experiment
This commit is contained in:
parent
42fcd0a389
commit
e8d11f3337
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Support function for calcRespRate()
|
// Support function for calcRespRate()
|
||||||
int filterFlow(EventList *in, EventList *out, EventList *tv, EventList *mv, double rate, EventList *uf1)
|
int filterFlow(EventList *in, EventList *out, EventList *tv, EventList *mv, double rate, EventList *uf1, EventList *uf2)
|
||||||
{
|
{
|
||||||
|
|
||||||
int size=in->count();
|
int size=in->count();
|
||||||
@ -183,7 +183,7 @@ int filterFlow(EventList *in, EventList *out, EventList *tv, EventList *mv, doub
|
|||||||
} else {
|
} else {
|
||||||
if (c<=min) {
|
if (c<=min) {
|
||||||
min=c;
|
min=c;
|
||||||
peakmin=time+rate;
|
peakmin=time;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -193,16 +193,47 @@ int filterFlow(EventList *in, EventList *out, EventList *tv, EventList *mv, doub
|
|||||||
time+=rate;
|
time+=rate;
|
||||||
}
|
}
|
||||||
if (!breaths.size()) {
|
if (!breaths.size()) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
double avg;
|
double avgmax=0;
|
||||||
for (int i=0;i<breaths_max.size();i++) {
|
for (int i=0;i<breaths_max.size();i++) {
|
||||||
min=breaths_max[i];
|
max=breaths_max[i];
|
||||||
avg+=min;
|
avgmax+=max;
|
||||||
// uf1->AddEvent(breaths_max_peak[i],0,min);
|
}
|
||||||
|
avgmax/=EventDataType(breaths_max.size());
|
||||||
|
|
||||||
|
double avgmin=0;
|
||||||
|
for (int i=0;i<breaths_min.size();i++) {
|
||||||
|
min=breaths_min[i];
|
||||||
|
avgmin+=min;
|
||||||
|
//uf2->AddEvent(breaths_min_peak[i],0,min);
|
||||||
|
}
|
||||||
|
avgmin/=EventDataType(breaths_min.size());
|
||||||
|
|
||||||
|
QVector<qint64> goodb;
|
||||||
|
for (int i=0;i<breaths_max.size();i++) {
|
||||||
|
max=breaths_max[i];
|
||||||
|
time=breaths_max_peak[i];
|
||||||
|
|
||||||
|
if (max > avgmax*0.2) {
|
||||||
|
goodb.push_back(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<breaths_max.size();i++) {
|
||||||
|
min=breaths_min[i];
|
||||||
|
time=breaths_min_peak[i];
|
||||||
|
if (min < avgmin*0.2) {
|
||||||
|
goodb.push_back(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qSort(goodb);
|
||||||
|
for (int i=1;i<goodb.size();i++) {
|
||||||
|
qint64 len=qAbs(goodb[i]-goodb[i-1]);
|
||||||
|
if (len>=10000) {
|
||||||
|
time=goodb[i-1]+len/2;
|
||||||
|
uf1->AddEvent(time,0,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
avg/=EventDataType(breaths_max.size());
|
|
||||||
|
|
||||||
qint64 window=60000;
|
qint64 window=60000;
|
||||||
qint64 t1=in->first()-window/2;
|
qint64 t1=in->first()-window/2;
|
||||||
@ -316,7 +347,7 @@ int calcRespRate(Session *session)
|
|||||||
if (session->eventlist.contains(CPAP_RespRate))
|
if (session->eventlist.contains(CPAP_RespRate))
|
||||||
return 0; // already exists?
|
return 0; // already exists?
|
||||||
|
|
||||||
EventList *flow, *rr=NULL, *tv=NULL, *mv=NULL, *uf=NULL;
|
EventList *flow, *rr=NULL, *tv=NULL, *mv=NULL, *uf=NULL, *uf2=NULL;
|
||||||
|
|
||||||
if (!session->eventlist.contains(CPAP_TidalVolume)) {
|
if (!session->eventlist.contains(CPAP_TidalVolume)) {
|
||||||
tv=new EventList(EVL_Event);
|
tv=new EventList(EVL_Event);
|
||||||
@ -332,8 +363,11 @@ int calcRespRate(Session *session)
|
|||||||
if (rr) session->eventlist[CPAP_RespRate].push_back(rr);
|
if (rr) session->eventlist[CPAP_RespRate].push_back(rr);
|
||||||
if (tv) session->eventlist[CPAP_TidalVolume].push_back(tv);
|
if (tv) session->eventlist[CPAP_TidalVolume].push_back(tv);
|
||||||
if (mv) session->eventlist[CPAP_MinuteVent].push_back(mv);
|
if (mv) session->eventlist[CPAP_MinuteVent].push_back(mv);
|
||||||
//uf=new EventList(EVL_Event,1,0,0,0,0,true);
|
uf=new EventList(EVL_Event,1,0,0,0,0,true);
|
||||||
//session->eventlist["UserFlag1"].push_back(uf1);
|
session->eventlist["UserFlag1"].push_back(uf);
|
||||||
|
|
||||||
|
//uf2=new EventList(EVL_Event,1,0,0,0,0,true);
|
||||||
|
//session->eventlist["UserFlag2"].push_back(uf2);
|
||||||
|
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
for (int ws=0; ws < session->eventlist[CPAP_FlowRate].size(); ws++) {
|
for (int ws=0; ws < session->eventlist[CPAP_FlowRate].size(); ws++) {
|
||||||
@ -344,7 +378,7 @@ int calcRespRate(Session *session)
|
|||||||
if (flow->count()==103200) {
|
if (flow->count()==103200) {
|
||||||
int i=5;
|
int i=5;
|
||||||
}
|
}
|
||||||
cnt+=filterFlow(flow,rr,tv,mv,flow->rate(),uf);
|
cnt+=filterFlow(flow,rr,tv,mv,flow->rate(),uf,uf2);
|
||||||
|
|
||||||
if (tv->count()==0) {
|
if (tv->count()==0) {
|
||||||
int i=5;
|
int i=5;
|
||||||
|
@ -144,6 +144,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
|||||||
fg->AddLayer((new gFlagsLine(CPAP_RERA,QColor("gold"),"RE")));
|
fg->AddLayer((new gFlagsLine(CPAP_RERA,QColor("gold"),"RE")));
|
||||||
fg->AddLayer((new gFlagsLine(CPAP_VSnore,QColor("red"),"VS")));
|
fg->AddLayer((new gFlagsLine(CPAP_VSnore,QColor("red"),"VS")));
|
||||||
fg->AddLayer((new gFlagsLine("UserFlag1",QColor("yellow"),"UF1")));
|
fg->AddLayer((new gFlagsLine("UserFlag1",QColor("yellow"),"UF1")));
|
||||||
|
fg->AddLayer((new gFlagsLine("UserFlag2",QColor("green"),"UF2")));
|
||||||
//fg->AddLayer((new gFlagsLine(PRS1_0B,QColor("dark green"),"U0B")));
|
//fg->AddLayer((new gFlagsLine(PRS1_0B,QColor("dark green"),"U0B")));
|
||||||
//fg->AddLayer((new gFlagsLine(CPAP_VSnore2,QColor("red"),"VS2")));
|
//fg->AddLayer((new gFlagsLine(CPAP_VSnore2,QColor("red"),"VS2")));
|
||||||
SF->setBlockZoom(true);
|
SF->setBlockZoom(true);
|
||||||
@ -174,7 +175,8 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
|||||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_FlowLimit,QColor("black"),"FL")));
|
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_FlowLimit,QColor("black"),"FL")));
|
||||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_Obstructive,QColor("#40c0ff"),"OA"))));
|
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_Obstructive,QColor("#40c0ff"),"OA"))));
|
||||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_ClearAirway,QColor("purple"),"CA"))));
|
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_ClearAirway,QColor("purple"),"CA"))));
|
||||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar("UserFlag1",QColor("yellow"),"UF",FT_Bar)));
|
FRW->AddLayer(AddCPAP(new gLineOverlayBar("UserFlag1",QColor("yellow"),"U1",FT_Bar)));
|
||||||
|
FRW->AddLayer(AddCPAP(new gLineOverlayBar("UserFlag2",QColor("orange"),"U2",FT_Bar)));
|
||||||
FRW->AddLayer(AddOXI(new gLineOverlayBar(OXI_SPO2Drop,QColor("red"),"O2")));
|
FRW->AddLayer(AddOXI(new gLineOverlayBar(OXI_SPO2Drop,QColor("red"),"O2")));
|
||||||
FRW->AddLayer(AddOXI(new gLineOverlayBar(OXI_PulseChange,QColor("blue"),"PC",FT_Dot)));
|
FRW->AddLayer(AddOXI(new gLineOverlayBar(OXI_PulseChange,QColor("blue"),"PC",FT_Dot)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user