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.App Class Reference

Static Public Member Functions

static void UpdateImages ()
 
static void Initialize ()
 Initialize() is a function that initializes the BioImager UI.
 
static void Hide ()
 Hide() hides all the tools.
 
static List< ToolStripMenuItem > GetMenuItems ()
 
static List< ToolStripMenuItem > GetContextItems ()
 
static ToolStripItem GetMenuItemFromPath (string s, Function f)
 
static ToolStripItem GetContextMenuItemFromPath (string s, Function f)
 
static ToolStripItem GetMenuItemFromPath (string s)
 
static ToolStripItem GetContextMenuItemFromPath (string s)
 
static void AddMenu (string menu, Function f)
 
static void AddContextMenu (string menu, Function f)
 
static void AddMenu (string menu)
 
static void AddContextMenu (string menu)
 
static void AddROI (string an)
 

Static Public Attributes

static ROIManager manager = null
 
static ChannelsTool channelsTool = null
 
static TabsView tabsView = null
 
static NodeView nodeView = null
 
static Scripting runner = null
 
static Recorder recorder = null
 
static Imager imager = null
 
static Tools tools = null
 
static StackTools stackTools = null
 
static ImageView viewer = null
 
static StageTool stage = null
 
static Series seriesTool = null
 
static Recordings recordings = null
 
static Automation automation = null
 
static MicroscopeSetup setup = null
 
static CellImager cellImager = null
 
static SlideImager slideImager = null
 
static BioConsole console = null
 
static Light lightTool = null
 
static Library lib = null
 
static List< string > recent = new List<string>()
 

Properties

static BioImage Image [get]
 
static List< Channel > Channels [get]
 
static List< ROI > Annotations [get]
 

Detailed Description

Definition at line 12 of file App.cs.

Member Function Documentation

◆ AddContextMenu() [1/2]

static void BioImager.App.AddContextMenu ( string menu)
static

It takes a string and a function and adds a context menu item to the context menu

Parameters
menuThe path to the menu item.
FunctionThe function that will be called when the menu item is clicked.

Definition at line 416 of file App.cs.

417 {
419 }
static ToolStripItem GetContextMenuItemFromPath(string s, Function f)
Definition App.cs:230

◆ AddContextMenu() [2/2]

static void BioImager.App.AddContextMenu ( string menu,
Function f )
static

It takes a string and a function and adds a context menu item to the context menu

Parameters
menuThe path to the menu item.
FunctionThe function that will be called when the menu item is clicked.

Definition at line 398 of file App.cs.

399 {
401 }

◆ AddMenu() [1/2]

static void BioImager.App.AddMenu ( string menu)
static

It takes a string and a function and adds the function to the menu item specified by the string

Parameters
menuThe menu path to add the menu item to.
FunctionThe function that will be called when the menu item is clicked.

Definition at line 408 of file App.cs.

409 {
411 }
static ToolStripItem GetMenuItemFromPath(string s, Function f)
Definition App.cs:176

◆ AddMenu() [2/2]

static void BioImager.App.AddMenu ( string menu,
Function f )
static

It takes a string and a function and adds the function to the menu item specified by the string

Parameters
menuThe menu path to add the menu item to.
FunctionThe function that will be called when the menu item is clicked.

Definition at line 390 of file App.cs.

391 {
392 GetMenuItemFromPath(menu, f);
393 }

◆ AddROI()

static void BioImager.App.AddROI ( string an)
static

It takes a string, converts it to a ROI, and adds it to the list of ROIs

Parameters
anthe string representation of the ROI

Definition at line 467 of file App.cs.

468 {
469 Annotations.Add(BioImage.StringToROI(an));
470 Recorder.AddLine("App.AddROI(" + '"' + an + "'" + ");");
471 }

◆ GetContextItems()

static List< ToolStripMenuItem > BioImager.App.GetContextItems ( )
static

It takes the context menu of the viewer and returns a list of all the items in the menu

Returns
A list of ToolStripMenuItems

Definition at line 159 of file App.cs.

