Skip to content

Commit

Permalink
v0.6.7.1
Browse files Browse the repository at this point in the history
* (Add) Menu - Help - Benchmark: Run benchmark test to measure system performance
* (Fix) Properties listview trigger an error when there are no groups to show
* (Fix) Elfin: "(Number of Slices = x)" to ";Number of Slices = x" (#24)
  • Loading branch information
sn4k3 committed Aug 27, 2020
1 parent ba5b527 commit 4e4f3ca
Show file tree
Hide file tree
Showing 18 changed files with 3,981 additions and 1,003 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 27/08/2020 - v0.6.7.1

* (Add) Menu - Help - Benchmark: Run benchmark test to measure system performance
* (Fix) Properties listview trigger an error when there are no groups to show
* (Fix) Elfin: "(Number of Slices = x)" to ";Number of Slices = x" (#24)

## 21/08/2020 - v0.6.7.0

* (Add) Tool: Layer Clone
Expand Down
10 changes: 9 additions & 1 deletion UVtools.Core/FileFormats/CWSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,15 @@ private void UpdateGCode()
{
var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
if (ReferenceEquals(displayNameAttribute, null)) continue;
GCode.AppendLine($";({displayNameAttribute.DisplayName.PadRight(24)} = {propertyInfo.GetValue(OutputSettings)})");
if (propertyInfo.Name.Equals(nameof(OutputSettings.LayersNum)))
{
GCode.AppendLine($";{displayNameAttribute.DisplayName.PadRight(24)} = {propertyInfo.GetValue(OutputSettings)}");
}
else
{
GCode.AppendLine($";({displayNameAttribute.DisplayName.PadRight(24)} = {propertyInfo.GetValue(OutputSettings)})");
}

}
GCode.AppendLine();
GCode.AppendFormat(GCodeStart, Environment.NewLine);
Expand Down
42 changes: 16 additions & 26 deletions UVtools.Core/Layer/LayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -875,30 +875,19 @@ public List<LayerIssue> GetAllIssues(
}
}

if (islandConfig.BinaryThreshold > 0)
{
CvInvoke.Threshold(image, image, islandConfig.BinaryThreshold, 255,
ThresholdType.Binary);
}

using (Mat labels = new Mat())
using (Mat stats = new Mat())
using (Mat centroids = new Mat())
{
if (islandConfig.BinaryThreshold > 0)
{
CvInvoke.Threshold(image, image, islandConfig.BinaryThreshold, 255, ThresholdType.Binary);
/*using (var thresholdImage = new Mat())
{
CvInvoke.Threshold(image, thresholdImage, islandConfig.BinaryThreshold, 255, ThresholdType.Binary);
// Evaluate number of connected components using the 4-connected neighbor approach
numLabels = CvInvoke.ConnectedComponentsWithStats(thresholdImage, labels, stats, centroids,
islandConfig.AllowDiagonalBonds ? LineType.EightConnected : LineType.FourConnected);
}*/
}
/*else
{
// Evaluate number of connected components 4-connected neighbor approach
numLabels = CvInvoke.ConnectedComponentsWithStats(image, labels, stats, centroids,
islandConfig.AllowDiagonalBonds ? LineType.EightConnected : LineType.FourConnected);
}*/
var numLabels = CvInvoke.ConnectedComponentsWithStats(image, labels, stats, centroids,
islandConfig.AllowDiagonalBonds ? LineType.EightConnected : LineType.FourConnected);

// Get array that contains details of each connected component
var ccStats = stats.GetData();
//stats[i][0]: Left Edge of Connected Component
Expand Down Expand Up @@ -1012,6 +1001,7 @@ public List<LayerIssue> GetAllIssues(
{
if ((int) arr.GetValue(0, i, 2) != -1 || (int) arr.GetValue(0, i, 3) == -1)
continue;

var rect = CvInvoke.BoundingRectangle(contours[i]);
if(rect.GetArea() < resinTrapConfig.RequiredAreaToProcessCheck) continue;

Expand Down Expand Up @@ -1574,7 +1564,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
if (ReferenceEquals(progress, null)) progress = new OperationProgress();
progress.Reset("Drawings", (uint) pixelHistory.Count);

ConcurrentDictionary<uint, Mat> modfiedLayers = new ConcurrentDictionary<uint, Mat>();
ConcurrentDictionary<uint, Mat> modifiedLayers = new ConcurrentDictionary<uint, Mat>();
for (var i = 0; i < pixelHistory.Count; i++)
{
var operation = pixelHistory[i];
Expand All @@ -1584,7 +1574,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
if (operation.OperationType == PixelOperation.PixelOperationType.Drawing)
{
var operationDrawing = (PixelDrawing) operation;
var mat = modfiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);
var mat = modifiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);

if (operationDrawing.BrushSize == 1)
{
Expand All @@ -1608,13 +1598,13 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
else if (operation.OperationType == PixelOperation.PixelOperationType.Text)
{
var operationText = (PixelText)operation;
var mat = modfiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);
var mat = modifiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);

CvInvoke.PutText(mat, operationText.Text, operationText.Location, operationText.Font, operationText.FontScale, new MCvScalar(operationText.Color), operationText.Thickness, operationText.LineType, operationText.Mirror);
}
else if (operation.OperationType == PixelOperation.PixelOperationType.Eraser)
{
var mat = modfiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);
var mat = modifiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);

if (ReferenceEquals(layerContours, null))
{
Expand Down Expand Up @@ -1642,7 +1632,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
int drawnLayers = 0;
for (int operationLayer = (int)operation.LayerIndex-1; operationLayer >= 0; operationLayer--)
{
var mat = modfiedLayers.GetOrAdd((uint) operationLayer, u => this[operationLayer].LayerMat);
var mat = modifiedLayers.GetOrAdd((uint) operationLayer, u => this[operationLayer].LayerMat);
int radius = (operationLayer > 10 ? Math.Min(operationSupport.TipDiameter + drawnLayers, operationSupport.PillarDiameter) : operationSupport.BaseDiameter) / 2;
uint whitePixels;

Expand Down Expand Up @@ -1677,7 +1667,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
var operationDrainHole = (PixelDrainHole)operation;
for (int operationLayer = (int)operation.LayerIndex; operationLayer >= 0; operationLayer--)
{
var mat = modfiedLayers.GetOrAdd((uint)operationLayer, u => this[operationLayer].LayerMat);
var mat = modifiedLayers.GetOrAdd((uint)operationLayer, u => this[operationLayer].LayerMat);
int radius = operationDrainHole.Diameter / 2;
uint blackPixels;

Expand Down Expand Up @@ -1715,8 +1705,8 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
progress++;
}

progress.Reset("Saving", (uint) modfiedLayers.Count);
Parallel.ForEach(modfiedLayers, (modfiedLayer, state) =>
progress.Reset("Saving", (uint) modifiedLayers.Count);
Parallel.ForEach(modifiedLayers, (modfiedLayer, state) =>
{
this[modfiedLayer.Key].LayerMat = modfiedLayer.Value;
modfiedLayer.Value.Dispose();
Expand Down
6 changes: 3 additions & 3 deletions UVtools.Core/UVtools.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl>
<Description>MSLA/DLP, file analysis, repair, conversion and manipulation</Description>
<Version>0.6.6.1</Version>
<Version>0.6.7.1</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyVersion>0.6.7.0</AssemblyVersion>
<FileVersion>0.6.7.0</FileVersion>
<AssemblyVersion>0.6.7.1</AssemblyVersion>
<FileVersion>0.6.7.1</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
3 changes: 1 addition & 2 deletions UVtools.GUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@
<setting name="LayerRepairRemoveEmptyLayers" serializeAs="String">
<value>True</value>
</setting>
<setting name="LayerRepairRemoveIslandsBelowEqualPixelsDefault"
serializeAs="String">
<setting name="LayerRepairRemoveIslandsBelowEqualPixelsDefault" serializeAs="String">
<value>10</value>
</setting>
<setting name="PartialUpdateIslandsOnEditing" serializeAs="String">
Expand Down
27 changes: 27 additions & 0 deletions UVtools.GUI/Controls/BenchmarkTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace UVtools.GUI.Controls
{
public sealed class BenchmarkTest
{
public const string DEVCPU = "Intel® Core™ i9-9900K @ 3.60 GHz";
public const string DEVRAM = "G.SKILL Trident Z 32GB DDR4-3200MHz CL14";

public BenchmarkTest(string name, string functionName, float devSingleThreadResult = 0, float devMultiThreadResult = 0)
{
Name = name;
FunctionName = functionName;
DevSingleThreadResult = devSingleThreadResult;
DevMultiThreadResult = devMultiThreadResult;
}

public string Name { get; }
public string FunctionName { get; }

public float DevSingleThreadResult { get; }
public float DevMultiThreadResult { get; }

public override string ToString()
{
return $"{Name}";
}
}
}
Loading

0 comments on commit 4e4f3ca

Please sign in to comment.