diff --git a/Graphs/gLineChart.cpp b/Graphs/gLineChart.cpp index f70e0cee..198eb6c1 100644 --- a/Graphs/gLineChart.cpp +++ b/Graphs/gLineChart.cpp @@ -139,6 +139,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) num_points+=evec[i]->count(); total_points+=num_points; + const int num_averages=20; // Max n umber of samples taken from samples per pixel for better min/max values for (int n=0;n0) { sam=1; @@ -230,8 +230,10 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) if (minx>x0) { double j=minx-x0; // == starting min of first sample in this segment idx=(j/sr); + idx/=(sam*num_averages); + idx*=(sam*num_averages); // Loose the precision - //idx-=idx % sam; + //idx+=sam-(idx % sam); } // else just start from the beginning } diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index 9a12683a..15a72c28 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -625,8 +625,40 @@ EventList * ResmedLoader::ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & } bool ResmedLoader::LoadSAD(Session *sess,EDFParser &edf) { - // Oximeter bull crap.. this oximeter is not reported of highly.. - // nonetheless, the data is easy to access. + QString t; + sess->updateFirst(edf.startdate); + qint64 duration=edf.GetNumDataRecords()*edf.GetDuration(); + sess->updateLast(edf.startdate+duration); + + for (int s=0;snr*edf.GetNumDataRecords(); + ChannelID code; + if (edf.edfsignals[s]->label=="Pulse") { + code=CPAP_Pulse; + } else if (edf.edfsignals[s]->label=="SpO2") { + code=CPAP_SPO2; + } else { + qDebug() << "Unknown SAD.edf Signal " << edf.edfsignals[s]->label; + continue; + } + bool hasdata=false; + for (int i=0;isetMin(code,a->min()); + sess->setMax(code,a->max()); + } + } + + } return true; } diff --git a/SleepLib/machine.cpp b/SleepLib/machine.cpp index 364f8ca2..7ca15f87 100644 --- a/SleepLib/machine.cpp +++ b/SleepLib/machine.cpp @@ -30,7 +30,7 @@ CPAP_CSR, CPAP_VSnore, CPAP_PressurePulse, CPAP_Mode, CPAP_FlowRate, CPAP_MaskPr CPAP_EPAP, CPAP_IPAP, CPAP_IPAP_Low, CPAP_IPAP_High, CPAP_PressureSupport, CPAP_Snore, CPAP_Leak, CPAP_RespiratoryRate, CPAP_TidalVolume, CPAP_MinuteVentilation, CPAP_PatientTriggeredBreaths, CPAP_FlowLimitGraph, CPAP_TherapyPressure, CPAP_ExpiratoryPressure, CPAP_AHI, CPAP_BrokenSummary, -CPAP_BrokenWaveform; +CPAP_BrokenWaveform, CPAP_Pulse, CPAP_SPO2; ChannelID RMS9_PressureReliefType, RMS9_PressureReliefSetting, RMS9_Empty1, RMS9_Empty2; ChannelID PRS1_PressureMin,PRS1_PressureMax, PRS1_PressureMinAchieved, PRS1_PressureMaxAchieved, @@ -175,6 +175,9 @@ void InitMapsWithoutAwesomeInitializerLists() PRS1_Unknown12=CPAP_CODES.Get(CT_Event,QObject::tr("Unknown 12 Event"),QObject::tr("U12"),"PRS1_U12"), PRS1_VSnore2=CPAP_CODES.Get(CT_Event,QObject::tr("Vibratory Snore (Type 2)"),QObject::tr("VS2"),"VS2"); + // CPAP Integrated oximetery codes.. + CPAP_Pulse=CPAP_CODES.Get(CT_Event,QObject::tr("Pulse Rate"),QObject::tr("Pulse"),"CPPR"); + CPAP_SPO2=CPAP_CODES.Get(CT_Event,QObject::tr("SpO2"),QObject::tr("SpO2"),"CPSP"); OXI_Pulse=OXI_CODES.Get(CT_Graph,QObject::tr("Pulse Rate"),QObject::tr("PR"),"PR"), OXI_SPO2=OXI_CODES.Get(CT_Graph,QObject::tr("Oxygen Saturation"),QObject::tr("SPO2"),"SPO2"), diff --git a/SleepLib/machine_common.h b/SleepLib/machine_common.h index 13877ecb..394c09c7 100644 --- a/SleepLib/machine_common.h +++ b/SleepLib/machine_common.h @@ -119,7 +119,7 @@ CPAP_CSR, CPAP_VSnore, CPAP_PressurePulse, CPAP_Mode, CPAP_FlowRate, CPAP_MaskPr CPAP_EPAP, CPAP_IPAP, CPAP_IPAP_Low, CPAP_IPAP_High, CPAP_PressureSupport, CPAP_Snore, CPAP_Leak, CPAP_RespiratoryRate, CPAP_TidalVolume, CPAP_MinuteVentilation, CPAP_PatientTriggeredBreaths, CPAP_FlowLimitGraph, CPAP_TherapyPressure, CPAP_ExpiratoryPressure, CPAP_AHI, CPAP_BrokenSummary, -CPAP_BrokenWaveform; +CPAP_BrokenWaveform, CPAP_Pulse, CPAP_SPO2; extern ChannelID RMS9_PressureReliefType, RMS9_PressureReliefSetting, RMS9_Empty1, RMS9_Empty2; extern ChannelID PRS1_PressureMin,PRS1_PressureMax, PRS1_PressureMinAchieved, PRS1_PressureMaxAchieved, diff --git a/daily.cpp b/daily.cpp index f8b251c2..524be36d 100644 --- a/daily.cpp +++ b/daily.cpp @@ -96,6 +96,8 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) RR=new gGraphWindow(parental,tr("Respiratory Rate"),SF); PTB=new gGraphWindow(parental,tr("Patient Trig Breaths"),SF); //OF=new gGraphWindow(parental,tr("Oxi-Flags"),SF); + INTPULSE=new gGraphWindow(parental,tr("Pulse"),SF); // Integrated Pulse + INTSPO2=new gGraphWindow(parental,tr("SPO2"),SF); // Integrated Pulse PULSE=new gGraphWindow(parental,tr("Pulse"),SF); SPO2=new gGraphWindow(parental,tr("SPO2"),SF); @@ -214,9 +216,18 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) PTB->AddLayer(AddCPAP(new gLineChart(CPAP_PatientTriggeredBreaths,Qt::gray,true))); PTB->setMinimumHeight(min_height); + INTPULSE->AddLayer(new gXAxis()); + INTPULSE->AddLayer(new gYAxis()); + INTPULSE->AddLayer(AddCPAP(new gLineChart(CPAP_Pulse,Qt::red,true))); + INTPULSE->setMinimumHeight(min_height); + + INTSPO2->AddLayer(new gXAxis()); + INTSPO2->AddLayer(new gYAxis()); + INTSPO2->AddLayer(AddCPAP(new gLineChart(CPAP_SPO2,Qt::blue,true))); + INTSPO2->setMinimumHeight(min_height); + PULSE->AddLayer(new gXAxis()); PULSE->AddLayer(new gYAxis()); - // PULSE->AddLayer(new gFooBar()); PULSE->AddLayer(AddOXI(new gLineChart(OXI_Pulse,Qt::red,true))); PULSE->AddLayer(AddOXI(new gLineOverlayBar(OXI_PulseChange,Qt::green,"PC",FT_Bar))); PULSE->setMinimumHeight(min_height); @@ -285,7 +296,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) //int i=splitter->indexOf(NoData); splitter->setStretchFactor(NoData,1); - gGraphWindow * graphs[]={SF,FRW,MP,MV,TV,PTB,RR,PRD,LEAK,FLG,SNORE}; + gGraphWindow * graphs[]={SF,FRW,MP,MV,TV,PTB,RR,PRD,LEAK,FLG,SNORE,INTPULSE,INTSPO2}; int ss=sizeof(graphs)/sizeof(gGraphWindow *); for (int i=0;isetStretchFactor(graphs[i],1); //splitter->setAlignment(graphs[i],Qt::AlignTop); for (int j=0;jLinkZoom(graphs[j]); + } } } diff --git a/daily.h b/daily.h index bfc4b72a..f5758689 100644 --- a/daily.h +++ b/daily.h @@ -81,7 +81,7 @@ private: //gPointData *pulse,*spo2,*rr,*mv,*tv,*mp,*flg,*ptb; gFlagsGroup *fg; - gGraphWindow *PRD,*FRW,*G_AHI,*TAP,*LEAK,*SF,*TAP_EAP,*TAP_IAP,*PULSE,*SPO2,*SNORE,*RR,*MP,*MV,*TV,*FLG,*PTB,*OF; + gGraphWindow *PRD,*FRW,*G_AHI,*TAP,*LEAK,*SF,*TAP_EAP,*TAP_IAP,*PULSE,*SPO2,*SNORE,*RR,*MP,*MV,*TV,*FLG,*PTB,*OF,*INTPULSE,*INTSPO2; QList OXIData; QList CPAPData;