using PaintDotNet.Base.DedicatedAnalysis.Porosity.Model; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using static PaintDotNet.Base.DedicatedAnalysis.Porosity.PorositysGlobalSettings; namespace PaintDotNet.Base.DedicatedAnalysis.Porosity.Standard { public class PV6093 : PorositysStandard { public PV6093(double pxPerUnit) { this.globalSettings.binaryThreshold = 175; this.globalSettings.pxPerUnit = pxPerUnit; this.globalSettings.minimumLength = 3; this.globalSettings.minimumWidth = 2; string[] types = { "A" }; for (int i = 0; i < types.Length; i++) { TypesOfPorositys typesOfInclusion = new TypesOfPorositys(types[i]); typesOfInclusion.showColor = PorositysStandard.RAINBOW_COLORS[i].ToArgb(); this.globalSettings.typeDics.Add(types[i], typesOfInclusion); } this.globalSettings.colorOfPorositys.Add("Black", new ColorOfPorositys("Black", new TypesOfPorositys[] { this.globalSettings.typeDics["A"] }, Color.Black)); } public override void determineType(Porositys porosity) { Dictionary typeCount = new Dictionary(); foreach (var type in this.globalSettings.typeDics) { typeCount.Add(type.Value, 0); } if (porosity.color != null) { foreach (TypesOfPorositys item in porosity.color.ofTypes) { typeCount[this.globalSettings.typeDics[item.type]]++; } } porosity.type = typeCount.First(r => r.Value == typeCount.Max(t => t.Value)).Key; } public override void edgeErrorsCorrection(List porositys) { throw new NotImplementedException(); } } }