160 {
161 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
162 foreach (ToolStripMenuItem toolItem in viewer.ViewContextMenu.Items)
163 {
164 allItems.Add(toolItem);
165 allItems.AddRange(GetItems(toolItem));
166 }
167 return allItems;
168 }
ContextMenuStrip ViewContextMenu
A property that returns a ContextMenuStrip object. *‍/.

◆ GetContextMenuItemFromPath() [1/2]

static ToolStripItem BioImager.App.GetContextMenuItemFromPath ( string s)
static

It takes a string and a function, and adds the function to the context menu at the location specified by the string

Parameters
sThe path to the item.
Function
Returns
A ToolStripItem

Definition at line 338 of file App.cs.

339 {
340 if (s == "" || s == null)
341 return null;
342 string[] sts = s.Split('/');
343 start:
344 List<ToolStripMenuItem> allItems = GetContextItems();
345 //Find path or create it.
346 bool found = false;
347 ToolStripMenuItem item = null;
348
349 for (int t = 0; t < sts.Length; t++)
350 {
351 found = false;
352 for (int i = 0; i < allItems.Count; i++)
353 {
354 if (allItems[i].Text == sts[t])
355 {
356 item = allItems[i];
357 found = true;
358 if (t == sts.Length - 1)
359 return allItems[i];
360 }
361 }
362 if (!found)
363 {
364 if (t == 0)
365 {
366 viewer.ViewContextMenu.Items.Add(sts[t]);
367 goto start;
368 }
369 else if (t > 0 && t < sts.Length)
370 {
371 ToolStripMenuItem itm = new ToolStripMenuItem();
372 itm.Name = Path.GetFileName(s);
373 item.DropDownItems.Add(Path.GetFileName(s), null, ItemClicked);
374 return item;
375 }
376 else
377 {
378 item.DropDownItems.Add(sts[t]);
379 }
380 }
381 }
382 return item;
383 }
static List< ToolStripMenuItem > GetContextItems()
Definition App.cs:159

◆ GetContextMenuItemFromPath() [2/2]

static ToolStripItem BioImager.App.GetContextMenuItemFromPath ( string s,
Function f )
static

It takes a string and a function, and adds the function to the context menu at the location specified by the string

Parameters
sThe path to the item.
Function
Returns
A ToolStripItem

Definition at line 230 of file App.cs.

231 {
232 if (s == "" || s == null)
233 return null;
234 string[] sts = s.Split('/');
235 start:
236 List<ToolStripMenuItem> allItems = GetContextItems();
237 //Find path or create it.
238 bool found = false;
239 ToolStripMenuItem item = null;
240
241 for (int t = 0; t < sts.Length; t++)
242 {
243 found = false;
244 for (int i = 0; i < allItems.Count; i++)
245 {
246 if (allItems[i].Text == sts[t])
247 {
248 item = allItems[i];
249 found = true;
250 if (t == sts.Length - 1)
251 return allItems[i];
252 }
253 }
254 if (!found)
255 {
256 if (t == 0)
257 {
258 viewer.ViewContextMenu.Items.Add(sts[t]);
259 goto start;
260 }
261 else if (t > 0 && t < sts.Length)
262 {
263 ToolStripMenuItem itm = new ToolStripMenuItem();
264 itm.Tag = f;
265 itm.Name = f.Name;
266 item.DropDownItems.Add(f.Name, null, ItemClicked);
267 return item;
268 }
269 else
270 {
271 item.DropDownItems.Add(sts[t]);
272 }
273 }
274 }
275 return item;
276 }

◆ GetMenuItemFromPath() [1/2]

static ToolStripItem BioImager.App.GetMenuItemFromPath ( string s)
static

It takes a string and a function, and adds the function to the menu item specified by the string

Parameters
sThe path to the menu item.
Function
Returns
A ToolStripItem

Definition at line 285 of file App.cs.

