-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetectorplotter.h
More file actions
52 lines (44 loc) · 1.72 KB
/
detectorplotter.h
File metadata and controls
52 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef DETECTORPLOTTER_H
#define DETECTORPLOTTER_H
#include "H5Cpp.h"
#include "Eigen/Core"
#include "Eigen/Geometry"
#include <vector>
namespace Nexus {
const H5std_string NX_ENTRY = "NXentry";
const H5std_string NX_INSTRUMENT = "NXinstrument";
const H5std_string NX_DETECTOR = "NXdetector";
}
class DetectorPlotter {
public:
explicit DetectorPlotter(const H5std_string &FILE_NAME);
~DetectorPlotter();
/// Stores all detector groups in a vector
std::vector<H5::Group> openDetectorGroups();
/// Gets detectorGroup pixel offsets as Eigen 3xN matrix
Eigen::Matrix<double, 3, Eigen::Dynamic>
getPixelOffsets(H5::Group &detectorGroup);
/// Gets the transformations applied to the detector's pixelOffsets
Eigen::Transform<double, 3, Eigen::Affine>
getTransformations(H5::Group &detectorGroup);
/// Gets the data from a string dataset
H5std_string get1DStringDataset(H5std_string &dataset);
/// Writes detector pixel offsets to file
void writeToFile(Eigen::Matrix<double, 3, Eigen::Dynamic> &detectorPixels,
const H5std_string &name);
private:
H5::H5File file;
H5::Group rootGroup;
/// Read dataset into vector
template <typename valueType>
std::vector<valueType> get1DDataset(H5std_string &dataset);
/// Opens sub groups matching CLASS_TYPE
std::vector<H5::Group> openSubGroups(H5::Group &parentGroup,
const H5std_string &CLASS_TYPE);
/// Get the unit vector for the transformation
void getTransformationVector(Eigen::Vector3d &transformVector,
const H5::Attribute &attribute) const;
/// Convert angle in degrees to radians
double degrees_to_radians(double angle_in_degrees) const;
};
#endif // DETECTORPLOTTER_H