BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
BioCore.App Class Reference

Static Public Member Functions

static void Initialize (bool requireImageJ=false)
 Initialize() is a function that initializes the BioImage Suite Web viewer.
 
static void Hide ()
 Hide() hides all the tools.
 
static ToolStripItem GetMenuItemFromPath (string s)
 
static ToolStripItem GetContextMenuItemFromPath (string s)
 
static void AddMenu (string menu)
 
static void AddContextMenu (string menu)
 
static void SelectWindow (string name)
 
static void CloseWindow (string name)
 
static void Rename (string text)
 
static List< ToolStripMenuItem > GetMenuItems ()
 Retrieves all the menu items from the main menu strip.
 
static List< ToolStripMenuItem > GetContextItems ()
 
static ToolStripItem GetMenuItemFromPath (string s, Function f)
 
static ToolStripItem GetContextMenuItemFromPath (string s, Function f)
 
static void AddMenu (string menu, Function f)
 
static void AddContextMenu (string menu, Function f)
 
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 Tools tools = null
 
static StackTools stackTools = null
 
static ImageView viewer = null
 
static Series seriesTool = null
 
static BioConsole console = null
 
static Library lib = null
 
static List< string > recent = new List<string>()
 

Properties

static BioImage Image [get]
 Gets the BioImage object for the selected image in the ImageView. If no image is selected, returns the image from the tabsView.
 
static List< Channel > Channels [get]
 
static List< ROI > Annotations [get]
 
static bool Initialized [get]
 
static bool UseFiji [get]
 

Detailed Description

Definition at line 6 of file App.cs.

Member Function Documentation

◆ AddContextMenu() [1/2]

static void BioCore.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 215 of file App.cs.

216 {
218 }
static ToolStripItem GetContextMenuItemFromPath(string s)
Definition App.cs:155

◆ AddContextMenu() [2/2]

static void BioCore.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 472 of file App.cs.

473 {
475 }

◆ AddMenu() [1/2]

static void BioCore.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 207 of file App.cs.

208 {
210 }
static ToolStripItem GetMenuItemFromPath(string s)
Definition App.cs:102

◆ AddMenu() [2/2]

static void BioCore.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 464 of file App.cs.

465 {
466 GetMenuItemFromPath(menu, f);
467 }

◆ AddROI()

static void BioCore.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 502 of file App.cs.

503 {
504 Annotations.Add(BioImage.StringToROI(an));
505 Recorder.AddLine("App.AddROI(" + '"' + an + "'" + ");");
506 }
static List< ROI > Annotations
Definition App.cs:43
static void AddLine(string s)
Definition Recorder.cs:6

◆ CloseWindow()

static void BioCore.App.CloseWindow ( string name)
static

Definition at line 244 of file App.cs.

245 {
246 BioLib.Recorder.Record("App.CloseWindow(\"" + name + "\")");
247 TabsView tbs = App.tabsView;
248 int c = tbs.GetViewerCount();
249 if (name == "ROI Manager")
250 App.manager.Close();
251 else
252 if (name == "Stack Tool")
253 App.stackTools.Close();
254 else
255 if (name == "Channels Tool")
256 App.channelsTool.Close();
257 else
258 if (name == "Recorder")
259 App.recorder.Close();
260 else
261 if (name == "Tools")
262 App.tools.Close();
263 else
264 for (int v = 0; v < c; v++)
265 {
266 int cc = tbs.GetViewer(v).Images.Count;
267 for (int im = 0; im < cc; im++)
268 {
269 ImageView vi = tbs.GetViewer(v);
270 if (vi.Images[im].Filename == Path.GetFileName(name))
271 {
272 tbs.RemoveTab(name);
273 vi.Dispose();
274 return;
275 }
276 else if (vi.Name == name)
277 {
278 tbs.RemoveTab(name);
279 vi.Dispose();
280 return;
281 }
282 }
283 }
284
285 }
static Recorder recorder
Definition App.cs:13
static ChannelsTool channelsTool
Definition App.cs:9
static TabsView tabsView
Definition App.cs:10
static StackTools stackTools
Definition App.cs:15
static ROIManager manager
Definition App.cs:8
static Tools tools
Definition App.cs:14
ImageView control for image stacks, pyramidal and whole-slide-images.
new void Dispose()
List< BioImage > Images
Definition ImageView.cs:359
int GetViewerCount()
Definition TabsView.cs:240
void RemoveTab(string tabName)
Definition TabsView.cs:146
ImageView GetViewer(int i)
Definition TabsView.cs:224

