-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractImageLoader.h
More file actions
executable file
·65 lines (51 loc) · 1.63 KB
/
AbstractImageLoader.h
File metadata and controls
executable file
·65 lines (51 loc) · 1.63 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
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Created by Arkadiy Simonov on 03.10.2024.
//
#ifndef MEERKAT2_ABSTRACTIMAGELOADER_H
#define MEERKAT2_ABSTRACTIMAGELOADER_H
#include <vector>
#include <string>
#include "ReconstructionParameters.h"
class AbstractImageLoader {
public:
explicit AbstractImageLoader(const ReconstructionParameters & par);
virtual ~AbstractImageLoader() = default;
virtual bool load_next_frame() = 0;
inline bool should_reconstruct(size_t x, size_t y) {
return should_reconstruct(xy2index(x,y));
};
inline bool should_reconstruct(size_t ind) {
if(mask_is_defined)
return (current_frame(ind) >= 0) && mask[ind];
else
return current_frame(ind) >= 0;
}
inline corrected_frame_dt current_frame(size_t x, size_t y) {
return data[xy2index(x, y)];
};
inline corrected_frame_dt current_frame(size_t ind) {
return data[ind];
}
void initialize_buffers() {
data = vector<int> (m_dim1*m_dim2);
buffer = vector<int> (m_dim1*m_dim2);
}
int ny() const { return m_dim1; }
int nx() const { return m_dim2; }
int current_frame_no() const { return current_frame_number; }
void load_mask(string mask_filename);
protected:
virtual void load_frame_to_buffer() = 0;
size_t frame_increment;
size_t m_dim1, m_dim2;
int current_frame_number, last_frame_number;
std::vector<int> data;
std::vector<int> buffer;
std::vector<int> mask;
bool mask_is_defined;
std::string filename_template;
inline size_t xy2index(size_t x,size_t y) {
return x * ny() + y;
}
};
#endif //MEERKAT2_ABSTRACTIMAGELOADER_H