Ver código fonte

添加颗粒过滤功能

zty 3 anos atrás
pai
commit
f2c9c396c1

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

@@ -1008,6 +1008,7 @@
 	  <Control name="label33" text="CountingExpectations" />
 	  <Control name="label31" text="ScanningMode(Large particles)" />
 	  <Control name="label37" text="Analysis threshold" />
+	  <Control name="label52" text="Enable particle filtering(Bruker)" />
 	  <Control name="groupBox7" text="ModeSelection" />
 	  <Control name="lbModelSel" text="ModeSelection" />
 	  <Control name="lbLaboratoty" text="Laboratoty" />

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

@@ -1008,6 +1008,7 @@
 	  <Control name="label33" text="分析X-ray计数期望值" />
 	  <Control name="label31" text="扫描方式(大颗粒)" /> 
 	  <Control name="label37" text="分析阈值" />
+	  <Control name="label52" text="是否启用颗粒过滤(Bruker)" />
 	  <Control name="groupBox7" text="模式选择" />
 	  <Control name="lbModelSel" text="模式选择" />
 	  <Control name="lbLaboratoty" text="实验室" />

+ 1 - 0
OTS.sln

@@ -34,6 +34,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OTSSQLiteDll", "OTSCPP\OTSS
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OTSImagePro", "OTSCPP\OTSImagePro\OTSImagePro.vcxproj", "{CD59EA38-9ADF-40D3-B1C0-7A66A9D2F77B}"
 	ProjectSection(ProjectDependencies) = postProject
+		{201A7F92-48AE-4BCC-B75E-988E3AAC117C} = {201A7F92-48AE-4BCC-B75E-988E3AAC117C}
 		{CEA06DD1-5CD7-4B7D-A807-785718C3A854} = {CEA06DD1-5CD7-4B7D-A807-785718C3A854}
 	EndProjectSection
 EndProject

+ 13 - 8
OTSCPP/OTSControl/Bruker/OTSBrukerImpl.cpp

@@ -3017,16 +3017,16 @@ BOOL COTSBrukerImpl::SetXRayPoints(CPosXraysList& a_listXrayPois, const DWORD a_
 			return FALSE;
 		}
 
-		//COTSImageProcess::FindPeaks(11.11);
-		bool isTrue = true;
-		//if (i > nCollectCount / 2)
-		//{
-		//	isTrue = false;
-		//}
-
-		if (m_bDoQuantification && isTrue)
+		std::vector<double> peakList;
+		std::vector<CString> eleList;
+		for (size_t i = 0; i < a_listXrayPois[i]->GetElementQuantifyData().size(); i++)
 		{
+			eleList.push_back(a_listXrayPois[i]->GetElementQuantifyData()[i]->GetName());
+		}
+		bool isFilter = COTSImageProcess::FindPeaks(nChannelData, peakList, eleList);
 
