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 412 of file App.cs.

413 {
415 }
static ToolStripItem GetContextMenuItemFromPath(string s, Function f)
Definition App.cs:226

◆ 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 394 of file App.cs.

395 {
397 }

◆ 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 404 of file App.cs.

405 {
407 }
static ToolStripItem GetMenuItemFromPath(string s, Function f)
Definition App.cs:172

◆ 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 386 of file App.cs.

387 {
388 GetMenuItemFromPath(menu, f);
389 }

◆ 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 463 of file App.cs.

464 {
465 Annotations.Add(BioImage.StringToROI(an));
466 Recorder.AddLine("App.AddROI(" + '"' + an + "'" + ");");
467 }

◆ 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 155 of file App.cs.

156 {
157 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
158 foreach (ToolStripMenuItem toolItem in viewer.ViewContextMenu.Items)
159 {
160 allItems.Add(toolItem);
161 allItems.AddRange(GetItems(toolItem));
162 }
163 return allItems;
164 }
ContextMenuStrip ViewContextMenu
A property that returns a ContextMenuStrip object. *‍/.
Definition ImageView.cs:831

◆ 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 334 of file App.cs.

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

◆ 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 226 of file App.cs.

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

◆ 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 281 of file App.cs.

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

◆ 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 172 of file App.cs.

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

◆ 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 142 of file App.cs.

143 {
144 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
145 foreach (ToolStripMenuItem toolItem in tabsView.MainMenuStrip.Items)
146 {
147 allItems.Add(toolItem);
148 allItems.AddRange(GetItems(toolItem));
149 }
150 return allItems;
151 }

◆ Hide()

static void BioImager.App.Hide ( )
static

Hide() hides all the tools.

Definition at line 109 of file App.cs.

110 {
111 tools.Hide();
112 stackTools.Hide();
113 manager.Hide();
114 runner.Hide();
115 recorder.Hide();
116 seriesTool.Hide();
117 recordings.Hide();
118 console.Hide();
119 }

◆ Initialize()

static void BioImager.App.Initialize ( )
static

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

Definition at line 73 of file App.cs.

74 {
75 BioImage.Initialize(ImageJ.ImageJPath);
76 Thread th = new Thread(UpdateImages);
77 th.Start();
78 do
79 {
80 Thread.Sleep(100);
81 } while (!BioImage.Initialized);
82 imager = new Imager();
83 Microscope.Initialize();
85 setup = new MicroscopeSetup();
86 stage = new StageTool();
87 cellImager = new CellImager();
88 stackTools = new StackTools();
89 tools = new Tools();
90 manager = new ROIManager();
91 runner = new Scripting();
92 recorder = new Recorder();
93 seriesTool = new Series();
94 recordings = new Recordings();
95 automation = new Automation();
96 slideImager = new SlideImager();
97 if (!Properties.Settings.Default.PycroManager && !Properties.Settings.Default.PMicroscope)
98 {
99 lightTool = new Light();
100 }
101 lib = new Library();
102
103 console = new BioConsole();
104 imager.Show();
105
106 //ImageJ.Initialize(Properties.Settings.Default.ImageJPath);
107 }
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 foreach (var item in Images.images)
43 {
44 if(App.tabsView!=null)
45 if (App.tabsView.HasTab(item.Filename))
46 continue;
47 else
48 App.tabsView.AddTab(item);
49 }
50 } while (true);
51 }
void AddTab(BioImage b)
Definition TabsView.cs:129

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 68 of file App.cs.

69 {
70 get { return Image.Annotations; }
71 }

◆ Channels

List<Channel> BioImager.App.Channels
staticget

Definition at line 63 of file App.cs.

64 {
65 get { return Image.Channels; }
66 }

◆ Image

BioImage BioImager.App.Image
staticget

Definition at line 54 of file App.cs.

55 {
56 get
57 {
58 if (ImageView.SelectedImage == null)
59 return tabsView.Image;
60 return ImageView.SelectedImage;
61 }
62 }
ImageView control for image stacks, pyramidal and whole-slide-images.

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