-
Notifications
You must be signed in to change notification settings - Fork 8
/
IMAS_coverings.h
120 lines (106 loc) · 3.57 KB
/
IMAS_coverings.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
* @file IMAS_covering.h
* @author Mariano Rodríguez
* @date 2017
* @brief handles IMAS coverings: either coverings proposed in the literature or optimal coverings as in Mariano Rodríguez, Julie Delon and Jean-Michel Morel.
*/
#ifndef IMAS_COVERING_H
#define IMAS_COVERING_H
#include <vector>
#include "mex_and_omp.h"
#include<fstream>
/**
* @brief It stores all rotations to be simulated for an certain tilt
*/
struct tilt_simu {
float t;
std::vector<float> rots;
};
class imasCoverings
{
protected:
/**
* @brief Global variable that stores tilts and rotations to be performed on image1
* @code
// Loop on tilts
for (tt = 1; tt <= simu_details.size(); tt++)
{
// Loop on rotations.
for ( int rr = 1; rr <= simu_details[tt-1].rots.size(); rr++ )
{
... Do something here with it
}
}
*@endcode
*/
std::vector<tilt_simu> simu_details1;
/**
* @brief Global variable that stores tilts and rotations to be performed on image2
* @code
// Loop on tilts
for (tt = 1; tt <= simu_details.size(); tt++)
{
// Loop on rotations.
for ( int rr = 1; rr <= simu_details[tt-1].rots.size(); rr++ )
{
... Do something here with it
}
}
*@endcode
*/
std::vector<tilt_simu> simu_details2;
/**
* @brief Global variable that stores the total amount of simulations to be performed on image1
*/
int totsimu1;
/**
* @brief Global variable that stores the total amount of simulations to be performed on image2
*/
int totsimu2;
float _arearatio;
static float transition_tilt(float t, float psi1, float s, float psi2);
static float Fcout(const std::vector<float>& tilt_element);
static void drawpoint(float * data, int width, int i, int j, float radius, float value);
static void getdisks(float t,float psi, float r, float phistep, std::vector<float>& phivec, std::vector<float>& tupvec,std::vector<float>& tlowvec);
static void drawborder(float *data, std::vector<float> phivec, std::vector<float>& tvec,float seenregion, int logseenregionpixels);
static std::vector<float> scalarmult(std::vector<float> vec, float scalar);
static void drawdisks(float * data, const std::vector<float>& covering_element, float r,float seenregion, int logseenregionpixels);
void insertsimu(float t1,float r1, std::vector<tilt_simu>& simu_details);
static std::vector<float> string2vec(std::string s);
public:
static void write_image_covering(const std::vector<float>& covering_element, float r,float region,float seenregion, int logseenregionpixels);
void loadsimulations2do();
void loadsimulations2do(std::vector<float>& vec_simtilts1, std::vector<float>& vec_simrot1,std::vector<float>& vec_simtilts2, std::vector<float>& vec_simrot2);
void load_optimal_simulations2do(const std::vector<float>& tilts, const std::vector<float>& phase);
void loadsimulations2do(float covering_code,float radius, bool writeimage);
imasCoverings()
{
_arearatio = 0.0f;
}
const std::vector<tilt_simu> getSimuDetails1()
{
return(simu_details1);
}
int getTotSimu1()
{
return(totsimu1);
}
const std::vector<tilt_simu> getSimuDetails2()
{
return(simu_details2);
}
int getTotSimu2()
{
return(totsimu2);
}
float getAreaRatio()
{
return(_arearatio);
}
~imasCoverings()
{
simu_details1.clear();
simu_details2.clear();
}
};
#endif // IMAS_COVERING_H