Jelajahi Sumber

add the red rectangle while displaying the field image with particle.

gsp 1 tahun lalu
induk
melakukan
148b57e0db

+ 6 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSField.cs

@@ -178,7 +178,9 @@ namespace OTSDataType
             CImageHandler imghandler = new CImageHandler();
             List<COTSParticleClr> Parts = GetListAnalysisParticles();
             Bitmap img = new Bitmap(this.ImgWidth, this.ImgHeight);
-            imghandler.GetImageWithBlackColoredParts(Parts, ref img);
+            var imgparam = m_sample.GetMsrParams().GetImageProcessParam();
+            var pixelsize = m_sample.CalculatePixelSize();
+            imghandler.GetImageWithBlackColoredParts(Parts,imgparam,pixelsize, ref img);
             return img;
         }
         public Bitmap GetAnalysisParticleSTDColoredImage()
@@ -186,7 +188,9 @@ namespace OTSDataType
             CImageHandler imghandler = new CImageHandler();
             List<COTSParticleClr> Parts = GetListAnalysisParticles();
             Bitmap img = new Bitmap(this.ImgWidth, this.ImgHeight);
-            imghandler.GetImageWithSTDColoredParts(Parts, ref img);
+            var imgparam = m_sample.GetMsrParams().GetImageProcessParam();
+            var pixelsize = m_sample.CalculatePixelSize();
+            imghandler.GetImageWithSTDColoredParts(Parts, imgparam, pixelsize, ref img);
             return img;
         }
         public void SetBSEImage(CBSEImgClr a_pBSEImg)

+ 23 - 3
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -413,7 +413,7 @@ namespace OTSModelSharp.ServiceCenter
 
             return;
         }
-        public void GetImageWithBlackColoredParts(List<COTSParticleClr> analysitParts, ref Bitmap a_pBmpOut)
+        public void GetImageWithBlackColoredParts(List<COTSParticleClr> analysitParts,COTSImageProcParam a_pImgProcessParam,double a_pixelSize, ref Bitmap a_pBmpOut)
         {
 
 
@@ -446,12 +446,22 @@ namespace OTSModelSharp.ServiceCenter
                     }
                 }
 
+            }
+            Graphics graphics = Graphics.FromImage(a_pBmpOut);
+
+            // 绘制一个红色矩形
+            Pen pen = new Pen(Color.Red, 1);
+            var overlap = a_pImgProcessParam.GetOverlapParam();
+            if (overlap > 0)
+            {
+                int overlapPixels = (int)(overlap / a_pixelSize);
+                graphics.DrawRectangle(pen, overlapPixels, overlapPixels, a_pBmpOut.Width - 2 * overlapPixels, a_pBmpOut.Height - 2 * overlapPixels);
+
             }
 
-        
             return;
         }
-        public void GetImageWithSTDColoredParts(List<COTSParticleClr> analysitParts, ref Bitmap a_pBmpOut)
+        public void GetImageWithSTDColoredParts(List<COTSParticleClr> analysitParts, COTSImageProcParam a_pImgProcessParam, double a_pixelSize, ref Bitmap a_pBmpOut)
         {
 
 
@@ -486,7 +496,17 @@ namespace OTSModelSharp.ServiceCenter
 
             }
 
+            Graphics graphics = Graphics.FromImage(a_pBmpOut);
 
+            // 绘制一个红色矩形
+            Pen pen = new Pen(Color.Red, 1);
+            var overlap = a_pImgProcessParam.GetOverlapParam();
+            if (overlap > 0)
+            {
+                int overlapPixels = (int)(overlap / a_pixelSize);
+                graphics.DrawRectangle(pen, overlapPixels, overlapPixels, a_pBmpOut.Width - 2 * overlapPixels, a_pBmpOut.Height - 2 * overlapPixels);
+
+            }
             return;
         }