ProteoWizard
Translator_mz5.hpp
Go to the documentation of this file.
1 //
2 // $Id: Translator_mz5.hpp 3484 2012-04-04 19:55:33Z mwilhelm42 $
3 //
4 //
5 // Original authors: Mathias Wilhelm <mw@wilhelmonline.com>
6 // Marc Kirchner <mail@marc-kirchner.de>
7 //
8 // Copyright 2011 Proteomics Center
9 // Children's Hospital Boston, Boston, MA 02135
10 //
11 // Licensed under the Apache License, Version 2.0 (the "License");
12 // you may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at
14 //
15 // http://www.apache.org/licenses/LICENSE-2.0
16 //
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the License is distributed on an "AS IS" BASIS,
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 // See the License for the specific language governing permissions and
21 // limitations under the License.
22 //
23 
24 #ifndef TRANSLATOR_MZ5_HPP_
25 #define TRANSLATOR_MZ5_HPP_
26 
27 #include <vector>
28 
29 namespace pwiz {
30 namespace msdata {
31 namespace mz5 {
32 
33 /**
34  * Helper class to translate mz values.
35  */
37 {
38 public:
39 
40  /**
41  * Translates mz and intensity values.
42  * @param mz mz data
43  * @param inten intensity data
44  */
45  static void translate(std::vector<double>& mz, std::vector<double>& inten);
46 
47  /**
48  * Translates a mz data array with the function
49  * f[0] = f[0]
50  * f[i] = f[i] - f[i-1]
51  *
52  * This creates delta mz values in O(n) time but only needs one additional double.
53  * @param mz untranslated mz data
54  */
55  static void translateMZ(std::vector<double>& mz);
56 
57  /**
58  * Currently empty but can be used to alter intensity values.
59  */
60  static void translateIntensity(std::vector<double>& inten);
61 
62  /**
63  * Recalculates mz and intensity data.
64  * @param mz mz data
65  * @param inten intensity data
66  */
67  static void reverseTranslate(std::vector<double>& mz,
68  std::vector<double>& inten);
69 
70  /**
71  * Translates a mz data array with the function:
72  * f[0] = f[0]
73  * f[i] = f[i-1] + f[i]
74  *
75  * This method creates absolute mz values in O(n) time but only needs one additional double.
76  * @param mz translated mz data
77  */
78  static void reverseTranslateMZ(std::vector<double>&);
79 
80  /**
81  * Currently empty but can be used to reverse the function translateIntensity()
82  */
83  static void reverseTranslateIntensity(std::vector<double>&);
84 };
85 
86 }
87 }
88 }
89 
90 #endif /* TRANSLATOR_MZ5_HPP_ */