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

Classes

class  Node
 

Public Member Functions

 NodeView (string[] args)
 
void UpdateOverlay ()
 
void InitNodes ()
 
void UpdateNodes ()
 
void Exit ()
 It closes the current form, exits the application, and exits the thread.
 

Protected Member Functions

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

Detailed Description

Definition at line 3 of file NodeView.Designer.cs.

Constructor & Destructor Documentation

◆ NodeView()

BioCore.NodeView.NodeView ( string[] args)

Definition at line 45 of file NodeView.cs.

46 {
47 InitializeComponent();
48 //Let's make sure the directories we need for startup exist.
49 Console.WriteLine("Reading start up folders.");
50 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath);
51 System.IO.Directory.CreateDirectory(st + "/Scripts");
52 System.IO.Directory.CreateDirectory(st + "/Functions");
53 System.IO.Directory.CreateDirectory(st + "/Tools");
54 Init();
55 InitNodes();
56 App.nodeView = this;
57 Shown += async (sender, e) =>
58 {
59 foreach (string file in args)
60 await OpenImageAsync(file);
61 };
62 Show();
63 }
void InitNodes()
Definition NodeView.cs:80

Member Function Documentation

◆ Dispose()

override void BioCore.NodeView.Dispose ( bool disposing)
protected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 14 of file NodeView.Designer.cs.

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

◆ Exit()

void BioCore.NodeView.Exit ( )

It closes the current form, exits the application, and exits the thread.

Definition at line 160 of file NodeView.cs.

161 {
162 this.Close();
163 Application.Exit();
164 Application.ExitThread();
165 }
System.Windows.Forms.Application Application
Definition ImageView.cs:14

◆ InitNodes()

void BioCore.NodeView.InitNodes ( )

It creates a treeview with a root node called "BioImages" and then adds a child node for each BioImage in the Images.images list. Each child node has two child nodes, one for the planes and one for the ROIs

Definition at line 80 of file NodeView.cs.

81 {
82 treeView.Nodes.Clear();
83 TreeNode images = new TreeNode();
84 images.Text = "BioImages";
85 images.ForeColor = Color.White;
86 foreach (BioImage item in Images.images)
87 {
88 //TreeNode node = new TreeNode();
89 Node tree = new Node(item, Node.DataType.image);
90
91 Node implanes = new Node(item, Node.DataType.text);
92 implanes.Text = "Planes";
93
94 foreach (Bitmap buf in item.Buffers)
95 {
96 Node plane = new Node(buf, Node.DataType.buf);
97 plane.Text = buf.ID + ", " + buf.Coordinate.ToString();
98
99 implanes.node.Nodes.Add(plane.node);
100 }
101 tree.node.Nodes.Add(implanes.node);
102
103 Node rois = new Node(item, Node.DataType.text);
104 rois.Text = "ROI";
105
106 foreach (ROI an in item.Annotations)
107 {
108 Node roi = new Node(an, Node.DataType.roi);
109 rois.node.Nodes.Add(roi.node);
110 }
111 tree.node.Nodes.Add(rois.node);
112 images.Nodes.Add(tree.node);
113 }
114 treeView.Nodes.Add(images);
115 }
System.Drawing.Color Color

◆ UpdateNodes()

void BioCore.NodeView.UpdateNodes ( )

If the number of images in the treeview is not the same as the number of images in the Images class, we refresh the whole treeview. If the number of ROIs in the treeview is not the same as the number of ROIs in the image, we refresh the ROIs

Returns
The return type is void.

Definition at line 122 of file NodeView.cs.

123 {
124 if (Images.images.Count != treeView.Nodes[0].Nodes.Count)
125 {
126 //If image count is not same as node count we refresh whole tree.
127 InitNodes();
128 return;
129 }
130 TreeNode images = treeView.Nodes[0];
131 foreach (TreeNode item in images.Nodes)
132 {
133 //TreeNode node = new TreeNode();
134 Node node = (Node)item.Tag;
135 BioImage im = (BioImage)node.Object;
136
137 TreeNode rois = node.node.Nodes[1];
138 if (im.Annotations.Count != rois.Nodes.Count)
139 {
140 //If ROI count is not same as node count we refresh annotations.
141 rois.Nodes.Clear();
142 foreach (ROI an in im.Annotations)
143 {
144 Node roi = new Node(an, Node.DataType.roi);
145 rois.Nodes.Add(roi.node);
146 }
147 }
148 else
149 for (int i = 0; i < im.Annotations.Count; i++)
150 {
151 TreeNode roi = rois.Nodes[i];
152 Node n = (Node)roi.Tag;
153 ROI an = (ROI)n.Object;
154 roi.Text = an.ToString();
155 }
156 }
157 }

◆ UpdateOverlay()

void BioCore.NodeView.UpdateOverlay ( )

‍UpdateOverlay() is a function that updates the overlay

Definition at line 72 of file NodeView.cs.

73 {
74 if (App.viewer != null)
75 App.viewer.UpdateOverlay();
76 }

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