CFEL - ASG Software Suite  2.5.0
CASS
geom_parser.h
Go to the documentation of this file.
1 // Copyright (C) 2014 Lutz Foucar
2 
3 /**
4  * @file geom_parser.h class to parse and retrieve info from geom files.
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _GEOMPARSER_
10 #define _GEOMPARSER_
11 
12 #include <string>
13 #include <vector>
14 
15 namespace cass
16 {
17 namespace GeometryInfo
18 {
19 /** combine the position in the lab into a struct */
20 struct pos_t
21 {
22  typedef double x_t;
23  typedef double y_t;
24  x_t x;
25  y_t y;
26 };
27 
28 /** define the conversion table type */
29 typedef std::vector<pos_t> conversion_t;
30 
31 /** combine info needed for the lookuptable */
33 {
34  std::vector<size_t> lut;
37  size_t nCols;
38  size_t nRows;
39 };
40 
41 /** functor to substract one position from the other
42  *
43  * @return the result of the subtraction
44  * @param minuent the minuent of the subtraction
45  * @param subtrahend the subtrahend of the subtraction
46  *
47  * @author Lutz Foucar
48  */
49 pos_t minus(const pos_t& minuent, const pos_t &subtrahend );
50 
51 /** convert index with 2 components into a linearized index
52  *
53  * @return linearized index
54  * @param pos the index in the frame with 2 components
55  * @param nCols the number of columns (fast changing index) in the frame
56  *
57  * @author Lutz Foucar
58  */
59 size_t linearizeComponents(const pos_t &pos, const size_t nCols);
60 
61 /** parse the geom file and generate a lookup table
62  *
63  * in the lookup table each entry corresponsed to the coordinates in the lab
64  *
65  * @return list of index to pos in lab
66  * @param filename The filename of the geomfile
67  * @param sizeOfSrc the size of the source image
68  * @param nSrcCols the number of columns (fast changing index) in the image
69  * @param convertFromCheetahToCASS flag to tell whether the geom file uses
70  * layout in Cheetah but CASS uses CASS raw
71  * image coordinates
72  *
73  * @author Lutz Foucar
74  */
75 conversion_t generateConversionMap(const std::string &filename,
76  const size_t sizeOfSrc,
77  const size_t nSrcCols,
78  const bool convertFromCheetahToCASS);
79 
80 /** generate a lookup table for a new image
81  *
82  * generate a lookup table that has the corresponding index in an image that
83  * looks like an lab image
84  *
85  * @return the index lookup table
86  * @param filename The filename of the geomfile
87  * @param sizeOfSrc the size of the source image
88  * @param nSrcCols the number of columns (fast changing index) in the image
89  * @param convertFromCheetahToCASS flag to tell whether the geom file uses
90  * layout in Cheetah but CASS uses CASS raw
91  * image coordinates
92  *
93  * @author Lutz Foucar
94  */
95 lookupTable_t generateLookupTable(const std::string &filename,
96  const size_t sizeOfSrc,
97  const size_t nSrcCols,
98  const bool convertFromCheetahToCASS);
99 }//end namespace geometryInfo
100 
101 }//end namespace cass
102 
103 #endif
pos_t minus(const pos_t &minuent, const pos_t &subtrahend)
functor to substract one position from the other
Definition: geom_parser.cpp:45
std::vector< pos_t > conversion_t
define the conversion table type
Definition: geom_parser.h:29
conversion_t generateConversionMap(const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
parse the geom file and generate a lookup table
Definition: geom_parser.cpp:60
combine the position in the lab into a struct
Definition: geom_parser.h:20
size_t linearizeComponents(const pos_t &pos, const size_t nCols)
convert index with 2 components into a linearized index
Definition: geom_parser.cpp:53
combine info needed for the lookuptable
Definition: geom_parser.h:32
std::vector< size_t > lut
Definition: geom_parser.h:34
lookupTable_t generateLookupTable(const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
generate a lookup table for a new image