forked from MSiemons/MIRAO_DeviceAdapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mirao52e.h
212 lines (188 loc) · 8.7 KB
/
Mirao52e.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
///////////////////////////////////////////////////////////////////////////////
// FILE: Mirao52e.h
// PROJECT: Micro-Manager
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: Device adapter for MICAO-52E deformable mirror
//
// AUTHOR: Marijn Siemons. [email protected], 27-02-2018
#pragma once
#define NOMINMAX
#define IMPORT_IMOP_WAVEKITBIO_FROM_LIBRARY
#include "../../MMDevice/MMDevice.h"
#include "../../MMDevice/DeviceBase.h"
#include <string>
#include <sstream>
#include "Mirror.hpp"
#include "Model.h"
#include "PhaseDiversity.h"
#include "3NAlgorithm.h"
#include "merit_functions.hpp"
#include "conversion.hpp"
//////////////////////////////////////////////////////////////////////////////
// Error codes
//
#define ERR_PORT_CHANGE_FORBIDDEN 10001
#define ERR_MIRRORINIT_FILE_NONEXIST 10201
#define ERR_DIVINIT_FILE_NONEXIST 10202
#define ERR_CAL_FILE_NONEXIST 10203
#define ERR_DIVPREF_FILE_NONEXIST 10204
#define ERR_FILE_NONEXIST 10205
class Mirao52e : public CGenericBase<Mirao52e>
{
public:
Mirao52e(void);
~Mirao52e(void);
// Device API
// ----------
int Initialize();
int Shutdown();
void GetName(char* name) const;
bool Busy();
// Deformable mirror API
// ---------
imop::microscopy::Mirror * mirrorhandle;
imop::microscopy::Diversity * diversityhandle;
imop::microscopy::CalibrationParams * calibparamshandle;
imop::microscopy::DiversityPreferences * divprefshandle;
imop::microscopy::Zernikes zer_store;
imop::microscopy::Zernikes zer_rel;
// int GetActuatorPos(std::vector<float> pos);
int SetCalibration(std::basic_string<char> path);
int SetDiversityPref(std::basic_string<char> path);
int SetCalibrationParams(std::basic_string<char> path);
int LoadWavefront(std::basic_string<char> path);
int SaveCurrentPosition(std::basic_string<char> path);
int ApplyZernmodes();
int SetZernMode_Tip(float Acoef);
int SetZernMode_Tilt(float Acoef);
int SetZernMode_Defocus(float Acoef);
int SetZernMode_Astig0deg(float Acoef);
int SetZernMode_Astig45deg(float Acoef);
int SetZernMode_Coma0deg(float Acoef);
int SetZernMode_Coma90deg(float Acoef);
int SetZernMode_PrimSpherical(float Acoef);
int SetZernMode_Trefoil0deg(float Acoef);
int SetZernMode_Trefoil90deg(float Acoef);
int SetZernMode_SecondAstig0deg(float Acoef);
int SetZernMode_SecondAstig45deg(float Acoef);
int SetZernMode_Quadrafoil0deg(float Acoef);
int SetZernMode_Quadrafoil45deg(float Acoef);
int SetZernMode_SecondComa0deg(float Acoef);
int SetZernMode_SecondComa90deg(float Acoef);
int SetZernMode_SecondTrefoil0deg(float Acoef);
int SetZernMode_SecondTrefoil90deg(float Acoef);
int SetZernMode_SecondSpherical(float Acoef);
// action interface
// ----------------
int OnPort (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetCalibration (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetCalibrationParams (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetDiversityPref (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnLoadWavefront (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSaveCurrentPosition (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnApplyZernmodes (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Tip (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Tilt (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Defocus (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Astig0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Astig45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Coma0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Coma90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_PrimSpherical (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Trefoil0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Trefoil90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondAstig0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondAstig45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Quadrafoil0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Quadrafoil45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondComa0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondComa90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondTrefoil0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondTrefoil90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondSpherical (MM::PropertyBase* pProp, MM::ActionType eAct);
std::string mirrorinitpath_;
std::string calibpath_;
std::string calibparamspath_;
std::string divprefpath_;
std::string wfcpath_;
std::string savepath_;
protected:
bool initialized_;
std::string port_;
MM::Device *device_;
MM::Core *core_;
};
class Mirao52e_FAKE : public CGenericBase<Mirao52e_FAKE>
{
public:
Mirao52e_FAKE(void);
~Mirao52e_FAKE(void);
// Device API
// ----------
int Initialize();
int Shutdown();
void GetName(char* name) const;
bool Busy();
// Deformable mirror API
// ---------
imop::microscopy::Mirror * mirrorhandle;
imop::microscopy::Diversity * diversityhandle;
imop::microscopy::CalibrationParams * calibparamshandle;
imop::microscopy::DiversityPreferences * divprefshandle;
imop::microscopy::Zernikes zer_store;
imop::microscopy::Zernikes zer_rel;
// int GetActuatorPos(std::vector<float> pos);
int SetCalibration(std::basic_string<char> path);
int SetDiversityPref(std::basic_string<char> path);
int SetCalibrationParams(std::basic_string<char> path);
int LoadWavefront(std::basic_string<char> path);
int SaveCurrentPosition(std::basic_string<char> path);
int SetZernMode_Tip(float Acoef);
int SetZernMode_Tilt(float Acoef);
int SetZernMode_Defocus(float Acoef);
int SetZernMode_Astig0deg(float Acoef);
int SetZernMode_Astig45deg(float Acoef);
int SetZernMode_Coma0deg(float Acoef);
int SetZernMode_Coma90deg(float Acoef);
int SetZernMode_PrimSpherical(float Acoef);
int SetZernMode_Trefoil0deg(float Acoef);
int SetZernMode_Trefoil90deg(float Acoef);
int SetZernMode_SecondAstig0deg(float Acoef);
int SetZernMode_SecondAstig45deg(float Acoef);
int SetZernMode_Quadrafoil0deg(float Acoef);
int SetZernMode_Quadrafoil45deg(float Acoef);
// action interface
// ----------------
int OnPort (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetCalibration (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetCalibrationParams (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetDiversityPref (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnLoadWavefront (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSaveCurrentPosition (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Tip (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Tilt (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Defocus (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Astig0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Astig45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Coma0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Coma90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_PrimSpherical (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Trefoil0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Trefoil90deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondAstig0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_SecondAstig45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Quadrafoil0deg (MM::PropertyBase* pProp, MM::ActionType eAct);
int OnSetZernMode_Quadrafoil45deg (MM::PropertyBase* pProp, MM::ActionType eAct);
std::string mirrorinitpath_;
std::string calibpath_;
std::string calibparamspath_;
std::string divprefpath_;
std::string wfcpath_;
std::string savepath_;
protected:
bool initialized_;
std::string port_;
MM::Device *device_;
MM::Core *core_;
};