BioGTK  5.1.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images.
Loading...
Searching...
No Matches
Bio.ROIManager Class Reference
Inheritance diagram for Bio.ROIManager:

Public Member Functions

void InitItems ()
 
void UpdateAnnotationList ()
 
void updateROI (int index, ROI an)
 
void UpdatePointBox ()
 

Static Public Member Functions

static ROIManager Create ()
 

Public Attributes

ROI anno = new ROI()
 
bool autoUpdate = true
 

Static Public Attributes

static Dictionary< string, ROIrois = new Dictionary<string, ROI>()
 
static bool showBounds = true
 
static bool showText = false
 
static bool showR = true
 
static bool showG = true
 
static bool showB = true
 

Protected Member Functions

 ROIManager (Builder builder, IntPtr handle)
 

Constructor & Destructor Documentation

◆ ROIManager()

Bio.ROIManager.ROIManager ( Builder  builder,
IntPtr  handle 
)
inlineprotected
89 : base(handle)
90 {
91 _builder = builder;
92 builder.Autoconnect(this);
93 xBox.ValueChanged += xBox_ValueChanged;
94 yBox.ValueChanged += yBox_ValueChanged;
95 wBox.ValueChanged += wBox_ValueChanged;
96 hBox.ValueChanged += hBox_ValueChanged;
97 rBox.ValueChanged += rBox_ValueChanged;
98 gBox.ValueChanged += gBox_ValueChanged;
99 bBox.ValueChanged += bBox_ValueChanged;
100 zBox.ValueChanged += zBox_ValueChanged;
101 cBox.ValueChanged += cBox_ValueChanged;
102 tBox.ValueChanged += tBox_ValueChanged;
103 widthBox.ValueChanged += strokeWBox_ValueChanged;
104 pointXBox.ValueChanged += pointXBox_ValueChanged;
105 pointYBox.ValueChanged += pointYBox_ValueChanged;
106 pointBox.ValueChanged += pointBox_ValueChanged;
107 selBox.ValueChanged += selectBoxSize_ValueChanged;
108 widthBox.ValueChanged += strokeWBox_ValueChanged;
109 textBox.Changed += textBox_TextChanged;
110 idBox.Changed += idBox_TextChanged;
111 boundsBox.Clicked += showBoundsBox_ActiveChanged;
112 showTextBox.Clicked += showTextBox_ActiveChanged;
113 showRBox.Clicked += showRBox_ActiveChanged;
114 showGBox.Clicked += showGBox_ActiveChanged;
115 showBBox.Clicked += showBBox_ActiveChanged;
116 this.DeleteEvent += ROIManager_DeleteEvent;
117
118 //roiView.Selection.Changed += roiView_SelectedIndexChanged;
119 roiView.RowActivated += RoiView_RowActivated;
120 roiView.ActivateOnSingleClick = true;
121 this.FocusInEvent += ROIManager_FocusInEvent;
122
123 xBox.Adjustment.Upper = PointD.MaxX;
124 xBox.Adjustment.StepIncrement= 0.1;
125 xBox.Adjustment.PageIncrement= 1;
126 yBox.Adjustment.Upper = PointD.MaxY;
127 yBox.Adjustment.StepIncrement = 0.1;
128 yBox.Adjustment.PageIncrement = 1;
129 wBox.Adjustment.Upper = PointD.MaxX;
130 wBox.Adjustment.StepIncrement = 0.1;
131 wBox.Adjustment.PageIncrement = 1;
132 hBox.Adjustment.Upper = PointD.MaxY;
133 xBox.Adjustment.StepIncrement = 0.1;
134 xBox.Adjustment.PageIncrement = 1;
135 rBox.Adjustment.Upper = byte.MaxValue;
136 rBox.Adjustment.StepIncrement = 1;
137 rBox.Adjustment.PageIncrement = 1;
138 gBox.Adjustment.Upper = byte.MaxValue;
139 gBox.Adjustment.StepIncrement = 1;
140 gBox.Adjustment.PageIncrement = 1;
141 bBox.Adjustment.Upper = byte.MaxValue;
142 bBox.Adjustment.StepIncrement = 1;
143 bBox.Adjustment.PageIncrement = 1;
144 zBox.Adjustment.Upper = 10000;
145 zBox.Adjustment.StepIncrement = 1;
146 zBox.Adjustment.PageIncrement = 1;
147 cBox.Adjustment.Upper = 10000;
148 cBox.Adjustment.StepIncrement = 1;
149 cBox.Adjustment.PageIncrement = 1;
150 tBox.Adjustment.Upper = 10000;
151 tBox.Adjustment.StepIncrement = 1;
152 tBox.Adjustment.PageIncrement = 1;
153 widthBox.Adjustment.Upper = 100;
154 widthBox.Adjustment.StepIncrement = 1;
155 widthBox.Adjustment.PageIncrement = 1;
156 pointBox.Adjustment.Upper = 100000;
157 pointBox.Adjustment.StepIncrement = 1;
158 pointBox.Adjustment.PageIncrement = 1;
159 pointXBox.Adjustment.Upper = PointD.MaxX;
160 pointXBox.Adjustment.StepIncrement = 0.1;
161 pointXBox.Adjustment.PageIncrement = 1;
162 pointYBox.Adjustment.Upper = PointD.MaxY;
163 pointYBox.Adjustment.StepIncrement = 0.1;
164 pointYBox.Adjustment.PageIncrement = 1;
165 selBox.Value = ROI.selectBoxSize;
166 selBox.Adjustment.Upper = 100;
167 selBox.Adjustment.StepIncrement = 1;
168 InitItems();
169 App.ApplyStyles(this);
170 }
void InitItems()
Definition ROIManager.cs:273
Definition Bio.cs:391
static float selectBoxSize
Definition Bio.cs:521

