OpenMS
Loading...
Searching...
No Matches
ImzMLSpectrumRules Class Reference

Per-spectrum rules shared by every imzML access path (in-memory, streaming, metadata-only, index-only and OnDiscImzMLExperiment), so they cannot drift apart. More...

#include <OpenMS/FORMAT/HANDLERS/ImzMLHandlerHelper.h>

Static Public Member Functions

static double scanStartTime (const MSSpectrum &s)
 Acquisition (scan start) time of an imaging spectrum in seconds.
 
static bool isLoadableAuxArray (const std::string &name, uint64_t length, ImzMLSpectrumIndex::DataType type, uint64_t n_peaks, bool warn=false, uint32_t x=0, uint32_t y=0, uint32_t z=0)
 Whether an external auxiliary array is read from the .ibd for a spectrum with n_peaks peaks (it needs an identity, a non-zero length equal to the peak count and a known binary data type). The one rule for every access path.
 
static void applyIMPeakType (MSSpectrum &s, bool has_im_array)
 Set the IM peak type after the auxiliary arrays are known: with an ion mobility array, UNKNOWN becomes IM_PROFILE (a type the file declares, e.g. MS:1003441, is kept); without one, the type is UNKNOWN.
 
static void attachAuxArray (MSSpectrum &s, const std::string &name, const std::string &unit_accession, const std::vector< float > &values)
 Attach the values of an external auxiliary array read from the .ibd.
 
static void pruneEmptyDataArrays (MSSpectrum &s)
 Drop the empty Float/Integer/StringDataArrays left by MzMLHandler for aux arrays that were not filled.
 

Detailed Description

Per-spectrum rules shared by every imzML access path (in-memory, streaming, metadata-only, index-only and OnDiscImzMLExperiment), so they cannot drift apart.

Member Function Documentation

◆ applyIMPeakType()

static void applyIMPeakType ( MSSpectrum &  s,
bool  has_im_array 
)
static

Set the IM peak type after the auxiliary arrays are known: with an ion mobility array, UNKNOWN becomes IM_PROFILE (a type the file declares, e.g. MS:1003441, is kept); without one, the type is UNKNOWN.

◆ attachAuxArray()

static void attachAuxArray ( MSSpectrum &  s,
const std::string &  name,
const std::string &  unit_accession,
const std::vector< float > &  values 
)
static

Attach the values of an external auxiliary array read from the .ibd.

They go into the first still-empty FloatDataArray named name (MzMLHandler creates one per auxiliary binaryDataArray, with its metadata), so repeated names map 1:1 in order; without one, a new array named name (and unit_accession) is added.

◆ isLoadableAuxArray()

static bool isLoadableAuxArray ( const std::string &  name,
uint64_t  length,
ImzMLSpectrumIndex::DataType  type,
uint64_t  n_peaks,
bool  warn = false,
uint32_t  x = 0,
uint32_t  y = 0,
uint32_t  z = 0 
)
static

Whether an external auxiliary array is read from the .ibd for a spectrum with n_peaks peaks (it needs an identity, a non-zero length equal to the peak count and a known binary data type). The one rule for every access path.

With warn, a skipped array (other than one of length 0) is logged with the pixel x / y / z.

◆ pruneEmptyDataArrays()

static void pruneEmptyDataArrays ( MSSpectrum &  s)
static

Drop the empty Float/Integer/StringDataArrays left by MzMLHandler for aux arrays that were not filled.

◆ scanStartTime()

static double scanStartTime ( const MSSpectrum &  s)
static

Acquisition (scan start) time of an imaging spectrum in seconds.

Imaging spectra keep RT at -1 and store the time as the MetaValue imzml:scan_start_time. An RT the caller set (>= 0) wins over the MetaValue; a non-numeric, non-finite or negative MetaValue counts as no time (a scan start time is relative to the start of the run, so a negative one is a placeholder).

Returns
The time (>= 0), or the (negative) RT if the spectrum has none.