◆ GetContextItems()

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

It takes a list of items, and for each item in the list, it adds that item to the list, and then adds all the items in that item's submenu to the list

Returns
A list of ToolStripMenuItems

Definition at line 341 of file App.cs.

342 {
343 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
344 foreach (ToolStripMenuItem toolItem in viewer.ViewContextMenu.Items)
345 {
346 allItems.Add(toolItem);
347 allItems.AddRange(GetItems(toolItem));
348 }
349 return allItems;
350 }
static ImageView viewer
Definition App.cs:16
ContextMenuStrip ViewContextMenu
A property that returns a ContextMenuStrip object. *‍/.
Definition ImageView.cs:826

◆ GetContextMenuItemFromPath() [1/2]

static ToolStripItem BioCore.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 155 of file App.cs.

156 {
157 if (s == "" || s == null)
158 return null;
159 string[] sts = s.Split('/');
160 start:
161 List<ToolStripMenuItem> allItems = GetContextItems();
162 //Find path or create it.
163 bool found = false;
164 ToolStripMenuItem item = null;
165
166 for (int t = 0; t < sts.Length; t++)
167 {
168 found = false;
169 for (int i = 0; i < allItems.Count; i++)
170 {
171 if (allItems[i].Text == sts[t])
172 {
173 item = allItems[i];
174 found = true;
175 if (t == sts.Length - 1)
176 return allItems[i];
177 }
178 }
179 if (!found)
180 {
181 if (t == 0)
182 {
183 viewer.ViewContextMenu.Items.Add(sts[t]);
184 goto start;
185 }
186 else if (t > 0 && t < sts.Length)
187 {
188 ToolStripMenuItem itm = new ToolStripMenuItem();
189 itm.Name = Path.GetFileName(s);
190 item.DropDownItems.Add(Path.GetFileName(s), null, ItemClicked);
191 return item;
192 }
193 else
194 {
195 item.DropDownItems.Add(sts[t]);
196 }
197 }
198 }
199 return item;
200 }
static List< ToolStripMenuItem > GetContextItems()
Definition App.cs:341

◆ GetContextMenuItemFromPath() [2/2]

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

413 {
414 if (s == "" || s == null)
415 return null;
416 string[] sts = s.Split('/');
417 start:
418 List<ToolStripMenuItem> allItems = GetContextItems();
419 //Find path or create it.
420 bool found = false;
421 ToolStripMenuItem item = null;
422
423 for (int t = 0; t < sts.Length; t++)
424 {
425 found = false;
426 for (int i = 0; i < allItems.Count; i++)
427 {
428 if (allItems[i].Text == sts[t])
429 {
430 item = allItems[i];
431 found = true;
432 if (t == sts.Length - 1)
433 return allItems[i];
434 }
435 }
436 if (!found)
437 {
438 if (t == 0)
439 {
440 viewer.ViewContextMenu.Items.Add(sts[t]);
441 goto start;
442 }
443 else if (t > 0 && t < sts.Length)
444 {
445 ToolStripMenuItem itm = new ToolStripMenuItem();
446 itm.Tag = f;
447 itm.Name = f.Name;
448 item.DropDownItems.Add(f.Name, null, ItemClicked);
449 return item;
450 }
451 else
452 {
453 item.DropDownItems.Add(sts[t]);
454 }
455 }
456 }
457 return item;
458 }

◆ GetMenuItemFromPath() [1/2]

static ToolStripItem BioCore.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 102 of file App.cs.