286 {
287 if (s == "" || s == null)
288 return null;
289 string[] sts = s.Split('/');
290 start:
291 List<ToolStripMenuItem> allItems = GetMenuItems();
292 //Find path or create it.
293 bool found = false;
294 ToolStripMenuItem item = null;
295
296 for (int t = 0; t < sts.Length; t++)
297 {
298 found = false;
299 for (int i = 0; i < allItems.Count; i++)
300 {
301 if (allItems[i].Text == sts[t])
302 {
303 item = allItems[i];
304 found = true;
305 if (t == sts.Length - 1)
306 return allItems[i];
307 }
308 }
309 if (!found)
310 {
311 if (t == 0)
312 {
313 tabsView.MainMenuStrip.Items.Add(sts[t]);
314 goto start;
315 }
316 else if (t > 0 && t < sts.Length)
317 {
318 ToolStripMenuItem itm = new ToolStripMenuItem();
319 itm.Text = Path.GetFileName(s);
320 item.DropDownItems.Add(Path.GetFileName(s), null, ItemClicked);
321 return item;
322 }
323 else
324 {
325 item.DropDownItems.Add(sts[t]);
326 }
327 }
328 }
329 return item;
330 }
static List< ToolStripMenuItem > GetMenuItems()
Definition App.cs:146

◆ GetMenuItemFromPath() [2/2]

static ToolStripItem BioImager.App.GetMenuItemFromPath ( string s,
Function f )
static

It takes a string and a function, and adds the function to the menu item specified by the string

Parameters
sThe path to the menu item.
Function
Returns
A ToolStripItem

Definition at line 176 of file App.cs.

177 {
178 if (s == "" || s == null)
179 return null;
180 string[] sts = s.Split('/');
181 start:
182 List<ToolStripMenuItem> allItems = GetMenuItems();
183 //Find path or create it.
184 bool found = false;
185 ToolStripMenuItem item = null;
186
187 for (int t = 0; t < sts.Length; t++)
188 {
189 found = false;
190 for (int i = 0; i < allItems.Count; i++)
191 {
192 if (allItems[i].Text == sts[t])
193 {
194 item = allItems[i];
195 found = true;
196 if (t == sts.Length - 1)
197 return allItems[i];
198 }
199 }
200 if (!found)
201 {
202 if(t == 0)
203 {
204 tabsView.MainMenuStrip.Items.Add(sts[t]);
205 goto start;
206 }
207 else if(t > 0 && t < sts.Length)
208 {
209 ToolStripMenuItem itm = new ToolStripMenuItem();
210 itm.Tag = f;
211 itm.Name = f.Name;
212 item.DropDownItems.Add(f.Name, null, ItemClicked);
213 return item;
214 }
215 else
216 {
217 item.DropDownItems.Add(sts[t]);
218 }
219 }
220 }
221 return item;
222 }

◆ GetMenuItems()

static List< ToolStripMenuItem > BioImager.App.GetMenuItems ( )
static

It takes a menu strip and returns a list of all the menu items in the menu strip

Returns
A list of ToolStripMenuItems

Definition at line 146 of file App.cs.

147 {
148 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
149 foreach (ToolStripMenuItem toolItem in tabsView.MainMenuStrip.Items)
150 {
151 allItems.Add(toolItem);
152 allItems.AddRange(GetItems(toolItem));
153 }
154 return allItems;
155 }

◆ Hide()

static void BioImager.App.Hide ( )
static

Hide() hides all the tools.

Definition at line 113 of file App.cs.

114 {
115 tools.Hide();
116 stackTools.Hide();
117 manager.Hide();
118 runner.Hide();
119 recorder.Hide();
120 seriesTool.Hide();
121 recordings.Hide();
122 console.Hide();
123 }

◆ Initialize()

static void BioImager.App.Initialize ( )
static

Initialize() is a function that initializes the BioImager UI.

Definition at line 77 of file App.cs.

