BioImager  5.0.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
ApplyFilter.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9using System.Windows.Forms;
10using AForge;
11using BioLib;
12namespace BioImager
13{
14 public partial class ApplyFilter : Form
15 {
16 /* This is the constructor for the ApplyFilter class. It is called when the ApplyFilter class
17 is instantiated. */
18 public ApplyFilter(bool two)
19 {
20 InitializeComponent();
22 if (!two)
23 {
24 stackBBox.Enabled = false;
25 if (stackBBox.Items.Count > 1)
26 stackBBox.SelectedIndex = 1;
27 }
28 if (stackABox.Items.Count > 0)
29 stackABox.SelectedIndex = 0;
30 }
35 public void UpdateStacks()
36 {
37 if (Images.images.Count != stackABox.Items.Count)
38 {
39 stackABox.Items.Clear();
40 stackBBox.Items.Clear();
41 foreach (BioImage b in Images.images)
42 {
43 stackABox.Items.Add(b);
44 stackBBox.Items.Add(b);
45 }
46 if (stackABox.Items.Count == 1)
47 stackABox.SelectedIndex = 0;
48 }
49 }
51 {
52 get { return (BioImage)stackABox.SelectedItem; }
53 }
55 {
56 get { return (BioImage)stackBBox.SelectedItem; }
57 }
59 {
60 get
61 {
62 if (roiBox.SelectedIndex != -1)
63 return ((ROI)roiBox.SelectedItem).BoundingBox;
64 else
65 return new RectangleD((double)xBox.Value, (double)yBox.Value, (double)wBox.Value, (double)hBox.Value);
66 }
67 }
68 public int Angle
69 {
70 get
71 {
72 return (int)angleBox.Value;
73 }
74 }
75 public System.Drawing.Color Color
76 {
77 get
78 {
79 return colorDialog.Color;
80 }
81 }
82 public int W
83 {
84 get
85 {
86 return (int)wBox.Value;
87 }
88 }
89 public int H
90 {
91 get
92 {
93 return (int)hBox.Value;
94 }
95 }
96
104 private void stackABox_SelectedIndexChanged(object sender, EventArgs e)
105 {
106 if (stackABox.SelectedIndex == -1)
107 return;
108 roiBox.Items.Clear();
109 roiBox.Items.AddRange(ImageA.Annotations.ToArray());
110 if (stackBBox.SelectedIndex == -1)
111 return;
112 if(stackABox.SelectedItem == stackBBox.SelectedItem)
113 {
114 //Same image selected for A & B
115 MessageBox.Show("Same image selected for A & B. Change either A stack or B stack.");
116 stackABox.SelectedIndex = -1;
117 }
118 }
125 private void stackBBox_SelectedIndexChanged(object sender, EventArgs e)
126 {
127 if (stackABox.SelectedIndex == -1)
128 return;
129 if (stackBBox.SelectedIndex == -1)
130 return;
131 if (stackABox.SelectedItem == stackBBox.SelectedItem)
132 {
133 //Same image selected for A & B
134 MessageBox.Show("Same image selected for A & B. Change either A stack or B stack.");
135 stackBBox.SelectedIndex = -1;
136 }
137 }
142 private void StackTools_Activated(object sender, EventArgs e)
143 {
144 UpdateStacks();
145 }
150 private void okBut_Click(object sender, EventArgs e)
151 {
152 DialogResult = DialogResult.OK;
153 }
158 private void cancelBut_Click(object sender, EventArgs e)
159 {
160 DialogResult = DialogResult.Cancel;
161 }
170 private void setColorBut_Click(object sender, EventArgs e)
171 {
172 if (colorDialog.ShowDialog() != DialogResult.OK)
173 return;
174 fillPanel.BackColor = colorDialog.Color;
175 }
180 private void clearToolStripMenuItem_Click(object sender, EventArgs e)
181 {
182 roiBox.SelectedIndex = -1;
183 }
184 }
185}
AForge.RectangleD RectangleD
AForge.Color Color
AForge.Rectangle Rectangle
BioLib.BioImage BioImage
Definition TabsView.cs:15