using OTSCLRINTERFACE; using OTSDataType; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OTSModelSharp.Measure.OTSCleanliness { class CFieldDataClean : COTSFieldData { public CFieldDataClean(CBSEImgClr a_pBSEImg, double a_dPixelSize) : base(a_pBSEImg, a_dPixelSize) { } List m_listBigParticles = new List(); List m_listSmallParticles = new List(); double m_smallParticlePercentage;//if the small particles are measured for a percentage of the whole,then this variable remember the percentage. public List ListSmallParticles { get => m_listSmallParticles; set => m_listSmallParticles = value; } public List ListBigParticles { get => m_listBigParticles; set => m_listBigParticles = value; } public double SmallParticlePercentage { get => m_smallParticlePercentage; set => m_smallParticlePercentage = value; } // particle list public new List GetTopBorderedParticles() { List parts = new List(); foreach (var p in ListBigParticles) { var segs = p.GetFeature().GetSegmentsList();//COTSSegment foreach (var seg in segs) { if (seg.GetHeight() == 0) { parts.Add(p); break; } } } return parts; } public new List GetBottomBorderedParticles() { List parts = new List(); foreach (var p in ListBigParticles) { var segs = p.GetFeature().GetSegmentsList(); foreach (var seg in segs) { if (seg.GetHeight() == this.Height - 1)//the lowest height is 767(height-1),cause starting from 0. { parts.Add(p); break; } } } return parts; } public new List GetLeftBorderedParticles() { List parts = new List(); foreach (var p in ListBigParticles) { var segs = p.GetFeature().GetSegmentsList(); foreach (var seg in segs) { if (seg.GetStart() == 0) { parts.Add(p); break; } } } return parts; } public new List GetRightBorderedParticles() { List parts = new List(); foreach (var p in ListBigParticles) { var segs = p.GetFeature().GetSegmentsList(); foreach (var seg in segs) { if (seg.GetStart() + seg.GetLength() == this.Width) { parts.Add(p); break; } } } return parts; } } }