Skip to content

Commit

Permalink
Bioformats package built for NET6. As well as bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
BiologyTools committed Dec 5, 2022
1 parent 62cafc2 commit 2141e0c
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 160 deletions.
12 changes: 6 additions & 6 deletions BioCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BioCore", "BioCore\BioCore.csproj", "{9A5177C9-401B-44C3-8F2E-D4327A25DDCC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BioCore", "BioCore\BioCore.csproj", "{9A5177C9-401B-44C3-8F2E-D4327A25DDCC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AForgeCore", "..\..\AForgeCore\AForgeCore\AForgeCore.csproj", "{89DFD274-5379-4FB5-8742-1243C5331459}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NugetTest", "..\..\NugetTest\NugetTest\NugetTest\NugetTest.csproj", "{038FFD81-A452-4F9F-9BB9-56740B871589}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,10 +17,10 @@ Global
{9A5177C9-401B-44C3-8F2E-D4327A25DDCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A5177C9-401B-44C3-8F2E-D4327A25DDCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A5177C9-401B-44C3-8F2E-D4327A25DDCC}.Release|Any CPU.Build.0 = Release|Any CPU
{89DFD274-5379-4FB5-8742-1243C5331459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89DFD274-5379-4FB5-8742-1243C5331459}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89DFD274-5379-4FB5-8742-1243C5331459}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89DFD274-5379-4FB5-8742-1243C5331459}.Release|Any CPU.Build.0 = Release|Any CPU
{038FFD81-A452-4F9F-9BB9-56740B871589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{038FFD81-A452-4F9F-9BB9-56740B871589}.Debug|Any CPU.Build.0 = Debug|Any CPU
{038FFD81-A452-4F9F-9BB9-56740B871589}.Release|Any CPU.ActiveCfg = Release|Any CPU
{038FFD81-A452-4F9F-9BB9-56740B871589}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file added BioCore/Bio.ico
Binary file not shown.
51 changes: 46 additions & 5 deletions BioCore/BioCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<Version>2.7.6</Version>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<ApplicationIcon>Bio.ico</ApplicationIcon>
<Authors>ErikRepo</Authors>
<PackageIcon>banner.jpg</PackageIcon>
<PackageProjectUrl>https://github.com/BiologyTools/BioNETCore</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>biology; bio-formats; microscopy; imagej; whole-slide-image;</PackageTags>
<RepositoryUrl>https://github.com/BiologyTools/BioNETCore</RepositoryUrl>
<Copyright>GNU GPL-3.0</Copyright>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -30,9 +42,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BioFormats.Net" Version="6.5.1" />
<Content Include="Bio.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BitMiracle.LibTiff.NET" Version="2.4.649" />
<PackageReference Include="CS-Script" Version="4.4.6" />
<PackageReference Include="IKVM" Version="8.3.3" />
<PackageReference Include="InputSimulator" Version="1.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="SharpDX" Version="4.2.0" />
Expand All @@ -41,10 +57,15 @@
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\AForgeCore\AForgeCore\AForgeCore.csproj" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" />
<PackageReference Include="System.Xml.XDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -66,4 +87,24 @@
<Folder Include="Graphics\Graphics\" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\Bio\banner.jpg">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<Reference Include="AForgeCore">
<HintPath>..\..\..\AForgeCore\AForgeCore\bin\Release\net6.0-windows\AForgeCore.dll</HintPath>
</Reference>
<Reference Include="bioformats_package">
<HintPath>..\..\..\BioFormats\bioformats_package.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions BioCore/Source/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static void Initialize()
{
BioImage.Initialize();
Microscope.Initialize();
tabsView = new TabsView();
viewer = new ImageView();
stackTools = new StackTools();
tools = new Tools();
Expand Down
61 changes: 16 additions & 45 deletions BioCore/Source/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ public ImageView(BioImage im)
tools = App.tools;
Dock = DockStyle.Fill;
Images.Add(im);
if (HardwareAcceleration)
{
dx = new Direct2D();
dx.Initialize(new Configuration("BioImager", dxPanel.Width, dxPanel.Height), dxPanel.Handle);
}
App.viewer = this;
if (file == "" || file == null)
return;
SetCoordinate(0, 0, 0);
SelectedImage.Coordinate = new ZCT(zBar.Value, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T);
InitGUI();
//Buf = image.GetBufByCoord(GetCoordinate());
MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
Expand Down Expand Up @@ -65,17 +71,15 @@ public ImageView(BioImage im)
overlayPictureBox.Width += 18;
overlayPictureBox.Height += 18;
}
update = true;
UpdateImages();
UpdateImage();
GoToImage();
Mode = ViewMode.Filtered;
Resolution = im.series;


UpdateView();
if (HardwareAcceleration)
{
dx = new Direct2D();
dx.Initialize(new Configuration("BioImager", dxPanel.Width, dxPanel.Height), dxPanel.Handle);
}

}
public ImageView()
{
Expand All @@ -100,8 +104,6 @@ public ImageView()
// Change parent for overlay PictureBox.
overlayPictureBox.Parent = pictureBox;
overlayPictureBox.Location = new Point(0, 0);

update = true;
UpdateImages();
GoToImage();
UpdateView();
Expand Down Expand Up @@ -155,9 +157,7 @@ public static bool Ctrl
private PointD pd;
public static bool showBounds = true;
public static bool showText = true;
public Image Buf = null;
public bool init = false;
private bool update = false;
private bool updateOverlay = false;
public List<BioImage> Images = new List<BioImage>();
SharpDX.Direct2D1.Bitmap[] dBitmaps;
Expand Down Expand Up @@ -363,7 +363,6 @@ public ViewMode Mode
{
viewMode = value;
//If view mode is changed we update.
update = true;
UpdateImages();
App.tabsView.UpdateViewMode(viewMode);
UpdateView();
Expand Down Expand Up @@ -475,7 +474,6 @@ public PointD Origin
set
{
origin = value;
update = true;
}
}
public Point PyramidalOrigin
Expand Down Expand Up @@ -520,7 +518,6 @@ public int Resolution
set
{
scale = value;
update = true;
UpdateView();
}
}
Expand Down Expand Up @@ -954,27 +951,13 @@ public void RenderFrame()
return;
}
}
public void UpdateView(bool refresh)
{
UpdateStatus();
update = refresh;
if (HardwareAcceleration)
{
//dxPanel.Invalidate();
}
if (update)
{
pictureBox.Invalidate();
overlayPictureBox.Invalidate();
}
}
public void UpdateImages()
{
if (SelectedImage == null)
return;
for (int i = 0; i < Bitmaps.Count; i++)
{
Bitmaps[i] = null;
Bitmaps[i].Dispose();
}
GC.Collect();
Bitmaps.Clear();
Expand All @@ -997,7 +980,6 @@ public void UpdateImages()
else
dBitmaps = new SharpDX.Direct2D1.Bitmap[Images.Count];
}
GC.Collect();
dBitmaps = new SharpDX.Direct2D1.Bitmap[Images.Count];

