![]() |
OpenMS
|
Pixel grid metadata and (x, y) -> spectrum_index lookup for MSI data. More...
#include <OpenMS/IMAGING/MSImagingGeometry.h>
Classes | |
| struct | Pixel |
| A pixel in the imaging grid, linked to one spectrum in the experiment. More... | |
Public Member Functions | |
| void | setDimensions (UInt width, UInt height) |
| Sets the image dimensions. | |
| UInt | getWidth () const |
| Image width. | |
| UInt | getHeight () const |
| Image height. | |
| void | setPixelSize (double x, double y, const std::string &unit="micrometer") |
| Records the physical pixel size and its unit. | |
| double | getPixelSizeX () const |
| Physical pixel size along x. | |
| double | getPixelSizeY () const |
| Physical pixel size along y. | |
| const std::string & | getPixelSizeUnit () const |
| Unit for the pixel size. | |
| void | addPixel (UInt x, UInt y, Size spectrum_index) |
Adds a pixel at (x, y) bound to spectrum_index. | |
| bool | hasPixel (UInt x, UInt y) const |
Tests pixel presence at (x, y). | |
| Size | getSpectrumIndex (UInt x, UInt y) const |
Looks up the spectrum index at (x, y). | |
| const std::vector< Pixel > & | getPixels () const |
| Pixels in insertion order. | |
| Size | getNumberOfPixels () const |
| Total number of pixels with a bound spectrum. | |
| void | clear () |
| Resets all state (dimensions, pixel size, pixels, lookup, regions). | |
| void | addRegion (const MSImagingRegion ®ion) |
| Adds a region to the geometry as a decoupled overlay. | |
| void | removeRegion (Size id) |
| Removes the region with the given id. | |
| void | clearRegions () |
| Removes all regions; acquired pixels are left untouched. | |
| const std::vector< MSImagingRegion > & | getRegions () const |
| All regions in insertion order. | |
| const MSImagingRegion & | getRegion (Size id) const |
| Returns the region with the given id. | |
| Size | getNumberOfRegions () const |
| Number of regions in the overlay. | |
| Size | regionOf (UInt x, UInt y) const |
Returns the id of the region owning the acquired pixel at (x, y). | |
| std::vector< Size > | getRegionPixels (Size id) const |
| Acquired pixels belonging to a region, as indices into getPixels(). | |
| std::vector< Size > | getRegionSpectrumIndices (Size id) const |
| Spectrum indices of the acquired pixels belonging to a region. | |
Static Public Attributes | |
| static constexpr Size | NO_REGION = std::numeric_limits<Size>::max() |
| Sentinel returned by regionOf() when a coordinate belongs to no region. | |
Static Private Member Functions | |
| static UInt64 | packKey_ (UInt x, UInt y) |
Private Attributes | |
| UInt | width_ = 0 |
| UInt | height_ = 0 |
| double | pixel_size_x_ = 1.0 |
| double | pixel_size_y_ = 1.0 |
| std::string | pixel_size_unit_ = "micrometer" |
| std::vector< Pixel > | pixels_ |
| std::unordered_map< UInt64, Size > | lookup_ |
| std::vector< MSImagingRegion > | regions_ |
| std::unordered_map< Size, Size > | region_id_to_index_ |
Pixel grid metadata and (x, y) -> spectrum_index lookup for MSI data.
Coordinates are zero-based. imzML files are one-based; the Phase 2 loader (ImzMLFile) is responsible for normalizing those to zero-based coordinates before populating this geometry.
3D MSI is intentionally not modeled here. Serial-section experiments should be handled as a collection of MSImagingExperiment objects (one per section).
| struct OpenMS::MSImagingGeometry::Pixel |
Adds a pixel at (x, y) bound to spectrum_index.
| [in] | x | Column index (zero-based). |
| [in] | y | Row index (zero-based). |
| [in] | spectrum_index | Index into the bound MSExperiment. |
| Exception::InvalidValue | on duplicate coordinates, or if dimensions have been set and (x, y) is outside [0, width) x [0, height). |
| void addRegion | ( | const MSImagingRegion & | region | ) |
Adds a region to the geometry as a decoupled overlay.
Membership of acquired pixels in the region is derived on demand via MSImagingRegion::contains(); no per-pixel region state is stored.
| [in] | region | Region footprint to add (copied in). |
| Exception::InvalidValue | if the id equals NO_REGION, the id is already present, or the footprint geometrically overlaps an existing region. |
| void clear | ( | ) |
Resets all state (dimensions, pixel size, pixels, lookup, regions).
| void clearRegions | ( | ) |
Removes all regions; acquired pixels are left untouched.
| UInt getHeight | ( | ) | const |
Image height.
| Size getNumberOfPixels | ( | ) | const |
Total number of pixels with a bound spectrum.
| Size getNumberOfRegions | ( | ) | const |
Number of regions in the overlay.
| const std::vector< Pixel > & getPixels | ( | ) | const |
Pixels in insertion order.
| const std::string & getPixelSizeUnit | ( | ) | const |
Unit for the pixel size.
| double getPixelSizeX | ( | ) | const |
Physical pixel size along x.
| double getPixelSizeY | ( | ) | const |
Physical pixel size along y.
| const MSImagingRegion & getRegion | ( | Size | id | ) | const |
Returns the region with the given id.
| [in] | id | Region id to look up. |
| Exception::ElementNotFound | if no region with that id exists. |
Acquired pixels belonging to a region, as indices into getPixels().
| [in] | id | Region id. |
| Exception::ElementNotFound | if no region with that id exists. |
| const std::vector< MSImagingRegion > & getRegions | ( | ) | const |
All regions in insertion order.
Spectrum indices of the acquired pixels belonging to a region.
| [in] | id | Region id. |
| Exception::ElementNotFound | if no region with that id exists. |
Looks up the spectrum index at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
| Exception::ElementNotFound | if no pixel exists at that coordinate. |
| UInt getWidth | ( | ) | const |
Image width.
Tests pixel presence at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
Returns the id of the region owning the acquired pixel at (x, y).
| [in] | x | Column index. |
| [in] | y | Row index. |
x, y) is not an acquired pixel or belongs to no region. | void removeRegion | ( | Size | id | ) |
Removes the region with the given id.
| [in] | id | Region id to remove. |
| Exception::ElementNotFound | if no region with that id exists. |
Sets the image dimensions.
| [in] | width | Number of columns. |
| [in] | height | Number of rows. |
| void setPixelSize | ( | double | x, |
| double | y, | ||
| const std::string & | unit = "micrometer" |
||
| ) |
|
private |
Sentinel returned by regionOf() when a coordinate belongs to no region.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |