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
46 class OPENMS_DLLAPI RationalScan2ImConverter : public Scan2InvIonMobilityConverter
47 {
48 public:
50 struct Coefficients
51 {
52 double c0, c1, c2, c3, c4, c5, c6, c7, c8, c9;
53 // c5, c8, c9: stored but unused in ModelType=2. No public documentation
54 // assigns them meaning. Retained for forward compatibility.
55 };
56
59 RationalScan2ImConverter(
60 std::unordered_map<uint32_t, Coefficients> calibrations,
61 std::vector<uint32_t> frame_to_cal);
62
63 void convert(uint32_t frame_id, double* inv_ion_mobilities,
64 const double* scans, uint32_t size) override;
65 void convert(uint32_t frame_id, double* inv_ion_mobilities,
66 const uint32_t* scans, uint32_t size) override;
67 void inverse_convert(uint32_t frame_id, uint32_t* scans,
68 const double* inv_ion_mobilities, uint32_t size) override;
69
71 std::string description() const override;
72
73 private:
74 std::unordered_map<uint32_t, Coefficients> calibrations_;
75 std::vector<uint32_t> frame_to_cal_;
76
79 const Coefficients& getCalibration(uint32_t frame_id) const;
80
83 static double applyFormula(const Coefficients& c, double scan);
84
87 static double invertFormula(const Coefficients& c, double inv_k0);
88 };
89
93 OPENMS_DLLAPI std::unique_ptr<Scan2InvIonMobilityConverter> tryCreateRationalConverter(
94 const std::string& tims_dir_path);
95
96} // namespace OpenMS
97
98#endif // WITH_OPENTIMS
T convert(const std::string &s)
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19