78 {
79 BioImage.Initialize(ImageJ.ImageJPath);
80 Thread th = new Thread(UpdateImages);
81 th.Start();
82 do
83 {
84 Thread.Sleep(100);
85 } while (!BioImage.Initialized);
86 imager = new Imager();
87 Microscope.Initialize();
89 setup = new MicroscopeSetup();
90 stage = new StageTool();
91 cellImager = new CellImager();
92 stackTools = new StackTools();
93 tools = new Tools();
94 manager = new ROIManager();
95 runner = new Scripting();
96 recorder = new Recorder();
97 seriesTool = new Series();
98 recordings = new Recordings();
99 automation = new Automation();
100 slideImager = new SlideImager();
101 if (!Properties.Settings.Default.PycroManager && !Properties.Settings.Default.PMicroscope)
102 {
103 lightTool = new Light();
104 }
105 lib = new Library();
106
107 console = new BioConsole();
108 imager.Show();
109
110 //ImageJ.Initialize(Properties.Settings.Default.ImageJPath);
111 }
static bool Initialize()
Definition ImageJ.cs:247

◆ UpdateImages()

static void BioImager.App.UpdateImages ( )
static

Definition at line 37 of file App.cs.

38 {
39 do
40 {
41 Thread.Sleep(1000);
42 var images = Images.images.ToList();
43 var tabs = App.tabsView;
44 if (tabs == null)
45 continue;
46
47 foreach (var item in images)
48 {
49 if (tabs.HasTab(item))
50 continue;
51 else
52 tabs.AddTab(item);
53 }
54 } while (true);
55 }

Member Data Documentation

◆ automation

Automation BioImager.App.automation = null
static

Definition at line 27 of file App.cs.

◆ cellImager

CellImager BioImager.App.cellImager = null
static

Definition at line 29 of file App.cs.

◆ channelsTool

ChannelsTool BioImager.App.channelsTool = null
static

Definition at line 15 of file App.cs.

◆ console

BioConsole BioImager.App.console = null
static

Definition at line 31 of file App.cs.

◆ imager

Imager BioImager.App.imager = null
static

Definition at line 20 of file App.cs.

◆ lib

Library BioImager.App.lib = null
static

Definition at line 33 of file App.cs.

◆ lightTool

Light BioImager.App.lightTool = null
static

Definition at line 32 of file App.cs.

◆ manager

ROIManager BioImager.App.manager = null
static

Definition at line 14 of file App.cs.

◆ nodeView

NodeView BioImager.App.nodeView = null
static

Definition at line 17 of file App.cs.

◆ recent

List<string> BioImager.App.recent = new List<string>()
static

Definition at line 34 of file App.cs.

◆ recorder

Recorder BioImager.App.recorder = null
static

Definition at line 19 of file App.cs.

◆ recordings

Recordings BioImager.App.recordings = null
static

Definition at line 26 of file App.cs.

◆ runner

Scripting BioImager.App.runner = null
static

Definition at line 18 of file App.cs.

◆ seriesTool

Series BioImager.App.seriesTool = null
static

Definition at line 25 of file App.cs.

◆ setup

MicroscopeSetup BioImager.App.setup = null
static

Definition at line 28 of file App.cs.

◆ slideImager

SlideImager BioImager.App.slideImager = null
static

Definition at line 30 of file App.cs.

◆ stackTools

StackTools BioImager.App.stackTools = null
static

Definition at line 22 of file App.cs.

◆ stage

StageTool BioImager.App.stage = null
static

Definition at line 24 of file App.cs.

◆ tabsView

TabsView BioImager.App.tabsView = null
static

Definition at line 16 of file App.cs.

◆ tools

Tools BioImager.App.tools = null
static

Definition at line 21 of file App.cs.

◆ viewer

ImageView BioImager.App.viewer = null
static

Definition at line 23 of file App.cs.

Property Documentation

◆ Annotations

List<ROI> BioImager.App.Annotations
staticget

Definition at line 72 of file App.cs.

73 {
74 get { return Image.Annotations; }
75 }

◆ Channels

List<Channel> BioImager.App.Channels
staticget

Definition at line 67 of file App.cs.

68 {
69 get { return Image.Channels; }
70 }

◆ Image

BioImage BioImager.App.Image
staticget

Definition at line 58 of file App.cs.

59 {
60 get
61 {
62 if (ImageView.SelectedImage == null)
63 return tabsView.Image;
64 return ImageView.SelectedImage;
65 }
66 }
ImageView control for image stacks, pyramidal and whole-slide-images.

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