OpenMS
Loading...
Searching...
No Matches
IonImage Class Referencefinal

Dense W x H grid of ion intensities with a per-pixel mask. More...

#include <OpenMS/IMAGING/IonImage.h>

Collaboration diagram for IonImage:
[legend]

Public Member Functions

 IonImage ()=default
 Default-construct an empty 0 x 0 image.
 
 IonImage (UInt width, UInt height)
 Constructs and zero-initializes a width x height image; all pixels invalid.
 
void resize (UInt width, UInt height)
 Resizes and zero-initializes; all pixels become invalid.
 
UInt getWidth () const
 Image width.
 
UInt getHeight () const
 Image height.
 
bool hasPixel (UInt x, UInt y) const
 True once setIntensity has been called for the cell at (x, y).
 
double getIntensity (UInt x, UInt y) const
 Intensity at (x, y); 0.0 if never set.
 
void setIntensity (UInt x, UInt y, double intensity)
 Stores intensity at (x, y) and marks the cell valid.
 
void setMzRange (const RangeMZ &range)
 Records the m/z window the image was extracted from.
 
const RangeMZgetMzRange () const
 m/z window the image was extracted from.
 
const std::vector< double > & getData () const
 Raw row-major intensity buffer.
 
const std::vector< bool > & getMask () const
 Parallel pixel mask (same indexing as getData()).
 

Private Member Functions

Size linearIndex_ (UInt x, UInt y) const
 

Private Attributes

UInt width_ = 0
 
UInt height_ = 0
 
std::vector< double > intensities_
 
std::vector< bool > mask_
 
RangeMZ mz_range_
 

Detailed Description

Dense W x H grid of ion intensities with a per-pixel mask.

Storage is row-major: index = y * W + x. Pixels are masked-out by default; setIntensity marks them present. The m/z window the image was extracted from is stored alongside the data for traceability.

3D MSI is intentionally not modeled here. Serial-section experiments are a stack of independent 2D acquisitions and should be handled as a collection of IonImage objects (one per section), matching the OpenMS "vector of units" idiom.

Constructor & Destructor Documentation

◆ IonImage() [1/2]

IonImage ( )
default

Default-construct an empty 0 x 0 image.

◆ IonImage() [2/2]

IonImage ( UInt  width,
UInt  height 
)

Constructs and zero-initializes a width x height image; all pixels invalid.

Parameters
[in]widthNumber of columns.
[in]heightNumber of rows.

Member Function Documentation

◆ getData()

const std::vector< double > & getData ( ) const

Raw row-major intensity buffer.

Returns
Reference to the internal buffer of size width * height.

◆ getHeight()

UInt getHeight ( ) const

Image height.

Returns
Number of rows.

◆ getIntensity()

double getIntensity ( UInt  x,
UInt  y 
) const

Intensity at (x, y); 0.0 if never set.

Parameters
[in]xColumn index.
[in]yRow index.
Returns
Stored intensity, or 0.0 if hasPixel(x, y) is false.
Exceptions
Exception::IndexOverflowon out-of-bounds access.

◆ getMask()

const std::vector< bool > & getMask ( ) const

Parallel pixel mask (same indexing as getData()).

Returns
Reference to the mask of size width * height.

◆ getMzRange()

const RangeMZ & getMzRange ( ) const

m/z window the image was extracted from.

Returns
Stored range; empty if never set.

◆ getWidth()

UInt getWidth ( ) const

Image width.

Returns
Number of columns.

◆ hasPixel()

bool hasPixel ( UInt  x,
UInt  y 
) const

True once setIntensity has been called for the cell at (x, y).

Parameters
[in]xColumn index.
[in]yRow index.
Returns
false for out-of-bounds coordinates or cells never written.

◆ linearIndex_()

Size linearIndex_ ( UInt  x,
UInt  y 
) const
private

◆ resize()

void resize ( UInt  width,
UInt  height 
)

Resizes and zero-initializes; all pixels become invalid.

Parameters
[in]widthNumber of columns.
[in]heightNumber of rows.

◆ setIntensity()

void setIntensity ( UInt  x,
UInt  y,
double  intensity 
)

Stores intensity at (x, y) and marks the cell valid.

Parameters
[in]xColumn index.
[in]yRow index.
[in]intensityValue to store.
Exceptions
Exception::IndexOverflowon out-of-bounds access.

◆ setMzRange()

void setMzRange ( const RangeMZ range)

Records the m/z window the image was extracted from.

Parameters
[in]rangem/z window.

Member Data Documentation

◆ height_

UInt height_ = 0
private

◆ intensities_

std::vector<double> intensities_
private

◆ mask_

std::vector<bool> mask_
private

◆ mz_range_

RangeMZ mz_range_
private

◆ width_

UInt width_ = 0
private