OpenMS
Loading...
Searching...
No Matches
MSImagingGeometry.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13
14#include <unordered_map>
15#include <vector>
16
17namespace OpenMS
18{
30 class OPENMS_DLLAPI MSImagingGeometry final
31 {
32 public:
34 struct Pixel
35 {
36 UInt x = 0;
37 UInt y = 0;
38 Size spectrum_index = 0;
39 };
40
46 void setDimensions(UInt width, UInt height);
47
50 UInt getWidth() const;
51
54 UInt getHeight() const;
55
62 void setPixelSize(double x, double y, const std::string& unit = "micrometer");
63
66 double getPixelSizeX() const;
67
70 double getPixelSizeY() const;
71
74 const std::string& getPixelSizeUnit() const;
75
85 void addPixel(UInt x, UInt y, Size spectrum_index);
86
93 bool hasPixel(UInt x, UInt y) const;
94
103
106 const std::vector<Pixel>& getPixels() const;
107
111
113 void clear();
114
115 private:
116 UInt width_ = 0;
117 UInt height_ = 0;
118 double pixel_size_x_ = 1.0;
119 double pixel_size_y_ = 1.0;
120 std::string pixel_size_unit_ = "micrometer";
121 std::vector<Pixel> pixels_;
122 std::unordered_map<UInt64, Size> lookup_;
123
124 static UInt64 packKey_(UInt x, UInt y);
125 };
126
127} // namespace OpenMS
Pixel grid metadata and (x, y) -> spectrum_index lookup for MSI data.
Definition MSImagingGeometry.h:31
Size getNumberOfPixels() const
Total number of pixels with a bound spectrum.
double getPixelSizeY() const
Physical pixel size along y.
static UInt64 packKey_(UInt x, UInt y)
bool hasPixel(UInt x, UInt y) const
Tests pixel presence at (x, y).
const std::vector< Pixel > & getPixels() const
Pixels in insertion order.
UInt getWidth() const
Image width.
void addPixel(UInt x, UInt y, Size spectrum_index)
Adds a pixel at (x, y) bound to spectrum_index.
Size getSpectrumIndex(UInt x, UInt y) const
Looks up the spectrum index at (x, y).
std::vector< Pixel > pixels_
Definition MSImagingGeometry.h:121
void setPixelSize(double x, double y, const std::string &unit="micrometer")
Records the physical pixel size and its unit.
void setDimensions(UInt width, UInt height)
Sets the image dimensions.
std::unordered_map< UInt64, Size > lookup_
Definition MSImagingGeometry.h:122
UInt getHeight() const
Image height.
void clear()
Resets all state (dimensions, pixel size, pixels, lookup).
const std::string & getPixelSizeUnit() const
Unit for the pixel size.
double getPixelSizeX() const
Physical pixel size along x.
A pixel in the imaging grid, linked to one spectrum in the experiment.
Definition MSImagingGeometry.h:35
uint64_t UInt64
Unsigned integer type (64bit)
Definition Types.h:47
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19