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

Public Member Functions

 TabsView (BioImage arg)
 
 TabsView ()
 
 TabsView (string[] arg)
 
void AddTab (BioImage b)
 
void RemoveTab (string tabName)
 
void SetTab (string tabName)
 
void SetTab (int i)
 
void RenameTab (string tabName, string text)
 
ImageView GetViewer (int i)
 
ImageView? GetViewer (string name)
 
int GetViewerCount ()
 
void RemoveViewer (ImageView v)
 
void AddViewer (ImageView v)
 
void ResizeView ()
 
void OpenInNewProcess (string file)
 
void UpdateViewMode (ImageView.ViewMode v)
 

Public Attributes

Filter filters = null
 
List< ImageView > viewers = new List<ImageView>()
 

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, set]
 
ImageView ImageView [get]
 
int TabCount [get]
 

Detailed Description

Definition at line 9 of file TabsView.Zarr.cs.

Constructor & Destructor Documentation

◆ TabsView() [1/3]

BioCore.TabsView.TabsView ( BioImage arg)

Definition at line 44 of file TabsView.cs.

45 {
46 InitializeComponent();
47 LoadProperties();
48 ResizeView();
49 Init();
50 AddTab(arg);
51 }
void AddTab(BioImage b)
Definition TabsView.cs:96
void ResizeView()
Definition TabsView.cs:307

◆ TabsView() [2/3]

BioCore.TabsView.TabsView ( )

Definition at line 53 of file TabsView.cs.

54 {
55 InitializeComponent();
56 LoadProperties();
57 ResizeView();
58 Init();
59 }

◆ TabsView() [3/3]

BioCore.TabsView.TabsView ( string[] arg)

Definition at line 62 of file TabsView.cs.

63 {
64 InitializeComponent();
65 LoadProperties();
66 Init();
67 if (arg.Length == 0)
68 return;
69 else
70 {
71 for (int i = 0; i < arg.Length; i++)
72 {
73 if (arg[i].EndsWith(".cs"))
74 {
75 App.runner.RunScriptFile(arg[0]);
76 return;
77 }
78 if (arg[i].EndsWith(".ijm"))
79 {
80 Fiji.RunMacroFiji(ImageView.SelectedImage, arg[i], "");
81 return;
82 }
83 else
84 {
85 AddTab(BioImage.OpenFile(arg[i]).Result);
86 }
87 }
88 }
89 }
static Scripting runner
Definition App.cs:12
ImageView control for image stacks, pyramidal and whole-slide-images.
static BioImage SelectedImage
Definition ImageView.cs:306
void RunScriptFile(string file)
Definition Scripting.cs:398

Member Function Documentation

◆ AddTab()

void BioCore.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
A TabPage object.

Definition at line 96 of file TabsView.cs.

97 {
98 if (b == null)
99 throw new ArgumentNullException(nameof(b), "The image loader returned no image to display.");
100 if (b.filename.Contains('/') || b.filename.Contains('\\'))
101 b.filename = Path.GetFileName(b.filename);
102 TabPage t = new TabPage(GetAvailableTabTitle(b.filename));
103 ImageView v = new ImageView(b);
104 v.Dock = DockStyle.Fill;
105 t.Controls.Add(v);
106 if (Width < b.SizeX || Height < b.SizeY)
107 {
108 Width = b.SizeX;
109 Height = b.SizeY + 190;
110 }
111 tabControl.TabPages.Add(t);
112 tabControl.Dock = DockStyle.Fill;
113 tabControl.SelectedIndex = tabControl.TabCount - 1;
114 viewers.Add(v);
115 ResizeView();
116 if (!Visible)
117 Show();
118 if (WindowState == FormWindowState.Minimized)
119 WindowState = FormWindowState.Normal;
120 Activate();
121 }
List< ImageView > viewers
Definition TabsView.cs:13
ImageView ImageView
Definition TabsView.cs:348

◆ AddViewer()

void BioCore.TabsView.AddViewer ( ImageView v)

Definition at line 248 of file TabsView.cs.

249 {
250 viewers.Add(v);
251 }

◆ Dispose()

override void BioCore.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 BioCore.TabsView.GetViewer ( int i)

Definition at line 224 of file TabsView.cs.

225 {
226 return viewers[i];
227 }

◆ GetViewer() [2/2]

ImageView? BioCore.TabsView.GetViewer ( string name)

Definition at line 228 of file TabsView.cs.

229 {
230 for (int v = 0; v < viewers.Count; v++)
231 {
232 for (int i = 0; i < viewers.Count; i++)
233 {
234 if (viewers[v].Images[i].Filename == name)
235 return viewers[v];
236 }
237 }
238 return null;
239 }

◆ GetViewerCount()

int BioCore.TabsView.GetViewerCount ( )

Definition at line 240 of file TabsView.cs.

241 {
242 return viewers.Count;
243 }

◆ OpenInNewProcess()

void BioCore.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 368 of file TabsView.cs.

369 {
370 Process p = new Process();
371 p.StartInfo.FileName = Application.ExecutablePath;
372 p.StartInfo.Arguments = file;
373 p.Start();
374 }
System.Windows.Forms.Application Application
Definition ImageView.cs:14

◆ RemoveTab()

void BioCore.TabsView.RemoveTab ( string tabName)

This function removes a tab from the tab control

Parameters
tabNameThe name of the tab to remove.

Definition at line 146 of file TabsView.cs.

