OpenMS
Loading...
Searching...
No Matches
RationalScan2ImConverter.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#pragma once
5
6#include <OpenMS/config.h>
7
8#ifdef WITH_OPENTIMS
9
10#include <OpenMS/OpenMSConfig.h>
11#include <opentims++/scan2inv_ion_mobility_converter.h>
12#include <cstdint>
13#include <string>
14#include <unordered_map>
15#include <vector>
16
17namespace OpenMS
18{
19
45 class OPENMS_DLLAPI RationalScan2ImConverter : public Scan2InvIonMobilityConverter
46 {
47 public:
49 struct Coefficients
50 {
51 double c0, c1, c2, c3, c4, c5, c6, c7, c8, c9;
52 // c5, c8, c9: stored but unused in ModelType=2. No public documentation
53 // assigns them meaning. Retained for forward compatibility.
54 };
55
58 RationalScan2ImConverter(
59 std::unordered_map<uint32_t, Coefficients> calibrations,
60 std::vector<uint32_t> frame_to_cal);
61
62 void convert(uint32_t frame_id, double* inv_ion_mobilities,
63 const double* scans, uint32_t size) override;
64 void convert(uint32_t frame_id, double* inv_ion_mobilities,
65 const uint32_t* scans, uint32_t size) override;
66 void inverse_convert(uint32_t frame_id, uint32_t* scans,
67 const double* inv_ion_mobilities, uint32_t size) override;
68
70 std::string description() const override;
71
72 private:
73 std::unordered_map<uint32_t, Coefficients> calibrations_;
74 std::vector<uint32_t> frame_to_cal_;
75
78 const Coefficients& getCalibration(uint32_t frame_id) const;
79
82 static double applyFormula(const Coefficients& c, double scan);
83
85 static double invertFormula(const Coefficients& c, double inv_k0);
86 };
87
91 OPENMS_DLLAPI std::unique_ptr<Scan2InvIonMobilityConverter> tryCreateRationalConverter(
92 const std::string& tims_dir_path);
93
94} // namespace OpenMS
95
96#endif // WITH_OPENTIMS
T convert(const String &s)
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19