+		if (m_bDoQuantification && isFilter)
+		{
 			// quantify the spectrum
 			char* pcMethod = "Oxides";//"Default";//"Automatic";//Oxides
 			char* pcParams = "ResultType=quantification";
@@ -3042,6 +3042,11 @@ BOOL COTSBrukerImpl::SetXRayPoints(CPosXraysList& a_listXrayPois, const DWORD a_
 			CElementChemistriesList listElement = CElement::ExtractElementChemistrys(CControllerHelper::CharToString(cResult));
 			a_listXrayPois[i]->SetElementQuantifyData(listElement);
 		}
+		else
+		{
+			CElementChemistriesList listElement;
+			a_listXrayPois[i]->SetElementQuantifyData(listElement);
+		}
 
 		// set spectrum data for the x-ray point
 		a_listXrayPois[i]->SetXrayData(nChannelData);

+ 15 - 1
OTSCPP/OTSControl/Simulate/OTSEDSSim.cpp

@@ -1,8 +1,11 @@
 #include "stdafx.h"
 #include "OTSEDSSim.h"
+#include "OTSImageProcess.h"
 
 namespace OTSController {
 
+	using namespace OTSIMGPROC;
+
 	COTSEDSSim::COTSEDSSim()
 	{
 		m_bDoQuantification = FALSE;
@@ -135,14 +138,25 @@ namespace OTSController {
 			LogTrace(__FILE__, __LINE__, _T("COTSEDSSim::GetXRayByPoints: failed to call CollectASpectrumFromTxtFile method."));
 		}
 		int icount = 0;
+
 		for (auto pXrayPoi : a_vXRayPoints)
 		{
+			//std::vector<double> peakList;
+			//std::vector<CString> eleList;
+			//for (size_t i = 0; i < pXrayPoi->GetElementQuantifyData().size(); i++)
+			//{
+			//	eleList.push_back(pXrayPoi->GetElementQuantifyData()[i]->GetName());
+			//}
+			//bool isFilter = COTSImageProcess::FindPeaks(m_nRayData, peakList, eleList);
+
+			bool isFilter = true;
+
 			pXrayPoi->SetXrayData(m_nRayData);
 
 			CString sResult = "";
 			CElementChemistriesList listElementQuantifyData;
 			CElementPtr pElement = CElementPtr(new CElement());
-			if (m_bDoQuantification)
+			if (m_bDoQuantification && isFilter)
 			{
 				switch (icount % 7)
 				{

+ 31 - 0
OTSCPP/OTSData/Element.cpp

@@ -623,6 +623,37 @@ namespace OTSDATA
 		return listElementChemistrys;
 	}
 
+	void CElement::GetAllElementsEnergyK(float fEnergy, float fDelt, std::vector<CString>& vecstr)
+	{
+		float fResult = 0;
+		CString str = _T("");
+		vecstr.clear();
+
+		fDelt = (fDelt < 0) ? -fDelt : fDelt;
+
+		for (int i = 0; i < ATOMIC_NUMBER_MAX; i++)
+		{
+			fResult = (float)ELEMENT_ENERGY_VALUES_K[i] - fEnergy;
+			str = _T("");
+
+			// ×ó²à
+			if (fResult >= -fDelt && fResult < 0)
+			{
+				str.Format(_T("%.3f: %s"), fResult, ELEMENT_NAMES[i]);
+				vecstr.push_back(str);
+			}
+			// ÓÒ²à
+			else if (fResult <= fDelt && fResult >= 0)
+			{
+				str.Format(_T("+%.3f: %s"), fResult, ELEMENT_NAMES[i]);
+				vecstr.push_back(str);
+			}
+			else
+			{
+			}
+		}
+	}
+
 	void CElement::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
 	{
 		// atomic number

+ 1 - 0
OTSCPP/OTSData/Element.h

@@ -226,6 +226,7 @@ namespace OTSDATA
 
 		static std::vector<CString>& GetElementNameList();
 		static CElementChemistriesList ExtractElementChemistrys(CString a_strSource);
+		static void GetAllElementsEnergyK(float fEnergy, float fDelt, std::vector<CString>& vecstr);
 
 		void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode);
 

+ 97 - 7
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -10,6 +10,7 @@
 #include <OTSFieldData.h>
 #include "../OTSLog/COTSUtilityDllFunExport.h"
 #include "FieldMgr.h"
+
 using namespace cv;
 using namespace std;
 
@@ -1754,7 +1755,7 @@ namespace OTSIMGPROC
 	{
 		// the background  pixel will be 0,and the other part will be 255.
 		ASSERT(a_pImgIn);
-		
+
 
 		ASSERT(a_pImageProcessParam);
 		int nWidthImg = a_pImgIn->GetWidth();
@@ -2760,17 +2761,106 @@ namespace OTSIMGPROC
 		return true;
 	}
 	
-	BOOL COTSImageProcess::FindPeaks(double pixelSize)
+	BOOL COTSImageProcess::FindPeaks(DWORD* nChannelData, vector<double>& peakList, vector<CString>& eleList)
 	{
-		int random = rand();
-		if (random % 2 == 0)
+		//获取Peaks
+		DWORD m_nXrayData[GENERALXRAYCHANNELS];
+		memcpy(m_nXrayData, nChannelData, sizeof(DWORD) * GENERALXRAYCHANNELS);
+		map<int, int> tMap;
+		int countMap = 0;
+		for (size_t i = 0; i < GENERALXRAYCHANNELS; i++)
+		{
+			tMap.insert(pair<int, int>(i, m_nXrayData[i]));
+			countMap += m_nXrayData[i];
+		}
+		vector<pair<int, int>> tVector;
+		COTSImageProcess::sortMapByValue(tMap, tVector);
+		vector<CString> nameList;
+		for (size_t i = 0; i < GENERALXRAYCHANNELS; i++)
+		{
+			if (tVector[i].second > countMap * 0.002)
+			{
+				std::vector<CString> vecstr;
+				CElement::GetAllElementsEnergyK((float)tVector[i].first / 100, 0.1f, vecstr);
+				if (vecstr.size() != 0)
+				{
+					std::vector<CString> vecstrSplit;
+					SplitCString(vecstr[0], ":", 2, vecstrSplit);
+					if (std::find(nameList.begin(), nameList.end(), vecstrSplit[1]) == nameList.end())
+					{
+						nameList.push_back(vecstrSplit[1]);
+					}
+				}
+			}
+		}
+		//判断Peaks是否存在
+		for each (CString var in nameList)
 		{
-			return TRUE;
+			if (std::find(eleList.begin(), eleList.end(), var) == eleList.end())
+			{
+
+			}
+			else
+			{
+				return TRUE;
+			}
 		}
-		else
+
+		return FALSE;
+	}
+
+	int COTSImageProcess::SplitCString(const CString& str, const char* separator, int sep_number, vector<CString>& strArray)
+	{
+		strArray.clear();
+		int index = -1;
+		const int MAX_COUNT = 1000000; //最大分割长度
+		int smallIndex = MAX_COUNT;
+		CString szLeft;
+		CString szRight = str;
+
+		for (int i = 0; i < sep_number; i++)
 		{
-			return FALSE;
+			index = szRight.Find(separator[i]);
+			if (index >= 0 && index < smallIndex)
+			{
+				smallIndex = index; //遍历获得所有的分割符的最小Index
+			}
+
+			if (i == sep_number - 1 && smallIndex != MAX_COUNT) //遍历全部分割符之后
+			{
+				szLeft = szRight.Left(smallIndex);
+				szLeft.Trim(); //去除空格
+				if (!szLeft.IsEmpty()) strArray.push_back(szLeft);
+
+				szRight = szRight.Right(szRight.GetLength() - smallIndex - 1);
+				szRight.Trim();
+				if (szRight.GetLength() > 0)
+				{
+					i = -1;
+					smallIndex = MAX_COUNT;
+				}
+				else break;
+			}
+			else if (i == sep_number - 1)
+			{
+				szRight.Trim();
+				if (!szRight.IsEmpty()) strArray.push_back(szRight);
+			}
 		}
+
+		return strArray.size();
 	}
 	
+	int cmp(const pair<int, int>& x, const pair<int, int>& y)
+	{
+		return x.second > y.second;
+	}
+
+	void COTSImageProcess::sortMapByValue(map<int, int>& tMap, vector<pair<int, int> >& tVector)
+	{
+		for (map<int, int>::iterator curr = tMap.begin(); curr != tMap.end(); curr++)
+			tVector.push_back(make_pair(curr->first, curr->second));
+
+		sort(tVector.begin(), tVector.end(), cmp);
+	}
 }

+ 3 - 1
OTSCPP/OTSImagePro/OTSImageProcess.h

@@ -71,7 +71,9 @@ namespace OTSIMGPROC {
 		static void GetSpecialGrayRangeImage(CBSEImgPtr a_pImgIn, CIntRangePtr a_SpecialGrayRange, CBSEImgPtr a_pBinImgOut, long& foundedPixelNum);
 		static void RemoveBackGround(CBSEImgPtr a_pImgIn, COTSImageProcessParamPtr a_pImageProcessParam, CBSEImgPtr a_pImgOut,long& foundedPixelNum);
 		static BOOL CalcuParticleImagePropertes(COTSParticlePtr part, double a_PixelSize);
-		static BOOL FindPeaks(double a_PixelSize);
+		static int SplitCString(const CString& str, const char* separator, int sep_number, vector<CString>& strArray);
+		static BOOL FindPeaks(DWORD* nChannelData, vector<double>& peakList, vector<CString>& eleList);
+		static void sortMapByValue(map<int, int>& tMap, vector<pair<int, int>>& tVector);
 
 		static BOOL MergeBigBoundaryParticles(COTSFieldDataList allFields, double pixelSize, int scanFieldSize, CSize ResolutionSize, COTSParticleList& mergedParts);
 

+ 11 - 5
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -15,6 +15,8 @@ using OTSModelSharp.DTLBase;
 using OTSCLRINTERFACE;
 using OTSModelSharp.ServiceCenter;
 using OTSMeasureApp._0_OTSModel.Measure.ParamData;
+using System.Windows.Forms;
+using System.Data;
 
 namespace OTSModelSharp
 {
@@ -671,9 +673,14 @@ namespace OTSModelSharp
 
                     FldDatas = m_Sample.GetFieldsData();
                 }
-                
-
 
+                List<string> KeyNameList = new List<string>();
+                if (m_EDSHardwareMgr.eds.GetEDSName() == "EDS Bruker" && m_Sample.GetMsrParams().GetXRayParam().GetUseFilter())
+                {
+                    string DBAddress = Application.StartupPath + "\\Config\\SysData\\" + m_Sample.GetMsrParams().GetSTDName() + ".db";
+                    SQLiteHelper sQLiteHelper = new SQLiteHelper(DBAddress);//
+                    KeyNameList = sQLiteHelper.GetDBKeyElementList("ClassifySTD", "KeyElementList");
+                }
 
                 for (int i = 0; i < FldDatas.Count; ++i)
                 {// check and break if stop button is clicked
@@ -772,8 +779,7 @@ namespace OTSModelSharp
                         return;
                     }
 
-                  
-
+                    curFld.strKeyName = KeyNameList;
 
                     //BSEData
                     ST_MSTMsg MsgFieldBSE = new ST_MSTMsg(); 
@@ -1081,8 +1087,8 @@ namespace OTSModelSharp
                     bigparts.Add(p);
                 }
             }
-            
 
+            m_EDSHardwareMgr.nameList = curFldData.strKeyName;
 
             var pStatus = m_Sample.GetMsrStatus();
             curFldData.CreateXrayList(bigparts); // big particle using the full xray strategy.

+ 2 - 0
OTSIncAMeasureApp/0-OTSModel/Measure/BSEPicData/COTSFieldData.cs

@@ -49,6 +49,8 @@ namespace OTSModelSharp
         public int Width { get => width; set => width = value; }
         public System.Drawing.Point OTSPos { get => m_otsPos; set => m_otsPos = value; }
 
+        public List<string> strKeyName;
+
         public bool GetIsMeasureComplete()
         {
             return isMeasureComplete;

+ 19 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSXRayParam.cs

@@ -45,6 +45,7 @@ namespace OTSDataType
         private int m_nFastXrayTime;
 
         private bool m_nUsingXray;
+        private bool m_UseFilter;
 
         private int m_XrayLimit;
 
@@ -79,6 +80,7 @@ namespace OTSDataType
             m_nFastXrayTime = a_oSource.m_nFastXrayTime;
 
             m_nUsingXray = a_oSource.m_nUsingXray;
+            m_UseFilter = a_oSource.m_UseFilter;
             m_XrayLimit = a_oSource.m_XrayLimit;
         }
         // copy constructor
@@ -99,8 +101,8 @@ namespace OTSDataType
                 m_nQutantifyMinSize == a_oSource.m_nQutantifyMinSize &&
                 m_nFastXrayTime == a_oSource.m_nFastXrayTime &&
            
-                m_nUsingXray == a_oSource.m_nUsingXray;
-
+                m_nUsingXray == a_oSource.m_nUsingXray &&
+                m_UseFilter == a_oSource.m_UseFilter;
         }
 
 
@@ -147,6 +149,13 @@ namespace OTSDataType
         {
             m_nUsingXray = a_nUsingXray;
         }
+
+        public bool GetUseFilter() { return m_UseFilter; }
+        public void SetUseFilter(bool a_UseFilter)
+        {
+            m_UseFilter = a_UseFilter;
+        }
+
         public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
         {
             xString xnScanMode = new xString();
@@ -161,6 +170,8 @@ namespace OTSDataType
 
             xBool xnUsingXray = new xBool();
 
+            xBool xnUseFilter = new xBool();
+
             xInt xXrayLimit = new xInt();
 
     
@@ -178,6 +189,8 @@ namespace OTSDataType
 
             slo.Register("UsingXray", xnUsingXray);
 
+            slo.Register("UseFilter", xnUseFilter);
+
             slo.Register("XrayLimit", xXrayLimit);
 
 
@@ -197,6 +210,8 @@ namespace OTSDataType
 
                 xnUsingXray.AssignValue(m_nUsingXray);
 
+                xnUseFilter.AssignValue(m_UseFilter);
+
                 xXrayLimit.AssignValue(m_XrayLimit);
 
                 slo.Serialize(true, classDoc, rootNode);
@@ -217,6 +232,8 @@ namespace OTSDataType
 
                 m_nUsingXray = xnUsingXray.value();
 
+                m_UseFilter = xnUseFilter.value();
+
                 m_XrayLimit = xXrayLimit.value();
             }
         }

+ 7 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/ProgMgrInfoForm.cs

@@ -678,6 +678,9 @@ namespace OTSMeasureApp
             IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetFastXrayTime().ToString();
 
             IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
+
+            IDC_FILTER.Checked = m_cotsxrayprm.GetUseFilter();
+
             //IDC_XRAY_MODE_SWITCH.Checked = m_cotsxrayprm.GetShowScanMode();
             //IDC_XRAY_TIME_SWITCH.Checked = m_cotsxrayprm.GetShowSpeed();
             //IDC_XRAY_COUNT_SWITCH.Checked = m_cotsxrayprm.GetShowExpCount();
@@ -858,6 +861,10 @@ namespace OTSMeasureApp
             m_cotsxrayprm.SetFastXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
 
             m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
+
+            m_cotsxrayprm.SetUseFilter(IDC_FILTER.Checked);
+
+
             //m_cotsxrayprm.SetShowScanMode(IDC_XRAY_MODE_SWITCH.Checked);
             //m_cotsxrayprm.SetShowSpeed(IDC_XRAY_TIME_SWITCH.Checked);
             //m_cotsxrayprm.SetShowExpCount(IDC_XRAY_COUNT_SWITCH.Checked);

+ 59 - 33
OTSIncAMeasureApp/7-OTSProgMgrInfo/ProgMgrInfoForm.designer.cs

@@ -96,6 +96,8 @@
             this.IDC_BUTTON_MEASPRAMPATHSET = new System.Windows.Forms.Button();
             this.groupBox5 = new System.Windows.Forms.GroupBox();
             this.IDC_COMBO_CorrosionExpansionCoefficient = new System.Windows.Forms.ComboBox();
+            this.label50 = new System.Windows.Forms.Label();
+            this.IDC_EDIT_Overlap = new System.Windows.Forms.TextBox();
             this.label49 = new System.Windows.Forms.Label();
             this.IDC_COMBO_AUTOBGREMOVETYP = new System.Windows.Forms.ComboBox();
             this.label_Auto = new System.Windows.Forms.Label();
@@ -112,6 +114,7 @@
             this.IDC_EDIT_PARTAREAMIN = new System.Windows.Forms.TextBox();
             this.label24 = new System.Windows.Forms.Label();
             this.label28 = new System.Windows.Forms.Label();
+            this.label51 = new System.Windows.Forms.Label();
             this.label27 = new System.Windows.Forms.Label();
             this.label26 = new System.Windows.Forms.Label();
             this.label23 = new System.Windows.Forms.Label();
@@ -158,9 +161,8 @@
             this.groupBox7 = new System.Windows.Forms.GroupBox();
             this.IDC_EDIT_STOP_INCA_AREA = new System.Windows.Forms.TextBox();
             this.label48 = new System.Windows.Forms.Label();
-            this.label50 = new System.Windows.Forms.Label();
-            this.label51 = new System.Windows.Forms.Label();
-            this.IDC_EDIT_Overlap = new System.Windows.Forms.TextBox();
+            this.label52 = new System.Windows.Forms.Label();
+            this.IDC_FILTER = new System.Windows.Forms.CheckBox();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
@@ -705,11 +707,11 @@
             this.groupBox4.Controls.Add(this.label15);
             this.groupBox4.Controls.Add(this.label14);
             this.groupBox4.Controls.Add(this.IDC_BUTTON_MEASPRAMPATHSET);
-            this.groupBox4.Location = new System.Drawing.Point(6, 346);
+            this.groupBox4.Location = new System.Drawing.Point(6, 357);
             this.groupBox4.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox4.Name = "groupBox4";
             this.groupBox4.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox4.Size = new System.Drawing.Size(306, 285);
+            this.groupBox4.Size = new System.Drawing.Size(306, 274);
             this.groupBox4.TabIndex = 380;
             this.groupBox4.TabStop = false;
             this.groupBox4.Text = "常规测量参数";
@@ -946,11 +948,11 @@
             this.groupBox5.Controls.Add(this.label26);
             this.groupBox5.Controls.Add(this.label23);
             this.groupBox5.Controls.Add(this.label20);
-            this.groupBox5.Location = new System.Drawing.Point(334, 365);
+            this.groupBox5.Location = new System.Drawing.Point(334, 357);
             this.groupBox5.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox5.Name = "groupBox5";
             this.groupBox5.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox5.Size = new System.Drawing.Size(306, 226);
+            this.groupBox5.Size = new System.Drawing.Size(306, 234);
             this.groupBox5.TabIndex = 540;
             this.groupBox5.TabStop = false;
             this.groupBox5.Text = "图像处理参数";
@@ -965,6 +967,25 @@
             this.IDC_COMBO_CorrosionExpansionCoefficient.TabIndex = 825;
             this.IDC_COMBO_CorrosionExpansionCoefficient.TextChanged += new System.EventHandler(this.IDC_COMBO_CorrosionExpansionCoefficient_TextChanged);
             // 
+            // label50
+            // 
+            this.label50.AutoSize = true;
+            this.label50.Location = new System.Drawing.Point(6, 181);
+            this.label50.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label50.Name = "label50";
+            this.label50.Size = new System.Drawing.Size(77, 12);
+            this.label50.TabIndex = 824;
+            this.label50.Text = "图像重叠像素";
+            // 
+            // IDC_EDIT_Overlap
+            // 
+            this.IDC_EDIT_Overlap.Location = new System.Drawing.Point(125, 178);
+            this.IDC_EDIT_Overlap.MaxLength = 10;
+            this.IDC_EDIT_Overlap.Name = "IDC_EDIT_Overlap";
+            this.IDC_EDIT_Overlap.Size = new System.Drawing.Size(92, 21);
+            this.IDC_EDIT_Overlap.TabIndex = 832;
+            this.IDC_EDIT_Overlap.Text = "20";
+            // 
             // label49
             // 
             this.label49.AutoSize = true;
@@ -1125,6 +1146,16 @@
             this.label28.TabIndex = 680;
             this.label28.Text = "最大";
             // 
+            // label51
+            // 
+            this.label51.AutoSize = true;
+            this.label51.Location = new System.Drawing.Point(225, 181);
+            this.label51.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label51.Name = "label51";
+            this.label51.Size = new System.Drawing.Size(35, 12);
+            this.label51.TabIndex = 721;
+            this.label51.Text = "pixel";
+            // 
             // label27
             // 
             this.label27.AutoSize = true;
@@ -1239,7 +1270,9 @@
             // 
             // groupBox6
             // 
+            this.groupBox6.Controls.Add(this.IDC_FILTER);
             this.groupBox6.Controls.Add(this.IDC_EDIT_XrayLimit);
+            this.groupBox6.Controls.Add(this.label52);
             this.groupBox6.Controls.Add(this.label47);
             this.groupBox6.Controls.Add(this.IDC_EDIT_SmallPartAQTime);
             this.groupBox6.Controls.Add(this.label45);
@@ -1266,7 +1299,7 @@
             this.groupBox6.Location = new System.Drawing.Point(6, 134);
             this.groupBox6.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox6.Name = "groupBox6";
-            this.groupBox6.Size = new System.Drawing.Size(306, 187);
+            this.groupBox6.Size = new System.Drawing.Size(306, 217);
             this.groupBox6.TabIndex = 700;
             this.groupBox6.TabStop = false;
             this.groupBox6.Text = "X-ray参数";
@@ -1622,34 +1655,25 @@
             this.label48.Text = "终止测量面积";
             this.label48.Visible = false;
             // 
-            // label50
-            // 
-            this.label50.AutoSize = true;
-            this.label50.Location = new System.Drawing.Point(6, 181);
-            this.label50.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
-            this.label50.Name = "label50";
-            this.label50.Size = new System.Drawing.Size(77, 12);
-            this.label50.TabIndex = 824;
-            this.label50.Text = "图像重叠像素";
-            // 
-            // label51
+            // label52
             // 
-            this.label51.AutoSize = true;
-            this.label51.Location = new System.Drawing.Point(225, 181);
-            this.label51.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
-            this.label51.Name = "label51";
-            this.label51.Size = new System.Drawing.Size(35, 12);
-            this.label51.TabIndex = 721;
-            this.label51.Text = "pixel";
+            this.label52.AutoSize = true;
+            this.label52.Location = new System.Drawing.Point(9, 189);
+            this.label52.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label52.Name = "label52";
+            this.label52.Size = new System.Drawing.Size(77, 12);
+            this.label52.TabIndex = 833;
+            this.label52.Text = "是否启动过滤";
             // 
-            // IDC_EDIT_Overlap
+            // IDC_FILTER
             // 
-            this.IDC_EDIT_Overlap.Location = new System.Drawing.Point(125, 178);
-            this.IDC_EDIT_Overlap.MaxLength = 10;
-            this.IDC_EDIT_Overlap.Name = "IDC_EDIT_Overlap";
-            this.IDC_EDIT_Overlap.Size = new System.Drawing.Size(92, 21);
-            this.IDC_EDIT_Overlap.TabIndex = 832;
-            this.IDC_EDIT_Overlap.Text = "20";
+            this.IDC_FILTER.AutoSize = true;
+            this.IDC_FILTER.Location = new System.Drawing.Point(276, 189);
+            this.IDC_FILTER.Margin = new System.Windows.Forms.Padding(2);
+            this.IDC_FILTER.Name = "IDC_FILTER";
+            this.IDC_FILTER.Size = new System.Drawing.Size(15, 14);
+            this.IDC_FILTER.TabIndex = 835;
+            this.IDC_FILTER.UseVisualStyleBackColor = true;
             // 
             // ProgMgrInfoForm
             // 
@@ -1853,5 +1877,7 @@
         private System.Windows.Forms.Label label50;
         private System.Windows.Forms.Label label51;
         public System.Windows.Forms.TextBox IDC_EDIT_Overlap;
+        private System.Windows.Forms.Label label52;
+        public System.Windows.Forms.CheckBox IDC_FILTER;
     }
 }

