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

Public Member Functions

ImageView GetViewer (int i)
 
ImageViewGetViewer (string name)
 
int GetViewerCount ()
 
void RemoveViewer (ImageView v)
 
void AddViewer (ImageView v)
 
 TabsView (BioImage arg)
 
 TabsView (string[] arg)
 
void AddTab (BioImage b)
 
void RemoveTab (BioImage b)
 
bool HasTab (string name)
 
bool HasTab (BioImage image)
 
void ResizeView ()
 
void OpenInNewProcess (string file)
 
void UpdateViewMode (ImageView.ViewMode v)
 
void SetTab (int i)
 Sets the current tab index.
 
void RenameTab (string name, string newName)
 

Static Public Member Functions

static void SelectWindow (string name)
 
static void CloseWindow (string name)
 
static void Rename (string text)
 

Public Attributes

Filter filters = null
 
ImageView viewer
 

Static Public Attributes

static bool init = false
 
static System.Drawing.Graphics graphics = null
 

Protected Member Functions

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

Properties

ImageView Viewer [get]
 
static BioImage SelectedImage [get]
 
static ImageView SelectedViewer [get]
 
BioImage Image [get]
 
int TabCount [get]
 

Detailed Description

Definition at line 4 of file TabsView.designer.cs.

Constructor & Destructor Documentation

◆ TabsView() [1/3]

BioImager.TabsView.TabsView ( BioImage arg)

Definition at line 83 of file TabsView.cs.

84 {
85 InitializeComponent();
86 LoadProperties();
87 ResizeView();
88 Init();
89 }

◆ TabsView() [2/3]

BioImager.TabsView.TabsView ( )

Definition at line 90 of file TabsView.cs.

91 {
92 InitializeComponent();
93 LoadProperties();
94 ResizeView();
95 Init();
96 }

◆ TabsView() [3/3]

BioImager.TabsView.TabsView ( string[] arg)

Definition at line 99 of file TabsView.cs.

100 {
101 InitializeComponent();
102 LoadProperties();
103 Init();
104 KeyPreview = true;
105 if (arg.Length == 0)
106 return;
107 else
108 {
109 for (int i = 0; i < arg.Length; i++)
110 {
111 if (arg[i].EndsWith(".cs"))
112 {
113 App.runner.RunScriptFile(arg[0]);
114 return;
115 }
116 if (arg[i].EndsWith(".ijm"))
117 {
118 ImageJ.RunMacro(arg[i], "");
119 return;
120 }
121 else
122 {
123 BioImage.OpenFile(arg[i], true);
124 }
125 }
126 }
127 }

Member Function Documentation

◆ AddTab()

void BioImager.TabsView.AddTab ( BioImage b)

It creates a new tab, adds an image to it, and then resizes the window to fit the image

Parameters
BioImageThis is a class that contains the image data, and some other information about the image.
Returns
The method is returning a void.

Definition at line 134 of file TabsView.cs.

135 {
136 if (b == null)
137 return;
138 if (HasTab(b))
139 return;
140 if (tabControl.IsHandleCreated)
141 tabControl.Invoke((MethodInvoker)delegate
142 {
143 if (HasTab(b))
144 return;
145 AddTabCore(b);
146 AddAssociatedImageTabs(b);
147 });
148 }

◆ AddViewer()

void BioImager.TabsView.AddViewer ( ImageView v)

Definition at line 65 of file TabsView.cs.

66 {
67 viewers.Add(v);
68 }

◆ CloseWindow()

static void BioImager.TabsView.CloseWindow ( string name)
static

Definition at line 1720 of file TabsView.cs.

1721 {
1722 BioLib.Recorder.Record("App.CloseWindow(\"" + name + "\")");
1723 TabsView tbs = App.tabsView;
1724 int c = tbs.GetViewerCount();
1725 if (name == "ROI Manager")
1726 App.manager.Close();
1727 else
1728 if (name == "Stack Tool")
1729 App.stackTools.Close();
1730 else
1731 if (name == "Channels Tool")
1732 App.channelsTool.Close();
1733 else
1734 if (name == "Scripting")
1735 App.runner.Close();
1736 else
1737 if (name == "Recorder")
1738 App.recorder.Close();
1739 else
1740 if (name == "Tools")
1741 App.tools.Close();
1742 else
1743 for (int v = 0; v < c; v++)
1744 {
1745 int cc = tbs.GetViewer(v).Images.Count;
1746 for (int im = 0; im < cc; im++)
1747 {
1748 ImageView vi = tbs.GetViewer(v);
1749 if (vi.Images[im].Filename == Path.GetFileName(name))
1750 {
1751 tbs.RemoveTab(vi.Images[im]);
1752 return;
1753 }
1754 else if (vi.Name == name)
1755 {
1756 tbs.RemoveTab(vi.Images[im]);
1757 return;
1758 }
1759 }
1760 }
1761
1762 }