103 {
104 if (s == "" || s == null)
105 return null;
106 string[] sts = s.Split('/');
107 start:
108 List<ToolStripMenuItem> allItems = GetMenuItems();
109 //Find path or create it.
110 bool found = false;
111 ToolStripMenuItem item = null;
112
113 for (int t = 0; t < sts.Length; t++)
114 {
115 found = false;
116 for (int i = 0; i < allItems.Count; i++)
117 {
118 if (allItems[i].Text == sts[t])
119 {
120 item = allItems[i];
121 found = true;
122 if (t == sts.Length - 1)
123 return allItems[i];
124 }
125 }
126 if (!found)
127 {
128 if (t == 0)
129 {
130 tabsView.MainMenuStrip.Items.Add(sts[t]);
131 goto start;
132 }
133 else if (t > 0 && t < sts.Length)
134 {
135 ToolStripMenuItem itm = new ToolStripMenuItem();
136 itm.Text = Path.GetFileName(s);
137 item.DropDownItems.Add(Path.GetFileName(s), null, ItemClicked);
138 return item;
139 }
140 else
141 {
142 item.DropDownItems.Add(sts[t]);
143 }
144 }
145 }
146 return item;
147 }
static List< ToolStripMenuItem > GetMenuItems()
Retrieves all the menu items from the main menu strip.
Definition App.cs:327

◆ GetMenuItemFromPath() [2/2]

static ToolStripItem BioCore.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 358 of file App.cs.

359 {
360 if (s == "" || s == null)
361 return null;
362 string[] sts = s.Split('/');
363 start:
364 List<ToolStripMenuItem> allItems = GetMenuItems();
365 //Find path or create it.
366 bool found = false;
367 ToolStripMenuItem item = null;
368
369 for (int t = 0; t < sts.Length; t++)
370 {
371 found = false;
372 for (int i = 0; i < allItems.Count; i++)
373 {
374 if (allItems[i].Text == sts[t])
375 {
376 item = allItems[i];
377 found = true;
378 if (t == sts.Length - 1)
379 return allItems[i];
380 }
381 }
382 if (!found)
383 {
384 if (t == 0)
385 {
386 tabsView.MainMenuStrip.Items.Add(sts[t]);
387 goto start;
388 }
389 else if (t > 0 && t < sts.Length)
390 {
391 ToolStripMenuItem itm = new ToolStripMenuItem();
392 itm.Tag = f;
393 itm.Name = f.Name;
394 item.DropDownItems.Add(f.Name, null, ItemClicked);
395 return item;
396 }
397 else
398 {
399 item.DropDownItems.Add(sts[t]);
400 }
401 }
402 }
403 return item;
404 }

◆ GetMenuItems()

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

Retrieves all the menu items from the main menu strip.

Returns
A list of ToolStripMenuItem objects representing the menu items

Definition at line 327 of file App.cs.

328 {
329 List<ToolStripMenuItem> allItems = new List<ToolStripMenuItem>();
330 foreach (ToolStripMenuItem toolItem in tabsView.MainMenuStrip.Items)
331 {
332 allItems.Add(toolItem);
333 allItems.AddRange(GetItems(toolItem));
334 }
335 return allItems;
336 }

◆ Hide()

static void BioCore.App.Hide ( )
static

Hide() hides all the tools.

Definition at line 85 of file App.cs.

86 {
87 tools.Hide();
88 stackTools.Hide();
89 manager.Hide();
90 runner.Hide();
91 recorder.Hide();
92 seriesTool.Hide();
93 console.Hide();
94 }
static Scripting runner
Definition App.cs:12
static BioConsole console
Definition App.cs:18
static Series seriesTool
Definition App.cs:17

◆ Initialize()

static void BioCore.App.Initialize ( bool requireImageJ = false)
static

Initialize() is a function that initializes the BioImage Suite Web viewer.

Definition at line 48 of file App.cs.

49 {
50
52 OpenFileDialog openFileDialog = new OpenFileDialog();
53 string imj = BioLib.Settings.GetSettings("ImageJPath");
54 if (imj!="")
55 {
56 if(openFileDialog.ShowDialog() == DialogResult.OK)
57 {
58 if(openFileDialog.FileName.Contains("Fiji"))
59 Fiji.Initialize(openFileDialog.FileName);
60 else
61 ImageJ.Initialize(openFileDialog.FileName);
62 }
63 }
64 else
65 {
66 if (openFileDialog.FileName.Contains("Fiji"))
67 Fiji.Initialize(imj);
68 else
69 ImageJ.Initialize(imj);
70 }
71 tabsView = new TabsView();
72 BioImage.Initialize(imj);
73 viewer = new ImageView();
74 stackTools = new StackTools();
75 tools = new Tools();
76 manager = new ROIManager();
77 runner = new Scripting();
78 recorder = new Recorder();
79 seriesTool = new Series();
80 lib = new Library();
81 console = new BioConsole();
82 Initialized = true;
83 }
static Library lib
Definition App.cs:19
static bool Initialized
Definition App.cs:46
static void Initialize()