147 {
148 for (int i = 0; i < tabControl.TabPages.Count; i++)
149 {
150 var item = tabControl.TabPages[i];
151 string name = System.IO.Path.GetFileName(item.Name);
152 if (name == tabName)
153 {
154 ImageView iv = viewers[i];
155 for (int v = 0; v < iv.Images.Count; v++)
156 {
157 Images.RemoveImage(iv.Images[v]);
158 }
159 tabControl.TabPages.Remove(item);
160 viewers.RemoveAt(i);
162 return;
163 }
164 i++;
165 }
166 }
static NodeView nodeView
Definition App.cs:11
List< BioImage > Images
Definition ImageView.cs:359
void UpdateNodes()
Definition NodeView.cs:122

◆ RemoveViewer()

void BioCore.TabsView.RemoveViewer ( ImageView v)

Definition at line 244 of file TabsView.cs.

245 {
246 viewers.Remove(v);
247 }

◆ RenameTab()

void BioCore.TabsView.RenameTab ( string tabName,
string text )

Definition at line 177 of file TabsView.cs.

178 {
179 for (int i = 0; i < tabControl.TabPages.Count; i++)
180 {
181 TabPage t = tabControl.TabPages[i];
182 if (t.Text == tabName)
183 {
184 t.Text = text;
185 return;
186 }
187 }
188 }

◆ ResizeView()

void BioCore.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 307 of file TabsView.cs.

308 {
309 if (Image == null)
310 return;
311 System.Drawing.Size s;
312 if (SelectedImage.isPyramidal)
313 s = new System.Drawing.Size(ImageView.SelectedImage.Resolutions[ImageView.Level].SizeX + 42, ImageView.SelectedImage.Resolutions[ImageView.Level].SizeY + 206);
314 else
315 s = new System.Drawing.Size(ImageView.SelectedImage.SizeX + 20, ImageView.SelectedImage.SizeY + 180);
316 if (s.Width > Screen.PrimaryScreen.Bounds.Width || s.Height > Screen.PrimaryScreen.Bounds.Height)
317 {
318 this.WindowState = FormWindowState.Maximized;
320 }
321 else
322 {
323 Size = s;
325 }
326 }
System.Drawing.Image Image
Definition ImageView.cs:15
System.Drawing.Size Size
int Level
Current level when viewing whole-slide and pyramidal images.
Definition ImageView.cs:791
ImageView Viewer
Definition TabsView.cs:15
static BioImage SelectedImage
Definition TabsView.cs:29

◆ SetTab() [1/2]

void BioCore.TabsView.SetTab ( int i)

Definition at line 172 of file TabsView.cs.

173 {
174 tabControl.SelectedIndex = i;
175 }

◆ SetTab() [2/2]

void BioCore.TabsView.SetTab ( string tabName)

Definition at line 168 of file TabsView.cs.

169 {
170 tabControl.SelectTab(tabName);
171 }

◆ UpdateViewMode()

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

This function is called when the user clicks on the menu item to change the view mode. It updates the menu item to reflect the current view mode.

Parameters
vThe view mode to be updated

Definition at line 650 of file TabsView.cs.

651 {
652 if (v == ImageView.ViewMode.RGBImage)
653 rGBToolStripMenuItem.Checked = true;
654 if (v == ImageView.ViewMode.Filtered)
655 filteredToolStripMenuItem.Checked = true;
656 if (v == ImageView.ViewMode.Raw)
657 rawToolStripMenuItem.Checked = true;
658 }

Member Data Documentation

◆ filters

Filter BioCore.TabsView.filters = null

Definition at line 11 of file TabsView.cs.

◆ graphics

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

Definition at line 12 of file TabsView.cs.

◆ init

bool BioCore.TabsView.init = false
static

Definition at line 10 of file TabsView.cs.

◆ viewers

List<ImageView> BioCore.TabsView.viewers = new List<ImageView>()

Definition at line 13 of file TabsView.cs.

Property Documentation

◆ Image

BioImage BioCore.TabsView.Image
getset

Definition at line 330 of file TabsView.cs.

331 {
332 get
333 {
334 if (Viewer == null)
335 return null;
336 if (ImageView.SelectedImage == null)
337 return null;
339 }
340 set
341 {
343 }
344 }
static ImageView viewer
Definition App.cs:16
int SelectedIndex
A property that is used to set the selected index of the image. *‍/.
Definition ImageView.cs:406

◆ ImageView

ImageView BioCore.TabsView.ImageView
get

Definition at line 347 of file TabsView.cs.

348 {
349 get
350 {
351 return Viewer;
352 }
353 }

◆ SelectedImage

BioImage BioCore.TabsView.SelectedImage
staticget

Definition at line 28 of file TabsView.cs.

29 {
30 get
31 {
32 return App.tabsView.Image;
33 }
34 }
static TabsView tabsView
Definition App.cs:10
BioImage Image
Definition TabsView.cs:331

◆ SelectedViewer

ImageView BioCore.TabsView.SelectedViewer
staticget

Definition at line 36 of file TabsView.cs.

37 {
38 get
39 {
40 return App.tabsView.ImageView;
41 }
42 }

◆ TabCount

int BioCore.TabsView.TabCount
get

Definition at line 356 of file TabsView.cs.

357 {
358 get
359 {
360 return tabControl.TabPages.Count;
361 }
362 }

◆ Viewer

ImageView BioCore.TabsView.Viewer
get

Definition at line 14 of file TabsView.cs.

15 {
16 get
17 {
18 if (tabControl.TabPages.Count == 0)
19 return null;
20 if (tabControl.SelectedIndex == -1)
21 return null;
22 if (tabControl.SelectedTab.Controls.Count == 0)
23 return null;
24 return (ImageView)tabControl.SelectedTab.Controls[0];
25 }
26 }

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