CFieldDataClean.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using OTSCOMMONCLR;
  2. using OTSDataType;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace OTSModelSharp.Measure.OTSCleanliness
  9. {
  10. class CFieldDataClean : COTSFieldData
  11. {
  12. public CFieldDataClean(CBSEImgClr a_pBSEImg, double a_dPixelSize) : base(a_pBSEImg, a_dPixelSize)
  13. {
  14. }
  15. List<COTSParticleClr> m_listBigParticles = new List<COTSParticleClr>();
  16. List<COTSParticleClr> m_listSmallParticles = new List<COTSParticleClr>();
  17. double m_smallParticlePercentage;//if the small particles are measured for a percentage of the whole,then this variable remember the percentage.
  18. public List<COTSParticleClr> ListSmallParticles { get => m_listSmallParticles; set => m_listSmallParticles = value; }
  19. public List<COTSParticleClr> ListBigParticles { get => m_listBigParticles; set => m_listBigParticles = value; }
  20. public double SmallParticlePercentage { get => m_smallParticlePercentage; set => m_smallParticlePercentage = value; }
  21. // particle list
  22. public new List<COTSParticleClr> GetTopBorderedParticles()
  23. {
  24. List<COTSParticleClr> parts = new List<COTSParticleClr>();
  25. foreach (var p in ListBigParticles)
  26. {
  27. var segs = p.GetFeature().GetSegmentsList();//COTSSegment
  28. foreach (var seg in segs)
  29. {
  30. if (seg.GetHeight() == 0)
  31. {
  32. parts.Add(p);
  33. break;
  34. }
  35. }
  36. }
  37. return parts;
  38. }
  39. public new List<COTSParticleClr> GetBottomBorderedParticles()
  40. {
  41. List<COTSParticleClr> parts = new List<COTSParticleClr>();
  42. foreach (var p in ListBigParticles)
  43. {
  44. var segs = p.GetFeature().GetSegmentsList();
  45. foreach (var seg in segs)
  46. {
  47. if (seg.GetHeight() == this.Height - 1)//the lowest height is 767(height-1),cause starting from 0.
  48. {
  49. parts.Add(p);
  50. break;
  51. }
  52. }
  53. }
  54. return parts;
  55. }
  56. public new List<COTSParticleClr> GetLeftBorderedParticles()
  57. {
  58. List<COTSParticleClr> parts = new List<COTSParticleClr>();
  59. foreach (var p in ListBigParticles)
  60. {
  61. var segs = p.GetFeature().GetSegmentsList();
  62. foreach (var seg in segs)
  63. {
  64. if (seg.GetStart() == 0)
  65. {
  66. parts.Add(p);
  67. break;
  68. }
  69. }
  70. }
  71. return parts;
  72. }
  73. public new List<COTSParticleClr> GetRightBorderedParticles()
  74. {
  75. List<COTSParticleClr> parts = new List<COTSParticleClr>();
  76. foreach (var p in ListBigParticles)
  77. {
  78. var segs = p.GetFeature().GetSegmentsList();
  79. foreach (var seg in segs)
  80. {
  81. if (seg.GetStart() + seg.GetLength() == this.Width)
  82. {
  83. parts.Add(p);
  84. break;
  85. }
  86. }
  87. }
  88. return parts;
  89. }
  90. }
  91. }