BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
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< BioImageStoredImages = 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. More...
 

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 23 of file Imager.cs.

Constructor & Destructor Documentation

◆ Imager()

BioImager.Imager.Imager ( )

Definition at line 138 of file Imager.cs.

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

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 997 of file Imager.cs.

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

References BioImager.Imager.PerformFunction().

◆ 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 477 of file Imager.cs.

478 {
479 int count = 0;
480 for (int i = 0; i < str.Length; i++)
481 {
482 if ((str[i] >= '0') && (str[i] <= '9'))
483 {
484 count++;
485 }
486 }
487 return count;
488 }

◆ 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 1338 of file Imager.cs.

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

References BioImager.ImageJ.RunMacro(), and BioImager.Scripting.RunScript().

Referenced by BioImager.Imager.CheckGamepadButtons(), BioImager.Function.PerformFunction(), and BioImager.Objectives.SetPosition().

◆ StoreCoordinate()

void BioImager.Imager.StoreCoordinate ( )

Definition at line 263 of file Imager.cs.

264 {
265 Point3D p3 = Microscope.GetPosition();
266 storedCoordsBox.Items.Add(p3);
267 storedCoordsBox.SelectedIndex = storedCoordsBox.Items.Count - 1;
268 }

◆ 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 243 of file Imager.cs.

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

Member Data Documentation

◆ apph

IntPtr BioImager.Imager.apph
static

Definition at line 26 of file Imager.cs.

◆ AppPath

string BioImager.Imager.AppPath = ""
static

Definition at line 28 of file Imager.cs.

◆ connected

bool BioImager.Imager.connected = false

Definition at line 33 of file Imager.cs.

◆ controller

Controller BioImager.Imager.controller

Definition at line 30 of file Imager.cs.

◆ CurrentProfile

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

Definition at line 84 of file Imager.cs.

◆ deadzone

int BioImager.Imager.deadzone = 5

Definition at line 35 of file Imager.cs.

◆ gamepad

Gamepad BioImager.Imager.gamepad

Definition at line 31 of file Imager.cs.

◆ input

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

Definition at line 1331 of file Imager.cs.

◆ leftTrigger

float BioImager.Imager.leftTrigger

Definition at line 34 of file Imager.cs.

◆ liveStatus

? bool BioImager.Imager.liveStatus = null
static

Definition at line 270 of file Imager.cs.

◆ m_ID

string BioImager.Imager.m_ID

Definition at line 37 of file Imager.cs.

◆ previousGamepadState

Gamepad BioImager.Imager.previousGamepadState

Definition at line 31 of file Imager.cs.

◆ prevState

bool BioImager.Imager.prevState = false

Definition at line 32 of file Imager.cs.

◆ rightTrigger

float BioImager.Imager.rightTrigger

Definition at line 34 of file Imager.cs.

◆ StoredImages

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

Definition at line 29 of file Imager.cs.

Property Documentation

◆ ID

string BioImager.Imager.ID
get

Definition at line 38 of file Imager.cs.

◆ ImagesPerSlice

uint BioImager.Imager.ImagesPerSlice
getset

Definition at line 50 of file Imager.cs.

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

◆ SliceIncrement

uint BioImager.Imager.SliceIncrement
getset

Definition at line 61 of file Imager.cs.

62 {
63 get
64 {
65 return (uint)sliceIncrementBox.Value;
66 }
67 set
68 {
69 sliceIncrementBox.Value = (decimal)value;
70 }
71 }

◆ SlicesPerSlide

uint BioImager.Imager.SlicesPerSlide
getset

Definition at line 72 of file Imager.cs.

73 {
74 get
75 {
76 return (uint)slicesPerSlideBox.Value;
77 }
78 set
79 {
80 slicesPerSlideBox.Value = (decimal)value;
81 }
82 }

◆ ZenP

Process BioImager.Imager.ZenP
staticgetset

Definition at line 39 of file Imager.cs.

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

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