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.Imager Class Reference
Inheritance diagram for BioImager.Imager:

Classes

class  ControllerFuncs
 
class  Profile
 

Public Member Functions

void UpdateStatus ()
 
void StoreCoordinate ()
 
void CheckGamepadButtons (Gamepad state, Gamepad prevState)
 
object PerformFunction (Function f)
 

Static Public Member Functions

static int DigitsInString (string str)
 

Public Attributes

Controller controller
 
Gamepad gamepad
 
Gamepad previousGamepadState
 
bool prevState = false
 
bool connected = false
 
float leftTrigger
 
float rightTrigger
 
int deadzone = 5
 
string m_ID
 
Profile CurrentProfile = new Profile("Default")
 

Static Public Attributes

static IntPtr apph
 
static string AppPath = ""
 
static List< BioImage > StoredImages = new List<BioImage>()
 
static ? bool liveStatus = null
 
static InputSimulator input = new InputSimulator()
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used.
 

Properties

string ID [get]
 
static Process ZenP [get, set]
 
uint ImagesPerSlice [get, set]
 
uint SliceIncrement [get, set]
 
uint SlicesPerSlide [get, set]
 

Detailed Description

Definition at line 4 of file Imager.Designer.cs.

Constructor & Destructor Documentation

◆ Imager()

BioImager.Imager.Imager ( )

Definition at line 142 of file Imager.cs.

143 {
144 InitializeComponent();
145 if (Settings.Default.PycroManager)
146 {
147 topMostCheckBox.Checked = false;
148 dockToApp.Checked = false;
149 }
150 Stopwatch timer = new Stopwatch();
151 timer.Start();
152 TimeSpan st1 = timer.Elapsed;
153 m_ID = "";
154 if (Settings.Default.AppPath != "" && !Settings.Default.AppPath.Contains("ImageJ"))
155 {
156 //We start the imaging application making sure the we have the right path to the executable.
157 AppPath = Settings.Default.AppPath;
158 if (!File.Exists(AppPath))
159 {
160 MessageBox.Show("Error!", "Imaging appplication not found. Please locate the executable.");
161 //path is not default. Let the user find it.
162 if (openExeFileDialog.ShowDialog() != DialogResult.OK)
163 Application.Exit();
164 Settings.Default.AppPath = openExeFileDialog.FileName;
165 }
166 string pn = Path.GetFileNameWithoutExtension(AppPath);
167 Process[] prs = Process.GetProcessesByName(pn);
168 if (prs.Length == 0)
169 {
170 AppP = Process.Start(AppPath);
171 }
172 else
173 AppP = prs[0];
174 apph = AppP.MainWindowHandle;
175 //We use a try block incase of Win32 Access violation error.
176 try
177 {
178 AppP.WaitForInputIdle();
179 }
180 catch (Exception)
181 {
182 }
183 }
184 statusTimer.Start();
185
186 for (UserIndex i = UserIndex.One; i <= UserIndex.Four; i++)
187 {
188 controller = new Controller(i);
189 if (controller.IsConnected)
190 {
191 connected = true;
192 break;
193 }
194 else controller = null;
195 }
196
197 ControllerFuncs.LoadSettings();
198
199 controllerJoystickUpdate.Start();
200
201 controllerButtonUpdate.Start();
202
203
204 if (!Directory.Exists(Application.StartupPath + "\\Profiles"))
205 Directory.CreateDirectory(Application.StartupPath + "\\Profiles");
206 string[] sts = Directory.GetFiles(Application.StartupPath + "\\Profiles");
207 foreach (string s in sts)
208 {
209 Profile p = new Profile(s);
210 profilesBox.Items.Add(p);
211 }
212
213 if (Settings.Default.PreviousProfile != "Default")
214 {
215 CurrentProfile = new Profile(Settings.Default.PreviousProfile);
216 CurrentProfile.Load();
217 int index = 0;
218 foreach (Profile item in profilesBox.Items)
219 {
220 if (item.FilePath == Settings.Default.PreviousProfile)
221 {
222 profilesBox.SelectedIndex = index;
223 break;
224 }
225 index++;
226 }
227 }
228 this.TopMost = topMostCheckBox.Checked;
229
230 if (dockToApp.Checked && !Properties.Settings.Default.PycroManager)
231 {
232 //We set window location based on imaging application location.
233 Win32.Rect r = new Win32.Rect();
234 Win32.GetWindowRect(apph, ref r);
235 System.Drawing.Point pp = new System.Drawing.Point(r.Right - this.Width, r.Bottom - this.Height - 23);
236 this.Location = new System.Drawing.Point((int)pp.X, (int)pp.Y);
237 }
238 this.Show();
239 }