+ 38 - 2
OTSIncAMeasureApp/ServiceCenter/DTLBase/SQliteHelper.cs

@@ -735,9 +735,45 @@ namespace OTSModelSharp.DTLBase
             return ExecuteQuery(queryString);
         }
 
+        /// <summary>
+        /// 获取关键元素列表
+        /// </summary>
+        /// <param name="tableName">表名</param>
+        /// <param name="eleName">字段名</param>
+        /// <returns></returns>
+        public List<string> GetDBKeyElementList(string tableName, string eleName)
+        {
+            string queryString = "SELECT "+ eleName + " FROM " + tableName;
+            DataTable dt = ExecuteQuery(queryString);
+            List<string> nameList = new List<string>();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                string str_name = dt.Rows[i][eleName].ToString();
+                if (str_name != "")
+                {
+                    if (str_name.Contains(","))
+                    {
+                        for (int j = 0; j < str_name.Split(',').Length; j++)
+                        {
+                            if (!nameList.Contains(str_name.Split(',')[j]))
+                            {
+                                nameList.Add(str_name.Split(',')[j]);
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if (!nameList.Contains(str_name))
+                        {
+                            nameList.Add(str_name);
+                        }
+                    }
+                }
+            }
+            return nameList;
+        }
+
 
-      
 
-      
     }
 }