int bi = 0;
Expand Down Expand Up @@ -1076,7 +1058,6 @@ public void UpdateImages()
Bitmaps.Add(bitmap);
bi++;
}
update = true;
UpdateView();
}
Bitmap bitmap;
Expand Down Expand Up @@ -1159,41 +1140,33 @@ public void UpdateImage()
dBitmaps[SelectedIndex].Dispose();
dBitmaps[SelectedIndex] = null;
}
Clipboard.SetImage(bitmap);
dBitmaps[SelectedIndex] = DBitmap.FromImage(dx.RenderTarget2D, bitmap);
}


if (SelectedIndex < Bitmaps.Count)
Bitmaps[SelectedIndex] = bitmap;
else
Bitmaps.Add(bitmap);

update = false;
UpdateView();
}
private void channelBoxR_SelectedIndexChanged(object sender, EventArgs e)
{
if (channelBoxR.SelectedIndex == -1)
return;
SelectedImage.rgbChannels[0] = channelBoxR.SelectedIndex;
update = true;
UpdateView();
}
private void channelBoxG_SelectedIndexChanged(object sender, EventArgs e)
{
if (channelBoxG.SelectedIndex == -1)
return;
SelectedImage.rgbChannels[1] = channelBoxG.SelectedIndex;
update = true;
UpdateView();
}
private void channelBoxB_SelectedIndexChanged(object sender, EventArgs e)
{
if (channelBoxB.SelectedIndex == -1)
return;
SelectedImage.rgbChannels[2] = channelBoxB.SelectedIndex;
update = true;
UpdateView();
}
private void showControlsToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1504,7 +1477,6 @@ private void zBar_ValueChanged(object sender, EventArgs e)
if (SelectedImage == null)
return;
SelectedImage.Coordinate = new ZCT(zBar.Value, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T);
update = true;
UpdateImage();
UpdateView();
}
Expand All @@ -1513,7 +1485,6 @@ private void timeBar_ValueChanged(object sender, EventArgs e)
if (SelectedImage == null)
return;
SelectedImage.Coordinate = new ZCT(SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, tBar.Value);
update = true;
UpdateImage();
UpdateView();
}
Expand All @@ -1522,7 +1493,6 @@ private void cBar_ValueChanged(object sender, EventArgs e)
if (SelectedImage == null)
return;
SelectedImage.Coordinate = new ZCT(SelectedImage.Coordinate.Z, cBar.Value, SelectedImage.Coordinate.T);
update = true;
UpdateImage();
UpdateView();
}
Expand Down Expand Up @@ -1847,14 +1817,12 @@ private void DrawView(System.Drawing.Graphics g)
}
blue.Dispose();
red.Dispose();
update = false;
}

private int resolution;
private double scaleorig = 0;
private void pictureBox_Paint(object sender, PaintEventArgs e)
{
update = true;
DrawView(e.Graphics);
}
public double GetScale()
Expand Down Expand Up @@ -2613,7 +2581,6 @@ private void drawToolStripMenuItem_Click(object sender, EventArgs e)
}
}
}
update = true;
UpdateImage();
}

Expand Down Expand Up @@ -2646,7 +2613,6 @@ private void fillToolStripMenuItem_Click(object sender, EventArgs e)
}
}
}
update = true;
UpdateImage();
}

Expand All @@ -2668,6 +2634,11 @@ private void dxPanel_SizeChanged(object sender, EventArgs e)
{
if (HardwareAcceleration)
{
if(dx == null)
{
dx = new Direct2D();
dx.Initialize(new Configuration("BioImager", dxPanel.Width, dxPanel.Height), dxPanel.Handle);
}
conf.Width = dxPanel.Width;
conf.Height = dxPanel.Height;
dx.Update(conf, dxPanel.Handle);
Expand Down
Loading

0 comments on commit 2141e0c

Please sign in to comment.