Member Function Documentation

◆ CheckGamepadButtons()

void BioImager.Imager.CheckGamepadButtons ( Gamepad state,
Gamepad prevState )

If the button is set to be pressed, then check if the button is pressed. If it is, then perform the function. If it's not, then do nothing. If the button is set to be released, then check if the button is released. If it is, then perform the function. If it's not, then do nothing

Parameters
GamepadThe current state of the controller
GamepadThe previous state of the controller

Definition at line 1002 of file Imager.cs.

1003 {
1004 #region YBAX Keys
1005 if (ControllerFuncs.Y.State == Function.ButtonState.Released)
1006 {
1007 if (prevState.Buttons == GamepadButtonFlags.Y && state.Buttons != GamepadButtonFlags.Y)
1008 {
1009 PerformFunction(ControllerFuncs.Y);
1010 prevState.Buttons = GamepadButtonFlags.None;
1011 YPressedLabel.Text = "Y: released";
1012 }
1013 else
1014 YPressedLabel.Text = "Y: not pressed";
1015 }
1016 else
1017 {
1018 if (state.Buttons == GamepadButtonFlags.Y)
1019 {
1020 PerformFunction(ControllerFuncs.Y);
1021 prevState.Buttons = GamepadButtonFlags.None;
1022 YPressedLabel.Text = "Y: pressed";
1023 }
1024 else
1025 YPressedLabel.Text = "Y: not pressed";
1026 }
1027 if (ControllerFuncs.B.State == Function.ButtonState.Released)
1028 {
1029 if (prevState.Buttons == GamepadButtonFlags.B && state.Buttons != GamepadButtonFlags.B)
1030 {
1031 PerformFunction(ControllerFuncs.B);
1032 prevState.Buttons = GamepadButtonFlags.None;
1033 state.Buttons = GamepadButtonFlags.None;
1034 BPressedLabel.Text = "B: released";
1035 }
1036 else
1037 BPressedLabel.Text = "B: not pressed";
1038 }
1039 else
1040 {
1041 if (state.Buttons == GamepadButtonFlags.B)
1042 {
1043 PerformFunction(ControllerFuncs.B);
1044 prevState.Buttons = GamepadButtonFlags.None;
1045 BPressedLabel.Text = "B: pressed";
1046 }
1047 else
1048 BPressedLabel.Text = "B: not pressed";
1049 }
1050 if (ControllerFuncs.A.State == Function.ButtonState.Released)
1051 {
1052 if (prevState.Buttons == GamepadButtonFlags.A && state.Buttons != GamepadButtonFlags.A)
1053 {
1054 PerformFunction(ControllerFuncs.A);
1055 prevState.Buttons = GamepadButtonFlags.None;
1056 APressedLabel.Text = "A: released";
1057 }
1058 else
1059 APressedLabel.Text = "A: not pressed";
1060 }
1061 else
1062 {
1063 if (state.Buttons == GamepadButtonFlags.A)
1064 {
1065 PerformFunction(ControllerFuncs.A);
1066 prevState.Buttons = GamepadButtonFlags.None;
1067 APressedLabel.Text = "A: pressed";
1068 }
1069 else
1070 APressedLabel.Text = "A: not pressed";
1071 }
1072 if (ControllerFuncs.X.State == Function.ButtonState.Released)
1073 {
1074 if (prevState.Buttons == GamepadButtonFlags.X && state.Buttons != GamepadButtonFlags.X)
1075 {
1076 PerformFunction(ControllerFuncs.X);
1077 prevState.Buttons = GamepadButtonFlags.None;
1078 XPressedLabel.Text = "X: released";
1079 }
1080 else
1081 XPressedLabel.Text = "X: not pressed";
1082 }
1083 else
1084 {
1085 if (state.Buttons == GamepadButtonFlags.X)
1086 {
1087 PerformFunction(ControllerFuncs.X);
1088 prevState.Buttons = GamepadButtonFlags.None;
1089 XPressedLabel.Text = "X: pressed";
1090 }
1091 else
1092 XPressedLabel.Text = "X: not pressed";
1093 }
1094 #endregion
1095
1096 #region Back & Start Keys
1097 if (ControllerFuncs.Start.State == Function.ButtonState.Released)
1098 {
1099 if (prevState.Buttons == GamepadButtonFlags.Start && state.Buttons != GamepadButtonFlags.Start)
1100 {
1101 PerformFunction(ControllerFuncs.Start);
1102 prevState.Buttons = GamepadButtonFlags.None;
1103 StartPressedLabel.Text = "Start: released";
1104 }
1105 else
1106 StartPressedLabel.Text = "Start: not pressed";
1107 }
1108 else
1109 {
1110 if (state.Buttons == GamepadButtonFlags.Start)
1111 {
1112 PerformFunction(ControllerFuncs.Start);
1113 prevState.Buttons = GamepadButtonFlags.None;
1114 StartPressedLabel.Text = "Start: pressed";
1115 }
1116 else
1117 StartPressedLabel.Text = "Start: not pressed";
1118 }
1119 if (ControllerFuncs.Back.State == Function.ButtonState.Released)
1120 {
1121 if (prevState.Buttons == GamepadButtonFlags.Back && state.Buttons != GamepadButtonFlags.Back)
1122 {
1123 PerformFunction(ControllerFuncs.Back);
1124 prevState.Buttons = GamepadButtonFlags.None;
1125 BackPressedLabel.Text = "Back: released";
1126 }
1127 else
1128 BackPressedLabel.Text = "Back: not pressed";
1129 }
1130 else
1131 {
1132 if (state.Buttons == GamepadButtonFlags.Back)
1133 {
1134 PerformFunction(ControllerFuncs.Back);
1135 prevState.Buttons = GamepadButtonFlags.None;
1136 BackPressedLabel.Text = "Back: pressed";
1137 }
1138 else
1139 BackPressedLabel.Text = "Back: not pressed";
1140 }
1141 #endregion
1142
1143 #region Shoulders
1144 if (ControllerFuncs.RShoulder.State == Function.ButtonState.Released)
1145 {
1146 if (prevState.Buttons == GamepadButtonFlags.RightShoulder && state.Buttons != GamepadButtonFlags.RightShoulder)
1147 {
1148 PerformFunction(ControllerFuncs.RShoulder);
1149 prevState.Buttons = GamepadButtonFlags.None;
1150 shoulderRightLabel.Text = "Right: released";
1151 }
1152 else
1153 shoulderRightLabel.Text = "Right: not pressed";
1154 }
1155 else
1156 {
1157 if (state.Buttons == GamepadButtonFlags.RightShoulder)
1158 {
1159 PerformFunction(ControllerFuncs.RShoulder);
1160 prevState.Buttons = GamepadButtonFlags.None;
1161 shoulderRightLabel.Text = "Right: pressed";
1162 }
1163 else
1164 shoulderRightLabel.Text = "Right: not pressed";
1165 }
1166 if (ControllerFuncs.LShoulder.State == Function.ButtonState.Released)
1167 {
1168 if (prevState.Buttons == GamepadButtonFlags.LeftShoulder && state.Buttons != GamepadButtonFlags.LeftShoulder)
1169 {
1170 PerformFunction(ControllerFuncs.RShoulder);
1171 prevState.Buttons = GamepadButtonFlags.None;
1172 shoulderLeftLabel.Text = "Left: released";
1173 }
1174 else
1175 shoulderLeftLabel.Text = "Left: not pressed";
1176 }
1177 else
1178 {
1179 if (state.Buttons == GamepadButtonFlags.LeftShoulder)
1180 {
1181 PerformFunction(ControllerFuncs.LShoulder);
1182 prevState.Buttons = GamepadButtonFlags.None;
1183 shoulderLeftLabel.Text = "Left: pressed";
1184 }
1185 else
1186 shoulderLeftLabel.Text = "Left: not pressed";
1187 }
1188
1189 #endregion
1190
1191 #region L3 & R3
1192 if (ControllerFuncs.R3.State == Function.ButtonState.Released)
1193 {
1194 if (prevState.Buttons == GamepadButtonFlags.RightThumb && state.Buttons != GamepadButtonFlags.RightThumb)
1195 {
1196 PerformFunction(ControllerFuncs.R3);
1197 prevState.Buttons = GamepadButtonFlags.None;
1198 r3PressedLabel.Text = "R3: released";
1199 }
1200 else
1201 r3PressedLabel.Text = "R3: not pressed";
1202 }
1203 else
1204 {
1205 if (state.Buttons == GamepadButtonFlags.RightThumb)
1206 {
1207 PerformFunction(ControllerFuncs.R3);
1208 prevState.Buttons = GamepadButtonFlags.None;
1209 r3PressedLabel.Text = "R3: pressed";
1210 }
1211 else
1212 r3PressedLabel.Text = "R3: not pressed";
1213 }
1214
1215 if (ControllerFuncs.L3.State == Function.ButtonState.Released)
1216 {
1217 if (prevState.Buttons == GamepadButtonFlags.LeftThumb && state.Buttons != GamepadButtonFlags.LeftThumb)
1218 {
1219 PerformFunction(ControllerFuncs.L3);
1220 prevState.Buttons = GamepadButtonFlags.None;
1221 l3PressedLabel.Text = "L3: released";
1222 }
1223 else
1224 l3PressedLabel.Text = "L3: not pressed";
1225 }
1226 else
1227 {
1228 if (state.Buttons == GamepadButtonFlags.LeftThumb)
1229 {
1230 PerformFunction(ControllerFuncs.L3);
1231 prevState.Buttons = GamepadButtonFlags.None;
1232 l3PressedLabel.Text = "L3: pressed";
1233 }
1234 else
1235 l3PressedLabel.Text = "L3: not pressed";
1236 }
1237 #endregion
1238
1239 #region DPAD BUTTONS
1240 if (ControllerFuncs.DPadUp.State == Function.ButtonState.Released)
1241 {
1242 if (prevState.Buttons == GamepadButtonFlags.DPadUp && state.Buttons != GamepadButtonFlags.DPadUp)
1243 {
1244 PerformFunction(ControllerFuncs.DPadUp);
1245 prevState.Buttons = GamepadButtonFlags.None;
1246 DPadUpLabel.Text = "Up: released";
1247 }
1248 else
1249 DPadUpLabel.Text = "Up: not pressed";
1250 }
1251 else
1252 {
1253 if (state.Buttons == GamepadButtonFlags.DPadUp)
1254 {
1255 PerformFunction(ControllerFuncs.DPadUp);
1256 prevState.Buttons = GamepadButtonFlags.None;
1257 DPadUpLabel.Text = "Up: pressed";
1258 }
1259 else
1260 DPadUpLabel.Text = "Up: not pressed";
1261 }
1262
1263 if (ControllerFuncs.DPadRight.State == Function.ButtonState.Released)
1264 {
1265 if (prevState.Buttons == GamepadButtonFlags.DPadRight && state.Buttons != GamepadButtonFlags.DPadRight)
1266 {
1267 PerformFunction(ControllerFuncs.DPadRight);
1268 prevState.Buttons = GamepadButtonFlags.None;
1269 DPadRightLabel.Text = "Right: released";
1270 }
1271 else
1272 DPadRightLabel.Text = "Right: not pressed";
1273 }
1274 else
1275 {
1276 if (state.Buttons == GamepadButtonFlags.DPadRight)
1277 {
1278 PerformFunction(ControllerFuncs.DPadRight);
1279 prevState.Buttons = GamepadButtonFlags.None;
1280 DPadRightLabel.Text = "Right: pressed";
1281 }
1282 else
1283 DPadRightLabel.Text = "Right: not pressed";
1284 }
1285
1286 if (ControllerFuncs.DPadDown.State == Function.ButtonState.Released)
1287 {
1288 if (prevState.Buttons == GamepadButtonFlags.DPadDown && state.Buttons != GamepadButtonFlags.DPadDown)
1289 {
1290 PerformFunction(ControllerFuncs.DPadDown);
1291 prevState.Buttons = GamepadButtonFlags.None;
1292 DPadDownLabel.Text = "Down: released";
1293 }
1294 else
1295 DPadDownLabel.Text = "Down: not pressed";
1296 }
1297 else
1298 {
1299 if (state.Buttons == GamepadButtonFlags.DPadDown)
1300 {
1301 PerformFunction(ControllerFuncs.DPadDown);
1302 prevState.Buttons = GamepadButtonFlags.None;
1303 DPadDownLabel.Text = "Down: pressed";
1304 }
1305 else
1306 DPadDownLabel.Text = "Down: not pressed";
1307 }
1308
1309 if (ControllerFuncs.DPadLeft.State == Function.ButtonState.Released)
1310 {
1311 if (prevState.Buttons == GamepadButtonFlags.DPadLeft && state.Buttons != GamepadButtonFlags.DPadLeft)
1312 {
1313 PerformFunction(ControllerFuncs.DPadLeft);
1314 prevState.Buttons = GamepadButtonFlags.None;
1315 DPadLeftLabel.Text = "Left: released";
1316 }
1317 else
1318 DPadLeftLabel.Text = "Left: not pressed";
1319 }
1320 else
1321 {
1322 if (state.Buttons == GamepadButtonFlags.DPadLeft)
1323 {
1324 PerformFunction(ControllerFuncs.DPadLeft);
1325 prevState.Buttons = GamepadButtonFlags.None;
1326 DPadLeftLabel.Text = "Left: pressed";
1327 }
1328 else
1329 DPadLeftLabel.Text = "Left: not pressed";
1330 }
1331
1332 #endregion
1333
1334 }
object PerformFunction(Function f)
Definition Imager.cs:1343