+ 32 - 2
OTSIncAMeasureApp/ServiceCenter/EDSController.cs

@@ -15,7 +15,7 @@ namespace OTSModelSharp.ServiceInterface
 
     public class EDSController : IEDSController
     {
-        private COTSControlFunExport eds;
+        public COTSControlFunExport eds;
         static EDSController edsctrl = null;
         public static APIClass ApiClass = null;
         private static bool isFEI = false;
@@ -23,6 +23,7 @@ namespace OTSModelSharp.ServiceInterface
         private string strResolution = "";
         private int width = 0;
         private int height = 0;
+        public List<string> nameList = new List<string>();
         public static EDSController GetEDSController()
         {
             if (FileHelper.GetXMLInformations("EDSName") == "FEI")
@@ -99,8 +100,22 @@ namespace OTSModelSharp.ServiceInterface
                     return false;
                 }
 
-                COTSParticleClr[] parts = a_listParticles.ToArray();
+                if (eds.GetEDSName() == "EDS Bruker")
+                {
+                    for (int i = 0; i < a_listParticles.Count; i++)
+                    {
+                        List<CElementChemistryClr> elementChemistryClrs = new List<CElementChemistryClr>();
+                        for (int j = 0; j < nameList.Count; j++)
+                        {
+                            CElementChemistryClr chemistryClr = new CElementChemistryClr();
+                            chemistryClr.SetName(nameList[j]);
+                            elementChemistryClrs.Add(chemistryClr);
+                        }
+                        a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
+                    }
+                }    
 
+                COTSParticleClr[] parts = a_listParticles.ToArray();
 
                 return eds.GetXRayByFeatures((uint)a_nXRayAQTime, parts, a_bElementInfo);
             }
@@ -152,6 +167,21 @@ namespace OTSModelSharp.ServiceInterface
                     Ps[i].Y = p.Y;
                 }
 
+                if (eds.GetEDSName() == "EDS Bruker")
+                {
+                    for (int i = 0; i < a_listParticles.Count; i++)
+                    {
+                        List<CElementChemistryClr> elementChemistryClrs = new List<CElementChemistryClr>();
+                        for (int j = 0; j < nameList.Count; j++)
+                        {
+                            CElementChemistryClr chemistryClr = new CElementChemistryClr();
+                            chemistryClr.SetName(nameList[j]);
+                            elementChemistryClrs.Add(chemistryClr);
+                        }
+                        a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
+                    }
+                }
+
                 COTSParticleClr[] parts = a_listParticles.ToArray();
 
                 return eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);

BIN
OpenDll/FEIAPI/FEIApiControl.dll