Skip to content

Commit

Permalink
3.4.1 OMERO Support.
Browse files Browse the repository at this point in the history
  • Loading branch information
BiologyTools committed Jan 6, 2025
1 parent 9f856e8 commit c7bf8fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
11 changes: 4 additions & 7 deletions BioGTK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BioLib" Version="3.4.1" />
<PackageReference Include="Flurl" Version="4.0.0" />
<PackageReference Include="Flurl.Http" Version="4.0.2" />
<PackageReference Include="ImageJ.NET" Version="154.0.0.2" />
Expand All @@ -439,18 +440,14 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ScottPlot" Version="5.0.47" />
<PackageReference Include="ScottPlot" Version="5.0.48" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.116.1" />
<PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="3.116.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="3.116.1" />
<PackageReference Include="SkiaSharp.Views.Gtk3" Version="3.116.1" />
<PackageReference Include="TorchSharp-cpu" Version="0.104.0" />
<PackageReference Include="YamlDotNet" Version="16.2.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BioLib\BioLib.csproj" />
<PackageReference Include="TorchSharp-cpu" Version="0.105.0" />
<PackageReference Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
34 changes: 10 additions & 24 deletions Source/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,36 +346,24 @@ private async void Render(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceE
canvas.DrawImage(SKImages[i], 0, 0, paint);
if (overviewImage != null)
{
var ims = BitmapToSKImage(overviewImage.GetImageRGB());
paint.Style = SKPaintStyle.Fill;
// Draw the overview image at the top-left corner
canvas.DrawImage(BitmapToSKImage(overviewImage), 0, 0, paint);
canvas.DrawImage(ims, 0, 0, paint);
}
// Set the paint style to stroke for drawing rectangles
paint.Style = SKPaintStyle.Stroke;
// Draw the gray rectangle representing the overview's entire visible region
paint.Color = SKColors.Gray;
canvas.DrawRect(overview.X, overview.Y, overview.Width, overview.Height, paint);
paint.Color = SKColors.Red;
if (!openSlide)
{
double dsx = _slideBase.Schema.Resolutions[Level].UnitsPerPixel / Resolution;
Resolution rs = SelectedImage.Resolutions[Level];
double dx = ((double)PyramidalOrigin.X / (rs.SizeX * dsx)) * overview.Width;
double dy = ((double)PyramidalOrigin.Y / (rs.SizeY * dsx)) * overview.Height;
double dw = ((double)viewStack.AllocatedWidth / (rs.SizeX)) * overview.Width * dsx;
double dh = ((double)viewStack.AllocatedHeight / (rs.SizeY)) * overview.Height * dsx;
canvas.DrawRect((int)dx, (int)dy, (int)dw, (int)dh, paint);
}
else
{
double dsx = _openSlideBase.Schema.Resolutions[Level].UnitsPerPixel / Resolution;
var rs = _openSlideBase.Schema.Resolutions.Last();
Resolution rss = SelectedImage.Resolutions[Level];
double dx = ((double)PyramidalOrigin.X / (rss.SizeX * dsx)) * overview.Width;
double dy = ((double)PyramidalOrigin.Y / (rss.SizeY * dsx)) * overview.Height;
double dw = ((double)viewStack.AllocatedWidth / (rss.SizeX * dsx)) * overview.Width;
double dh = ((double)viewStack.AllocatedHeight / (rss.SizeY * dsx)) * overview.Height;
canvas.DrawRect((int)dx, (int)dy, (int)dw, (int)dh, paint);
}
double dsx = _slideBase.Schema.Resolutions[Level].UnitsPerPixel / Resolution;
Resolution rs = SelectedImage.Resolutions[Level];
double dx = ((double)PyramidalOrigin.X / (rs.SizeX * dsx)) * overview.Width;
double dy = ((double)PyramidalOrigin.Y / (rs.SizeY * dsx)) * overview.Height;
double dw = ((double)viewStack.AllocatedWidth / (rs.SizeX)) * overview.Width * dsx;
double dh = ((double)viewStack.AllocatedHeight / (rs.SizeY)) * overview.Height * dsx;
canvas.DrawRect((int)dx, (int)dy, (int)dw, (int)dh, paint);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -832,7 +820,6 @@ private void InitPreview()
Bitmap bm = BioImage.GetTile(SelectedImage, SelectedImage.GetFrameIndex(GetCoordinate().Z, GetCoordinate().C, GetCoordinate().T), MacroResolution.Value - 2, 0, 0, SelectedImage.Resolutions[MacroResolution.Value - 2].SizeX, SelectedImage.Resolutions[MacroResolution.Value - 2].SizeY);
ResizeBilinear re = new ResizeBilinear(overview.Width, overview.Height);
Bitmap bmp = re.Apply(bm.GetImageRGB());
bmp.SwitchRedBlue();
overviewImage = bmp;
}
else
Expand All @@ -851,7 +838,6 @@ private void InitPreview()
Bitmap bm = BioImage.GetTile(SelectedImage, SelectedImage.GetFrameIndex(GetCoordinate().Z, GetCoordinate().C, GetCoordinate().T), lev, 0, 0, SelectedImage.Resolutions[lev].SizeX, SelectedImage.Resolutions[lev].SizeY);
ResizeBilinear re = new ResizeBilinear(overview.Width, overview.Height);
Bitmap bmp = re.Apply(bm.GetImageRGB());
bmp.SwitchRedBlue();
overviewImage = bmp;
}
ShowOverview = true;
Expand Down
3 changes: 3 additions & 0 deletions Source/OMERO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected OMERO(Builder builder, IntPtr handle) : base(handle)

private void View_ItemActivated(object o, ItemActivatedArgs args)
{
BioLib.OMERO.ReConnect();
TreePath path = args.Path;
store.GetIter(out TreeIter iter, path);
string selectedItem;
Expand Down Expand Up @@ -154,6 +155,8 @@ private void InitIcons()
if (db.getId() == long.Parse(sts[1]))
continue;
List<long> str = BioLib.OMERO.GetDatasetIds(db.getId());
if (str.Count == 0)
BioLib.OMERO.ReConnect();
foreach (var item in str)
{
Image image = new Image();
Expand Down

0 comments on commit c7bf8fb

Please sign in to comment.