00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef MFERREADER_H
00026 #define MFERREADER_H
00027
00035 class MferReader
00036 {
00037 public:
00039 enum MFER_TAGS
00040 {
00041
00042
00043
00044 MWF_IVL = 0x0B,
00045 MWF_SEN = 0x0C,
00047
00048 MWF_BLK = 0x04,
00049 MWF_CHN = 0x05,
00050 MWF_SEQ = 0x06,
00052
00053 MWF_WFM = 0x08,
00054 MWF_LDN = 0x09,
00055 MWF_WAV = 0x1E,
00057
00058 MWF_ATT = 0x3F,
00060
00061 MWF_DTP = 0x0A,
00062 MWF_OFF = 0x0D,
00063 MWF_NUL = 0x12,
00064 MWF_CMP = 0x0E,
00066
00067 MWF_BLE = 0x01,
00068 MWF_PNT = 0x07,
00069 MWF_ZRO = 0x00,
00071
00072 MWF_PRE = 0x40,
00073 MWF_MAN = 0x17,
00074 MWF_EVT = 0x41,
00075 MWF_INF = 0x15,
00076 MWF_CND = 0x44,
00077 MWF_NTE = 0x16,
00078 MWF_VER = 0x02,
00079 MWF_TXC = 0x03,
00080 MWF_FLT = 0x11,
00081 MWF_IPD = 0x0F,
00083
00084 MWF_INVALID = 0xFF
00085 };
00086
00088 enum SamplingRateUnit
00089 {
00090 Frequency_hz = 0,
00091 Time_interval_sec = 1,
00092 Distance_m = 2
00093 };
00094
00096 enum SamplingResolutionUnit
00097 {
00098 Volt = 0,
00099 mmHg_Torr = 1,
00100 Pa = 2,
00101 cmH2O = 3,
00102 mmHg_s = 4,
00103 dyne = 5,
00104 Newton = 6
00105 };
00106
00108 enum WaveformType
00109 {
00110 UNDEFINED = 0,
00111 ECG_STD12 = 1,
00112 ECG_LTERM = 2,
00113 ECG_VECTR = 3,
00114 ECG_EXCER = 4,
00115 ECG_INTR = 5,
00116 ECG_SURF = 6,
00117 ECG_ILATE = 7,
00118 ECG_LATE = 8
00119 };
00120
00122 enum WaveformCode
00123 {
00124 Lead_I = 1,
00125 Lead_2 = 2,
00126 Lead_V1 = 3,
00127 Lead_V2 = 4,
00128 Lead_V3 = 5,
00129 Lead_V4 = 6,
00130 Lead_V5 = 7,
00131 Lead_V6 = 8,
00132 Lead_V7 = 9
00133 };
00134
00136 typedef struct mfer_tags_t
00137 {
00138 qint64 offset;
00139 MFER_TAGS type;
00140 quint32 length;
00141 char *value;
00142 } mfer_tags;
00143
00144
00145
00147 typedef qint16 mfer_data_block;
00149 typedef struct mfer_frame_t
00150 {
00151
00152 int numberOfSequences;
00153
00154 int numberOfChannels;
00155
00156 int dataBlockLength;
00157 mfer_data_block *block;
00158 } mfer_frame;
00159
00161 typedef void(MferReader::*pt2mem)(char *, int);
00163 typedef std::map<MFER_TAGS, pt2mem> parseFuncMap;
00165 typedef std::map<MFER_TAGS, pt2mem>::const_iterator parseFuncMap_cit;
00166
00171 MferReader(const QString &filename = "");
00172
00177 bool readFile(const QString &filename);
00186 int fillData(QVector<QVector<double> > &pDest,
00187 int screennumber,
00188 int channel);
00189
00191 bool isValid() const { return valid; }
00193 QPointF lineAxisBounds() const;
00195 int samplesprSecond() const;
00196
00197 QVector<mfer_tags> tagsVector;
00198 mfer_frame mferFrame;
00199 QByteArray baTemp;
00201 private:
00202 void parseBlocks(void);
00203 void convertByteArray(int length);
00204
00205
00206 void parseBuffer(QDataStream &inputStream);
00207 void initParsetable(void);
00208
00209
00210 void parse_MWF_IVL(char *, int);
00211 void parse_MWF_SEN(char *, int);
00212
00213
00214 void parse_MWF_BLK(char *, int);
00215 void parse_MWF_CHN(char *, int);
00216 void parse_MWF_SEQ(char *, int);
00217
00218
00219
00220
00221 void parse_MWF_WFM(char *, int);
00222
00223 void parse_MWF_LDN(char *, int);
00224
00225 void parse_MWF_BLE(char *, int);
00226
00227 void printHeader(void);
00228
00229 SamplingRateUnit samplingRateUnit;
00230 SamplingResolutionUnit samplingResolutionUnit;
00232 int samplingRateMantissa;
00233 int samplingResolutionMantissa;
00234 char samplingRateExponent;
00235 char samplingResolutionExponent;
00236 WaveformType waveformType;
00237
00238 WaveformCode waveformCode;
00240 parseFuncMap parseFunctions;
00241 QString filename;
00242
00243 bool noswap;
00244 QDataStream::ByteOrder byteorder;
00245 bool valid;
00246
00247 };
00248 inline QPointF MferReader::lineAxisBounds() const
00249 { return QPointF(-2.0, 2.0); }
00250
00251 #endif // MFERREADER_H