mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 20:20:44 +00:00
Added live AHI calcs for Waveform Overlay
This commit is contained in:
parent
dd3a354145
commit
fbebd35fd8
@ -52,7 +52,9 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
bool verts_exceeded=false;
|
||||
QHash<ChannelID,QVector<EventList *> >::iterator cei;
|
||||
|
||||
m_count=0;
|
||||
m_flag_color=schema::channel[m_code].defaultColor();
|
||||
|
||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||
cei=(*s)->eventlist.find(m_code);
|
||||
if (cei==(*s)->eventlist.end()) continue;
|
||||
@ -74,6 +76,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
|
||||
//x1=w.x2p(X);
|
||||
x1=double(width)/double(xx)*double(X-w.min_x)+left;
|
||||
m_count++;
|
||||
if (m_flt==FT_Span) {
|
||||
//x2=w.x2p(Y);
|
||||
x2=double(width)/double(xx)*double(Y-w.min_x)+left;
|
||||
@ -119,3 +122,29 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
}
|
||||
}
|
||||
|
||||
gLineOverlaySummary::gLineOverlaySummary(QString text, int x, int y)
|
||||
:Layer(""),m_text(text),m_x(x),m_y(y)
|
||||
{
|
||||
}
|
||||
|
||||
gLineOverlaySummary::~gLineOverlaySummary()
|
||||
{
|
||||
}
|
||||
|
||||
void gLineOverlaySummary::paint(gGraph & w,int left, int top, int width, int height)
|
||||
{
|
||||
Q_UNUSED(width);
|
||||
Q_UNUSED(height);
|
||||
float cnt=0;
|
||||
for (int i=0;i<m_overlays.size();i++) {
|
||||
cnt+=m_overlays[i]->count();
|
||||
}
|
||||
double time=w.max_x-w.min_x;
|
||||
time/=3600000;
|
||||
|
||||
//if (time<1) time=1;
|
||||
|
||||
double val=cnt/time;
|
||||
QString a=m_text+"="+QString::number(val,'f',2);
|
||||
w.renderText(a,left+m_x,top+m_y);
|
||||
}
|
||||
|
@ -19,12 +19,32 @@ class gLineOverlayBar:public Layer
|
||||
virtual EventDataType Miny() { return 0; }
|
||||
virtual EventDataType Maxy() { return 0; }
|
||||
virtual bool isEmpty() { return true; }
|
||||
int count() { return m_count; }
|
||||
protected:
|
||||
QColor m_flag_color;
|
||||
QString m_label;
|
||||
FlagType m_flt;
|
||||
int m_count;
|
||||
|
||||
GLShortBuffer *points,*quads, *lines;
|
||||
};
|
||||
|
||||
class gLineOverlaySummary:public Layer
|
||||
{
|
||||
public:
|
||||
gLineOverlaySummary(QString text, int x, int y);
|
||||
virtual ~gLineOverlaySummary();
|
||||
|
||||
virtual void paint(gGraph & w,int left, int top, int width, int height);
|
||||
virtual EventDataType Miny() { return 0; }
|
||||
virtual EventDataType Maxy() { return 0; }
|
||||
virtual bool isEmpty() { return true; }
|
||||
gLineOverlayBar *add(gLineOverlayBar *bar) { m_overlays.push_back(bar); return bar; }
|
||||
protected:
|
||||
QVector<gLineOverlayBar *> m_overlays;
|
||||
QString m_text;
|
||||
int m_x,m_y;
|
||||
};
|
||||
|
||||
|
||||
#endif // GLINEOVERLAY_H
|
||||
|
10
daily.cpp
10
daily.cpp
@ -128,24 +128,26 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
||||
|
||||
gLineChart *l;
|
||||
l=new gLineChart(CPAP_FlowRate,Qt::black,false,false);
|
||||
gLineOverlaySummary *los=new gLineOverlaySummary("AHI",5,-3);
|
||||
AddCPAP(l);
|
||||
FRW->AddLayer(new gXGrid());
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_CSR,QColor("light green"),"CSR",FT_Span)));
|
||||
FRW->AddLayer(l);
|
||||
FRW->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||
FRW->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_Hypopnea,QColor("blue"),"H")));
|
||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_Hypopnea,QColor("blue"),"H"))));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_PressurePulse,QColor("red"),"PR",FT_Dot)));
|
||||
//FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_Pressure,QColor("white"),"P",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_0B,QColor("blue"),"0B",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_10,QColor("orange"),"10",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_0E,QColor("dark red"),"0E",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_RERA,QColor("gold"),"RE")));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_Apnea,QColor("dark green"),"A")));
|
||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_Apnea,QColor("dark green"),"A"))));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_VSnore,QColor("red"),"VS")));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_FlowLimit,QColor("black"),"FL")));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_Obstructive,QColor("#40c0ff"),"OA")));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_ClearAirway,QColor("purple"),"CA")));
|
||||
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));
|
||||
|
||||
|
||||
gGraph *graphs[]={ PRD, LEAK, SNORE, PTB, MP, RR, MV, TV, FLG, IE, TI, TE, SPO2, PLETHY, PULSE,INTPULSE, INTSPO2 };
|
||||
|
2
main.cpp
2
main.cpp
@ -13,13 +13,11 @@
|
||||
#include <QPushButton>
|
||||
#include <QWebFrame>
|
||||
|
||||
|
||||
#include "SleepLib/schema.h"
|
||||
#include "mainwindow.h"
|
||||
#include "SleepLib/profiles.h"
|
||||
#include "profileselect.h"
|
||||
#include "newprofile.h"
|
||||
|
||||
#include "SleepLib/loader_plugins/prs1_loader.h"
|
||||
#include "SleepLib/loader_plugins/cms50_loader.h"
|
||||
#include "SleepLib/loader_plugins/zeo_loader.h"
|
||||
|
Loading…
Reference in New Issue
Block a user