Member Function Documentation

◆ Create()

static ROIManager Bio.ROIManager.Create ( )
inlinestatic
84 {
85 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/ROIManager.glade", FileMode.Open));
86 return new ROIManager(builder, builder.GetObject("roiManager").Handle);
87 }
ROIManager(Builder builder, IntPtr handle)
Definition ROIManager.cs:89

◆ InitItems()

void Bio.ROIManager.InitItems ( )
inline

It creates a treeview with 4 columns, and then populates the treeview with the data from the Images class

274 {
275 Gtk.TreeViewColumn typeCol = new Gtk.TreeViewColumn();
276 typeCol.Title = "Type";
277 Gtk.CellRendererText typeCell = new Gtk.CellRendererText();
278 typeCol.PackStart(typeCell, true);
279
280 Gtk.TreeViewColumn idCol = new Gtk.TreeViewColumn();
281 idCol.Title = "ID";
282 Gtk.CellRendererText idCell = new Gtk.CellRendererText();
283 idCol.PackStart(idCell, true);
284
285 Gtk.TreeViewColumn textCol = new Gtk.TreeViewColumn();
286 textCol.Title = "Text";
287 Gtk.CellRendererText textCell = new Gtk.CellRendererText();
288 textCol.PackStart(textCell, true);
289
290 Gtk.TreeViewColumn rectCol = new Gtk.TreeViewColumn();
291 rectCol.Title = "Bounds";
292 Gtk.CellRendererText rectCell = new Gtk.CellRendererText();
293 rectCol.PackStart(rectCell, true);
294
295
296 roiView.AppendColumn(typeCol);
297 roiView.AppendColumn(idCol);
298 roiView.AppendColumn(textCol);
299 roiView.AppendColumn(rectCol);
300
301 typeCol.AddAttribute(typeCell, "text", 0);
302 idCol.AddAttribute(idCell, "text", 1);
303 textCol.AddAttribute(textCell, "text", 2);
304 rectCol.AddAttribute(rectCell, "text", 3);
305
306 Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
307
308 foreach (BioImage b in Images.images)
309 {
310 Gtk.TreeIter iter = store.AppendValues(System.IO.Path.GetFileName(b.Filename));
311 foreach (ROI r in b.Annotations)
312 {
313 store.AppendValues(iter, r.type.ToString(), r.id, r.Text, r.BoundingBox.ToString());
314 }
315 }
316 roiView.Model = store;
317
318 }
Definition Bio.cs:2008
string Filename
Definition Bio.cs:2144
List< ROI > Annotations
Definition Bio.cs:2140
string id
Definition Bio.cs:548
RectangleD BoundingBox
Definition Bio.cs:539
string Text
Definition Bio.cs:803
Type type
Definition Bio.cs:520
override string ToString()
Definition Bio.cs:378

◆ UpdateAnnotationList()

void Bio.ROIManager.UpdateAnnotationList ( )
inline

It takes a list of images, and for each image, it takes a list of annotations, and for each annotation, it adds the annotation to a dictionary, and then adds the annotation to a treeview

323 {
324 rois.Clear();
325 Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
326 foreach (BioImage b in Images.images)
327 {
328 Gtk.TreeIter iter = store.AppendValues(System.IO.Path.GetFileName(b.Filename));
329 foreach (ROI r in b.Annotations)
330 {
331 rois.Add(r.type.ToString() + "," + r.id + "," + r.Text + "," + r.BoundingBox.ToString(),r);
332 store.AppendValues(iter, r.type.ToString(), r.id, r.Text, r.BoundingBox.ToString());
333 }
334 }
335 roiView.Model = store;
336 }
static Dictionary< string, ROI > rois
Definition ROIManager.cs:82

◆ UpdatePointBox()

void Bio.ROIManager.UpdatePointBox ( )
inline

This function updates the point box with the current point

Returns
The point of the annotation.
629 {
630 if (anno == null)
631 return;
632 PointD d = anno.GetPoint((int)pointBox.Value);
633 pointXBox.Value = (int)d.X;
634 pointYBox.Value = (int)d.Y;
635 }
ROI anno
Definition ROIManager.cs:191
PointD GetPoint(int i)
Definition Bio.cs:990

◆ updateROI()

void Bio.ROIManager.updateROI ( int  index,
ROI  an 
)
inline

‍Update the ROI at the specified index with the specified ROI

Parameters
indexthe index of the annotation to be updated
ROIThe ROI object to be updated
Returns
The ROI object is being returned.
350 {
351 if (ImageView.SelectedImage == null)
352 return;
354 UpdateView();
355 }
Definition ImageView.cs:23
static BioImage SelectedImage
Definition ImageView.cs:1559

Member Data Documentation

◆ anno

ROI Bio.ROIManager.anno = new ROI()

◆ autoUpdate

bool Bio.ROIManager.autoUpdate = true

◆ rois

Dictionary<string, ROI> Bio.ROIManager.rois = new Dictionary<string, ROI>()
static

◆ showB

bool Bio.ROIManager.showB = true
static

◆ showBounds

bool Bio.ROIManager.showBounds = true
static

◆ showG

bool Bio.ROIManager.showG = true
static

◆ showR

bool Bio.ROIManager.showR = true
static

◆ showText

bool Bio.ROIManager.showText = false
static

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