BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
BioImager.SDK Class Reference

Public Member Functions

static int PriorScientificSDK_Version (StringBuilder version)
 
static int PriorScientificSDK_Initialise ()
 
static int PriorScientificSDK_OpenNewSession ()
 
static int PriorScientificSDK_CloseSession (int sessionID)
 
static int PriorScientificSDK_cmd (int session, StringBuilder tx, StringBuilder rx)
 
int InitialiseStage ()
 
bool SetPosition (PointD p)
 
PointD GetPosition ()
 
bool SetPosition (Point3D p)
 
bool SetObjective (int p)
 
Point3D GetPosition3D ()
 
bool SetZ (double d)
 
double GetZ ()
 
bool SetNosePiece (int d)
 
int GetNosePiece ()
 
int GetNosePiecePositions ()
 
int stageBusy ()
 
int zBusy ()
 
int nosePieceBusy ()
 
bool shutterOpen ()
 
bool shutterClose ()
 
int shutterPosition ()
 
void waitUntilStageIdle ()
 
void waitUntilZIdle ()
 
void waitUntilNosePieceIdle ()
 
int GetVersion (StringBuilder version)
 
int Initialise ()
 
int OpenSession ()
 
int CloseSession (int sessionID)
 
int Cmd (int session, string usertx, ref string userrx, bool displayError=true)
 

Detailed Description

Definition at line 17 of file SDK.cs.

Constructor & Destructor Documentation

◆ SDK()

BioImager.SDK.SDK ( )

Definition at line 42 of file SDK.cs.

43 {
44
45 }

Member Function Documentation

◆ CloseSession()

int BioImager.SDK.CloseSession ( int sessionID)

Definition at line 349 of file SDK.cs.

350 {
351 return PriorScientificSDK_CloseSession(sessionID);
352 }

◆ Cmd()

int BioImager.SDK.Cmd ( int session,
string usertx,
ref string userrx,
bool displayError = true )

Definition at line 354 of file SDK.cs.

355 {
356 int ret;
357
358 StringBuilder tx = new StringBuilder();
359 StringBuilder rx = new StringBuilder();
360
361 tx.Append(usertx);
362 ret = PriorScientificSDK_cmd(session,tx,rx);
363
364 if (ret == Prior.PRIOR_OK)
365 {
366 userrx = rx.ToString();
367 }
368 else
369 {
370 if (displayError)
371 {
372 MessageBox.Show("Sent " + usertx + "\rSDK error: " + ret.ToString() );
373 }
374 }
375
376 return ret;
377 }

◆ GetNosePiece()

int BioImager.SDK.GetNosePiece ( )

Definition at line 235 of file SDK.cs.

236 {
237 if ((err = priorSDK.Cmd(sessionID, "controller.nosepiece.position.get", ref userRx)) != Prior.PRIOR_OK)
238 {
239 throw new Exception(err.ToString());
240 }
241 return int.Parse(userRx);
242 }

◆ GetNosePiecePositions()

int BioImager.SDK.GetNosePiecePositions ( )

Definition at line 243 of file SDK.cs.

244 {
245 if ((err = priorSDK.Cmd(sessionID, "controller.nosepiece.no-of-positions.get", ref userRx)) != Prior.PRIOR_OK)
246 {
247 throw new Exception(err.ToString());
248 }
249 return int.Parse(userRx);
250 }

◆ GetPosition()

PointD BioImager.SDK.GetPosition ( )

Definition at line 156 of file SDK.cs.

157 {
158 if ((err = priorSDK.Cmd(sessionID, "controller.stage.position.get", ref userRx)) != Prior.PRIOR_OK)
159 {
160 return new PointD(0, 0);
161 }
162 string[] sts = userRx.Split(' ');
163 double dx = double.Parse(sts[0]);
164 double yx = double.Parse(sts[1]);
165 return new PointD(dx,yx);
166 }

◆ GetPosition3D()

Point3D BioImager.SDK.GetPosition3D ( )

Definition at line 191 of file SDK.cs.