◆ Dispose()

override void BioImager.TabsView.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 TabsView.designer.cs.

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

◆ GetViewer() [1/2]

ImageView BioImager.TabsView.GetViewer ( int i)

Definition at line 41 of file TabsView.cs.

42 {
43 return viewers[i];
44 }

◆ GetViewer() [2/2]

ImageView? BioImager.TabsView.GetViewer ( string name)

Definition at line 45 of file TabsView.cs.

46 {
47 for (int v = 0; v < viewers.Count; v++)
48 {
49 for (int i = 0; i < viewers.Count; i++)
50 {
51 if (viewers[v].Images[i].Filename == name)
52 return viewers[v];
53 }
54 }
55 return null;
56 }

◆ GetViewerCount()

int BioImager.TabsView.GetViewerCount ( )

Definition at line 57 of file TabsView.cs.

58 {
59 return viewers.Count;
60 }

◆ HasTab() [1/2]

bool BioImager.TabsView.HasTab ( BioImage image)

Definition at line 173 of file TabsView.cs.

174 {
175 if (image == null)
176 return false;
177 foreach (TabPage tabPage in tabControl.TabPages)
178 {
179 if (tabPage.Controls.Count == 0 || tabPage.Controls[0] is not ImageView view)
180 continue;
181 foreach (BioImage tabImage in view.Images)
182 {
183 if (tabImage == null)
184 continue;
185 if (ReferenceEquals(tabImage, image))
186 return true;
187 if (!string.IsNullOrEmpty(tabImage.ID) && !string.IsNullOrEmpty(image.ID) && tabImage.ID == image.ID)
188 return true;
189 if (!string.IsNullOrEmpty(tabImage.Filename) && !string.IsNullOrEmpty(image.Filename) && tabImage.Filename == image.Filename)
190 return true;
191 }
192 }
193 return false;
194 }

◆ HasTab() [2/2]

bool BioImager.TabsView.HasTab ( string name)

Definition at line 162 of file TabsView.cs.

163 {
164 foreach (TabPage item in tabControl.TabPages)
165 {
166 if (item.Text == name)
167 {
168 return true;
169 }
170 }
171 return false;
172 }

◆ OpenInNewProcess()

void BioImager.TabsView.OpenInNewProcess ( string file)

It creates a new process, sets the file name to the current executable, and sets the arguments to the file name

Parameters
fileThe file to open

Definition at line 399 of file TabsView.cs.

400 {
401 Process p = new Process();
402 p.StartInfo.FileName = Application.ExecutablePath;
403 p.StartInfo.Arguments = file;
404 p.Start();
405 }

◆ RemoveTab()

void BioImager.TabsView.RemoveTab ( BioImage b)

Definition at line 149 of file TabsView.cs.

150 {
151 int i = 0;
152 foreach (ImageView t in tabControl.TabPages)
153 {
154 if (t.Name == b.filename)
155 {
156 Images.RemoveImage(b);
157 return;
158 }
159 i++;
160 }
161 }

◆ RemoveViewer()

void BioImager.TabsView.RemoveViewer ( ImageView v)

Definition at line 61 of file TabsView.cs.

62 {
63 viewers.Remove(v);
64 }

◆ Rename()

static void BioImager.TabsView.Rename ( string text)
static

Definition at line 1779 of file TabsView.cs.

1780 {
1781 App.tabsView.RenameTab(ImageView.SelectedImage.Filename, text);
1782 ImageView.SelectedImage.Rename(text);
1783 ImageView v = App.tabsView.GetViewer(ImageView.SelectedImage.Filename);
1784 v.Name = ImageView.SelectedImage.Filename;
1785 BioLib.Recorder.AddLine("App.Rename(\"" + text + "\");", false);
1786 }

◆ RenameTab()

void BioImager.TabsView.RenameTab ( string name,
string newName )

Definition at line 1763 of file TabsView.cs.

1764 {
1765 foreach (ImageView item in tabControl.TabPages)
1766 {
1767 if (item.Name == name)
1768 {
1769 item.Name = newName;
1770 foreach (var b in item.Images)
1771 {
1772 b.Filename = newName;
1773 b.ID = newName;
1774 return;
1775 }
1776 }
1777 }
1778 }

◆ ResizeView()

void BioImager.TabsView.ResizeView ( )

If the image is pyramidal, add 42 to the width and 206 to the height. Otherwise, add 20 to the width and 180 to the height

Returns
The size of the image.