◆ Rename()

static void BioCore.App.Rename ( string text)
static

Definition at line 296 of file App.cs.

297 {
299 ImageView.SelectedImage.Rename(text);
301 //TODO v.SetTitle(ImageView.SelectedImage.Filename);
302 BioLib.Recorder.AddLine("App.Rename(\"" + text + "\");", false);
303 }
static BioImage SelectedImage
Definition ImageView.cs:306
void RenameTab(string tabName, string text)
Definition TabsView.cs:177

◆ SelectWindow()

static void BioCore.App.SelectWindow ( string name)
static

Definition at line 220 of file App.cs.

221 {
222 TabsView tbs = App.tabsView;
223
224 int c = tbs.GetViewerCount();
225 for (int v = 0; v < c; v++)
226 {
227 int cc = tbs.GetViewer(v).Images.Count;
228 for (int im = 0; im < cc; im++)
229 {
230 if (tbs.GetViewer(v).Images[im].Filename == Path.GetFileName(name))
231 {
232 tbs.SetTab(v);
233 BioLib.Recorder.Record("App.SelectWindow(\"" + name + "\")");
234 ImageView.SelectedImage = tbs.GetViewer(v).Images[im];
235 viewer = tbs.GetViewer(v);
236 viewer.BringToFront();
237 viewer.Focus();
238 return;
239 }
240 }
241 }
242 }
void SetTab(string tabName)
Definition TabsView.cs:168

Member Data Documentation

◆ channelsTool

ChannelsTool BioCore.App.channelsTool = null
static

Definition at line 9 of file App.cs.

◆ console

BioConsole BioCore.App.console = null
static

Definition at line 18 of file App.cs.

◆ lib

Library BioCore.App.lib = null
static

Definition at line 19 of file App.cs.

◆ manager

ROIManager BioCore.App.manager = null
static

Definition at line 8 of file App.cs.

◆ nodeView

NodeView BioCore.App.nodeView = null
static

Definition at line 11 of file App.cs.

◆ recent

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

Definition at line 20 of file App.cs.

◆ recorder

Recorder BioCore.App.recorder = null
static

Definition at line 13 of file App.cs.

◆ runner

Scripting BioCore.App.runner = null
static

Definition at line 12 of file App.cs.

◆ seriesTool

Series BioCore.App.seriesTool = null
static

Definition at line 17 of file App.cs.

◆ stackTools

StackTools BioCore.App.stackTools = null
static

Definition at line 15 of file App.cs.

◆ tabsView

TabsView BioCore.App.tabsView = null
static

Definition at line 10 of file App.cs.

◆ tools

Tools BioCore.App.tools = null
static

Definition at line 14 of file App.cs.

◆ viewer

ImageView BioCore.App.viewer = null
static

Definition at line 16 of file App.cs.

Property Documentation

◆ Annotations

List<ROI> BioCore.App.Annotations
staticget

Definition at line 42 of file App.cs.

43 {
44 get { return Image.Annotations; }
45 }
System.Drawing.Image Image
Definition ImageView.cs:15

◆ Channels

List<Channel> BioCore.App.Channels
staticget

Definition at line 37 of file App.cs.

38 {
39 get { return Image.Channels; }
40 }

◆ Image

BioImage BioCore.App.Image
staticget

Gets the BioImage object for the selected image in the ImageView. If no image is selected, returns the image from the tabsView.

The selected BioImage object.

Definition at line 28 of file App.cs.

29 {
30 get
31 {
32 if (ImageView.SelectedImage == null)
33 return tabsView.Image;
35 }
36 }
BioImage Image
Definition TabsView.cs:331

◆ Initialized

bool BioCore.App.Initialized
staticget

Definition at line 46 of file App.cs.

46{ get; private set; }

◆ UseFiji

bool BioCore.App.UseFiji
staticget

Definition at line 286 of file App.cs.

287 {
288 get
289 {
290 if (Fiji.ImageJPath.Contains("Fiji"))
291 return true;
292 else
293 return false;
294 }
295 }

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