123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using PaintDotNet.Base.DedicatedAnalysis.Inclusions.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.Inclusions.InclusionsGlobalSettings;
- namespace PaintDotNet.Base.DedicatedAnalysis.Inclusions.Standard.GBT10561_2005
- {
- public class GBT10561_2005 : InclusionsStandard
- {
- public GBT10561_2005(double pxPerUnit)
- {
- this.globalSettings.binaryThreshold = 175;
- this.globalSettings.pxPerUnit = pxPerUnit;
- this.globalSettings.distancesBetweenParticlesE = 40;
- this.globalSettings.distancesBetweenParticlesT = 10;
- this.globalSettings.distancesBetweenStringersE = 40;
- this.globalSettings.distancesBetweenStringersT = 10;
- this.globalSettings.minimumLength = 3;
- this.globalSettings.minimumWidth = 2;
- this.globalSettings.lwRatioLimit = 3f;
- string[] types = { "A", "B", "C", "D", "DS" };
- for (int i = 0; i < types.Length; i++)
- {
- TypesOfInclusions typesOfInclusion = new TypesOfInclusions(types[i]);
- typesOfInclusion.showColor = InclusionsStandard.RAINBOW_COLORS[i].ToArgb();
- this.globalSettings.typeDics.Add(types[i], typesOfInclusion);
- }
- this.globalSettings.colorOfInclusions.Add("Black", new ColorOfInclusions("Black",new TypesOfInclusions[] { this.globalSettings.typeDics["B"], this.globalSettings.typeDics["C"], this.globalSettings.typeDics["D"] },Color.Black));
- this.globalSettings.colorOfInclusions.Add("Gray", new ColorOfInclusions("Gray", new TypesOfInclusions[] { this.globalSettings.typeDics["A"] }, Color.DarkGray));
- this.globalSettings.colorOfInclusions.Add("DarkGray", new ColorOfInclusions("DarkGray", new TypesOfInclusions[] { this.globalSettings.typeDics["C"] }, Color.Gray));
- this.globalSettings.colorOfInclusions.Add("LightBlue", new ColorOfInclusions("LightBlue", new TypesOfInclusions[] { this.globalSettings.typeDics["B"], this.globalSettings.typeDics["D"] }, Color.LightBlue));
- }
- public override void determineType(Inclusion inclusion)
- {
- Dictionary<TypesOfInclusions, int> typeCount = new Dictionary<TypesOfInclusions, int>();
- foreach (var type in this.globalSettings.typeDics)
- {
- typeCount.Add(type.Value, 0);
- }
- switch (inclusion.classes)
- {
- case ClassesOfInclusions.α:
- typeCount[this.globalSettings.typeDics["A"]] = typeCount[this.globalSettings.typeDics["A"]] + 2;
- typeCount[this.globalSettings.typeDics["C"]] = typeCount[this.globalSettings.typeDics["C"]] + 2;
- break;
- case ClassesOfInclusions.β:
- typeCount[this.globalSettings.typeDics["B"]] = typeCount[this.globalSettings.typeDics["B"]] + 2;
- break;
- case ClassesOfInclusions.γ:
- typeCount[this.globalSettings.typeDics["A"]] = typeCount[this.globalSettings.typeDics["A"]] + 2;
- typeCount[this.globalSettings.typeDics["C"]] = typeCount[this.globalSettings.typeDics["C"]] + 2;
- break;
- case ClassesOfInclusions.δ:
- if (inclusion.physicalWidth >= 13)
- {
- typeCount[this.globalSettings.typeDics["DS"]] = typeCount[this.globalSettings.typeDics["DS"]] + 2;
- }
- else
- {
- typeCount[this.globalSettings.typeDics["D"]] = typeCount[this.globalSettings.typeDics["D"]] + 2;
- }
- break;
- }
- if (inclusion.color != null)
- {
- foreach (TypesOfInclusions item in inclusion.color.ofTypes)
- {
- typeCount[this.globalSettings.typeDics[item.type]]++;
- }
- }
- inclusion.type = typeCount.First(r => r.Value == typeCount.Max(t => t.Value)).Key;
- }
- public override void edgeErrorsCorrection(List<Inclusion> inclusions)
- {
- throw new NotImplementedException();
- }
-
- }
- }
|