riCOM_cpp
This repository contains the C++ implementation of the riCOM (Real Time Centre Of Mass) algorithm for 4D Scanning electron microscopy.
Loading...
Searching...
No Matches
Camera.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Thomas Friedrich, Chu-Ping Yu,
2 * University of Antwerp - All Rights Reserved.
3 * You may use, distribute and modify
4 * this code under the terms of the GPL3 license.
5 * You should have received a copy of the GPL3 license with
6 * this file. If not, please visit:
7 * https://www.gnu.org/licenses/gpl-3.0.en.html
8 *
9 * Authors:
10 * Thomas Friedrich <thomas.friedrich@uantwerpen.be>
11 * Chu-Ping Yu <chu-ping.yu@uantwerpen.be>
12 */
13
14#ifndef CAMERA_H
15#define CAMERA_H
16
17#include <vector>
18#include <atomic>
19#include <array>
20#include <stdlib.h>
21
22// Only forward declaration for Ricom class
23class Ricom;
24
25namespace CAMERA
26{
33
39
41 {
42 public:
45 int nx_cam;
46 int ny_cam;
48 int depth;
50 std::vector<int> u;
51 std::vector<int> v;
52 void init_uv_default();
53
56 nx_cam(256),
57 ny_cam(256),
59 depth(1),
60 dwell_time(1000){};
61 };
62
63 // primary template
64 template <class CameraInterface, CAMERA::Camera_type cam_type>
65 class Camera : public CameraInterface, public Camera_BASE
66 {
67 };
68
69 // specialization for frame based camera
70 template <class CameraInterface>
71 class Camera<CameraInterface, FRAME_BASED> : public CameraInterface, public Camera_BASE
72 {
73 public:
76 void run(Ricom *ricom);
77 template <typename T>
78 void read_frame(std::vector<T> &data, bool b_first);
79 };
80
81 // specialization for event based camera
82 template <class CameraInterface>
83 class Camera<CameraInterface, EVENT_BASED> : public CameraInterface, public Camera_BASE
84 {
85 public:
88 void run(Ricom *ricom);
89 void read_frame_com(std::atomic<size_t> &idx, std::vector<size_t> &dose_map,
90 std::vector<size_t> &sumx_map, std::vector<size_t> &sumy_map,
91 std::vector<float> &stem_map, bool b_stem,
92 std::array<float, 2> &offset, std::array<float, 2> &radius,
93 size_t first_frame, size_t end_frame);
94 void read_frame_com_cbed(std::atomic<size_t> &idx, std::vector<size_t> &dose_map,
95 std::vector<size_t> &sumx_map, std::vector<size_t> &sumy_map,
96 std::vector<float> &stem_map, bool b_stem,
97 std::array<float, 2> &offset, std::array<float, 2> &radius,
98 std::vector<uint16_t> &frame, size_t frame_id, int cbed_cmap_frames,
99 size_t first_frame, size_t end_frame);
100 };
101
103 {
104 public:
106 CAMERA::Camera_BASE &operator[](unsigned int index);
107 std::array<CAMERA::Camera_BASE, CAMERA::MODELS_COUNT> hws;
108
109 private:
110 CAMERA::Camera_BASE *hws_ptr;
111 };
112}
113
114#endif // CAMERA_H
void read_frame_com(std::atomic< size_t > &idx, std::vector< size_t > &dose_map, std::vector< size_t > &sumx_map, std::vector< size_t > &sumy_map, std::vector< float > &stem_map, bool b_stem, std::array< float, 2 > &offset, std::array< float, 2 > &radius, size_t first_frame, size_t end_frame)
void read_frame_com_cbed(std::atomic< size_t > &idx, std::vector< size_t > &dose_map, std::vector< size_t > &sumx_map, std::vector< size_t > &sumy_map, std::vector< float > &stem_map, bool b_stem, std::array< float, 2 > &offset, std::array< float, 2 > &radius, std::vector< uint16_t > &frame, size_t frame_id, int cbed_cmap_frames, size_t first_frame, size_t end_frame)
void read_frame(std::vector< T > &data, bool b_first)
Camera_type type
Definition Camera.h:44
Camera_model model
Definition Camera.h:43
std::vector< int > v
Definition Camera.h:51
std::vector< int > u
Definition Camera.h:50
void init_uv_default()
Definition Camera.cpp:20
CAMERA::Camera_BASE & operator[](unsigned int index)
Definition Camera.cpp:43
std::array< CAMERA::Camera_BASE, CAMERA::MODELS_COUNT > hws
Definition Camera.h:107
Definition Ricom.h:152
Camera_model
Definition Camera.h:28
@ TIMEPIX
Definition Camera.h:30
@ MODELS_COUNT
Definition Camera.h:31
@ MERLIN
Definition Camera.h:29
Camera_type
Definition Camera.h:35
@ FRAME_BASED
Definition Camera.h:36
@ EVENT_BASED
Definition Camera.h:37