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)
 
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 78 of file TabsView.cs.

79 {
80 InitializeComponent();
81 LoadProperties();
82 ResizeView();
83 Init();
84 }

◆ TabsView() [2/3]

BioImager.TabsView.TabsView ( )

Definition at line 85 of file TabsView.cs.

86 {
87 InitializeComponent();
88 LoadProperties();
89 ResizeView();
90 Init();
91 }

◆ TabsView() [3/3]

BioImager.TabsView.TabsView ( string[] arg)

Definition at line 94 of file TabsView.cs.

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

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 129 of file TabsView.cs.

130 {
131 if (b == null)
132 return;
133 if (b.filename.Contains("/") || b.filename.Contains("\\"))
134 b.filename = Path.GetFileName(b.filename);
135 if (tabControl.IsHandleCreated)
136 tabControl.Invoke((MethodInvoker)delegate
137 {
138 TabPage t = new TabPage(b.filename);
139 ImageView v = new ImageView(b);
140 v.ShowStage = false;
141 v.Dock = DockStyle.Fill;
142 t.Controls.Add(v);
143 tabControl.TabPages.Add(t);
144 tabControl.SelectedIndex = tabControl.TabCount - 1;
145 ResizeView();
146 });
147 }

◆ AddViewer()

void BioImager.TabsView.AddViewer ( ImageView v)

Definition at line 60 of file TabsView.cs.

61 {
62 viewers.Add(v);
63 }

◆ CloseWindow()

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

Definition at line 1613 of file TabsView.cs.

1614 {
1615 BioLib.Recorder.Record("App.CloseWindow(\"" + name + "\")");
1616 TabsView tbs = App.tabsView;
1617 int c = tbs.GetViewerCount();
1618 if (name == "ROI Manager")
1619 App.manager.Close();
1620 else
1621 if (name == "Stack Tool")
1622 App.stackTools.Close();
1623 else
1624 if (name == "Channels Tool")
1625 App.channelsTool.Close();
1626 else
1627 if (name == "Scripting")
1628 App.runner.Close();
1629 else
1630 if (name == "Recorder")
1631 App.recorder.Close();
1632 else
1633 if (name == "Tools")
1634 App.tools.Close();
1635 else
1636 for (int v = 0; v < c; v++)
1637 {
1638 int cc = tbs.GetViewer(v).Images.Count;
1639 for (int im = 0; im < cc; im++)
1640 {
1641 ImageView vi = tbs.GetViewer(v);
1642 if (vi.Images[im].Filename == Path.GetFileName(name))
1643 {
1644 tbs.RemoveTab(vi.Images[im]);
1645 return;
1646 }
1647 else if (vi.Name == name)
1648 {
1649 tbs.RemoveTab(vi.Images[im]);
1650 return;
1651 }
1652 }
1653 }
1654
1655 }

◆ 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 36 of file TabsView.cs.

37 {
38 return viewers[i];
39 }

◆ GetViewer() [2/2]

ImageView? BioImager.TabsView.GetViewer ( string name)

Definition at line 40 of file TabsView.cs.

41 {
42 for (int v = 0; v < viewers.Count; v++)
43 {
44 for (int i = 0; i < viewers.Count; i++)
45 {
46 if (viewers[v].Images[i].Filename == name)
47 return viewers[v];
48 }
49 }
50 return null;
51 }

◆ GetViewerCount()

int BioImager.TabsView.GetViewerCount ( )

Definition at line 52 of file TabsView.cs.

53 {
54 return viewers.Count;
55 }

◆ HasTab()

bool BioImager.TabsView.HasTab ( string name)

Definition at line 161 of file TabsView.cs.

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

◆ 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 294 of file TabsView.cs.

295 {
296 Process p = new Process();
297 p.StartInfo.FileName = Application.ExecutablePath;
298 p.StartInfo.Arguments = file;
299 p.Start();
300 }

◆ RemoveTab()

void BioImager.TabsView.RemoveTab ( BioImage b)

Definition at line 148 of file TabsView.cs.

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

◆ RemoveViewer()

void BioImager.TabsView.RemoveViewer ( ImageView v)

Definition at line 56 of file TabsView.cs.

57 {
58 viewers.Remove(v);
59 }

◆ Rename()

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

Definition at line 1672 of file TabsView.cs.

1673 {
1674 App.tabsView.RenameTab(ImageView.SelectedImage.Filename, text);
1675 ImageView.SelectedImage.Rename(text);
1676 ImageView v = App.tabsView.GetViewer(ImageView.SelectedImage.Filename);
1677 v.Name = ImageView.SelectedImage.Filename;
1678 BioLib.Recorder.AddLine("App.Rename(\"" + text + "\");", false);
1679 }

◆ RenameTab()

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

