Browse Source

improve the autoBC function

gsp 5 tháng trước cách đây
mục cha
commit
a6c8f9b9cb

+ 3 - 3
Bin/x64/Debug/Config/SysData/OTSProgMgrParam.pmf

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <XMLData RunMode="ProfessionalMode" SysType="IncA">
-  <Member RegName="BrightnessContrastRegulateParam" BrightPhaseElement="Cu" BrightPhaseValue="209" DarkPhaseElement="C" DarkPhaseValue="40" InitialBrightness="44.44444446" InitialContrast="44.8769362" mag="100" StdMaterialOTSPos="-10705,4713" ToRun="true" Period="60" AutoRegulateType="EveryPeriod" />
+  <Member RegName="BrightnessContrastRegulateParam" AutoRegulateType="EveryPeriod" BrightPhaseElement="Cu" BrightPhaseValue="209" DarkPhaseElement="C" DarkPhaseValue="40" InitialBrightness="44.44444446" InitialContrast="44.8769362" mag="100" Period="60" StdMaterialOTSPos="-10705,4713" ToRun="false" />
   <Member RegName="GenParam" DefaultArea="1400" DefaultSampleName="Sample" DefaultShape="0" EngineType="0:InclustionEngine" MeasParamFileFolderName=".\Config\ProData\" MeasSwitch="true" PartSTDLibFolderName=".\Config\SysData\" PropertyDisplayMode="0" StdLibFileName="NoSTDDB" SteelTechnology="0" />
   <Member RegName="ImageProcParam" AutoBGRemoveType="0:MIDDLE" BGRemoveType="1:MANUAL" MatrixStep="0" OverlapParam="0" ParticleSelectionCondition="">
     <Member RegName="BGGray" end="255" start="175" />
     <Member RegName="IncArea" end="10000" start="5" />
     <Member RegName="ParticleGray" end="255" start="0" />
   </Member>
-  <Member RegName="ImageScanParam" ImageResolution="4:_1536_1024" SatrtImageMode="0:Spiral" ScanImageSpeed="0:low" StopMode="0:CoverMode,2:FieldMode" StopParamArea="10" StopParamFields="2" StopParamMeasTime="360" StopParamParticles="5000" />
+  <Member RegName="ImageScanParam" ImageResolution="3:_1024_768" SatrtImageMode="0:Spiral" ScanImageSpeed="0:low" StopMode="0:CoverMode,2:FieldMode" StopParamArea="10" StopParamFields="2" StopParamMeasTime="360" StopParamParticles="5000" />
   <Member RegName="SpecialGrayParam" ToRun="false">
     <Collection RegName="GrayRangeList" />
   </Member>
@@ -15,5 +15,5 @@
     <Member RegName="XAxis" end="55000" start="-55000" />
     <Member RegName="YAxis" end="55000" start="-55000" />
   </Member>
-  <Member RegName="XrayParam" AnalyExpCount="3000" IfAutoId="true" KnownElements="C,N,O,F,Na,Mg,Al,Si,P,S,Ca,Ti,V,Cr,Mn,Fe,Zr,Nb,Mo,La,Ce" MidAnalyAQTime="300" QuantifyMinSize="5" ScanMode="0:PointMode" SmallPartAQTime="300" UseFilter="false" UsingXray="true" XrayLimit="200" />
+  <Member RegName="XrayParam" AnalyExpCount="3000" IfAutoId="false" KnownElements="C,N,O,F,Na,Mg,Al,Si,P,S,Ca,Ti,V,Cr,Mn,Fe,Zr,Nb,Mo,La,Ce" MidAnalyAQTime="300" QuantifyMinSize="5" ScanMode="0:PointMode" SmallPartAQTime="300" UseFilter="false" UsingXray="true" XrayLimit="200" />
 </XMLData>

+ 20 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_EN.xml

@@ -132,6 +132,26 @@
 	  <Control name="str1" text="Close connection" />
 	  <Control name="str2" text="Connect" />
     </Controls>
+  </Form>
+   <Form>
+  <Name>frmBCRegulate</Name>
+    <Controls>
+	   <Control name="frmcaption" text="BrightnessContrastRegulate" />
+	  <Control name="stdpos" text="STDPos" />
+	  <Control name="dark" text="Dark" />
+	  <Control name="bright" text="Bright" />
+	  <Control name="mag" text="Mag" />
+	  <Control name="initbright" text="InitialBright" />
+	  <Control name="initcontrast" text="InitialContrast" />
+	  <Control name="autoBCTest" text="Excute" />
+	  <Control name="stop" text="Stop" />
+	  <Control name="enableAutoBC" text="Enable" />
+	  <Control name="everyperiod" text="Interval" />
+	  <Control name="everysample" text="EverySample" />
+	  <Control name="record" text="OK" />
+	  <Control name="read" text="Read" />
+	  <Control name="write" text="Wirte" />
+     </Controls>
   </Form>
    <!-- OTSIncAReportApp -->
 <Form>

+ 20 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -141,6 +141,26 @@
 	  <Control name="str2" text="连接" />
      </Controls>
   </Form>
+   <Form>
+  <Name>frmBCRegulate</Name>
+    <Controls>
+	   <Control name="frmcaption" text="亮度对比度调节" />
+	  <Control name="stdpos" text="标样位置" />
+	  <Control name="dark" text="暗相灰度" />
+	  <Control name="bright" text="亮相灰度" />
+	  <Control name="mag" text="放大倍数" />
+	  <Control name="initbright" text="初始亮度设定" />
+	  <Control name="initcontrast" text="初始对比度设定" />
+	  <Control name="autobcTest" text="测试执行" />
+	  <Control name="stop" text="停止执行" />
+	  <Control name="enableautobc" text="自动执行亮度对比度" />
+	  <Control name="everyperiod" text="时间间隔" />
+	  <Control name="everysample" text="每样品" />
+	  <Control name="record" text="确定" />
+	  <Control name="read" text="读取" />
+	  <Control name="write" text="输出" />
+     </Controls>
+  </Form>
  <!-- OTSIncAReportApp -->
 <Form>
    <Name>frmReportApp</Name>

+ 1 - 1
Bin/x64/Debug/Resources/XMLData/LanguageDefine.xml

@@ -1,4 +1,4 @@
 <?xml version="1.0" standalone="yes"?>
 <Language>
-  <DefaultLanguage>ZH</DefaultLanguage>
+  <DefaultLanguage>EN</DefaultLanguage>
 </Language>

+ 22 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSImageProcParam.cs

@@ -85,7 +85,7 @@ namespace OTSDataType
         {
             Init();
             // copy data over
-            Duplicate(a_oSource);
+            copyfrom(a_oSource);
         }
         public void Init()
         {
@@ -121,7 +121,7 @@ namespace OTSDataType
        public void SetOverlapParam(int overlap) { m_OverlapParam = overlap; }
 
 
-        public void Duplicate(COTSImageProcParam a_oSource)
+        public void copyfrom(COTSImageProcParam a_oSource)
         {
 
             // copy data over
@@ -138,6 +138,26 @@ namespace OTSDataType
             m_OverlapParam = a_oSource.m_OverlapParam;
             matrixStep = a_oSource.matrixStep;
 
+        }
+        public COTSImageProcParam Duplicate()
+        {
+            var a_oSource = this;
+            // copy data over
+            COTSImageProcParam procParam =new COTSImageProcParam();
+
+            procParam.m_oIncArea.SetStart(a_oSource.m_oIncArea.GetStart());
+            procParam.m_oIncArea.SetEnd(a_oSource.m_oIncArea.GetEnd());
+            procParam.m_oBGGray.SetStart(a_oSource.m_oBGGray.GetStart());
+            procParam.m_oBGGray.SetEnd(a_oSource.m_oBGGray.GetEnd());
+            procParam.m_oParticleEigenGray.SetStart(a_oSource.m_oParticleEigenGray.GetStart());
+            procParam.m_oParticleEigenGray.SetEnd(a_oSource.m_oParticleEigenGray.GetEnd());
+            procParam.m_BGRemoveType = a_oSource.m_BGRemoveType;
+            procParam.m_autoBGRemoveType = a_oSource.m_autoBGRemoveType;
+            procParam.SetParticleSelectCondition(a_oSource.GetParticleSelectCondition());
+            procParam.m_OverlapParam = a_oSource.m_OverlapParam;
+            procParam.matrixStep = a_oSource.matrixStep;
+            return procParam;
+
         }
         public bool Equals(COTSImageProcParam a_oSource)
         {

+ 29 - 3
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSImageScanParam.cs

@@ -71,7 +71,7 @@ namespace OTSDataType
             // copy data over
             Init();
         }
-        void Duplicate( COTSImgScanPrm  a_oSource)
+     public void CopyFrom( COTSImgScanPrm  a_oSource)
 	{
 
         // copy data over
@@ -95,13 +95,39 @@ namespace OTSDataType
 
        
     }
+       
+        public COTSImgScanPrm Duplicate()
+        {
+            COTSImgScanPrm a_oSource = this;
+            COTSImgScanPrm prm = new COTSImgScanPrm();
+            // copy data over
+            prm.m_nStopMode = a_oSource.m_nStopMode;
+            prm.m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime;
+            prm.m_nStopParamFields = a_oSource.m_nStopParamFields;
+            prm.m_nStopParamParticles = a_oSource.m_nStopParamParticles;
+            prm.m_nStopParamArea = a_oSource.m_nStopParamArea;
+            prm.m_nSatrtImageMode = a_oSource.m_nSatrtImageMode;
+            prm.m_nImageResulotion = a_oSource.m_nImageResulotion;
+            prm.m_nScanImageSpeed = a_oSource.m_nScanImageSpeed;
+
+            prm.m_nFieldStopMode = a_oSource.m_nFieldStopMode;
+            prm.m_nFieldAreaPercentage = a_oSource.m_nFieldAreaPercentage;
+            prm.m_nFieldLargeParticles = a_oSource.m_nFieldLargeParticles;
+            prm.m_nFieldLargeParticlesPercentage = a_oSource.m_nFieldLargeParticlesPercentage;
+            prm.m_nFieldSmallParticles = a_oSource.m_nFieldSmallParticles;
+            prm.m_nFieldSmallParticlesPercentage = a_oSource.m_nFieldSmallParticlesPercentage;
+
+            //m_OverlapParam = a_oSource.m_OverlapParam;
+            return prm;
+
+        }
 
-     public  COTSImgScanPrm ( COTSImgScanPrm  a_oSource)
+        public  COTSImgScanPrm ( COTSImgScanPrm  a_oSource)
 	{
 	
 
 		// copy data over
-		Duplicate(a_oSource);
+		CopyFrom(a_oSource);
     }
       public  bool Equals(COTSImgScanPrm  a_oSource) 
 	{

+ 26 - 10
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSXRayParam.cs

@@ -63,7 +63,7 @@ namespace OTSDataType
             Init();
         }
         // duplication
-        void Duplicate(COTSXRayParam a_oSource)
+        void CopyFrom(COTSXRayParam a_oSource)
         {
 
             // copy data over
@@ -83,10 +83,31 @@ namespace OTSDataType
             m_analysisElements = a_oSource.m_analysisElements;
 
         }
+       public COTSXRayParam Duplicate()
+        {
+            COTSXRayParam prm=new COTSXRayParam();
+            COTSXRayParam a_oSource = this;
+            // copy data over
+            prm.m_nScanMode = a_oSource.m_nScanMode;
+
+            prm.m_nAnalyLowestCount = a_oSource.m_nAnalyLowestCount;
+
+            prm.m_nMidAnalyAQTime = a_oSource.m_nMidAnalyAQTime;
+
+
+            prm.m_nUsingXray = a_oSource.m_nUsingXray;
+
+            prm.m_XrayLimit = a_oSource.m_XrayLimit;
+            prm.m_nQutantifyMinSize = a_oSource.m_nQutantifyMinSize;
+            prm.m_nSmallPartXrayTime = a_oSource.m_nSmallPartXrayTime;
+            prm.m_IfAutoId = a_oSource.m_IfAutoId;
+            prm.m_analysisElements = a_oSource.m_analysisElements;
+            return prm;
+        }
         // copy constructor
         public COTSXRayParam(COTSXRayParam a_oSource)
         {       // copy data over
-            Duplicate(a_oSource);
+            CopyFrom(a_oSource);
         }
         // ==operator
         public bool Equals(COTSXRayParam a_oSource)
@@ -208,9 +229,7 @@ namespace OTSDataType
 
                 xQuantifyMinSize.AssignValue(m_nQutantifyMinSize);
 
-                xnUsingXray.AssignValue(m_nUsingXray);
-
-                //xnUseFilter.AssignValue(m_UseFilter);
+                xnUsingXray.AssignValue(m_nUsingXray);             
 
                 xXrayLimit.AssignValue(m_XrayLimit);
 
@@ -235,12 +254,9 @@ namespace OTSDataType
 
                 m_nQutantifyMinSize = xQuantifyMinSize.value();
 
-                m_nUsingXray = xnUsingXray.value();
+                m_nUsingXray = xnUsingXray.value();            
 
-                //m_UseFilter = xnUseFilter.value();
-
-                m_XrayLimit = xXrayLimit.value();
-               
+                m_XrayLimit = xXrayLimit.value();             
                     
 
                 m_IfAutoId = xIfautoid.value();

+ 3 - 3
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs

@@ -134,14 +134,14 @@ namespace OTSDataType
             }
         }
 
-        public void SetImageScanParam(COTSImgScanPrm a_poImageScanParam)
+        public void CopyImageScanParam(COTSImgScanPrm a_poImageScanParam)
         {
 
             m_poImageScanParam =new COTSImgScanPrm( a_poImageScanParam);
         }
 
         // image process parameter
-        public void SetImageProcessParam(COTSImageProcParam a_poImageProcessParam)
+        public void CopyImageProcessParam(COTSImageProcParam a_poImageProcessParam)
         {
             // make sure that image process parameter always valid 
             m_poImageProcessParam = new COTSImageProcParam( a_poImageProcessParam);
@@ -153,7 +153,7 @@ namespace OTSDataType
         public string GetSTDName() { return m_strSTDName; }
         public void SetSTDName(string a_strName) { m_strSTDName = a_strName; }
         // x-ray parameter 
-        public void SetXRayParam(COTSXRayParam a_poXRayParam)
+        public void CopyXRayParam(COTSXRayParam a_poXRayParam)
         {
             // make sure that x-ray parameter always valid 
             m_poXRayParam = new COTSXRayParam( a_poXRayParam);

+ 7 - 2
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/CMeasure.cs

@@ -406,7 +406,12 @@ namespace OTSModelSharp
 
             HolePreviewThreadOver();
         }
-       
+        public void DoBrightnessContrastAdjust()
+        { 
+           BCregulater = new CBrightnessContrastAdjust(this);
+            BCregulater.DoBrightnessContrastAdjust();   
+
+        }
 
         public COTSSample CreatePreviewSample(CDomain a_pMsrArea)
         {
@@ -447,7 +452,7 @@ namespace OTSModelSharp
 
             CSampleParam poMsrParams = pHoleSample.GetMsrParams();
             poImageScanParam.SetImageResulotion(GetListMeasurableSamples()[0].GetMsrParams().GetImageScanParam().GetImageResulotion());//由于各样品分辨率应该一致,故此处没有读取选取的特定样品孔样品
-            poMsrParams.SetImageScanParam(poImageScanParam);
+            poMsrParams.CopyImageScanParam(poImageScanParam);
             pHoleSample.SetMsrParams(poMsrParams);
 
             return pHoleSample;

+ 5 - 4
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -305,11 +305,12 @@ namespace OTSMeasureApp
             CSampleParam poMsrParams = new CSampleParam();
             poMsrParams.m_nPackId = GetDefaultParam().SystemTypeId;
             poMsrParams.m_runmode = GetDefaultParam().m_runmode;
-            var m_pParam = GetDefaultParam().GetCommonParam();
+          
             //MEMBRANE_TYPE a_nVal = (MEMBRANE_TYPE)m_pParam.GetMembraneType();
-            poMsrParams.SetImageScanParam(GetDefaultParam().GetImageScanParam ());
-            poMsrParams.SetImageProcessParam(GetDefaultParam().GetImageProcParam()); 
-            poMsrParams.SetXRayParam(GetDefaultParam().GetXRayParam());
+            poMsrParams.CopyImageScanParam(GetDefaultParam().GetImageScanParam ());
+            poMsrParams.CopyImageProcessParam(GetDefaultParam().GetImageProcParam()); 
+            poMsrParams.CopyXRayParam(GetDefaultParam().GetXRayParam());
+            var m_pParam = GetDefaultParam().GetCommonParam();
             String sSTDName = m_pParam.GetSTDSelect();
             poMsrParams.SetSTDName(sSTDName);
             poMsrParams.SetSteelTechnology((STEEL_TECHNOLOGY)m_pParam.GetSteelTechnology());

+ 5 - 4
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.cs

@@ -347,15 +347,16 @@ namespace OTSMeasureApp
         {
             OTSModelSharp.COTSDefaultParam m_cotsprogmgrparamfile = m_MeasureAppForm.m_ProjParam.GetDefaultParam();
             COTSSample WSample = m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample();
-            m_cotsprogmgrparamfile.SetImageProcParam(WSample.GetMsrParams().GetImageProcessParam());
-            m_cotsprogmgrparamfile.SetImageScanParam(WSample.GetMsrParams().GetImageScanParam());
-            m_cotsprogmgrparamfile.SetXRayParam(WSample.GetMsrParams().GetXRayParam());
+            m_cotsprogmgrparamfile.SetImageProcParam(WSample.GetMsrParams().GetImageProcessParam().Duplicate());
+            m_cotsprogmgrparamfile.SetImageScanParam(WSample.GetMsrParams().GetImageScanParam().Duplicate());
+            m_cotsprogmgrparamfile.SetXRayParam(WSample.GetMsrParams().GetXRayParam().Duplicate());
             m_cotsprogmgrparamfile.SpecialGrayRangeParam = WSample.GetMsrParams().GetSpecialGrayRangeParam().Duplicate();
             OTSModelSharp.COTSCommonParam m_cgenparam = m_cotsprogmgrparamfile.GetCommonParam();
             m_cgenparam.SetEngineType(WSample.GetMsrParams().GetEngineType());
             m_cgenparam.SetSteelTechnology((int)WSample.GetMsrParams().GetSteelTechnology());
             m_cgenparam.SetSTDSelect(WSample.GetMsrParams().GetSTDName().ToString());
-            m_cotsprogmgrparamfile.SetCommonParam(m_cgenparam);
+         
+            m_cotsprogmgrparamfile.SetCommonParam(m_cgenparam.duplicate());
             if (m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
             {
                 //MessageBox.Show("Already saved!", "Tip");

+ 1 - 1
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.Designer.cs

@@ -245,7 +245,7 @@
 
         #endregion
         private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
-        private System.Windows.Forms.ToolStripMenuItem AcquireBSEImageMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem AcquireBSEImageMenuItem; 
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
        
         private System.Windows.Forms.ToolStripMenuItem MenuItemLineScan;

+ 3 - 2
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -1636,7 +1636,7 @@ namespace OTSMeasureApp
                 cIntRange.SetStart(grayStart);
                 cIntRange.SetEnd(grayEnd);
                 cOTSImgProc.SetBGGray(cIntRange);
-                m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample().GetMsrParams().SetImageProcessParam(cOTSImgProc);
+                m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample().GetMsrParams().CopyImageProcessParam(cOTSImgProc);
                 //更新属性窗口
                 m_MeasureAppForm.UpdatePropertyVal();
                 //确认后进行去背景
@@ -1836,7 +1836,8 @@ namespace OTSMeasureApp
             frmBC.mag=param.mag;
             frmBC.initialBrightness = param.initialBrightness;
             frmBC.initialContrast = param.initialContrast;
-           
+           frmBC.autoregulateType = param.autoRegulateType;
+            frmBC.period = param.period;
             frmBC.stageData = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetStageDataParam();  
             frmBC.isToRun=param.toRun;
             frmBC.Show();

+ 408 - 0
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/frmBCRegulate.Designer.cs

@@ -0,0 +1,408 @@
+namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
+{
+    partial class frmBCRegulate
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.txtstdpos = new System.Windows.Forms.TextBox();
+            this.cbobrele = new System.Windows.Forms.ComboBox();
+            this.txtbrvalue = new System.Windows.Forms.TextBox();
+            this.txtdarkvalue = new System.Windows.Forms.TextBox();
+            this.cbodarkele = new System.Windows.Forms.ComboBox();
+            this.txtinitbr = new System.Windows.Forms.TextBox();
+            this.txtinitcontrast = new System.Windows.Forms.TextBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.button2 = new System.Windows.Forms.Button();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.button3 = new System.Windows.Forms.Button();
+            this.EnableAutoBC = new System.Windows.Forms.CheckBox();
+            this.txtMag = new System.Windows.Forms.TextBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.button4 = new System.Windows.Forms.Button();
+            this.button5 = new System.Windows.Forms.Button();
+            this.button6 = new System.Windows.Forms.Button();
+            this.button7 = new System.Windows.Forms.Button();
+            this.button8 = new System.Windows.Forms.Button();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.label7 = new System.Windows.Forms.Label();
+            this.txtperiod = new System.Windows.Forms.TextBox();
+            this.radiobtnEverySample = new System.Windows.Forms.RadioButton();
+            this.radiobtnEveryPeriod = new System.Windows.Forms.RadioButton();
+            this.groupBox2.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // txtstdpos
+            // 
+            this.txtstdpos.Location = new System.Drawing.Point(161, 36);
+            this.txtstdpos.Name = "txtstdpos";
+            this.txtstdpos.Size = new System.Drawing.Size(132, 21);
+            this.txtstdpos.TabIndex = 0;
+            // 
+            // cbobrele
+            // 
+            this.cbobrele.FormattingEnabled = true;
+            this.cbobrele.Items.AddRange(new object[] {
+            "C",
+            "Al",
+            "Fe",
+            "Cu",
+            "Zn"});
+            this.cbobrele.Location = new System.Drawing.Point(162, 104);
+            this.cbobrele.Name = "cbobrele";
+            this.cbobrele.Size = new System.Drawing.Size(68, 20);
+            this.cbobrele.TabIndex = 1;
+            // 
+            // txtbrvalue
+            // 
+            this.txtbrvalue.Location = new System.Drawing.Point(240, 104);
+            this.txtbrvalue.Name = "txtbrvalue";
+            this.txtbrvalue.Size = new System.Drawing.Size(58, 21);
+            this.txtbrvalue.TabIndex = 2;
+            // 
+            // txtdarkvalue
+            // 
+            this.txtdarkvalue.Location = new System.Drawing.Point(240, 78);
+            this.txtdarkvalue.Name = "txtdarkvalue";
+            this.txtdarkvalue.Size = new System.Drawing.Size(58, 21);
+            this.txtdarkvalue.TabIndex = 3;
+            // 
+            // cbodarkele
+            // 
+            this.cbodarkele.FormattingEnabled = true;
+            this.cbodarkele.Items.AddRange(new object[] {
+            "C",
+            "Al",
+            "Fe",
+            "Cu"});
+            this.cbodarkele.Location = new System.Drawing.Point(162, 79);
+            this.cbodarkele.Name = "cbodarkele";
+            this.cbodarkele.Size = new System.Drawing.Size(68, 20);
+            this.cbodarkele.TabIndex = 4;
+            // 
+            // txtinitbr
+            // 
+            this.txtinitbr.Location = new System.Drawing.Point(162, 179);
+            this.txtinitbr.Name = "txtinitbr";
+            this.txtinitbr.Size = new System.Drawing.Size(131, 21);
+            this.txtinitbr.TabIndex = 5;
+            // 
+            // txtinitcontrast
+            // 
+            this.txtinitcontrast.Location = new System.Drawing.Point(162, 213);
+            this.txtinitcontrast.Name = "txtinitcontrast";
+            this.txtinitcontrast.Size = new System.Drawing.Size(131, 21);
+            this.txtinitcontrast.TabIndex = 6;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(303, 38);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(62, 19);
+            this.button1.TabIndex = 7;
+            this.button1.Text = "Read";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(89, 41);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(53, 12);
+            this.label1.TabIndex = 8;
+            this.label1.Text = "Location";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(93, 104);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(41, 12);
+            this.label2.TabIndex = 8;
+            this.label2.Text = "Bright";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(93, 78);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(29, 12);
+            this.label3.TabIndex = 8;
+            this.label3.Text = "Dark";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(67, 182);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(77, 12);
+            this.label4.TabIndex = 9;
+            this.label4.Text = "InitalBright";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(67, 216);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(89, 12);
+            this.label5.TabIndex = 9;
+            this.label5.Text = "InitalContrast";
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(32, 265);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(185, 42);
+            this.button2.TabIndex = 10;
+            this.button2.Text = "AutoBrightContrast";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Location = new System.Drawing.Point(12, 249);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(453, 10);
+            this.groupBox1.TabIndex = 11;
+            this.groupBox1.TabStop = false;
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(347, 445);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(109, 35);
+            this.button3.TabIndex = 12;
+            this.button3.Text = "Record";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // EnableAutoBC
+            // 
+            this.EnableAutoBC.AutoSize = true;
+            this.EnableAutoBC.Location = new System.Drawing.Point(10, 20);
+            this.EnableAutoBC.Name = "EnableAutoBC";
+            this.EnableAutoBC.Size = new System.Drawing.Size(96, 16);
+            this.EnableAutoBC.TabIndex = 13;
+            this.EnableAutoBC.Text = "EnableAutoBC";
+            this.EnableAutoBC.UseVisualStyleBackColor = true;
+            // 
+            // txtMag
+            // 
+            this.txtMag.Location = new System.Drawing.Point(162, 143);
+            this.txtMag.Name = "txtMag";
+            this.txtMag.Size = new System.Drawing.Size(131, 21);
+            this.txtMag.TabIndex = 14;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(95, 143);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(23, 12);
+            this.label6.TabIndex = 15;
+            this.label6.Text = "Mag";
+            // 
+            // button4
+            // 
+            this.button4.Location = new System.Drawing.Point(304, 85);
+            this.button4.Name = "button4";
+            this.button4.Size = new System.Drawing.Size(60, 21);
+            this.button4.TabIndex = 16;
+            this.button4.Text = "Read";
+            this.button4.UseVisualStyleBackColor = true;
+            this.button4.Click += new System.EventHandler(this.button4_Click);
+            // 
+            // button5
+            // 
+            this.button5.Location = new System.Drawing.Point(303, 192);
+            this.button5.Name = "button5";
+            this.button5.Size = new System.Drawing.Size(60, 21);
+            this.button5.TabIndex = 17;
+            this.button5.Text = "Read";
+            this.button5.UseVisualStyleBackColor = true;
+            this.button5.Click += new System.EventHandler(this.button5_Click);
+            // 
+            // button6
+            // 
+            this.button6.Location = new System.Drawing.Point(369, 192);
+            this.button6.Name = "button6";
+            this.button6.Size = new System.Drawing.Size(57, 22);
+            this.button6.TabIndex = 18;
+            this.button6.Text = "write";
+            this.button6.UseVisualStyleBackColor = true;
+            this.button6.Click += new System.EventHandler(this.button6_Click);
+            // 
+            // button7
+            // 
+            this.button7.Location = new System.Drawing.Point(369, 38);
+            this.button7.Name = "button7";
+            this.button7.Size = new System.Drawing.Size(57, 19);
+            this.button7.TabIndex = 19;
+            this.button7.Text = "GOTO";
+            this.button7.UseVisualStyleBackColor = true;
+            this.button7.Click += new System.EventHandler(this.button7_Click);
+            // 
+            // button8
+            // 
+            this.button8.Location = new System.Drawing.Point(234, 267);
+            this.button8.Name = "button8";
+            this.button8.Size = new System.Drawing.Size(92, 40);
+            this.button8.TabIndex = 20;
+            this.button8.Text = "stop";
+            this.button8.UseVisualStyleBackColor = true;
+            this.button8.Click += new System.EventHandler(this.button8_Click);
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.label7);
+            this.groupBox2.Controls.Add(this.txtperiod);
+            this.groupBox2.Controls.Add(this.radiobtnEverySample);
+            this.groupBox2.Controls.Add(this.radiobtnEveryPeriod);
+            this.groupBox2.Controls.Add(this.EnableAutoBC);
+            this.groupBox2.Location = new System.Drawing.Point(12, 313);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(470, 113);
+            this.groupBox2.TabIndex = 21;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "Strategy";
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(227, 54);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(41, 12);
+            this.label7.TabIndex = 17;
+            this.label7.Text = "minute";
+            // 
+            // txtperiod
+            // 
+            this.txtperiod.Location = new System.Drawing.Point(119, 52);
+            this.txtperiod.Name = "txtperiod";
+            this.txtperiod.Size = new System.Drawing.Size(99, 21);
+            this.txtperiod.TabIndex = 16;
+            // 
+            // radiobtnEverySample
+            // 
+            this.radiobtnEverySample.AutoSize = true;
+            this.radiobtnEverySample.Location = new System.Drawing.Point(10, 91);
+            this.radiobtnEverySample.Name = "radiobtnEverySample";
+            this.radiobtnEverySample.Size = new System.Drawing.Size(95, 16);
+            this.radiobtnEverySample.TabIndex = 15;
+            this.radiobtnEverySample.TabStop = true;
+            this.radiobtnEverySample.Text = "Every Sample";
+            this.radiobtnEverySample.UseVisualStyleBackColor = true;
+            // 
+            // radiobtnEveryPeriod
+            // 
+            this.radiobtnEveryPeriod.AutoSize = true;
+            this.radiobtnEveryPeriod.Location = new System.Drawing.Point(10, 53);
+            this.radiobtnEveryPeriod.Name = "radiobtnEveryPeriod";
+            this.radiobtnEveryPeriod.Size = new System.Drawing.Size(95, 16);
+            this.radiobtnEveryPeriod.TabIndex = 14;
+            this.radiobtnEveryPeriod.TabStop = true;
+            this.radiobtnEveryPeriod.Text = "Every Period";
+            this.radiobtnEveryPeriod.UseVisualStyleBackColor = true;
+            // 
+            // frmBCRegulate
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(494, 492);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.button8);
+            this.Controls.Add(this.button7);
+            this.Controls.Add(this.button6);
+            this.Controls.Add(this.button5);
+            this.Controls.Add(this.button4);
+            this.Controls.Add(this.label6);
+            this.Controls.Add(this.txtMag);
+            this.Controls.Add(this.button3);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.txtinitcontrast);
+            this.Controls.Add(this.txtinitbr);
+            this.Controls.Add(this.cbodarkele);
+            this.Controls.Add(this.txtdarkvalue);
+            this.Controls.Add(this.txtbrvalue);
+            this.Controls.Add(this.cbobrele);
+            this.Controls.Add(this.txtstdpos);
+            this.Name = "frmBCRegulate";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "frmBCRegulate";
+            this.Load += new System.EventHandler(this.frmBCRegulate_Load_1);
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox txtstdpos;
+        private System.Windows.Forms.ComboBox cbobrele;
+        private System.Windows.Forms.TextBox txtbrvalue;
+        private System.Windows.Forms.TextBox txtdarkvalue;
+        private System.Windows.Forms.ComboBox cbodarkele;
+        private System.Windows.Forms.TextBox txtinitbr;
+        private System.Windows.Forms.TextBox txtinitcontrast;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.Button button3;
+        private System.Windows.Forms.CheckBox EnableAutoBC;
+        private System.Windows.Forms.TextBox txtMag;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.Button button4;
+        private System.Windows.Forms.Button button5;
+        private System.Windows.Forms.Button button6;
+        private System.Windows.Forms.Button button7;
+        private System.Windows.Forms.Button button8;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.TextBox txtperiod;
+        private System.Windows.Forms.RadioButton radiobtnEverySample;
+        private System.Windows.Forms.RadioButton radiobtnEveryPeriod;
+        private System.Windows.Forms.Label label7;
+    }
+}

+ 162 - 0
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/frmBCRegulate.cs

@@ -0,0 +1,162 @@
+using OTSDataType;
+using OTSMeasureApp._0_OTSModel.OTSDataType;
+using OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow;
+using OTSModelSharp;
+using OTSModelSharp.ServiceCenter;
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
+{
+    public partial class frmBCRegulate : Form
+    {
+        public PointF stdPos;
+        public string brightphaseMaterial;
+        public int brightphasevalue;
+        public string darkphaseMaterial;
+        public int darkphasevalue;
+        public bool isToRun = false;
+        public double initialBrightness;
+        public double initialContrast;
+        public int mag = 100; //放大倍数    
+        public AutoRegulateType autoregulateType = AutoRegulateType.EveryPeriod; //自动调节类型
+        public int period = 60; //minutes to run the regulation
+        public CMeasure m_measureobj;
+        private ISemController semController = SemController.GetSEMController(); 
+        public CSEMStageData stageData = null;
+        public frmBCRegulate()
+        {
+            InitializeComponent();
+        }
+      
+        private void frmBCRegulate_Load_1(object sender, EventArgs e)
+        {
+            // 国际化
+            OTSCommon.Language lan = new OTSCommon.Language(this);
+            Hashtable table = lan.GetNameTable(this.Name);
+            this.Text = table["frmcaption"].ToString();
+            this.label1.Text = table["stdpos"].ToString();
+            this.label2.Text = table["bright"].ToString();
+            this.label3.Text = table["dark"].ToString();
+            this.label4.Text = table["initbright"].ToString();
+            this.label5.Text = table["initcontrast"].ToString();
+            this.label6.Text = table["mag"].ToString();
+            //this.label7.Text = table["label7"].ToString();
+
+           this.button2.Text = table["autobctest"].ToString();
+
+            this.button1.Text = table["read"].ToString();
+            this.button4.Text = table["read"].ToString();
+            this.button5.Text = table["read"].ToString();
+            this.button6.Text = table["write"].ToString();
+            this.button8.Text = table["stop"].ToString();
+            //this.button7.Text = table["ok"].ToString();
+            this.button3.Text = table["record"].ToString();
+            this.EnableAutoBC.Text = table["enableautobc"].ToString();
+            this.radiobtnEveryPeriod.Text = table["everyperiod"].ToString();
+            this.radiobtnEverySample.Text = table["everysample"].ToString();    
+
+            txtstdpos.Text = stdPos.ToString();
+            cbobrele.Text = brightphaseMaterial;
+            cbodarkele.Text = darkphaseMaterial;
+            txtbrvalue.Text = brightphasevalue.ToString();
+            txtdarkvalue.Text = darkphasevalue.ToString();
+            txtinitbr.Text = initialBrightness.ToString();
+            txtinitcontrast.Text = initialContrast.ToString();
+            txtMag.Text = mag.ToString();
+            radiobtnEveryPeriod.Checked = autoregulateType == AutoRegulateType.EveryPeriod;
+            radiobtnEverySample.Checked = autoregulateType == AutoRegulateType.EverySample;
+            txtperiod.Text = period.ToString();
+            EnableAutoBC.Checked = isToRun;
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            stdPos = Point.Empty;
+            double r = 0;
+            double x=0, y = 0;  
+            semController.GetSemPositionXY(ref x, ref y, ref r);
+            stageData.ConvertSEMToOTSCoord( new Point((int)x, (int)y),ref stdPos);
+            txtstdpos.Text = stdPos.ToString();
+           
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            var param = m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam;
+            param.stdMaterialOTSPos=new Point((int)stdPos.X,(int)stdPos.Y);
+            param.brightphaseelement = cbobrele.Text;
+            param.brightphaseGrayvalue = int.Parse(txtbrvalue.Text);
+            param.darkphaseelement = cbodarkele.Text;
+            param.darkphaseGrayvalue = int.Parse(txtdarkvalue.Text);
+            param.mag = txtMag.Text == "" ? 100 : int.Parse(txtMag.Text);
+            param.initialBrightness = double.Parse(txtinitbr.Text);
+            param.initialContrast = double.Parse(txtinitcontrast.Text);
+            param.toRun = EnableAutoBC.Checked;
+            m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam = param;
+           
+            Thread thread = new Thread(new ThreadStart(m_measureobj.DoBrightnessContrastAdjust));
+            thread.Start();
+          
+            
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            var param = m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam;
+            param.stdMaterialOTSPos = new Point((int)stdPos.X, (int)stdPos.Y);
+            param.brightphaseelement = cbobrele.Text;
+            param.brightphaseGrayvalue = int.Parse(txtbrvalue.Text);
+            param.darkphaseelement = cbodarkele.Text;
+            param.darkphaseGrayvalue = int.Parse(txtdarkvalue.Text);
+            param.mag = txtMag.Text == "" ? 100 : int.Parse(txtMag.Text);
+            param.initialBrightness = double.Parse(txtinitbr.Text);
+            param.initialContrast = double.Parse(txtinitcontrast.Text);
+            param.toRun = EnableAutoBC.Checked;
+            param.period= txtperiod.Text == "" ? 60 : int.Parse(txtperiod.Text);    
+            param.autoRegulateType =radiobtnEveryPeriod.Checked ? AutoRegulateType.EveryPeriod : AutoRegulateType.EverySample;
+            m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam = param;
+            Close();
+        }
+
+        private void button4_Click(object sender, EventArgs e)
+        {
+            CBrightnessContrastAdjust regulater = new CBrightnessContrastAdjust(m_measureobj);
+            int dark = 0, bright = 0;
+            regulater.GetCurrentTwoProminentGray(ref dark, ref bright);
+            txtbrvalue.Text = bright.ToString();
+            txtdarkvalue.Text = dark.ToString();
+        }
+
+        private void button5_Click(object sender, EventArgs e)
+        {
+            CBrightnessContrastAdjust regulater = new CBrightnessContrastAdjust(m_measureobj);
+            double br = 0, contra = 0;
+            regulater.GetCurrentBrightnessAndContrast(ref br, ref contra);
+            txtinitbr.Text = br.ToString();
+            txtinitcontrast.Text = contra.ToString();
+        }
+
+        private void button6_Click(object sender, EventArgs e)
+        {
+            CBrightnessContrastAdjust regulater = new CBrightnessContrastAdjust(m_measureobj);
+            double br = double.Parse(txtinitbr.Text), contra =double.Parse(txtinitcontrast.Text);
+            regulater.WriteBrightnessAndContrast(ref br,ref contra);
+
+        }
+
+        private void button7_Click(object sender, EventArgs e)
+        {
+            CBrightnessContrastAdjust regulater = new CBrightnessContrastAdjust(m_measureobj);
+            regulater.MoveSEMToPoint(new PointF(stdPos.X, stdPos.Y));   
+        }
+
+        private void button8_Click(object sender, EventArgs e)
+        {
+            m_measureobj.GetMsrThreadStatus().SetStatus(otsdataconst.OTS_MSR_THREAD_STATUS.STOPPED);    
+        }
+    }
+}

+ 4 - 4
OTSIncAMeasureApp/ServiceCenter/FEIAutoScript/FEISemController.cs

@@ -81,13 +81,13 @@ namespace OTSMeasureApp.ServiceCenter
 
         public bool GetSemBrightness(ref double a_dBrightness)
         {
-            a_dBrightness = m_ApiClass.GetDetectorBrightness();
+            a_dBrightness = m_ApiClass.GetDetectorBrightness()*100;
             return true;
         }
 
         public bool GetSemContrast(ref double a_dContrast)
         {
-            a_dContrast = m_ApiClass.GetDetectorContrast();
+            a_dContrast = m_ApiClass.GetDetectorContrast()*100;
             return true;
         }
 
@@ -166,12 +166,12 @@ namespace OTSMeasureApp.ServiceCenter
 
         public bool SetSemBrightness(double a_dBrightness)
         {
-            return m_ApiClass.SetDetectorBrightness(a_dBrightness);
+            return m_ApiClass.SetDetectorBrightness(a_dBrightness/100);
         }
 
         public bool SetSemContrast(double a_dContrast)
         {
-            return m_ApiClass.SetDetectorContrast(a_dContrast);
+            return m_ApiClass.SetDetectorContrast(a_dContrast/100);
         }
 
         public bool SetSemHighTension(double a_dKV)

+ 0 - 1
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -1672,7 +1672,6 @@
     <EmbeddedResource Include="Help.resx">
       <DependentUpon>Help.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>PublicResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>