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
StackTools.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 BioLib;
11namespace BioImager
12{
13 public partial class StackTools : Form
14 {
15 public StackTools()
16 {
17 InitializeComponent();
19 }
20
25 public void UpdateStacks()
26 {
27 if (stackABox.Items.Count == Images.images.Count)
28 return;
29 stackABox.Items.Clear();
30 stackBBox.Items.Clear();
31 foreach (BioImage b in Images.images)
32 {
33 stackABox.Items.Add(b);
34 stackBBox.Items.Add(b);
35 }
36 }
38 {
39 get { return (BioImage)stackABox.SelectedItem; }
40 }
42 {
43 get { return (BioImage)stackBBox.SelectedItem; }
44 }
52 private void substackBut_Click(object sender, EventArgs e)
53 {
54 if (stackABox.SelectedIndex == -1)
55 return;
56 BioImage b = BioImage.Substack(ImageA, ((BioImage)stackABox.SelectedItem).series, (int)zStartBox.Value, (int)zEndBox.Value, (int)cStartBox.Value, (int)cEndBox.Value, (int)tStartBox.Value, (int)tEndBox.Value);
59 }
60
68 private void stackABox_SelectedIndexChanged(object sender, EventArgs e)
69 {
70 if (stackABox.SelectedIndex == -1)
71 return;
72 if (stackABox.SelectedItem == stackBBox.SelectedItem)
73 {
74 //Same image selected for A & B
75 MessageBox.Show("Same image selected for A & B. Change either A stack or B stack.");
76 stackABox.SelectedIndex = -1;
77 }
78 zEndBox.Maximum = ImageA.SizeZ;
79 cEndBox.Maximum = ImageA.SizeC;
80 tEndBox.Maximum = ImageA.SizeT;
81 zEndBox.Value = ImageA.SizeZ;
82 cEndBox.Value = ImageA.SizeC;
83 tEndBox.Value = ImageA.SizeT;
84 }
85
92 private void stackBBox_SelectedIndexChanged(object sender, EventArgs e)
93 {
94 if (stackABox.SelectedIndex == -1)
95 return;
96 if (stackBBox.SelectedIndex == -1)
97 return;
98 if (stackABox.SelectedItem == stackBBox.SelectedItem)
99 {
100 //Same image selected for A & B
101 MessageBox.Show("Same image selected for A & B. Change either A stack or B stack.");
102 stackBBox.SelectedIndex = -1;
103 }
104 }
105
113 private void mergeBut_Click(object sender, EventArgs e)
114 {
115 if (stackABox.SelectedIndex == -1)
116 return;
117 if (stackBBox.SelectedIndex == -1)
118 return;
119 BioImage b = BioImage.MergeChannels(ImageA, ImageB);
120 TabsView iv = new TabsView(b);
121 iv.Show();
122 UpdateStacks();
123 }
124
133 private void splitChannelsBut_Click(object sender, EventArgs e)
134 {
135 if (stackABox.SelectedIndex == -1)
136 return;
137 BioImage[] bms = ImageA.SplitChannels();
138 for (int i = 0; i < bms.Length; i++)
139 {
140 App.tabsView.AddTab(bms[i]);
141 }
142 UpdateStacks();
143 }
144
145 private void StackTools_Activated(object sender, EventArgs e)
146 {
147 UpdateStacks();
148 }
149
150 private void setMaxToolStripMenuItem_Click(object sender, EventArgs e)
151 {
152 if(ImageA!=null)
153 zEndBox.Value = ImageA.SizeZ;
154 }
155
156 private void setMaxCToolStripMenuItem_Click(object sender, EventArgs e)
157 {
158 if (ImageA != null)
159 cEndBox.Value = ImageA.SizeC;
160 }
161
162 private void setMaxTToolStripMenuItem_Click(object sender, EventArgs e)
163 {
164 if (ImageA != null)
165 tEndBox.Value = ImageA.SizeT;
166 }
167
168 private void StackTools_FormClosing(object sender, FormClosingEventArgs e)
169 {
170 e.Cancel = true;
171 this.WindowState = FormWindowState.Minimized;
172 }
173
174 private void mergeZBut_Click(object sender, EventArgs e)
175 {
176 if (ImageA != null)
177 App.tabsView.AddTab(BioImage.MergeZ(ImageA));
178 }
179
180 private void mergeTBut_Click(object sender, EventArgs e)
181 {
182 if (ImageA != null)
183 App.tabsView.AddTab(BioImage.MergeT(ImageA));
184 }
185 }
186}
BioLib.BioImage BioImage
Definition TabsView.cs:15
static TabsView tabsView
Definition App.cs:16
void AddTab(BioImage b)
Definition TabsView.cs:134