libpappsomspp
Library for mass spectrometry
pappso::TimsFrameType1 Class Reference

#include <timsframetype1.h>

Inheritance diagram for pappso::TimsFrameType1:
pappso::TimsFrame pappso::TimsFrameBase

Public Member Functions

 TimsFrameType1 (std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
 
 TimsFrameType1 (const TimsFrameType1 &other)
 
virtual ~TimsFrameType1 ()
 
virtual std::size_t getNbrPeaks (std::size_t scanNum) const override
 get the number of peaks in this spectrum need the binary file More...
 
virtual std::vector< quint32 > getScanIndexList (std::size_t scanNum) const override
 get raw index list for one given scan index are not TOF nor m/z, just index on digitizer More...
 
virtual std::vector< quint32 > getScanIntensities (std::size_t scanNum) const override
 get raw intensities without transformation from one scan it needs intensity normalization More...
 
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr (std::size_t scanNum) const override
 get the mass spectrum corresponding to a scan number More...
 
- Public Member Functions inherited from pappso::TimsFrame
 TimsFrame (std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
 
 TimsFrame (const TimsFrame &other)
 
virtual ~TimsFrame ()
 
virtual std::size_t getNbrPeaks (std::size_t scanNum) const override
 get the number of peaks in this spectrum need the binary file More...
 
virtual Trace cumulateScanToTrace (std::size_t scanNumBegin, std::size_t scanNumEnd) const override
 cumulate scan list into a trace More...
 
virtual void cumulateScansInRawMap (std::map< quint32, quint32 > &rawSpectrum, std::size_t scanNumBegin, std::size_t scanNumEnd) const override
 cumulate scan list into a trace into a raw spectrum map More...
 
virtual std::vector< quint32 > getScanIndexList (std::size_t scanNum) const override
 get raw index list for one given scan index are not TOF nor m/z, just index on digitizer More...
 
virtual std::vector< quint32 > getScanIntensities (std::size_t scanNum) const override
 get raw intensities without transformation from one scan it needs intensity normalization More...
 
virtual pappso::MassSpectrumCstSPtr getMassSpectrumCstSPtr (std::size_t scanNum) const
 get the mass spectrum corresponding to a scan number More...
 
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr (std::size_t scanNum) const override
 get Mass spectrum with peaks for this scan number need the binary file More...
 
- Public Member Functions inherited from pappso::TimsFrameBase
 TimsFrameBase (std::size_t timsId, quint32 scanNum)
 constructor for binary independant tims frame More...
 
 TimsFrameBase (const TimsFrameBase &other)
 
virtual ~TimsFrameBase ()
 
virtual bool hasSameCalibrationData (const TimsFrameBase &other) const
 tells if 2 tims frame has the same calibration data Usefull to know if raw data can be handled between frames More...
 
virtual std::size_t getNbrPeaks (std::size_t scanNum) const
 get the number of peaks in this spectrum need the binary file More...
 
virtual std::size_t getTotalNumberOfScans () const
 get the number of scans contained in this frame each scan represents an ion mobility slice More...
 
virtual quint32 getMaximumRawMassIndex () const
 get the maximum raw mass index contained in this frame More...
 
virtual MassSpectrumSPtr getMassSpectrumSPtr (std::size_t scanNum) const
 get Mass spectrum with peaks for this scan number need the binary file More...
 
virtual Trace cumulateScanToTrace (std::size_t scanNumBegin, std::size_t scanNumEnd) const
 cumulate spectrum given a scan number range need the binary file More...
 
virtual void cumulateScansInRawMap (std::map< quint32, quint32 > &rawSpectrum, std::size_t scanNumBegin, std::size_t scanNumEnd) const
 cumulate scan list into a trace into a raw spectrum map More...
 
bool checkScanNum (std::size_t scanNum) const
 check that this scan number exists More...
 
void setAccumulationTime (double accumulation_time_ms)
 
void setMzCalibration (double T1_frame, double T2_frame, double digitizerTimebase, double digitizerDelay, double C0, double C1, double C2, double C3, double C4, double T1_ref, double T2_ref, double dC1, double dC2)
 
void setTimsCalibration (int tims_model_type, double C0, double C1, double C2, double C3, double C4, double C5, double C6, double C7, double C8, double C9)
 
void setTime (double time)
 
void setMsMsType (quint8 type)
 
unsigned int getMsLevel () const
 
double getTime () const
 
std::size_t getId () const
 
double getDriftTime (std::size_t scanNum) const
 get drift time of a scan number in milliseconds More...
 
double getOneOverK0Transformation (std::size_t scanNum) const
 get 1/K0 value of a given scan (mobility value) More...
 
std::size_t getScanNumFromOneOverK0 (double one_over_k0) const
 get the scan number from a given 1/Ko mobility value More...
 
double getVoltageTransformation (std::size_t scanNum) const
 get voltage for a given scan number More...
 
pappso::Trace getTraceFromCumulatedScans (std::map< quint32, quint32 > &accumulated_scans) const
 transform accumulation of raw scans into a real mass spectrum More...
 
pappso::Trace getTraceFromCumulatedScansBuiltinCentroid (std::map< quint32, quint32 > &accumulated_scans) const
 transform accumulation of raw scans into a real mass spectrum with a simple centroid on raw integers More...
 
virtual const MzCalibrationInterfaceSPtrgetMzCalibrationInterfaceSPtr () const final
 get the MzCalibration model to compute mz and TOF for this frame More...
 
void setMzCalibrationInterfaceSPtr (MzCalibrationInterfaceSPtr mzCalibration)
 
virtual std::vector< quint32 > getScanIndexList (std::size_t scanNum) const
 get raw index list for one given scan index are not TOF nor m/z, just index on digitizer More...
 
virtual std::vector< quint32 > getScanIntensities (std::size_t scanNum) const
 get raw intensities without transformation from one scan it needs intensity normalization More...
 
virtual Trace getIonMobilityTraceByMzIndexRange (std::size_t mz_index_lower_bound, std::size_t mz_index_upper_bound, XicExtractMethod method) const
 get a mobility trace cumulating intensities inside the given mass index range More...
 

Protected Member Functions

virtual void cumulateScan (std::size_t scanNum, std::map< quint32, quint32 > &accumulate_into) const override
 cumulate a scan into a map More...
 
virtual pappso::TraceSPtr getRawTraceSPtr (std::size_t scanNum) const override
 get the raw index tof_index and intensities (normalized) More...
 
- Protected Member Functions inherited from pappso::TimsFrame
 TimsFrame (std::size_t timsId, quint32 scanNum)
 constructor for binary independant tims frame More...
 
void extractTimsXicListInRtRange (std::vector< XicCoordTims * >::iterator &itXicListbegin, std::vector< XicCoordTims * >::iterator &itXicListend, XicExtractMethod method) const
 
virtual void cumulateScan (std::size_t scanNum, std::map< quint32, quint32 > &accumulate_into) const
 cumulate a scan into a map More...
 
virtual pappso::TraceSPtr getRawTraceSPtr (std::size_t scanNum) const
 get the raw index tof_index and intensities (normalized) More...
 

Private Member Functions

void copyAndLzfDecompress (const char *src, std::size_t len)
 copy buffer header and lzf decompress each scan for tims compression type 1 More...
 
unsigned int lzfDecompressScan (const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
 decompress a single LZF compressed scan buffer More...
 

Private Attributes

std::vector< std::size_t > m_scanOffsetList
 
std::vector< std::size_t > m_scanSizeList
 

Additional Inherited Members

- Protected Attributes inherited from pappso::TimsFrame
QByteArray m_timsDataFrame
 
- Protected Attributes inherited from pappso::TimsFrameBase
quint32 m_scanNumber
 total number of scans contained in this frame More...
 
std::size_t m_timsId
 Tims frame database id (the SQL identifier of this frame) More...
 
double m_accumulationTime = 0
 accumulation time in milliseconds More...
 
quint8 m_msMsType = 0
 
double m_time = 0
 retention time More...
 
double m_timsDvStart = 0
 
double m_timsSlope
 
double m_timsTtrans = 0
 
double m_timsNdelay = 0
 
double m_timsVmin = 0
 
double m_timsVmax = 0
 
double m_timsC6 = 0
 
double m_timsC7 = 0
 
MzCalibrationInterfaceSPtr msp_mzCalibration = nullptr
 

Detailed Description

Todo:
write docs

Definition at line 37 of file timsframetype1.h.

Constructor & Destructor Documentation

◆ TimsFrameType1() [1/2]

pappso::TimsFrameType1::TimsFrameType1 ( std::size_t  timsId,
quint32  scanNum,
char *  p_bytes,
std::size_t  len 
)
Parameters
timsIdtims frame id
scanNumtotal number of scans in this frame
p_bytespointer on the decompressed binary buffer
lensize of the decompressed binary buffer

Definition at line 40 of file timsframetype1.cpp.

44 : TimsFrame(timsId, scanNum)
45{
46 qDebug() << timsId;
47 m_timsDataFrame.resize(len * 2);
48
49 if(p_bytes != nullptr)
50 {
51 qDebug() << timsId;
52 copyAndLzfDecompress(p_bytes, len);
53 qDebug() << timsId;
54 }
55 else
56 {
57 if(m_scanNumber == 0)
58 {
59
61 QObject::tr(
62 "TimsFrameType1::TimsFrameType1(%1,%2,nullptr,%3) FAILED")
63 .arg(m_timsId)
64 .arg(m_scanNumber)
65 .arg(len));
66 }
67 }
68}
quint32 m_scanNumber
total number of scans contained in this frame
std::size_t m_timsId
Tims frame database id (the SQL identifier of this frame)
void copyAndLzfDecompress(const char *src, std::size_t len)
copy buffer header and lzf decompress each scan for tims compression type 1
QByteArray m_timsDataFrame
Definition: timsframe.h:181
TimsFrame(std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
Definition: timsframe.cpp:63

References copyAndLzfDecompress(), pappso::TimsFrameBase::m_scanNumber, pappso::TimsFrame::m_timsDataFrame, and pappso::TimsFrameBase::m_timsId.

◆ TimsFrameType1() [2/2]

pappso::TimsFrameType1::TimsFrameType1 ( const TimsFrameType1 other)

Copy constructor

Parameters
otherTODO

Definition at line 70 of file timsframetype1.cpp.

70 : TimsFrame(other)
71{
72}

◆ ~TimsFrameType1()

pappso::TimsFrameType1::~TimsFrameType1 ( )
virtual

Destructor

Definition at line 74 of file timsframetype1.cpp.

75{
76}

Member Function Documentation

◆ copyAndLzfDecompress()

void pappso::TimsFrameType1::copyAndLzfDecompress ( const char *  src,
std::size_t  len 
)
private

copy buffer header and lzf decompress each scan for tims compression type 1

Parameters
srcraw data buffer containing scan offsets and LZF compressed scans
lenlength of the data buffer

Definition at line 80 of file timsframetype1.cpp.

81{
82
83 qDebug() << " m_scanNumber=" << m_scanNumber << " len=" << len;
84 // the start position offset for each scan and the length of the last scan
85 // copy first m_scanNumber*4 bytes in qbyte array
86 std::size_t count = (m_scanNumber + 2) * 4;
87
88 qDebug() << " count=" << count;
89 if(m_timsDataFrame.size() < (long)(count + count))
90 {
91 qDebug() << " m_timsDataFrame.size()=" << m_timsDataFrame.size();
92 m_timsDataFrame.resize(count + count);
93 }
94
95 /*
96 std::size_t decompressed_size =
97 lzfDecompressScan(src + 3687 - 8,
98 9,
99 m_timsDataFrame.data() + 3660,
100 m_timsDataFrame.size() - 3660);
101
102 qDebug() << "decompressed_size=" << decompressed_size;
103 */
104 // memcpy(m_timsDataFrame.data(), src, count);
105
106 qDebug() << "offset begin at last :" << count + 4;
107
108 // std::vector<std::size_t> compressed_len_list;
109 std::size_t offset;
110 std::size_t previous_offset = (*(quint32 *)(src));
111 qDebug() << "first offset= " << previous_offset;
112 std::size_t cumul_decompressed_size = 0;
113
114
115 for(quint32 i = 1; i <= m_scanNumber; i++)
116 {
117 offset = (*(quint32 *)(src + (i * 4)));
118
119 std::size_t compressed_size = offset - previous_offset;
120
121 qDebug() << "scan i=" << i << " previous_offset=" << previous_offset
122 << " offset=" << offset << " length=" << compressed_size;
123 // compressed_len_list.push_back(offset - previous_offset);
124 std::size_t remaining_size = m_timsDataFrame.size();
125
126 if(cumul_decompressed_size < remaining_size)
127 {
128 remaining_size = remaining_size - cumul_decompressed_size;
129 }
130 else
131 {
132 remaining_size = 0;
133 }
134 qDebug() << " remaining_size=" << remaining_size;
135 std::size_t decompressed_size =
136 lzfDecompressScan(src + previous_offset - 8,
137 compressed_size,
138 m_timsDataFrame.data() + cumul_decompressed_size,
139 remaining_size);
140
141
142 m_scanOffsetList.push_back(cumul_decompressed_size);
143 m_scanSizeList.push_back(decompressed_size / 4);
144 cumul_decompressed_size += decompressed_size;
145 qDebug() << " decompressed_size=" << decompressed_size;
146
147
148 previous_offset = offset;
149 }
150 /*
151 std::size_t last_offset = (*(quint32 *)(src + (m_scanNumber * 4)));
152 qDebug() << "last scan length :" << last_offset;
153
154 qDebug() << "last scan length bonus:"
155 << (*(quint32 *)(src + (m_scanNumber + 1 * 4)));
156
157 qDebug() << " m_scanOffsetList.size()=" << m_scanOffsetList.size()
158 << " m_scanNumber=" << m_scanNumber;
159 */
160 /*
161 throw PappsoException(
162 QObject::tr("ERROR reading TimsFrameType1 ").arg(m_timsId));
163 */
164}
std::vector< std::size_t > m_scanSizeList
unsigned int lzfDecompressScan(const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
decompress a single LZF compressed scan buffer
std::vector< std::size_t > m_scanOffsetList

References lzfDecompressScan(), pappso::TimsFrameBase::m_scanNumber, m_scanOffsetList, m_scanSizeList, and pappso::TimsFrame::m_timsDataFrame.

Referenced by TimsFrameType1().

◆ cumulateScan()

void pappso::TimsFrameType1::cumulateScan ( std::size_t  scanNum,
std::map< quint32, quint32 > &  accumulate_into 
) const
overrideprotectedvirtual

cumulate a scan into a map

Parameters
scanNumscan number 0 to (m_scanNumber-1)

Reimplemented from pappso::TimsFrame.

Definition at line 218 of file timsframetype1.cpp.

220{
221 if(m_timsDataFrame.size() == 0)
222 return;
223 // checkScanNum(scanNum);
224
225
226 std::size_t size = m_scanSizeList[scanNum];
227
228 std::size_t offset = m_scanOffsetList[scanNum];
229
230 // qDebug() << "begin offset=" << offset << " size=" << size;
231 qint32 value = 0;
232 qint32 tof_index = 0;
233 for(std::size_t i = 0; i < size; i++)
234 {
235 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
236 // qDebug() << " i=" << i << " value=" << value;
237
238 if(value < 0)
239 {
240 tof_index += -1 * value;
241 }
242 else
243 {
244
245 quint32 x = tof_index;
246 quint32 y = value;
247
248 auto ret = accumulate_into.insert(std::pair<quint32, quint32>(x, y));
249
250 if(ret.second == false)
251 {
252 // already existed : cumulate
253 ret.first->second += y;
254 }
255 tof_index++;
256 }
257 }
258 qDebug() << "end";
259}

References m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::x, and pappso::y.

◆ getMassSpectrumSPtr()

pappso::MassSpectrumSPtr pappso::TimsFrameType1::getMassSpectrumSPtr ( std::size_t  scanNum) const
overridevirtual

get the mass spectrum corresponding to a scan number

Parameters
scanNumthe scan number to retrieve

Reimplemented from pappso::TimsFrame.

Definition at line 382 of file timsframetype1.cpp.

383{
384
385 qDebug() << " scanNum=" << scanNum;
386
387 checkScanNum(scanNum);
388
389 try
390 {
391 qDebug();
392
393 pappso::MassSpectrumSPtr mass_spectrum_sptr =
394 std::make_shared<pappso::MassSpectrum>();
395 // std::vector<DataPoint>
396
397 if(m_timsDataFrame.size() == 0)
398 return mass_spectrum_sptr;
399 qDebug();
400
401 std::size_t size = m_scanSizeList[scanNum];
402
403 std::size_t offset = m_scanOffsetList[scanNum];
404
405 qDebug() << " offset=" << offset << " size=" << size;
406 if(size == 0)
407 return mass_spectrum_sptr;
408
409
410 MzCalibrationInterface *mz_calibration_p =
412
413
414 qint32 value = 0;
415 qint32 tof_index = 0;
416 // std::vector<quint32> index_list;
417 DataPoint data_point;
418 for(std::size_t i = 0; i < size; i++)
419 {
420 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
421
422 if(value < 0)
423 {
424 tof_index += -1 * value;
425 }
426 else
427 {
428 data_point.y = value;
429
430 // intensity normalization
431 data_point.y *= 100.0 / m_accumulationTime;
432
433
434 // mz calibration
435 data_point.x = mz_calibration_p->getMzFromTofIndex(tof_index);
436 mass_spectrum_sptr.get()->push_back(data_point);
437 tof_index++;
438 }
439 }
440
441
442 qDebug() << mass_spectrum_sptr.get()->toString();
443 return mass_spectrum_sptr;
444 }
445 catch(PappsoException &error)
446 {
448 QObject::tr("Error TimsFrameType1::getMassSpectrumSPtr frameId=%1 "
449 "scanNum=%2 :\n%3")
450 .arg(getId())
451 .arg(scanNum)
452 .arg(error.qwhat()));
453 }
454}
double m_accumulationTime
accumulation time in milliseconds
virtual const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
bool checkScanNum(std::size_t scanNum) const
check that this scan number exists
std::size_t getId() const
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition: massspectrum.h:54

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), pappso::TimsFrameBase::getMzCalibrationInterfaceSPtr(), pappso::MzCalibrationInterface::getMzFromTofIndex(), pappso::TimsFrameBase::m_accumulationTime, m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::PappsoException::qwhat(), pappso::DataPoint::x, and pappso::DataPoint::y.

Referenced by getNbrPeaks().

◆ getNbrPeaks()

std::size_t pappso::TimsFrameType1::getNbrPeaks ( std::size_t  scanNum) const
overridevirtual

get the number of peaks in this spectrum need the binary file

Parameters
scanNumscan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented from pappso::TimsFrame.

Definition at line 210 of file timsframetype1.cpp.

211{
212 pappso::MassSpectrumSPtr mass_spectrum_sptr = getMassSpectrumSPtr(scanNum);
213 return mass_spectrum_sptr.get()->size();
214}
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const override
get the mass spectrum corresponding to a scan number

References getMassSpectrumSPtr().

◆ getRawTraceSPtr()

pappso::TraceSPtr pappso::TimsFrameType1::getRawTraceSPtr ( std::size_t  scanNum) const
overrideprotectedvirtual

get the raw index tof_index and intensities (normalized)

Parameters
scanNumthe scan number to extract
Returns
trace vector

Reimplemented from pappso::TimsFrame.

Definition at line 458 of file timsframetype1.cpp.

459{
460
461 // qDebug();
462
463 pappso::TraceSPtr trace_sptr = std::make_shared<pappso::Trace>();
464 // std::vector<DataPoint>
465
466 if(m_timsDataFrame.size() == 0)
467 return trace_sptr;
468 qDebug();
469
470 std::size_t size = m_scanSizeList[scanNum];
471
472 std::size_t offset = m_scanOffsetList[scanNum];
473
474 qDebug() << " offset=" << offset << " size=" << size;
475 if(size == 0)
476 return trace_sptr;
477
478 // qDebug();
479 qint32 value = 0;
480 qint32 tof_index = 0;
481
482 // std::vector<quint32> index_list;
483 DataPoint data_point;
484 for(std::size_t i = 0; i < size; i++)
485 {
486 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
487
488 if(value < 0)
489 {
490 tof_index += -1 * value;
491 }
492 else
493 {
494 data_point.y = value;
495
496 // intensity normalization
497 data_point.y *= 100.0 / m_accumulationTime;
498
499
500 // mz calibration
501 data_point.x = tof_index;
502 trace_sptr.get()->push_back(data_point);
503 tof_index++;
504 }
505 }
506
507
508 // qDebug();
509 return trace_sptr;
510}
std::shared_ptr< Trace > TraceSPtr
Definition: trace.h:134

References pappso::TimsFrameBase::m_accumulationTime, m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::DataPoint::x, and pappso::DataPoint::y.

◆ getScanIndexList()

std::vector< quint32 > pappso::TimsFrameType1::getScanIndexList ( std::size_t  scanNum) const
overridevirtual

get raw index list for one given scan index are not TOF nor m/z, just index on digitizer

Reimplemented from pappso::TimsFrame.

Definition at line 262 of file timsframetype1.cpp.

263{
264 qDebug();
265 checkScanNum(scanNum);
266
267 std::vector<quint32> mzindex_values;
268
269 try
270 {
271 qDebug();
272
273
274 if(m_timsDataFrame.size() == 0)
275 return mzindex_values;
276 qDebug();
277
278 std::size_t size = m_scanSizeList[scanNum];
279
280 std::size_t offset = m_scanOffsetList[scanNum];
281
282 qDebug() << " offset=" << offset << " size=" << size;
283 if(size == 0)
284 return mzindex_values;
285
286 qint32 value = 0;
287 qint32 tof_index = 0;
288 // std::vector<quint32> index_list;
289 for(std::size_t i = 0; i < size; i++)
290 {
291 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
292
293 if(value < 0)
294 {
295 tof_index += -1 * value;
296 }
297 else
298 {
299 mzindex_values.push_back(tof_index);
300 tof_index++;
301 }
302 }
303
304
305 qDebug();
306 return mzindex_values;
307 }
308 catch(PappsoException &error)
309 {
310 throw pappso::PappsoException(QObject::tr("Error %1 frameId=%2 "
311 "scanNum=%3 :\n%4")
312 .arg(__FUNCTION__)
313 .arg(getId())
314 .arg(scanNum)
315 .arg(error.qwhat()));
316 }
317 qDebug();
318}

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, and pappso::PappsoException::qwhat().

◆ getScanIntensities()

std::vector< quint32 > pappso::TimsFrameType1::getScanIntensities ( std::size_t  scanNum) const
overridevirtual

get raw intensities without transformation from one scan it needs intensity normalization

Reimplemented from pappso::TimsFrame.

Definition at line 321 of file timsframetype1.cpp.

322{
323
324
325 qDebug() << " scanNum=" << scanNum;
326
327 checkScanNum(scanNum);
328
329 std::vector<quint32> int_values;
330
331 try
332 {
333 qDebug();
334
335
336 if(m_timsDataFrame.size() == 0)
337 return int_values;
338 qDebug();
339
340 std::size_t size = m_scanSizeList[scanNum];
341
342 std::size_t offset = m_scanOffsetList[scanNum];
343
344 qDebug() << " offset=" << offset << " size=" << size;
345 if(size == 0)
346 return int_values;
347
348 qint32 value = 0;
349 qint32 tof_index = 0;
350 // std::vector<quint32> index_list;
351 for(std::size_t i = 0; i < size; i++)
352 {
353 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
354
355 if(value < 0)
356 {
357 tof_index += -1 * value;
358 }
359 else
360 {
361 int_values.push_back(value);
362 tof_index++;
363 }
364 }
365
366
367 qDebug();
368 return int_values;
369 }
370 catch(PappsoException &error)
371 {
372 throw pappso::PappsoException(QObject::tr("Error %1 frameId=%2 "
373 "scanNum=%3 :\n%4")
374 .arg(__FUNCTION__)
375 .arg(getId())
376 .arg(scanNum)
377 .arg(error.qwhat()));
378 }
379}

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, and pappso::PappsoException::qwhat().

◆ lzfDecompressScan()

unsigned int pappso::TimsFrameType1::lzfDecompressScan ( const char *  src,
unsigned int  src_len,
char *  dest,
unsigned int  dest_len 
)
private

decompress a single LZF compressed scan buffer

Parameters
srcpointer on the LZF compressed buffer
src_lenlength of the source buffer
destpointer to the destination buffer (in the qbyte array)
dest_lenlength of the destination buffer (max possible in the qbytearray)
Returns
scan decompressed size

Definition at line 168 of file timsframetype1.cpp.

172{
173 qDebug() << "src=" << src << " src_len=" << src_len
174 << " dest_len=" << dest_len;
175 if(src_len == 0)
176 return 0;
177 unsigned int decompressed_size;
178 unsigned int more_space = src_len * 2;
179 decompressed_size = lzf_decompress(src, src_len, dest, dest_len);
180 while(decompressed_size == 0)
181 {
182 qDebug() << "dest_len=" << dest_len;
183 qDebug() << "decompressed_size=" << decompressed_size;
184
185 if(errno == EINVAL)
186 {
187 throw PappsoException(
188 QObject::tr("ERROR reading TimsFrameType1 %1 TIMS binary file %2: "
189 "LZF decompression error EINVAL")
190 .arg(m_timsId));
191 }
192 else if(errno == E2BIG)
193 {
194 qDebug() << " m_timsDataFrame.size()=" << m_timsDataFrame.size()
195 << " more_space=" << more_space;
196 m_timsDataFrame.resize(m_timsDataFrame.size() + more_space);
197 dest_len += more_space;
198 qDebug();
199 decompressed_size = lzf_decompress(src, src_len, dest, dest_len);
200 }
201 else
202 {
203 break;
204 }
205 }
206 return decompressed_size;
207}

References pappso::TimsFrame::m_timsDataFrame, and pappso::TimsFrameBase::m_timsId.

Referenced by copyAndLzfDecompress().

Member Data Documentation

◆ m_scanOffsetList

std::vector<std::size_t> pappso::TimsFrameType1::m_scanOffsetList
private

◆ m_scanSizeList

std::vector<std::size_t> pappso::TimsFrameType1::m_scanSizeList
private

The documentation for this class was generated from the following files: