|
@@ -74,7 +74,7 @@ namespace OTSMeasureApp
|
|
|
//记录鼠标在BSE移动时 图像的位置
|
|
|
double m_MouseMoveImageX = -1;
|
|
|
double m_MouseMoveImageY = -1;
|
|
|
-
|
|
|
+
|
|
|
//记录采集点
|
|
|
List<Point> m_ElementSignPoint = new List<Point>();
|
|
|
//绘制采集点对象
|
|
@@ -101,7 +101,7 @@ namespace OTSMeasureApp
|
|
|
int FieldWitdh = 0;
|
|
|
double FieldHeight = 0;
|
|
|
|
|
|
- private otsdataconst.OTS_SysType_ID m_systype;
|
|
|
+ private otsdataconst.OTS_SysType_ID m_systype;
|
|
|
#endregion
|
|
|
public enum ImageType
|
|
|
{
|
|
@@ -114,9 +114,9 @@ namespace OTSMeasureApp
|
|
|
//线扫描曲线
|
|
|
GrayLevelLine = 3,
|
|
|
//显示去背景BSE图灰度曲线
|
|
|
- GrayAbandonLevelChart = 4,
|
|
|
+ GrayAbandonLevelChart = 4,
|
|
|
//
|
|
|
- ColorParticleImage=5
|
|
|
+ ColorParticleImage = 5
|
|
|
}
|
|
|
//图bfResult
|
|
|
public static bool bfResult = false;
|
|
@@ -132,12 +132,12 @@ namespace OTSMeasureApp
|
|
|
|
|
|
InitializeComponent();
|
|
|
m_MeasureAppForm = MeasureApp;
|
|
|
-
|
|
|
+
|
|
|
m_ElementPointGDIObjects = new List<CRectangleGDIObject>();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//进入时首先对XRayTable进行隐藏
|
|
|
panelXray.Visible = false;
|
|
|
//国际化
|
|
@@ -178,7 +178,7 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Image = coloredImage;
|
|
|
//设置Pictrue显示位置
|
|
|
pbBSEImage.Height = this.RestoreBounds.Height;
|
|
@@ -345,7 +345,7 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
nDwellTime = 8;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
int imageCount = GetScanImage(m_iWidth, m_iHeight, nDwellTime, ref originalBseData);
|
|
|
//取图不成功就返回
|
|
@@ -387,13 +387,13 @@ namespace OTSMeasureApp
|
|
|
|
|
|
//图像加载后的显示位置
|
|
|
m_CurrentMultiple = 0;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
pbBSEImage.Height = this.RestoreBounds.Height;
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Left = 0;
|
|
|
pbBSEImage.Top = 0;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -618,7 +618,7 @@ namespace OTSMeasureApp
|
|
|
m_IsShowImageType = ImageType.BSEImage;
|
|
|
m_imagetype = ImageType.BSEImage;
|
|
|
pbBSEImage.Show();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
@@ -709,40 +709,51 @@ namespace OTSMeasureApp
|
|
|
//获取图像数据
|
|
|
COTSSample WSample = m_MeasureAppForm.m_ProjData.GetWorkingSample();
|
|
|
double pixelSize = WSample.CalculatePixelSize();
|
|
|
-
|
|
|
+
|
|
|
var imageProcessParam = WSample.GetMsrParams().GetImageProcessParam();
|
|
|
|
|
|
var imageHandle = new CImageHandler();
|
|
|
m_systype = m_MeasureAppForm.m_ProjParam.GetResultData().m_systemTypeId;
|
|
|
-
|
|
|
-
|
|
|
+ if (m_systype == otsdataconst.OTS_SysType_ID.CleannessA)
|
|
|
+ {
|
|
|
+ coloredParticleImage = new Bitmap(m_iWidth, m_iHeight);
|
|
|
+ CBSEImgClr pImgNoBG = new CBSEImgClr(new Rectangle(0,0,m_iWidth,m_iHeight));
|
|
|
+ bfResult = imageHandle.GetColoredImage(imageProcessParam, pixelSize, originalBseData, m_iWidth, m_iHeight, ref pImgNoBG,ref coloredParticleImage);
|
|
|
+ m_imagetype = ImageType.ColorParticleImage;
|
|
|
+ //coloredParticleImage.getp
|
|
|
+ removeBGBseData = pImgNoBG.GetImageDataPtr();
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(m_systype == otsdataconst.OTS_SysType_ID.IncA)
|
|
|
+ {
|
|
|
bfResult = imageHandle.GetBSEImage(imageProcessParam, pixelSize, originalBseData, m_iWidth, m_iHeight, ref removeBGBseData);
|
|
|
m_IsShowImageType = ImageType.RemoveBGImage;
|
|
|
m_imagetype = ImageType.RemoveBGImage;
|
|
|
- //获取去背景灰度图数据
|
|
|
- dGrayAbandonLevelData = new double[(int)GrayLevel.Max];
|
|
|
- dGrayAbandonLevelData = GetGrayAbandonData(removeBGBseData, dGrayAbandonLevelData);
|
|
|
|
|
|
- //计算灰度去背景最大值
|
|
|
- dGrayAbandonLevelMax = dGrayAbandonLevelData[0];
|
|
|
- for (int i = 1; i < (int)GrayLevel.Max; i++)
|
|
|
- {
|
|
|
- dGrayAbandonLevelMax = Math.Max(dGrayAbandonLevelMax, dGrayAbandonLevelData[i]);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //获取去背景灰度图数据
|
|
|
+ dGrayAbandonLevelData = new double[(int)GrayLevel.Max];
|
|
|
+ dGrayAbandonLevelData = GetGrayAbandonData(removeBGBseData, dGrayAbandonLevelData);
|
|
|
+
|
|
|
+ //计算灰度去背景最大值
|
|
|
+ dGrayAbandonLevelMax = dGrayAbandonLevelData[0];
|
|
|
+ for (int i = 1; i < (int)GrayLevel.Max; i++)
|
|
|
+ {
|
|
|
+ dGrayAbandonLevelMax = Math.Max(dGrayAbandonLevelMax, dGrayAbandonLevelData[i]);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
//取图不成功就返回
|
|
|
if (!bfResult) { return; }
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//用于线扫描曲线
|
|
|
-
|
|
|
+
|
|
|
UpdateImageOrChart(m_imagetype);
|
|
|
-
|
|
|
+
|
|
|
myChart.Visible = false;
|
|
|
pbBSEImage.Show();
|
|
|
//切换显示至BSE图
|
|
@@ -761,7 +772,7 @@ namespace OTSMeasureApp
|
|
|
log.Error("(LZMeasureStatusWindow.ShowRemoveBGImage_Click) " + ex.ToString());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
#endregion
|
|
|
//显示灰度曲线
|
|
|
#region 显示灰度曲线
|
|
@@ -779,9 +790,9 @@ namespace OTSMeasureApp
|
|
|
try
|
|
|
{
|
|
|
m_imagetype = ImageType.GrayLevelChart;
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Hide();
|
|
|
-
|
|
|
+
|
|
|
//切换显示至BSE图
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = true;
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = true;
|
|
@@ -858,7 +869,7 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OTSMeasureStatusWindow));
|
|
|
this.control_XRayTable1 = new Control_XRayTable();
|
|
|
- this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(180,255,255);
|
|
|
+ this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(180, 255, 255);
|
|
|
this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
|
this.control_XRayTable1.GBInfoStr = "";
|
|
|
this.control_XRayTable1.GoodChineseName = "";
|
|
@@ -874,7 +885,7 @@ namespace OTSMeasureApp
|
|
|
this.control_XRayTable1.TabIndex = 0;
|
|
|
this.control_XRayTable1 = new OTSIncAGraph.Controls.Control_XRayTable();
|
|
|
this.panelXray.Controls.Add(this.control_XRayTable1);
|
|
|
-
|
|
|
+
|
|
|
//添加鼠标点击事件
|
|
|
myChart.MouseClick += new MouseEventHandler(this.LZMeasureStatusWindow_MouseClick);
|
|
|
pbBSEImage.MouseClick += new MouseEventHandler(HiddenXrayTablePanel_MouseClick);
|
|
@@ -884,10 +895,10 @@ namespace OTSMeasureApp
|
|
|
//
|
|
|
this.pbBSEImage.MouseUp += new MouseEventHandler(this.pbBSEImage_MouseUp);
|
|
|
this.pbBSEImage.MouseDown += new MouseEventHandler(this.pbBSEImage_MouseDown);
|
|
|
-
|
|
|
+
|
|
|
this.MouseUp += new MouseEventHandler(this.pbBSEImage_MouseUp);
|
|
|
this.MouseDown += new MouseEventHandler(this.pbBSEImage_MouseDown);
|
|
|
-
|
|
|
+
|
|
|
this.MouseWheel += new MouseEventHandler(this.pbBSEImage_MouseWheel);
|
|
|
|
|
|
log = NLog.LogManager.GetCurrentClassLogger();
|
|
@@ -1087,7 +1098,7 @@ namespace OTSMeasureApp
|
|
|
IsShowGrayLevelLine = true;
|
|
|
Rectangle rectangle = GetPictureBoxZoomSize(pbBSEImage);
|
|
|
if (pointStart.Equals(pointEnd))
|
|
|
-
|
|
|
+
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -1131,9 +1142,9 @@ namespace OTSMeasureApp
|
|
|
pen.DashPattern = new float[] { 5, 5 };
|
|
|
int fontOffWidth = 50;
|
|
|
int fontOffHeight = 10;
|
|
|
-
|
|
|
+
|
|
|
int scaleLine = 0;
|
|
|
- for (int i = 25; i <= 225; i+=25)
|
|
|
+ for (int i = 25; i <= 225; i += 25)
|
|
|
{
|
|
|
scaleLine = (int)(grayValue * i);
|
|
|
e.Graphics.DrawLine(pen, new Point(rectangle.X, (rectangle.Y + rectangle.Height * 3 / 4) - scaleLine), new Point(rectangle.X + fontOffWidth, (rectangle.Y + rectangle.Height * 3 / 4) - scaleLine));
|
|
@@ -1382,7 +1393,7 @@ namespace OTSMeasureApp
|
|
|
m_imagetype = ImageType.GrayAbandonLevelChart;
|
|
|
COTSSample WSample = m_MeasureAppForm.m_ProjData.GetWorkingSample();
|
|
|
var pixelSize = WSample.CalculatePixelSize();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var imageHandle = new CImageHandler();
|
|
|
bfResult = imageHandle.GetBSEImage(WSample.GetMsrParams().GetImageProcessParam(), pixelSize, originalBseData, m_iWidth, m_iHeight, ref removeBGBseData);
|
|
@@ -1399,7 +1410,7 @@ namespace OTSMeasureApp
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Hide();
|
|
|
|
|
|
//切换显示至BSE图
|
|
@@ -1413,8 +1424,8 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text = "SwitchDisplayToBSEDiagram";
|
|
|
}
|
|
|
-
|
|
|
- UpdateImageOrChart(m_imagetype );
|
|
|
+
|
|
|
+ UpdateImageOrChart(m_imagetype);
|
|
|
|
|
|
int[] XData = new int[(int)GrayLevel.Max];
|
|
|
for (int i = 0; i < (int)GrayLevel.Max; i++)
|
|
@@ -1453,7 +1464,7 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
SetContentMenu();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -1467,7 +1478,7 @@ namespace OTSMeasureApp
|
|
|
//设置右键菜单中的项 是否可编辑
|
|
|
SetContextMenuEnabled(true);
|
|
|
//显示切换至BSE图
|
|
|
- if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "切换显示至BSE图"|| contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "SwitchDisplayToBSEDiagram")
|
|
|
+ if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "切换显示至BSE图" || contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "SwitchDisplayToBSEDiagram")
|
|
|
{
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = true;
|
|
|
|
|
@@ -1492,7 +1503,7 @@ namespace OTSMeasureApp
|
|
|
//panel1.Visible = false;
|
|
|
}
|
|
|
}
|
|
|
- else if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "切换显示至BSE去背景图"|| contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "SwitchDisplayToBSEBackgroundImage")
|
|
|
+ else if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "切换显示至BSE去背景图" || contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text == "SwitchDisplayToBSEBackgroundImage")
|
|
|
{
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = true;
|
|
|
if (OTSCommon.Language.ReadDefaultLanguage() == "ZH")
|
|
@@ -1503,7 +1514,7 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text = "SwitchDisplayToBSEDiagram";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//显示去背景BSE图
|
|
|
if (originalBseData != null)
|
|
|
{
|
|
@@ -1511,12 +1522,12 @@ namespace OTSMeasureApp
|
|
|
m_IsShowImageType = ImageType.RemoveBGImage;
|
|
|
m_imagetype = ImageType.RemoveBGImage;
|
|
|
ShowImage(m_iWidth, m_iHeight, removeBGBseData);
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Show();
|
|
|
}
|
|
|
}
|
|
|
myChart.Visible = false;
|
|
|
- UpdateImageOrChart(m_imagetype );
|
|
|
+ UpdateImageOrChart(m_imagetype);
|
|
|
GetLineImage(YSize, m_iWidth, ref Imagedata);
|
|
|
m_CurrentMultiple = 0;
|
|
|
panelXray.Visible = false;
|
|
@@ -1608,14 +1619,14 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
MessageBox.Show(table["message24"].ToString() + ex.ToString());
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
#region 鼠标是否在图像上移动
|
|
@@ -1701,7 +1712,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
#endregion
|
|
|
#region 获取线扫描初始位置
|
|
@@ -1761,7 +1772,7 @@ namespace OTSMeasureApp
|
|
|
MenuItemLineScam.Checked = false;
|
|
|
//电镜设置对象
|
|
|
//控制类对象初始化
|
|
|
-
|
|
|
+
|
|
|
EDSController m_EDSHardwareMgr = EDSController.GetEDSController();
|
|
|
//1.连接电镜
|
|
|
if (m_EDSHardwareMgr.Connect())
|
|
@@ -1810,7 +1821,7 @@ namespace OTSMeasureApp
|
|
|
//4-2 根据位置绘制标记
|
|
|
Point ImgPoint = new Point((int)dMouseImgX, (int)dMouseImgY);
|
|
|
Rectangle rect = new Rectangle(p_mouseCurrentTempPoint, new Size(1, 1));
|
|
|
- CRectangleGDIObject createRect = new CRectangleGDIObject(rect, ImgPoint, m_CurrentMultiple, CreateRectangleType.DrawBSEElementSignPoint);
|
|
|
+ CRectangleGDIObject createRect = new CRectangleGDIObject(rect, ImgPoint, m_CurrentMultiple, CreateRectangleType.DrawBSEElementSignPoint);
|
|
|
m_ElementPointGDIObjects.Add(createRect);
|
|
|
//5.获取成功后弹出对话框
|
|
|
//计数率
|
|
@@ -1855,11 +1866,11 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
public void DelElementPointGDIObjects()
|
|
|
{
|
|
@@ -1951,7 +1962,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
public bool InsertDataToExcelTable(List<System.Data.DataTable> a_list_ElementData, string a_filePath, List<string> a_ImgFilePath)
|
|
|
{
|
|
|
- var m_xe = new ExcelEdit();
|
|
|
+ var m_xe = new ExcelEdit();
|
|
|
m_xe.Create();
|
|
|
Microsoft.Office.Interop.Excel.Worksheet ws = m_xe.GetSheet("Sheet1");
|
|
|
m_xe.m_ws = ws;
|
|
@@ -2059,7 +2070,7 @@ namespace OTSMeasureApp
|
|
|
//在picturebox的鼠标按下事件里.
|
|
|
private void pbBSEImage_MouseUp(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
MoveFlag = false;
|
|
|
}
|
|
|
|
|
@@ -2083,7 +2094,7 @@ namespace OTSMeasureApp
|
|
|
m_CurrentMultiple += Convert.ToSingle(m_Multiple.ToString("f2"));
|
|
|
pbBSEImage.Width += Convert.ToInt32(m_iWidth * m_Multiple);
|
|
|
pbBSEImage.Height += Convert.ToInt32(m_iHeight * m_Multiple);
|
|
|
- WheelElementPointGDIObjects(e.Location,m_CurrentMultiple);
|
|
|
+ WheelElementPointGDIObjects(e.Location, m_CurrentMultiple);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -2097,7 +2108,7 @@ namespace OTSMeasureApp
|
|
|
else
|
|
|
{
|
|
|
m_CurrentMultiple = 0;
|
|
|
-
|
|
|
+
|
|
|
pbBSEImage.Height = this.RestoreBounds.Height;
|
|
|
pbBSEImage.Width = this.RestoreBounds.Height * 4 / 3;
|
|
|
pbBSEImage.Left = 0;
|
|
@@ -2115,20 +2126,20 @@ namespace OTSMeasureApp
|
|
|
int sizeChangeY = sizeChangePoint.Y - m_GetBSEImageInitPoint.Y;
|
|
|
RectangleF sizeChangeRectF = m_ElementPointGDIObjects[0].GetZoomedRegionF();
|
|
|
sizeChangeRectF.X = m_ElementPointGDIObjects[0].GetZoomedRegionF().X + sizeChangeX;
|
|
|
- m_ElementPointGDIObjects[0].SetInitRegionF(sizeChangeRectF);
|
|
|
+ m_ElementPointGDIObjects[0].SetInitRegionF(sizeChangeRectF);
|
|
|
m_GetBSEImageInitPoint = sizeChangePoint;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- WheelElementPointGDIObjects(e.Location,m_CurrentMultiple);
|
|
|
+ WheelElementPointGDIObjects(e.Location, m_CurrentMultiple);
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 缩放时改变 单点标识位置
|
|
|
/// </summary>
|
|
|
/// <param name="m_CurrentMultiple"></param>
|
|
|
- public void WheelElementPointGDIObjects(Point refPoint,float CurrentMultiple)
|
|
|
+ public void WheelElementPointGDIObjects(Point refPoint, float CurrentMultiple)
|
|
|
{
|
|
|
if (m_ElementPointGDIObjects.Count > 0)
|
|
|
{
|
|
@@ -2202,7 +2213,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
ToolWindow toolWindow = new ToolWindow(m_MeasureAppForm, this);
|
|
|
int grayStart = 0;
|
|
|
int grayEnd = 0;
|
|
@@ -2253,10 +2264,10 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName(), m_MeasureAppForm, originalBseData, m_iWidth, m_iHeight,this);
|
|
|
+ SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName(), m_MeasureAppForm, originalBseData, m_iWidth, m_iHeight, this);
|
|
|
DialogResult dialogResult = specialParticleForm.ShowDialog();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|