20 public static List<string>
recent =
new List<string>();
39 get {
return Image.Channels; }
44 get {
return Image.Annotations; }
48 public static void Initialize(
bool requireImageJ =
false)
52 OpenFileDialog openFileDialog =
new OpenFileDialog();
53 string imj = BioLib.Settings.GetSettings(
"ImageJPath");
56 if(openFileDialog.ShowDialog() == DialogResult.OK)
58 if(openFileDialog.FileName.Contains(
"Fiji"))
59 Fiji.Initialize(openFileDialog.FileName);
61 ImageJ.Initialize(openFileDialog.FileName);
66 if (openFileDialog.FileName.Contains(
"Fiji"))
69 ImageJ.Initialize(imj);
72 BioImage.Initialize(imj);
104 if (s ==
"" || s ==
null)
106 string[] sts = s.Split(
'/');
111 ToolStripMenuItem item =
null;
113 for (
int t = 0; t < sts.Length; t++)
116 for (
int i = 0; i < allItems.Count; i++)
118 if (allItems[i].Text == sts[t])
122 if (t == sts.Length - 1)
130 tabsView.MainMenuStrip.Items.Add(sts[t]);
133 else if (t > 0 && t < sts.Length)
135 ToolStripMenuItem itm =
new ToolStripMenuItem();
136 itm.Text = Path.GetFileName(s);
137 item.DropDownItems.Add(Path.GetFileName(s),
null, ItemClicked);
142 item.DropDownItems.Add(sts[t]);
157 if (s ==
"" || s ==
null)
159 string[] sts = s.Split(
'/');
164 ToolStripMenuItem item =
null;
166 for (
int t = 0; t < sts.Length; t++)
169 for (
int i = 0; i < allItems.Count; i++)
171 if (allItems[i].Text == sts[t])
175 if (t == sts.Length - 1)
186 else if (t > 0 && t < sts.Length)
188 ToolStripMenuItem itm =
new ToolStripMenuItem();
189 itm.Name = Path.GetFileName(s);
190 item.DropDownItems.Add(Path.GetFileName(s),
null, ItemClicked);
195 item.DropDownItems.Add(sts[t]);
225 for (
int v = 0; v < c; v++)
228 for (
int im = 0; im < cc; im++)
233 BioLib.Recorder.Record(
"App.SelectWindow(\"" + name +
"\")");
246 BioLib.Recorder.Record(
"App.CloseWindow(\"" + name +
"\")");
249 if (name ==
"ROI Manager")
252 if (name ==
"Stack Tool")
255 if (name ==
"Channels Tool")
258 if (name ==
"Recorder")
264 for (
int v = 0; v < c; v++)
267 for (
int im = 0; im < cc; im++)
270 if (vi.
Images[im].Filename == Path.GetFileName(name))
276 else if (vi.Name == name)
290 if (Fiji.ImageJPath.Contains(
"Fiji"))
302 BioLib.Recorder.AddLine(
"App.Rename(\"" + text +
"\");",
false);
308 private static IEnumerable<ToolStripMenuItem> GetItems(ToolStripMenuItem item)
310 foreach (var dropDownItem
in item.DropDownItems)
312 if (dropDownItem.GetType() == typeof(ToolStripMenuItem))
314 if (((ToolStripMenuItem)dropDownItem).HasDropDownItems)
316 foreach (ToolStripMenuItem subItem
in GetItems((ToolStripMenuItem)dropDownItem))
317 yield
return subItem;
319 yield
return (ToolStripMenuItem)dropDownItem;
329 List<ToolStripMenuItem> allItems =
new List<ToolStripMenuItem>();
330 foreach (ToolStripMenuItem toolItem
in tabsView.MainMenuStrip.Items)
332 allItems.Add(toolItem);
333 allItems.AddRange(GetItems(toolItem));
343 List<ToolStripMenuItem> allItems =
new List<ToolStripMenuItem>();
346 allItems.Add(toolItem);
347 allItems.AddRange(GetItems(toolItem));
360 if (s ==
"" || s ==
null)
362 string[] sts = s.Split(
'/');
367 ToolStripMenuItem item =
null;
369 for (
int t = 0; t < sts.Length; t++)
372 for (
int i = 0; i < allItems.Count; i++)
374 if (allItems[i].Text == sts[t])
378 if (t == sts.Length - 1)
386 tabsView.MainMenuStrip.Items.Add(sts[t]);
389 else if (t > 0 && t < sts.Length)
391 ToolStripMenuItem itm =
new ToolStripMenuItem();
394 item.DropDownItems.Add(f.
Name,
null, ItemClicked);
399 item.DropDownItems.Add(sts[t]);
414 if (s ==
"" || s ==
null)
416 string[] sts = s.Split(
'/');
421 ToolStripMenuItem item =
null;
423 for (
int t = 0; t < sts.Length; t++)
426 for (
int i = 0; i < allItems.Count; i++)
428 if (allItems[i].Text == sts[t])
432 if (t == sts.Length - 1)
443 else if (t > 0 && t < sts.Length)
445 ToolStripMenuItem itm =
new ToolStripMenuItem();
448 item.DropDownItems.Add(f.
Name,
null, ItemClicked);
453 item.DropDownItems.Add(sts[t]);
481 private static void ItemClicked(
object sender, EventArgs e)
483 ToolStripMenuItem ts = (ToolStripMenuItem)sender;
484 if (ts.Text.EndsWith(
".dll"))
488 else if (ts.Text.EndsWith(
".ijm"))
490 string s = File.ReadAllText(Path.GetDirectoryName(Fiji.ImageJPath) +
"/macros/" + ts.Text);
496 f.PerformFunction(
true);
System.Drawing.Image Image
static void AddContextMenu(string menu, Function f)
static ToolStripItem GetContextMenuItemFromPath(string s)
static ChannelsTool channelsTool
static ToolStripItem GetMenuItemFromPath(string s)
static void Hide()
Hide() hides all the tools.
static void AddMenu(string menu)
static void Initialize(bool requireImageJ=false)
Initialize() is a function that initializes the BioImage Suite Web viewer.
static List< ToolStripMenuItem > GetMenuItems()
Retrieves all the menu items from the main menu strip.
static void AddROI(string an)
static List< Channel > Channels
static StackTools stackTools
static ROIManager manager
static void SelectWindow(string name)
static ToolStripItem GetMenuItemFromPath(string s, Function f)
static void CloseWindow(string name)
static void AddMenu(string menu, Function f)
static BioConsole console
static List< string > recent
static List< ROI > Annotations
static List< ToolStripMenuItem > GetContextItems()
static void AddContextMenu(string menu)
static ToolStripItem GetContextMenuItemFromPath(string s, Function f)
static void Rename(string text)
static bool useBioformats
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)
void SetTab(string tabName)
void RemoveTab(string tabName)
ImageView GetViewer(int i)
void RenameTab(string tabName, string text)