Skip to content

Commit

Permalink
OMERO Support.
Browse files Browse the repository at this point in the history
Full OMERO support including whole slide.
  • Loading branch information
BiologyTools committed Jan 5, 2025
1 parent e094f5f commit 9f856e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 41 deletions.
1 change: 1 addition & 0 deletions Source/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ public void UpdateImages(bool updatePyramidal = false)
return;
if (SelectedImage.isPyramidal && updatePyramidal || SelectedImage.Buffers.Count == 0)
{
SelectedImage.Coordinate = GetCoordinate();
SelectedImage.PyramidalSize = new AForge.Size(sk.AllocatedWidth, sk.AllocatedHeight);
SelectedImage.UpdateBuffersPyramidal().Wait();
}
Expand Down
66 changes: 25 additions & 41 deletions Source/OMERO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class Image
public static int IconHeight = 50;
public string database = "";
public List<Image> images = new List<Image>();
private ListStore store;
/// It creates a new Search object, which is a Gtk.Window, and returns it
///
/// @return A new instance of the Search class.
Expand All @@ -62,6 +63,27 @@ protected OMERO(Builder builder, IntPtr handle) : base(handle)
this.SizeAllocated += OMERO_SizeAllocated;
searchBox.Changed += SearchBox_Changed;
comboBox.Changed += ComboBox_Changed;
view.ItemActivated += View_ItemActivated;
}

private void View_ItemActivated(object o, ItemActivatedArgs args)
{
TreePath path = args.Path;
store.GetIter(out TreeIter iter, path);
string selectedItem;
if (loadIconsBut.Active)
selectedItem = (string)store.GetValue(iter, 1);
else
selectedItem = (string)store.GetValue(iter, 0);
string[] sts = selectedItem.Split(' ');
foreach (var item in images)
{
if (item.name.Contains(sts[0]))
{
BioImage bm = BioLib.OMERO.GetImage(sts[0], item.dataset);
App.tabsView.AddTab(bm);
}
}
}

private void OMERO_SizeAllocated(object o, SizeAllocatedArgs args)
Expand Down Expand Up @@ -114,26 +136,7 @@ private void InitIcons()
listStore.AppendValues(im.pixbuf, im.name);
}
view.Model = listStore;
// Handle item selection
view.ItemActivated += (o, args) =>
{
TreePath path = args.Path;
listStore.GetIter(out TreeIter iter, path);
string selectedItem;
if (loadIconsBut.Active)
selectedItem = (string)listStore.GetValue(iter, 1);
else
selectedItem = (string)listStore.GetValue(iter, 0);
string[] sts = selectedItem.Split(' ');
foreach (var item in images)
{
if (item.name == sts[0])
{
BioImage bm = BioLib.OMERO.GetImage(sts[0],item.dataset);
App.tabsView.AddTab(bm);
}
}
};
store = listStore;
}
else
{
Expand Down Expand Up @@ -165,26 +168,7 @@ private void InitIcons()
listStore.AppendValues(im.name);
}
view.Model = listStore;
// Handle item selection
view.ItemActivated += (o, args) =>
{
TreePath path = args.Path;
listStore.GetIter(out TreeIter iter, path);
string selectedItem;
if(loadIconsBut.Active)
selectedItem = (string)listStore.GetValue(iter, 1);
else
selectedItem = (string)listStore.GetValue(iter, 0);
string[] sts = selectedItem.Split(' ');
foreach (var item in images)
{
if(item.name == sts[0])
{
BioImage bm = BioLib.OMERO.GetImage(sts[0],item.dataset);
App.tabsView.AddTab(bm);
}
}
};
store = listStore;
}

}
Expand All @@ -197,6 +181,7 @@ public void InitItems()
comStore.AppendValues(im.getName() + " " + im.getId());
}
comboBox.Model = comStore;

}
public void UpdateItems(string filt)
{
Expand All @@ -209,7 +194,6 @@ public void UpdateItems(string filt)
listStore.AppendValues(im.pixbuf, im.name);
}
view.Model = listStore;
InitIcons();
}

private void SearchBox_Changed(object sender, EventArgs e)
Expand Down

0 comments on commit 9f856e8

Please sign in to comment.