◆ DigitsInString()

static int BioImager.Imager.DigitsInString ( string str)
static

It loops through the string and counts the number of times a digit is found

Parameters
strThe string to be searched.
Returns
The number of digits in the string.

Definition at line 482 of file Imager.cs.

483 {
484 int count = 0;
485 for (int i = 0; i < str.Length; i++)
486 {
487 if ((str[i] >= '0') && (str[i] <= '9'))
488 {
489 count++;
490 }
491 }
492 return count;
493 }

◆ Dispose()

override void BioImager.Imager.Dispose ( bool disposing)
protected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 15 of file Imager.Designer.cs.

16 {
17 if (disposing && (components != null))
18 {
19 components.Dispose();
20 }
21 base.Dispose(disposing);
22 }

◆ PerformFunction()

object BioImager.Imager.PerformFunction ( Function f)

It takes a function object and performs the function

Parameters
FunctionThe function to be performed
Returns
Nothing.

Definition at line 1343 of file Imager.cs.

1344 {
1345 if (f.FuncType == Function.FunctionType.Key)
1346 {
1347 if(AppP!=null)
1348 if (AppP.HasExited)
1349 return null;
1350 if (AppP != null)
1351 AppP.WaitForInputIdle();
1352 if (AppP != null)
1353 Win32.SetForegroundWindow(apph);
1354 if (f.Modifier != VirtualKeyCode.NONAME)
1355 {
1356 input.Keyboard.ModifiedKeyStroke(f.Modifier, f.Key);
1357 }
1358 else
1359 {
1360 input.Keyboard.KeyPress(f.Key);
1361 }
1362 return null;
1363 }
1364 if (f.FuncType == Function.FunctionType.Objective)
1365 {
1366 Objectives.Objective obj = BioImager.Microscope.Objectives.GetObjective();
1367 Microscope.Objectives.SetPosition((int)f.Value);
1368 //We set locate exposure as the locate tab is the only one that updates lightpath automatically after objective change.
1369 //Automation.SetProperty("LocateExposure", obj.LocateExposure.ToString());
1370 LJoystickStageMoveAmountBox.Value = (decimal)obj.MoveAmountL;
1371 RJoystickStageMoveAmountBox.Value = (decimal)obj.MoveAmountR;
1372 triggerFocusBox.Value = (decimal)obj.FocusMoveAmount;
1373 return null;
1374 }
1375 if (f.FuncType == Function.FunctionType.StoreCoordinate)
1376 {
1377 StoreCoordinate();
1378 return null;
1379 }
1380 if (f.FuncType == Function.FunctionType.NextCoordinate)
1381 {
1382 //If stored coordinates selected index is -1 then nothing is selected.
1383 //so we can't go to next stored coordinate
1384 if (storedCoordsBox.SelectedIndex != -1)
1385 {
1386 //We go to the next stored coordinate
1387 if (storedCoordsBox.SelectedIndex + 1 < storedCoordsBox.Items.Count)
1388 {
1389 Point3D p = (Point3D)storedCoordsBox.Items[storedCoordsBox.SelectedIndex + 1];
1390 Microscope.SetPosition(p);
1391 storedCoordsBox.SelectedIndex = storedCoordsBox.SelectedIndex + 1;
1392 }
1393 if (storedCoordsBox.SelectedIndex == 0)
1394 {
1395 Point3D p = (Point3D)storedCoordsBox.Items[storedCoordsBox.SelectedIndex];
1396 Microscope.SetPosition(p);
1397 }
1398 }
1399 return null;
1400 }
1401 if (f.FuncType == Function.FunctionType.PreviousCoordinate)
1402 {
1403 //We go to the previous stored coordinate unless selected index is 0
1404 //in which case we go to coordinate of selected point.
1405
1406 //If stored coordinates selected index is -1 then nothing is selected.
1407 //so we can't go to next stored coordinate
1408 if (storedCoordsBox.SelectedIndex != -1)
1409 {
1410 if (storedCoordsBox.SelectedIndex == 0)
1411 {
1412 Point3D p = (Point3D)storedCoordsBox.Items[storedCoordsBox.SelectedIndex];
1413 Microscope.SetPosition(p);
1414 }
1415 if (storedCoordsBox.SelectedIndex > 0)
1416 {
1417 Point3D p = (Point3D)storedCoordsBox.Items[storedCoordsBox.SelectedIndex - 1];
1418 Microscope.SetPosition(p);
1419 storedCoordsBox.SelectedIndex = storedCoordsBox.SelectedIndex - 1;
1420 }
1421 }
1422 return null;
1423 }
1424 if (f.FuncType == Function.FunctionType.NextSnapCoordinate)
1425 {
1426 //If stored coordinates selected index is -1 then nothing is selected.
1427 //so we can't go to next stored coordinate
1428 if (storedImageBox.SelectedIndex != -1)
1429 {
1430 //We go to the next stored coordinate
1431 if (storedImageBox.SelectedIndex + 1 < storedImageBox.Items.Count)
1432 {
1433 Point3D p = (Point3D)storedImageBox.Items[storedImageBox.SelectedIndex + 1];
1434 Microscope.SetPosition(p);
1435 storedImageBox.SelectedIndex = storedImageBox.SelectedIndex + 1;
1436 }
1437 if (storedImageBox.SelectedIndex == 0)
1438 {
1439 Point3D p = (Point3D)storedImageBox.Items[storedImageBox.SelectedIndex];
1440 Microscope.SetPosition(p);
1441 }
1442 }
1443 return null;
1444 }
1445 if (f.FuncType == Function.FunctionType.PreviousSnapCoordinate)
1446 {
1447 //We go to the previous stored coordinate unless selected index is 0
1448 //in which case we go to coordinate of selected point.
1449
1450 //If stored coordinates selected index is -1 then nothing is selected.
1451 //so we can't go to next stored coordinate
1452 if (storedImageBox.SelectedIndex != -1)
1453 {
1454 if (storedImageBox.SelectedIndex == 0)
1455 {
1456 Point3D p = (Point3D)storedImageBox.Items[storedImageBox.SelectedIndex];
1457 Microscope.SetPosition(p);
1458 }
1459 if (storedImageBox.SelectedIndex > 0)
1460 {
1461 Point3D p = (Point3D)storedImageBox.Items[storedImageBox.SelectedIndex - 1];
1462 Microscope.SetPosition(p);
1463 //We stop the controller update timer so we can update the stored coordinates list it operates on safely
1464 storedImageBox.SelectedIndex = storedImageBox.SelectedIndex - 1;
1465 }
1466 }
1467 return null;
1468 }
1469 if (f.FuncType == Function.FunctionType.Script)
1470 {
1471 Scripting.RunScript(f.File);
1472 }
1473 if (f.FuncType == Function.FunctionType.ImageJ)
1474 {
1475 ImageJ.RunMacro(f.File, "");
1476 }
1477 if (f.FuncType.ToString() == "StageUp")
1478 {
1479 Microscope.MoveUp(f.Value);
1480 }
1481 else
1482 if (f.FuncType.ToString() == "StageRight")
1483 {
1484 Microscope.MoveRight(f.Value);
1485 }
1486 else
1487 if (f.FuncType.ToString() == "StageDown")
1488 {
1489 Microscope.MoveDown(f.Value);
1490 }
1491 else
1492 if (f.FuncType.ToString() == "StageLeft")
1493 {
1494 Microscope.MoveLeft(f.Value);
1495 }
1496 else
1497 if (f.FuncType.ToString() == "FocusUp")
1498 {
1499 Microscope.SetFocus(f.Value);
1500 }
1501 else
1502 if (f.FuncType.ToString() == "FocusDown")
1503 {
1504 Microscope.SetFocus(-f.Value);
1505 }
1506 else
1507 if (f.FuncType.ToString() == "StageFieldUp")
1508 {
1509 Microscope.MoveFieldUp();
1510 }
1511 else
1512 if (f.FuncType.ToString() == "StageFieldRight")
1513 {
1514 Microscope.MoveFieldRight();
1515 }
1516 else
1517 if (f.FuncType.ToString() == "StageFieldDown")
1518 {
1519 Microscope.MoveFieldDown();
1520 }
1521 else
1522 if (f.FuncType.ToString() == "StageFieldLeft")
1523 {
1524 Microscope.MoveFieldLeft();
1525 }
1526 else
1527 if (f.FuncType.ToString() == "TakeImage")
1528 {
1529 Microscope.TakeImage();
1530 }
1531 else
1532 if (f.FuncType.ToString() == "TakeImageStack")
1533 {
1534 Microscope.TakeImageStack();
1535 }
1536 else
1537 if (f.FuncType.ToString() == "RL")
1538 {
1539 Microscope.RLShutter.SetPosition((int)f.Value);
1540 }
1541 else
1542 if (f.FuncType.ToString() == "TL")
1543 {
1544 Microscope.TLShutter.SetPosition((int)f.Value);
1545 }
1546 if (f.FuncType == Function.FunctionType.Property)
1547 {
1548 if (f.Name.StartsWith("Get"))
1549 {
1550 Automation.Recording r = (Automation.Recording)Automation.Properties[Path.GetFileNameWithoutExtension(f.File)];
1551 return r.Get();
1552 }
1553 else if (f.Name.StartsWith("Set"))
1554 {
1555 Automation.Recording r = (Automation.Recording)Automation.Properties[Path.GetFileNameWithoutExtension(f.File)];
1556 r.Set(f.Value.ToString());
1557 }
1558
1559 }
1560 if (f.FuncType == Function.FunctionType.Recording)
1561 {
1562 Automation.Recording r = (Automation.Recording)Automation.Recordings[Path.GetFileNameWithoutExtension(f.File)];
1563 r.Run();
1564 }
1565 return null;
1566 }