Definition at line 1656 of file TabsView.cs.

1657 {
1658 foreach (ImageView item in tabControl.TabPages)
1659 {
1660 if (item.Name == name)
1661 {
1662 item.Name = newName;
1663 foreach (var b in item.Images)
1664 {
1665 b.Filename = newName;
1666 b.ID = newName;
1667 return;
1668 }
1669 }
1670 }
1671 }

◆ 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 247 of file TabsView.cs.

248 {
249 if (Image == null)
250 return;
251 System.Drawing.Size s;
252 if (SelectedImage.isPyramidal)
253 s = new System.Drawing.Size(ImageView.SelectedImage.Resolutions[Viewer.Level].SizeX + 42, ImageView.SelectedImage.Resolutions[Viewer.Level].SizeY + 206);
254 else
255 s = new System.Drawing.Size(ImageView.SelectedImage.SizeX + 20, ImageView.SelectedImage.SizeY + 180);
256 if (s.Width > Screen.PrimaryScreen.Bounds.Width || s.Height > Screen.PrimaryScreen.Bounds.Height)
257 {
258 this.WindowState = FormWindowState.Maximized;
259 Viewer.GoToImage();
260 }
261 else
262 {
263 Size = s;
264 Viewer.GoToImage();
265 }
266 }
int Level
Current level when viewing whole-slide and pyramidal images.
Definition ImageView.cs:796

◆ SelectWindow()

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

Definition at line 1591 of file TabsView.cs.

1592 {
1593 TabsView tbs = App.tabsView;
1594
1595 int c = tbs.GetViewerCount();
1596 for (int v = 0; v < c; v++)
1597 {
1598 int cc = tbs.GetViewer(v).Images.Count;
1599 for (int im = 0; im < cc; im++)
1600 {
1601 if (tbs.GetViewer(v).Images[im].Filename == Path.GetFileName(name))
1602 {
1603 tbs.SetTab(v);
1604 BioLib.Recorder.Record("App.SelectWindow(\"" + name + "\")");
1605 ImageView.SelectedImage = tbs.GetViewer(v).Images[im];
1606 App.viewer = tbs.GetViewer(v);
1607 App.viewer.BringToFront();
1608 return;
1609 }
1610 }
1611 }
1612 }

◆ SetTab()

void BioImager.TabsView.SetTab ( int i)

Sets the current tab index.

Parameters
i

Definition at line 1582 of file TabsView.cs.

1583 {
1584 tabControl.SelectTab(i);
1585 }

◆ 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 609 of file TabsView.cs.

610 {
611 if (v == ImageView.ViewMode.RGBImage)
612 rGBToolStripMenuItem.Checked = true;
613 if (v == ImageView.ViewMode.Filtered)
614 filteredToolStripMenuItem.Checked = true;
615 if (v == ImageView.ViewMode.Raw)
616 rawToolStripMenuItem.Checked = true;
617 }

Member Data Documentation

◆ filters

Filter BioImager.TabsView.filters = null

Definition at line 18 of file TabsView.cs.

◆ graphics

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

Definition at line 20 of file TabsView.cs.

◆ init

bool BioImager.TabsView.init = false
static

Definition at line 17 of file TabsView.cs.

◆ viewer

ImageView BioImager.TabsView.viewer

Definition at line 19 of file TabsView.cs.

Property Documentation

◆ Image

BioImage BioImager.TabsView.Image
get

Definition at line 269 of file TabsView.cs.

270 {
271 get
272 {
273 if (Viewer == null)
274 return null;
275 if (ImageView.SelectedImage == null)
276 return null;
277 return ImageView.SelectedImage;
278 }
279 }

◆ SelectedImage

BioImage BioImager.TabsView.SelectedImage
staticget

Definition at line 64 of file TabsView.cs.

65 {
66 get
67 {
68 return App.tabsView.Image;
69 }
70 }

◆ SelectedViewer

ImageView BioImager.TabsView.SelectedViewer
staticget

Definition at line 71 of file TabsView.cs.

72 {
73 get
74 {
75 return App.tabsView.Viewer;
76 }
77 }

◆ TabCount

int BioImager.TabsView.TabCount
get

Definition at line 282 of file TabsView.cs.

283 {
284 get
285 {
286 return tabControl.TabPages.Count;
287 }
288 }

◆ Viewer

ImageView BioImager.TabsView.Viewer
get

Definition at line 22 of file TabsView.cs.

23 {
24 get
25 {
26 if (tabControl.TabPages.Count == 0)
27 return null;
28 if (tabControl.SelectedIndex == -1)
29 return null;
30 if (tabControl.SelectedTab.Controls.Count == 0)
31 return null;
32 return (ImageView)tabControl.SelectedTab.Controls[0];
33 }
34 }

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