Definition at line 352 of file TabsView.cs.

353 {
354 if (Image == null)
355 return;
356 System.Drawing.Size s;
357 if (SelectedImage.isPyramidal)
358 s = new System.Drawing.Size(ImageView.SelectedImage.Resolutions[Viewer.Level].SizeX + 42, ImageView.SelectedImage.Resolutions[Viewer.Level].SizeY + 206);
359 else
360 s = new System.Drawing.Size(ImageView.SelectedImage.SizeX + 20, ImageView.SelectedImage.SizeY + 180);
361 if (s.Width > Screen.PrimaryScreen.Bounds.Width || s.Height > Screen.PrimaryScreen.Bounds.Height)
362 {
363 this.WindowState = FormWindowState.Maximized;
364 Viewer.GoToImage();
365 }
366 else
367 {
368 Size = s;
369 Viewer.GoToImage();
370 }
371 }
int Level
Current level when viewing whole-slide and pyramidal images.

◆ SelectWindow()

static void BioImager.TabsView.SelectWindow ( string name)
static

Definition at line 1698 of file TabsView.cs.

1699 {
1700 TabsView tbs = App.tabsView;
1701
1702 int c = tbs.GetViewerCount();
1703 for (int v = 0; v < c; v++)
1704 {
1705 int cc = tbs.GetViewer(v).Images.Count;
1706 for (int im = 0; im < cc; im++)
1707 {
1708 if (tbs.GetViewer(v).Images[im].Filename == Path.GetFileName(name))
1709 {
1710 tbs.SetTab(v);
1711 BioLib.Recorder.Record("App.SelectWindow(\"" + name + "\")");
1712 ImageView.SelectedImage = tbs.GetViewer(v).Images[im];
1713 App.viewer = tbs.GetViewer(v);
1714 App.viewer.BringToFront();
1715 return;
1716 }
1717 }
1718 }
1719 }

◆ SetTab()

void BioImager.TabsView.SetTab ( int i)

Sets the current tab index.

Parameters
i

Definition at line 1689 of file TabsView.cs.

1690 {
1691 tabControl.SelectTab(i);
1692 }

◆ UpdateViewMode()

void BioImager.TabsView.UpdateViewMode ( ImageView.ViewMode v)

It updates the view mode of the image.

Parameters
vThe view mode that the user has selected.

Definition at line 715 of file TabsView.cs.

716 {
717 if (v == ImageView.ViewMode.RGBImage)
718 rGBToolStripMenuItem.Checked = true;
719 if (v == ImageView.ViewMode.Filtered)
720 filteredToolStripMenuItem.Checked = true;
721 if (v == ImageView.ViewMode.Raw)
722 rawToolStripMenuItem.Checked = true;
723 }

Member Data Documentation

◆ filters

Filter BioImager.TabsView.filters = null

Definition at line 23 of file TabsView.cs.

◆ graphics

System.Drawing.Graphics BioImager.TabsView.graphics = null
static

Definition at line 25 of file TabsView.cs.

◆ init

bool BioImager.TabsView.init = false
static

Definition at line 22 of file TabsView.cs.

◆ viewer

ImageView BioImager.TabsView.viewer

Definition at line 24 of file TabsView.cs.

Property Documentation

◆ Image

BioImage BioImager.TabsView.Image
get

Definition at line 374 of file TabsView.cs.

375 {
376 get
377 {
378 if (Viewer == null)
379 return null;
380 if (ImageView.SelectedImage == null)
381 return null;
382 return ImageView.SelectedImage;
383 }
384 }

◆ SelectedImage

BioImage BioImager.TabsView.SelectedImage
staticget

Definition at line 69 of file TabsView.cs.

70 {
71 get
72 {
73 return App.tabsView.Image;
74 }
75 }

◆ SelectedViewer

ImageView BioImager.TabsView.SelectedViewer
staticget

Definition at line 76 of file TabsView.cs.

77 {
78 get
79 {
80 return App.tabsView.Viewer;
81 }
82 }

◆ TabCount

int BioImager.TabsView.TabCount
get

Definition at line 387 of file TabsView.cs.

388 {
389 get
390 {
391 return tabControl.TabPages.Count;
392 }
393 }

◆ Viewer

ImageView BioImager.TabsView.Viewer
get

Definition at line 27 of file TabsView.cs.

28 {
29 get
30 {
31 if (tabControl.TabPages.Count == 0)
32 return null;
33 if (tabControl.SelectedIndex == -1)
34 return null;
35 if (tabControl.SelectedTab.Controls.Count == 0)
36 return null;
37 return (ImageView)tabControl.SelectedTab.Controls[0];
38 }
39 }

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