![]() |
OpenMS
|
In-memory model for a 2D imaging mass spectrometry dataset. More...
#include <OpenMS/IMAGING/MSImagingExperiment.h>
Public Member Functions | |
| MSImagingExperiment ()=default | |
| MSImagingExperiment (MSExperiment exp) | |
Constructs an MSImagingExperiment wrapping exp with an empty geometry. | |
| MSImagingExperiment & | operator= (MSExperiment exp) |
| Replaces the owned MSExperiment and resets the geometry. | |
| MSExperiment & | getMSExperiment () |
| Mutable access to the owned MSExperiment. | |
| const MSExperiment & | getMSExperiment () const |
| Read access to the owned MSExperiment. | |
| void | setMSExperiment (MSExperiment exp) |
| Replaces the owned MSExperiment. | |
| MSImagingGeometry & | getGeometry () |
| Mutable access to the owned geometry. | |
| const MSImagingGeometry & | getGeometry () const |
| Read access to the owned geometry. | |
| void | setGeometry (MSImagingGeometry geom) |
| Replaces the owned geometry. | |
| Size | getNumberOfPixels () const |
| Number of pixels in the geometry. | |
| Size | getNumberOfSpectra () const |
| Number of spectra in the underlying experiment. | |
| bool | hasPixel (UInt x, UInt y) const |
Tests pixel presence at (x, y). | |
| MSSpectrum & | getSpectrum (UInt x, UInt y) |
Mutable access to the spectrum bound to the pixel at (x, y). | |
| const MSSpectrum & | getSpectrum (UInt x, UInt y) const |
Read access to the spectrum bound to the pixel at (x, y). | |
| IonImage | extractIonImage (double mz, double tolerance_ppm) const |
| Extracts an ion image by summing peak intensities inside [mz - dm, mz + dm], with dm = mz * tolerance_ppm * 1e-6. | |
| void | validate () const |
| Validates that every pixel references an in-range spectrum_index. | |
Private Attributes | |
| MSExperiment | experiment_ |
| MSImagingGeometry | geometry_ |
In-memory model for a 2D imaging mass spectrometry dataset.
Owns an MSExperiment (spectra) and an MSImagingGeometry (pixel grid + pixel -> spectrum index mapping). Provides pixel-based spectrum access and a simple sum-based ion image extraction.
A 3D / serial-section experiment is modeled as a collection of MSImagingExperiment objects, one per section.
|
default |
|
explicit |
Constructs an MSImagingExperiment wrapping exp with an empty geometry.
| [in] | exp | MSExperiment to take ownership of (moved in). |
| IonImage extractIonImage | ( | double | mz, |
| double | tolerance_ppm | ||
| ) | const |
Extracts an ion image by summing peak intensities inside [mz - dm, mz + dm], with dm = mz * tolerance_ppm * 1e-6.
Preconditions: each referenced spectrum must be sorted by m/z. Phase 2's ImzMLFile loader will guarantee this; Phase 1 callers must ensure it manually.
Pixels not present in the geometry remain invalid in the returned image. Pixels with a spectrum but no peaks in the window are marked valid with intensity 0. The returned image's m/z range is set to [mz - dm, mz + dm].
| [in] | mz | m/z center of the extraction window (>= 0). |
| [in] | tolerance_ppm | Half-window width in ppm (>= 0). |
| Exception::InvalidValue | if mz or tolerance_ppm is negative or non-finite, or if any pixel references a missing spectrum_index. |
| Exception::IndexOverflow | if a pixel coordinate falls outside the geometry's declared dimensions. |
| MSImagingGeometry & getGeometry | ( | ) |
Mutable access to the owned geometry.
| const MSImagingGeometry & getGeometry | ( | ) | const |
Read access to the owned geometry.
| MSExperiment & getMSExperiment | ( | ) |
Mutable access to the owned MSExperiment.
| const MSExperiment & getMSExperiment | ( | ) | const |
Read access to the owned MSExperiment.
| Size getNumberOfPixels | ( | ) | const |
Number of pixels in the geometry.
| Size getNumberOfSpectra | ( | ) | const |
Number of spectra in the underlying experiment.
| MSSpectrum & getSpectrum | ( | UInt | x, |
| UInt | y | ||
| ) |
Mutable access to the spectrum bound to the pixel at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
| Exception::ElementNotFound | if no pixel exists at that coordinate. |
| Exception::InvalidValue | if the pixel references a spectrum_index outside the underlying experiment. |
| const MSSpectrum & getSpectrum | ( | UInt | x, |
| UInt | y | ||
| ) | const |
Read access to the spectrum bound to the pixel at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
| Exception::ElementNotFound | if no pixel exists at that coordinate. |
| Exception::InvalidValue | if the pixel references a spectrum_index outside the underlying experiment. |
Tests pixel presence at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
| MSImagingExperiment & operator= | ( | MSExperiment | exp | ) |
Replaces the owned MSExperiment and resets the geometry.
The previous geometry's spectrum indices are tied to the previous experiment's spectrum order and become meaningless after assignment, so the geometry is cleared. Use setMSExperiment() if you want to keep the existing geometry.
| [in] | exp | MSExperiment to take ownership of (moved in). |
| void setGeometry | ( | MSImagingGeometry | geom | ) |
Replaces the owned geometry.
| [in] | geom | New geometry (moved in). |
| void setMSExperiment | ( | MSExperiment | exp | ) |
Replaces the owned MSExperiment.
| [in] | exp | New experiment (moved in). |
| void validate | ( | ) | const |
Validates that every pixel references an in-range spectrum_index.
| Exception::InvalidValue | on the first dangling reference. |
|
private |
|
private |