192 {
193 if ((err = priorSDK.Cmd(sessionID, "controller.stage.position.get", ref userRx)) != Prior.PRIOR_OK)
194 {
195 throw new Exception(err.ToString());
196 }
197 string[] sts = userRx.Split(' ');
198 double dx = double.Parse(sts[0]);
199 double yx = double.Parse(sts[1]);
200 if ((err = priorSDK.Cmd(sessionID, "controller.z.position.get", ref userRx)) != Prior.PRIOR_OK)
201 {
202 throw new Exception(err.ToString());
203 }
204 double zx = double.Parse(userRx);
205 return new Point3D(dx, yx, zx);
206 }

◆ GetVersion()

int BioImager.SDK.GetVersion ( StringBuilder version)

Definition at line 334 of file SDK.cs.

335 {
336 return PriorScientificSDK_Version(version);
337 }

◆ GetZ()

double BioImager.SDK.GetZ ( )

Definition at line 217 of file SDK.cs.

218 {
219 if ((err = priorSDK.Cmd(sessionID, "controller.z.position.get", ref userRx)) != Prior.PRIOR_OK)
220 {
221 throw new Exception(err.ToString());
222 }
223 return double.Parse(userRx);
224 }

◆ Initialise()

int BioImager.SDK.Initialise ( )

Definition at line 339 of file SDK.cs.

340 {
341 return PriorScientificSDK_Initialise();
342 }

◆ InitialiseStage()

int BioImager.SDK.InitialiseStage ( )

Definition at line 119 of file SDK.cs.

120 {
121 /* do stage initialisation, goto back right limits (could be anywhere you wish it to be in reality )
122 * default positional units are in steps of 1micron
123 */
124
125 if ((err = priorSDK.Cmd(sessionID, "controller.stage.move-at-velocity " +
126 (-10000).ToString() + " " + (-10000).ToString(), ref userRx)) != Prior.PRIOR_OK)
127 {
128 return 1;
129 }
130
131 waitUntilStageIdle();
132
133 /* set temp zero pos */
134 if ((err = priorSDK.Cmd(sessionID, "controller.stage.position.set 0 0", ref userRx)) != Prior.PRIOR_OK)
135 {
136 return 1;
137 }
138 waitUntilStageIdle();
139 /* move off slightly */
140 if ((err = priorSDK.Cmd(sessionID, "controller.stage.goto-position 1000 1000", ref userRx)) != Prior.PRIOR_OK)
141 {
142 return 1;
143 }
144
145 return 0;
146 }

◆ nosePieceBusy()

int BioImager.SDK.nosePieceBusy ( )

Definition at line 270 of file SDK.cs.

271 {
272 if ((err = priorSDK.Cmd(sessionID, "controller.nosepiece.busy.get", ref userRx)) != Prior.PRIOR_OK)
273 {
274 return 0;
275 }
276 else
277 return Convert.ToInt32(userRx);
278 }

◆ OpenSession()

int BioImager.SDK.OpenSession ( )

Definition at line 344 of file SDK.cs.

345 {
346 return PriorScientificSDK_OpenNewSession();
347 }

◆ SetNosePiece()

bool BioImager.SDK.SetNosePiece ( int d)

Definition at line 225 of file SDK.cs.

226 {
227 waitUntilNosePieceIdle();
228 if ((err = priorSDK.Cmd(sessionID, "controller.nosepiece.position.set " + d, ref userRx)) != Prior.PRIOR_OK)
229 {
230 throw new Exception(err.ToString());
231 }
232 waitUntilNosePieceIdle();
233 return true;
234 }

◆ SetObjective()

bool BioImager.SDK.SetObjective ( int p)

Definition at line 181 of file SDK.cs.

182 {
183 waitUntilNosePieceIdle();
184 if ((err = priorSDK.Cmd(sessionID, "controller.nosepiece.goto-position " + p, ref userRx)) != Prior.PRIOR_OK)
185 {
186 return false;
187 }
188 waitUntilNosePieceIdle();
189 return true;
190 }

◆ SetPosition() [1/2]

bool BioImager.SDK.SetPosition ( Point3D p)

Definition at line 167 of file SDK.cs.

