123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PaintDotNet.Base.DedicatedAnalysis.Porosity
- {
- /// <summary>
- /// 孔隙抽象全局设置
- /// </summary>
- public class PorositysGlobalSettings: DedicatedAnalysisGlobalSettings
- {
- public bool autoThreshold = true;
- public int binaryThreshold;
- /// <summary>
- /// 轧制方向
- /// </summary>
- public RollingDirection rollingDirection;
- /// <summary>
- /// 系统纳米标尺每像素长度
- /// </summary>
- public double pxPerUnit;
- /// <summary>
- /// 微粒之间的距离(distances between particles) 垂直距离
- /// </summary>
- public int distancesBetweenParticlesE;
- /// <summary>
- /// 微粒之间的距离(distances between particles) 水平距离
- /// </summary>
- public int distancesBetweenParticlesT;
- /// <summary>
- /// 条串之间的距离(distances between stringers) 垂直距离
- /// </summary>
- public int distancesBetweenStringersE;
- /// <summary>
- /// 条串之间的距离(distances between stringers) 水平距离
- /// </summary>
- public int distancesBetweenStringersT;
- /// <summary>
- /// 判定微粒最小长度尺寸
- /// </summary>
- public int minimumLength;
- /// <summary>
- /// 判定微粒最小宽度尺寸
- /// </summary>
- public int minimumWidth;
- /// <summary>
- /// 长宽比界限,用于判断球型孔隙
- /// </summary>
- public double lwRatioLimit;
- public Dictionary<String, TypesOfPorositys> typeDics = new Dictionary<string, TypesOfPorositys>();
- public Dictionary<String, ColorOfPorositys> colorOfPorositys = new Dictionary<string, ColorOfPorositys>();
- public enum RollingDirection
- {
- [Description("纵向")]
- PORTRAIT,
- [Description("横向")]
- HORIZONTAL
- }
- /// <summary>
- /// 孔隙类型
- /// </summary>
- public class TypesOfPorositys
- {
- public TypesOfPorositys(string type)
- {
- this.type = type;
- }
- /// <summary>
- /// 展示颜色
- /// </summary>
- public int showColor;
- /// <summary>
- /// 孔隙类型字符串
- /// </summary>
- public string type;
-
- }
- public class ColorOfPorositys
- {
- public string colorName;
- public TypesOfPorositys[] ofTypes;
- /// <summary>
- /// 判断孔隙rgb
- /// rgb 上下限
- /// </summary>
- public byte ru;
- public byte rd;
- public byte gu;
- public byte gd;
- public byte bu;
- public byte bd;
- public ColorOfPorositys(string colorName, TypesOfPorositys[] ofTypes, Color color)
- {
- this.colorName = colorName;
- this.ofTypes = ofTypes;
- this.rd = (byte)(color.R - 10 < 0 ? 0 : color.R - 10);
- this.ru = (byte)(color.R + 10 > 255 ? 255 : color.R + 10);
- this.gd = (byte)(color.G - 10 < 0 ? 0 : color.G - 10);
- this.gu = (byte)(color.G + 10 > 255 ? 255 : color.G + 10);
- this.bd = (byte)(color.B - 10 < 0 ? 0 : color.B - 10);
- this.bu = (byte)(color.B + 10 > 255 ? 255 : color.B + 10);
- }
- public ColorOfPorositys(string colorName, TypesOfPorositys[] ofTypes, byte ru, byte rd, byte gu, byte gd, byte bu, byte bd)
- {
- this.colorName = colorName;
- this.ofTypes = ofTypes;
- this.ru = ru;
- this.rd = rd;
- this.gu = gu;
- this.gd = gd;
- this.bu = bu;
- this.bd = bd;
- }
- public void setColor(Color color)
- {
- this.rd = (byte)(color.R - 10 < 0 ? 0 : color.R - 10);
- this.ru = (byte)(color.R + 10 > 255 ? 255 : color.R + 10);
- this.gd = (byte)(color.G - 10 < 0 ? 0 : color.G - 10);
- this.gu = (byte)(color.G + 10 > 255 ? 255 : color.G + 10);
- this.bd = (byte)(color.B - 10 < 0 ? 0 : color.B - 10);
- this.bu = (byte)(color.B + 10 > 255 ? 255 : color.B + 10);
- }
- }
- }
- }
|