mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Change edf-parser to be more inheritation-friendly
This commit is contained in:
parent
f96ef0f15e
commit
0001681146
@ -250,6 +250,12 @@ bool EDFInfo::Parse() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ret = ParseSignalData();
|
||||||
|
fileData.clear();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EDFInfo::ParseSignalData() {
|
||||||
// Now check the file isn't truncated before allocating space for the values
|
// Now check the file isn't truncated before allocating space for the values
|
||||||
long allocsize = 0;
|
long allocsize = 0;
|
||||||
for (auto & sig : edfsignals) {
|
for (auto & sig : edfsignals) {
|
||||||
@ -265,7 +271,6 @@ bool EDFInfo::Parse() {
|
|||||||
fileData.clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate the arrays for the signal values
|
// allocate the arrays for the signal values
|
||||||
for (auto & sig : edfsignals) {
|
for (auto & sig : edfsignals) {
|
||||||
long samples = sig.sampleCnt * edfHdr.num_data_records;
|
long samples = sig.sampleCnt * edfHdr.num_data_records;
|
||||||
@ -289,7 +294,7 @@ bool EDFInfo::Parse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileData.clear();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ class EDFInfo
|
|||||||
|
|
||||||
virtual bool Parse(); //! \brief Parse the EDF+ file into the EDFheaderQT. Must call Open(..) first.
|
virtual bool Parse(); //! \brief Parse the EDF+ file into the EDFheaderQT. Must call Open(..) first.
|
||||||
|
|
||||||
|
virtual bool ParseSignalData(); //! \brief Parse the signal data
|
||||||
|
|
||||||
virtual bool parseHeader( EDFHeaderRaw * hdrPtr ); //! \brief parse just the edf header for duration, etc
|
virtual bool parseHeader( EDFHeaderRaw * hdrPtr ); //! \brief parse just the edf header for duration, etc
|
||||||
|
|
||||||
virtual EDFSignal * lookupLabel(const QString & name, int index=0); //! \brief Return a ptr to the i'th signal with that name
|
virtual EDFSignal * lookupLabel(const QString & name, int index=0); //! \brief Return a ptr to the i'th signal with that name
|
||||||
@ -166,24 +168,27 @@ class EDFInfo
|
|||||||
QHash<QString, QList<EDFSignal *> > signalList; //! \brief ResMed sometimes re-uses the SAME signal name
|
QHash<QString, QList<EDFSignal *> > signalList; //! \brief ResMed sometimes re-uses the SAME signal name
|
||||||
|
|
||||||
// the following could be private
|
// the following could be private
|
||||||
|
protected:
|
||||||
|
//! \brief This is the array of signal descriptors and values
|
||||||
|
char *signalPtr;
|
||||||
|
long filesize;
|
||||||
|
long datasize;
|
||||||
|
long pos;
|
||||||
|
bool eof;
|
||||||
|
|
||||||
|
//! \brief This is the array holding the EDF file data
|
||||||
|
QByteArray fileData;
|
||||||
|
//! \brief Read 16 bit word of data from the EDF+ data stream
|
||||||
|
qint16 Read16();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<Annotation> ReadAnnotations( const char * data, int charLen ); //! \brief Create an Annotaion vector from the signal values
|
QVector<Annotation> ReadAnnotations( const char * data, int charLen ); //! \brief Create an Annotaion vector from the signal values
|
||||||
|
|
||||||
QString ReadBytes(unsigned n); //! \brief Read n bytes of 8 bit data from the EDF+ data stream
|
QString ReadBytes(unsigned n); //! \brief Read n bytes of 8 bit data from the EDF+ data stream
|
||||||
|
|
||||||
qint16 Read16(); //! \brief Read 16 bit word of data from the EDF+ data stream
|
|
||||||
|
|
||||||
//! \brief This is the array holding the EDF file data
|
|
||||||
QByteArray fileData;
|
|
||||||
//! \brief The EDF+ files header structure, used as a place holder while processing the text data.
|
//! \brief The EDF+ files header structure, used as a place holder while processing the text data.
|
||||||
EDFHeaderRaw *hdrPtr;
|
EDFHeaderRaw *hdrPtr;
|
||||||
//! \brief This is the array of signal descriptors and values
|
|
||||||
char *signalPtr;
|
|
||||||
|
|
||||||
long filesize;
|
|
||||||
long datasize;
|
|
||||||
long pos;
|
|
||||||
bool eof;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user