◆ StoreCoordinate()

void BioImager.Imager.StoreCoordinate ( )

Definition at line 267 of file Imager.cs.

268 {
269 Point3D p3 = Microscope.GetPosition();
270 storedCoordsBox.Items.Add(p3);
271 storedCoordsBox.SelectedIndex = storedCoordsBox.Items.Count - 1;
272 }

◆ UpdateStatus()

void BioImager.Imager.UpdateStatus ( )

"If the number of images in the list is greater than the number of items in the listbox, add the difference to the listbox."

This is a very simple function, but it's a good example of how to add items to a listbox

Returns
The return type is void, so nothing is being returned.

Definition at line 247 of file Imager.cs.

248 {
249 //GetLiveStatus();
250 if (AppP.HasExited)
251 return;
252 Point3D p = Microscope.GetPosition();
253 double f = Microscope.GetFocus();
254 Point3D point = new Point3D(p.X, p.Y, f);
255 statusLabel.Text = "Stage: " + p.X + " , " + p.Y + " Focus: " + f;
256 if (StoredImages.Count > storedImageBox.Items.Count)
257 {
258 int dif = StoredImages.Count - storedImageBox.Items.Count;
259 for (int i = 0; i < dif; i++)
260 {
261 int index = (StoredImages.Count - 1) + dif;
262 storedImageBox.Items.Add(StoredImages[index - 1]);
263 }
264 }
265 }

