4using System.Collections.Generic;
7using System.Threading.Tasks;
8using System.Windows.Forms;
34 public static List<string>
recent =
new List<string>();
42 var images = Images.images.ToList();
47 foreach (var item
in images)
49 if (tabs.HasTab(item))
69 get {
return Image.Channels; }
74 get {
return Image.Annotations; }
101 if (!Properties.Settings.Default.PycroManager && !Properties.Settings.Default.PMicroscope)
128 private static IEnumerable<ToolStripMenuItem> GetItems(ToolStripMenuItem item)
130 foreach (var dropDownItem
in item.DropDownItems)
132 if (dropDownItem.GetType() == typeof(ToolStripMenuItem))
134 if (((ToolStripMenuItem)dropDownItem).HasDropDownItems)
136 foreach (ToolStripMenuItem subItem
in GetItems((ToolStripMenuItem)dropDownItem))
137 yield
return subItem;
139 yield
return (ToolStripMenuItem)dropDownItem;
148 List<ToolStripMenuItem> allItems =
new List<ToolStripMenuItem>();
149 foreach (ToolStripMenuItem toolItem
in tabsView.MainMenuStrip.Items)
151 allItems.Add(toolItem);
152 allItems.AddRange(GetItems(toolItem));
161 List<ToolStripMenuItem> allItems =
new List<ToolStripMenuItem>();
164 allItems.Add(toolItem);
165 allItems.AddRange(GetItems(toolItem));
178 if (s ==
"" || s ==
null)
180 string[] sts = s.Split(
'/');
185 ToolStripMenuItem item =
null;
187 for (
int t = 0; t < sts.Length; t++)
190 for (
int i = 0; i < allItems.Count; i++)
192 if (allItems[i].Text == sts[t])
196 if (t == sts.Length - 1)
204 tabsView.MainMenuStrip.Items.Add(sts[t]);
207 else if(t > 0 && t < sts.Length)
209 ToolStripMenuItem itm =
new ToolStripMenuItem();
212 item.DropDownItems.Add(f.
Name,
null, ItemClicked);
217 item.DropDownItems.Add(sts[t]);
232 if (s ==
"" || s ==
null)
234 string[] sts = s.Split(
'/');
239 ToolStripMenuItem item =
null;
241 for (
int t = 0; t < sts.Length; t++)
244 for (
int i = 0; i < allItems.Count; i++)
246 if (allItems[i].Text == sts[t])
250 if (t == sts.Length - 1)
261 else if (t > 0 && t < sts.Length)
263 ToolStripMenuItem itm =
new ToolStripMenuItem();
266 item.DropDownItems.Add(f.
Name,
null, ItemClicked);
271 item.DropDownItems.Add(sts[t]);
287 if (s ==
"" || s ==
null)
289 string[] sts = s.Split(
'/');
294 ToolStripMenuItem item =
null;
296 for (
int t = 0; t < sts.Length; t++)
299 for (
int i = 0; i < allItems.Count; i++)
301 if (allItems[i].Text == sts[t])
305 if (t == sts.Length - 1)
313 tabsView.MainMenuStrip.Items.Add(sts[t]);
316 else if (t > 0 && t < sts.Length)
318 ToolStripMenuItem itm =
new ToolStripMenuItem();
319 itm.Text = Path.GetFileName(s);
320 item.DropDownItems.Add(Path.GetFileName(s),
null, ItemClicked);
325 item.DropDownItems.Add(sts[t]);
340 if (s ==
"" || s ==
null)
342 string[] sts = s.Split(
'/');
347 ToolStripMenuItem item =
null;
349 for (
int t = 0; t < sts.Length; t++)
352 for (
int i = 0; i < allItems.Count; i++)
354 if (allItems[i].Text == sts[t])
358 if (t == sts.Length - 1)
369 else if (t > 0 && t < sts.Length)
371 ToolStripMenuItem itm =
new ToolStripMenuItem();
372 itm.Name = Path.GetFileName(s);
373 item.DropDownItems.Add(Path.GetFileName(s),
null, ItemClicked);
378 item.DropDownItems.Add(sts[t]);
427 private static void ItemClicked(
object sender, EventArgs e)
429 ToolStripMenuItem ts = (ToolStripMenuItem)sender;
430 if(ts.Text.EndsWith(
".dll"))
438 Console.WriteLine(ex.ToString());
442 else if(ts.Text.EndsWith(
".ijm"))
444 string st = File.ReadAllText(Path.GetDirectoryName(
ImageJ.
ImageJPath) +
"/macros/" + ts.Text);
447 else if(ts.Text.EndsWith(
".pt") || ts.Text.EndsWith(
".onnx"))
455 Console.WriteLine(ex.Message.ToString());
461 f.PerformFunction(
true);
System.Drawing.Image Image
static void UpdateImages()
static ROIManager manager
static void AddMenu(string menu, Function f)
static MicroscopeSetup setup
static void Hide()
Hide() hides all the tools.
static BioConsole console
static ToolStripItem GetMenuItemFromPath(string s)
static ToolStripItem GetContextMenuItemFromPath(string s, Function f)
static StackTools stackTools
static ToolStripItem GetMenuItemFromPath(string s, Function f)
static List< ROI > Annotations
static List< string > recent
static List< ToolStripMenuItem > GetContextItems()
static ToolStripItem GetContextMenuItemFromPath(string s)
static void AddContextMenu(string menu)
static SlideImager slideImager
static List< ToolStripMenuItem > GetMenuItems()
static List< Channel > Channels
static void Initialize()
Initialize() is a function that initializes the BioImager UI.
static void AddROI(string an)
static ChannelsTool channelsTool
static CellImager cellImager
static void AddMenu(string menu)
static void AddContextMenu(string menu, Function f)
static Recordings recordings
static Automation automation
static bool useBioformats
static async void RunOnImage(string con, bool headless, bool onTab, bool bioformats, bool newTab)
ImageView control for image stacks, pyramidal and whole-slide-images.
static BioImage SelectedImage
ContextMenuStrip ViewContextMenu
A property that returns a ContextMenuStrip object. */.
static Dictionary< string, IPlugin > Plugins
static void AddLine(string s)