168 {
169 if ((err = priorSDK.Cmd(sessionID, "controller.stage.position.set " + p.X + " " + p.Y, ref userRx)) != Prior.PRIOR_OK)
170 {
171 return false;
172 }
173 waitUntilStageIdle();
174 if ((err = priorSDK.Cmd(sessionID, "controller.z.position.set " + p.Z, ref userRx)) != Prior.PRIOR_OK)
175 {
176 throw new Exception(err.ToString());
177 }
178 waitUntilStageIdle();
179 return true;
180 }

◆ SetPosition() [2/2]

bool BioImager.SDK.SetPosition ( PointD p)

Definition at line 147 of file SDK.cs.

148 {
149 if ((err = priorSDK.Cmd(sessionID, "controller.stage.position.set "+ p.X + " " + p.Y, ref userRx)) != Prior.PRIOR_OK)
150 {
151 return false;
152 }
153 waitUntilStageIdle();
154 return true;
155 }

◆ SetZ()

bool BioImager.SDK.SetZ ( double d)

Definition at line 207 of file SDK.cs.

208 {
209 waitUntilZIdle();
210 if ((err = priorSDK.Cmd(sessionID, "controller.z.position.set " + d, ref userRx)) != Prior.PRIOR_OK)
211 {
212 throw new Exception(err.ToString());
213 }
214 waitUntilZIdle();
215 return true;
216 }

◆ shutterClose()

bool BioImager.SDK.shutterClose ( )

Definition at line 288 of file SDK.cs.

289 {
290 if ((err = priorSDK.Cmd(sessionID, "controller.shutter.close", ref userRx)) != Prior.PRIOR_OK)
291 {
292 return false;
293 }
294 else
295 return true;
296 }

◆ shutterOpen()

bool BioImager.SDK.shutterOpen ( )

Definition at line 279 of file SDK.cs.

280 {
281 if ((err = priorSDK.Cmd(sessionID, "controller.shutter.open", ref userRx)) != Prior.PRIOR_OK)
282 {
283 return false;
284 }
285 else
286 return true;
287 }

◆ shutterPosition()

int BioImager.SDK.shutterPosition ( )

Definition at line 297 of file SDK.cs.

298 {
299 if ((err = priorSDK.Cmd(sessionID, "controller.shutter.state.get", ref userRx)) != Prior.PRIOR_OK)
300 {
301 return 0;
302 }
303 else
304 return int.Parse(userRx);
305 }

◆ stageBusy()

int BioImager.SDK.stageBusy ( )

Definition at line 251 of file SDK.cs.

252 {
253 if ((err = priorSDK.Cmd(sessionID, "controller.stage.busy.get", ref userRx)) != Prior.PRIOR_OK)
254 {
255 return 0;
256 }
257 else
258 return Convert.ToInt32(userRx);
259 }

◆ waitUntilNosePieceIdle()

void BioImager.SDK.waitUntilNosePieceIdle ( )

Definition at line 324 of file SDK.cs.

325 {
326 do
327 {
328 Application.DoEvents();
329 Thread.Sleep(100);
330 }
331 while (nosePieceBusy() != 0);
332 }

◆ waitUntilStageIdle()

void BioImager.SDK.waitUntilStageIdle ( )

Definition at line 306 of file SDK.cs.

307 {
308 do
309 {
310 Application.DoEvents();
311 Thread.Sleep(100);
312 }
313 while (stageBusy() != 0);
314 }

◆ waitUntilZIdle()

void BioImager.SDK.waitUntilZIdle ( )

Definition at line 315 of file SDK.cs.

316 {
317 do
318 {
319 Application.DoEvents();
320 Thread.Sleep(100);
321 }
322 while (zBusy() != 0);
323 }

◆ zBusy()

int BioImager.SDK.zBusy ( )

Definition at line 261 of file SDK.cs.

262 {
263 if ((err = priorSDK.Cmd(sessionID, "controller.z.busy.get", ref userRx)) != Prior.PRIOR_OK)
264 {
265 return 0;
266 }
267 else
268 return Convert.ToInt32(userRx);
269 }

The documentation for this class was generated from the following file: