Skip to content

Commit

Permalink
3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BiologyTools committed Feb 20, 2024
1 parent 78def6c commit 4bd87cf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 86 deletions.
18 changes: 2 additions & 16 deletions BioCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "BioCoreSetup", "..\BioCoreS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginExampleWIN", "..\PluginExampleWIN\PluginExampleWIN.csproj", "{4350D3BC-54DE-439B-8544-C1BAAB8C1FC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSlideGTK", "..\OpenSlideGTK\src\OpenSlideSharp\OpenSlideGTK.csproj", "{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -43,8 +41,8 @@ Global
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Debug|x86.Build.0 = Debug|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|Any CPU.Build.0 = Release|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x64.ActiveCfg = Release|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x64.Build.0 = Release|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x64.ActiveCfg = Release|x64
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x64.Build.0 = Release|x64
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x86.ActiveCfg = Release|Any CPU
{633C711A-2C74-4DEE-9DA1-E2E2D7132E1B}.Release|x86.Build.0 = Release|Any CPU
{9F71BCBA-FB42-48F3-8CE2-B492365008A6}.Debug|Any CPU.ActiveCfg = Debug
Expand All @@ -70,18 +68,6 @@ Global
{4350D3BC-54DE-439B-8544-C1BAAB8C1FC9}.Release|x64.Build.0 = Release|Any CPU
{4350D3BC-54DE-439B-8544-C1BAAB8C1FC9}.Release|x86.ActiveCfg = Release|Any CPU
{4350D3BC-54DE-439B-8544-C1BAAB8C1FC9}.Release|x86.Build.0 = Release|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|x64.ActiveCfg = Debug|x64
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|x64.Build.0 = Debug|x64
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|x86.ActiveCfg = Debug|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Debug|x86.Build.0 = Debug|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|Any CPU.Build.0 = Release|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|x64.ActiveCfg = Release|x64
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|x64.Build.0 = Release|x64
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|x86.ActiveCfg = Release|Any CPU
{1675E8BA-EA48-4883-B7BA-CCA6211E9D21}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 1 addition & 3 deletions BioCore/BioCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenSlideGTK" Version="1.5.0" />
<PackageReference Include="ScottPlot" Version="5.0.21" />
<PackageReference Include="SharpDX" Version="4.2.0" />
<PackageReference Include="SharpDX.D3DCompiler" Version="4.2.0" />
Expand Down Expand Up @@ -125,7 +126,4 @@
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\OpenSlideGTK\src\OpenSlideSharp\OpenSlideGTK.csproj" />
</ItemGroup>
</Project>
17 changes: 8 additions & 9 deletions BioCore/Source/Bio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5846,11 +5846,6 @@ public PointD PyramidalOrigin
get { return pyramidalOrigin; }
set
{
if (Resolutions[Level].SizeX < value.X || Resolutions[Level].SizeY < value.Y || value.X < 0 || value.Y < 0)
{
pyramidalOrigin = new PointD(Resolutions[Level].SizeX - s.Width, Resolutions[Level].SizeY - s.Height);
return;
}
pyramidalOrigin = value;
}
}
Expand Down Expand Up @@ -5945,7 +5940,9 @@ public void UpdateBuffersPyramidal()
if (openSlideImage != null)
{
byte[] bts = openSlideBase.GetSlice(new OpenSlideGTK.SliceInfo(PyramidalOrigin.X, PyramidalOrigin.Y, PyramidalSize.Width, PyramidalSize.Height, resolution));
Buffers.Add(new BufferInfo((int)Math.Round(OpenSlideBase.destExtent.Width), (int)Math.Round(OpenSlideBase.destExtent.Height), PixelFormat.Format24bppRgb, bts, new ZCT(), ""));
BufferInfo bf = new BufferInfo((int)Math.Round(OpenSlideBase.destExtent.Width), (int)Math.Round(OpenSlideBase.destExtent.Height), PixelFormat.Format24bppRgb, bts, new ZCT(), "");
bf.Stats = Statistics.FromBytes(bf);
Buffers.Add(bf);
}
else
{
Expand All @@ -5960,10 +5957,12 @@ public void UpdateBuffersPyramidal()
pyramidalOrigin = new PointD(0, 0);
goto start;
}
Buffers.Add(new BufferInfo((int)Math.Round(SlideBase.destExtent.Width), (int)Math.Round(SlideBase.destExtent.Height), PixelFormat.Format24bppRgb, bts, new ZCT(), ""));
BufferInfo bf = new BufferInfo((int)Math.Round(SlideBase.destExtent.Width), (int)Math.Round(SlideBase.destExtent.Height), PixelFormat.Format24bppRgb, bts, new ZCT(), "");
bf.Stats = Statistics.FromBytes(bf);
Buffers.Add(bf);
}
}
BioImage.AutoThreshold(this, true);
BioImage.AutoThreshold(this, false);
if (bitsPerPixel > 8)
StackThreshold(true);
else
Expand Down Expand Up @@ -9522,7 +9521,7 @@ public static BioImage FolderToStack(string path)
Recorder.AddLine("BioImage.FolderToStack(\"" + path + "\");");
return b;
}
public static BioImage OpenOME(string file, int serie, bool tab, bool addToImages, bool tile, int tilex, int tiley, int tileSizeX, int tileSizeY, bool useOpenSlide = false)
public static BioImage OpenOME(string file, int serie, bool tab, bool addToImages, bool tile, int tilex, int tiley, int tileSizeX, int tileSizeY, bool useOpenSlide = true)
{
if (file == null || file == "")
throw new InvalidDataException("File is empty or null");
Expand Down
4 changes: 2 additions & 2 deletions BioCore/Source/Bio/ISlideSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public virtual byte[] GetSlice(SliceInfo sliceInfo)
var dstPixelWidth = sliceInfo.Parame.DstPixelWidth > 0 ? sliceInfo.Parame.DstPixelWidth : dstPixelExtent.Width;
destExtent = new Extent(0, 0, dstPixelWidth, dstPixelHeight);
sourceExtent = srcPixelExtent;
/*

if (UseVips)
{
try
Expand All @@ -101,7 +101,7 @@ public virtual byte[] GetSlice(SliceInfo sliceInfo)
Console.WriteLine(e.Message);
}
}
*/

try
{
Image<Rgb24> im = OpenSlideGTK.ImageUtil.Join(tiles, srcPixelExtent, new Extent(0, 0, dstPixelWidth, dstPixelHeight));
Expand Down
75 changes: 19 additions & 56 deletions BioCore/Source/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using BioCore.Graphics;
using Point = System.Drawing.Point;
using AForge.Imaging.Filters;
using org.checkerframework.checker.units.qual;

namespace BioCore
{
Expand Down Expand Up @@ -674,7 +675,7 @@ public int Level
if (!openSlide)
l = SelectedImage.Level;
else
l = OpenSlideGTK.TileUtil.GetLevel(_slideBase.Schema.Resolutions, Resolution);
l = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
return l;
}
}
Expand All @@ -695,10 +696,7 @@ public int Level
if (SelectedImage != null)
if (SelectedImage.isPyramidal)
{
if (openSlide)
Tools.selectBoxSize = (float)(ROI.selectBoxSize * Resolution);
else
Tools.selectBoxSize = ROI.selectBoxSize;
Tools.selectBoxSize = (float)(ROI.selectBoxSize * Resolution);
}
else
Tools.selectBoxSize = ROI.selectBoxSize * Scale.Width;
Expand Down Expand Up @@ -1947,10 +1945,7 @@ private void DrawOverlay(System.Drawing.Graphics g)
float width = (float)ToViewSizeW(ROI.selectBoxSize / w);
if (SelectedImage.isPyramidal)
{
if (openSlide)
width = (float)(ROI.selectBoxSize * Resolution);
else
width = ROI.selectBoxSize;
width = (float)(ROI.selectBoxSize * Resolution);
}
if (an.type == ROI.Type.Point)
{
Expand Down Expand Up @@ -2422,7 +2417,8 @@ private void pictureBox_MouseDown(object sender, MouseEventArgs e)
{
if (!OpenSlide)
{
double dsx = SelectedImage.GetUnitPerPixel(Level) / Resolution;
double up = SelectedImage.GetUnitPerPixel(Level);
double dsx = (SelectedImage.PhysicalSizeX / Resolution);
Resolution rs = SelectedImage.Resolutions[(int)Level];
double dx = ((double)e.X / overview.Width) * (rs.SizeX * dsx);
double dy = ((double)e.Y / overview.Height) * (rs.SizeY * dsx);
Expand Down Expand Up @@ -2468,7 +2464,7 @@ private void pictureBox_MouseDown(object sender, MouseEventArgs e)
{
float width = (float)ToViewSizeW(ROI.selectBoxSize / Scale.Width);
float height = (float)ToViewSizeH(ROI.selectBoxSize / Scale.Height);
if (openSlide)
if (SelectedImage.isPyramidal)
{
width = Tools.selectBoxSize;
height = Tools.selectBoxSize;
Expand Down Expand Up @@ -2749,12 +2745,7 @@ public PointD ImageToViewSpace(double x, double y)
{
if (SelectedImage.isPyramidal)
{
if (openSlide)
{
return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
}
else
return new PointD(PyramidalOrigin.X + x, PyramidalOrigin.Y + y);
return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
}
else
return ToViewSpace(x, y);
Expand Down Expand Up @@ -2788,14 +2779,9 @@ public PointD ToViewSpace(double x, double y)
{
if (SelectedImage.isPyramidal)
{
if (openSlide)
{
double ddx = x / Resolution;
double ddy = y / Resolution;
return new PointD(ddx, ddy);
}
else
return new PointD(PyramidalOrigin.X + x, PyramidalOrigin.Y + y);
double ddx = x / Resolution;
double ddy = y / Resolution;
return new PointD(ddx, ddy);
}

double dx = (ToViewSizeW(x - (pictureBox.Width / 2)) / Scale.Width) - Origin.X;
Expand All @@ -2809,7 +2795,7 @@ public PointD ToViewSpace(double x, double y)
/// @return The return value is the size of the object in pixels.
private double ToViewSizeW(double d)
{
if (openSlide)
if (SelectedImage.isPyramidal)
{
return d / Resolution;
}
Expand All @@ -2823,7 +2809,7 @@ private double ToViewSizeW(double d)
/// @return The return value is the size of the object in pixels.
public double ToViewSizeH(double d)
{
if (openSlide)
if (SelectedImage.isPyramidal)
{
return d / Resolution;
}
Expand Down Expand Up @@ -2960,29 +2946,13 @@ public PointF ToScreenScale(PointD p)
public System.Drawing.RectangleF ToScreenRectF(double x, double y, double w, double h)
{
if (SelectedImage == null)
{
PointD pf;
if (HardwareAcceleration)
{
double dx = (pxWmicron * (-Origin.X)) * Scale.Width;
double dy = (pxHmicron * (-Origin.Y)) * Scale.Height;
System.Drawing.RectangleF rf = new System.Drawing.RectangleF((float)(PxWmicron * -x * Scale.Width + dx), (float)(PxHmicron * -y * Scale.Height + dy), (float)(PxWmicron * -w * Scale.Width), (float)(PxHmicron * -h * Scale.Height));
return rf;
}
pf = ToScreenSpace(x, y);
return new System.Drawing.RectangleF((float)pf.X, (float)pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
}
return new RectangleF();
if (SelectedImage.isPyramidal)
{
if (openSlide)
{
PointD d = ToViewSpace(x, y);
double dw = ToViewSizeW(w);
double dh = ToViewSizeH(h);
return new System.Drawing.RectangleF((float)(d.X - PyramidalOrigin.X), (float)(d.Y - PyramidalOrigin.Y), (float)dw, (float)dh);
}
else
return new System.Drawing.RectangleF((float)(x - pyramidalOrigin.X), (float)(y - pyramidalOrigin.Y), (float)w, (float)h);
PointD d = ToViewSpace(x, y);
double dw = ToViewSizeW(w);
double dh = ToViewSizeH(h);
return new System.Drawing.RectangleF((float)(d.X - PyramidalOrigin.X), (float)(d.Y - PyramidalOrigin.Y), (float)dw, (float)dh);
}
else
{
Expand Down Expand Up @@ -3081,10 +3051,6 @@ public PointF[] ToScreenSpace(PointD[] p)
/// @return The return value is a float.
public float ToScreenW(double x)
{
if (HardwareAcceleration)
{
return (float)(x * PxWmicron);
}
return (float)(x * PxWmicron);
}
/// > Convert a value in microns to a value in pixels
Expand All @@ -3094,10 +3060,6 @@ public float ToScreenW(double x)
/// @return The return value is a float.
public float ToScreenH(double y)
{
if (HardwareAcceleration)
{
return (float)(y * PxHmicron);
}
return (float)(y * PxHmicron);
}
/// If the user presses the "C" key while holding down the "Control" key, then the function
Expand Down Expand Up @@ -3216,6 +3178,7 @@ public void GoToImage(int i)
{
int lev = MacroResolution.Value - 1;
Resolution = Math.Round(SelectedImage.GetUnitPerPixel(lev),2);
PyramidalOrigin = new PointD(0, 0);
}
else
{
Expand Down

0 comments on commit 4bd87cf

Please sign in to comment.