Member Data Documentation

◆ apph

IntPtr BioImager.Imager.apph
static

Definition at line 27 of file Imager.cs.

◆ AppPath

string BioImager.Imager.AppPath = ""
static

Definition at line 29 of file Imager.cs.

◆ connected

bool BioImager.Imager.connected = false

Definition at line 34 of file Imager.cs.

◆ controller

Controller BioImager.Imager.controller

Definition at line 31 of file Imager.cs.

◆ CurrentProfile

Profile BioImager.Imager.CurrentProfile = new Profile("Default")

Definition at line 88 of file Imager.cs.

◆ deadzone

int BioImager.Imager.deadzone = 5

Definition at line 36 of file Imager.cs.

◆ gamepad

Gamepad BioImager.Imager.gamepad

Definition at line 32 of file Imager.cs.

◆ input

InputSimulator BioImager.Imager.input = new InputSimulator()
static

Definition at line 1336 of file Imager.cs.

◆ leftTrigger

float BioImager.Imager.leftTrigger

Definition at line 35 of file Imager.cs.

◆ liveStatus

? bool BioImager.Imager.liveStatus = null
static

Definition at line 274 of file Imager.cs.

◆ m_ID

string BioImager.Imager.m_ID

Definition at line 38 of file Imager.cs.

◆ previousGamepadState

