BioGTK  6.7.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
MagicSelect.cs
1using AForge.Imaging.Filters;
2using BioGTK;
3using Gtk;
4using System;
5using System.IO;
6
7namespace Bio
8{
9 public partial class MagicSelect : Window
10 {
11 #region Properties
12
14 private Builder _builder;
15
16#pragma warning disable 649
17
18 [Builder.Object]
19 private SpinButton numBox;
20 [Builder.Object]
21 private SpinButton minBox;
22 [Builder.Object]
23 private SpinButton maxBox;
24 [Builder.Object]
25 private ComboBox thBox;
26 [Builder.Object]
27 private CheckButton numericBox;
28
29#pragma warning restore 649
30
31 #endregion
32
33 #region Constructors / Destructors
34
41 public static MagicSelect Create(int index)
42 {
43 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Magic.glade", FileMode.Open));
44 return new MagicSelect(builder, builder.GetObject("magicSelect").Handle, index);
45 }
46
47
48 /* The constructor for the class. */
49 protected MagicSelect(Builder builder, IntPtr handle, int index) : base(handle)
50 {
51 _builder = builder;
52 builder.Autoconnect(this);
53 var ths = new ListStore(typeof(string));
54 // Add items to the ListStore
55 ths.AppendValues("Min");
56 ths.AppendValues("Median");
57 ths.AppendValues("Median - Min");
58 // Set the model for the ComboBox
59 thBox.Model = ths;
60 // Set the text column to display
61 var renderer = new CellRendererText();
62 thBox.PackStart(renderer, false);
63 thBox.AddAttribute(renderer, "text", 0);
64 thBox.Active = index;
65 App.ApplyStyles(this);
66 }
67
68 #endregion
69
70 private bool numeric = false;
71
72 /* A property that returns the value of the checkbox. */
73 public bool Numeric
74 {
75 get
76 {
77 return numericBox.Active;
78 }
79 }
80
81 public int Threshold
82 {
83 get
84 {
85 return (int)numBox.Value;
86 }
87 }
88
89 public int Min
90 {
91 get { return (int)minBox.Value; }
92 }
93 public int Max
94 {
95 get { return (int)maxBox.Value; }
96 }
97 public int Index
98 {
99 get
100 {
101 return thBox.Active;
102 }
103 }
104 }
105}
static MagicSelect Create(int index)
Definition ML.cs:17