OpenMS
Loading...
Searching...
No Matches
IonImage.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 <vector>
15
16namespace OpenMS
17{
30 class OPENMS_DLLAPI IonImage final
31 {
32 public:
34 IonImage() = default;
35
41 IonImage(UInt width, UInt height);
42
48 void resize(UInt width, UInt height);
49
52 UInt getWidth() const;
53
56 UInt getHeight() const;
57
64 bool hasPixel(UInt x, UInt y) const;
65
73 double getIntensity(UInt x, UInt y) const;
74
82 void setIntensity(UInt x, UInt y, double intensity);
83
88 void setMzRange(const RangeMZ& range);
89
92 const RangeMZ& getMzRange() const;
93
96 const std::vector<double>& getData() const;
97
100 const std::vector<bool>& getMask() const;
101
102 private:
103 UInt width_ = 0;
104 UInt height_ = 0;
105 std::vector<double> intensities_;
106 std::vector<bool> mask_;
108
110 };
111
112} // namespace OpenMS
Dense W x H grid of ion intensities with a per-pixel mask.
Definition IonImage.h:31
bool hasPixel(UInt x, UInt y) const
True once setIntensity has been called for the cell at (x, y).
void setMzRange(const RangeMZ &range)
Records the m/z window the image was extracted from.
RangeMZ mz_range_
Definition IonImage.h:107
IonImage(UInt width, UInt height)
Constructs and zero-initializes a width x height image; all pixels invalid.
Size linearIndex_(UInt x, UInt y) const
std::vector< double > intensities_
Definition IonImage.h:105
const std::vector< double > & getData() const
Raw row-major intensity buffer.
UInt getWidth() const
Image width.
std::vector< bool > mask_
Definition IonImage.h:106
const std::vector< bool > & getMask() const
Parallel pixel mask (same indexing as getData()).
double getIntensity(UInt x, UInt y) const
Intensity at (x, y); 0.0 if never set.
UInt getHeight() const
Image height.
const RangeMZ & getMzRange() const
m/z window the image was extracted from.
void setIntensity(UInt x, UInt y, double intensity)
Stores intensity at (x, y) and marks the cell valid.
IonImage()=default
Default-construct an empty 0 x 0 image.
void resize(UInt width, UInt height)
Resizes and zero-initializes; all pixels become invalid.
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
Definition RangeManager.h:358