Gamepad BioImager.Imager.previousGamepadState

Definition at line 32 of file Imager.cs.

◆ prevState

bool BioImager.Imager.prevState = false

Definition at line 33 of file Imager.cs.

◆ rightTrigger

float BioImager.Imager.rightTrigger

Definition at line 35 of file Imager.cs.

◆ StoredImages

List<BioImage> BioImager.Imager.StoredImages = new List<BioImage>()
static

Definition at line 30 of file Imager.cs.

Property Documentation

◆ ID

string BioImager.Imager.ID
get

Definition at line 39 of file Imager.cs.

◆ ImagesPerSlice

uint BioImager.Imager.ImagesPerSlice
getset

Definition at line 52 of file Imager.cs.

53 {
54 get
55 {
56 return (uint)imagesPerSliceBox.Value;
57 }
58 set
59 {
60 imagesPerSliceBox.Value = (decimal)value;
61 }
62 }

◆ SliceIncrement

uint BioImager.Imager.SliceIncrement
getset

Definition at line 64 of file Imager.cs.

65 {
66 get
67 {
68 return (uint)sliceIncrementBox.Value;
69 }
70 set
71 {
72 sliceIncrementBox.Value = (decimal)value;
73 }
74 }

◆ SlicesPerSlide

uint BioImager.Imager.SlicesPerSlide
getset

Definition at line 76 of file Imager.cs.

77 {
78 get
79 {
80 return (uint)slicesPerSlideBox.Value;
81 }
82 set
83 {
84 slicesPerSlideBox.Value = (decimal)value;
85 }
86 }

◆ ZenP

Process BioImager.Imager.ZenP
staticgetset

Definition at line 40 of file Imager.cs.

41 {
42 get
43 {
44 return AppP;
45 }
46 set
47 {
48 AppP = value;
49 }
50 }

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