|
@@ -46,9 +46,55 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
eds = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance();
|
|
|
}
|
|
|
}
|
|
|
+ private void ProcessXrayInfo(COTSParticleClr partWithXrayInfo)//sometime the result will contain repeat percentage data for one element.It must be processed.
|
|
|
+ {
|
|
|
+ var eleChemistry = partWithXrayInfo.GetXray().GetElementQuantifyData();
|
|
|
+ Dictionary<string, List<double>> eleInfoDic = new Dictionary<string, List<double>>();
|
|
|
+ bool hasRepeatEle = false;
|
|
|
+ foreach (var ele in eleChemistry)
|
|
|
+ {
|
|
|
+ if (eleInfoDic.ContainsKey(ele.GetName()))//contain repeat data;
|
|
|
+ {
|
|
|
+ eleInfoDic[ele.GetName()].Add(ele.GetPercentage());
|
|
|
+ hasRepeatEle = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ eleInfoDic.Add(ele.GetName(), new List<double>() { ele.GetPercentage() });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ if (hasRepeatEle)
|
|
|
+ {
|
|
|
+ Dictionary<string, double> resultInfo = new Dictionary<string, double>();
|
|
|
+ foreach (var eleInfo in eleInfoDic)
|
|
|
+ {
|
|
|
+ double newPercentData=0;
|
|
|
+ foreach (var p in eleInfo.Value)
|
|
|
+ {
|
|
|
+ newPercentData += p;
|
|
|
+ }
|
|
|
+ newPercentData = newPercentData / eleInfo.Value.Count;
|
|
|
+ resultInfo.Add(eleInfo.Key, newPercentData);
|
|
|
+ }
|
|
|
+ foreach (var e in eleChemistry)
|
|
|
+ {
|
|
|
+ e.SetPercentage(resultInfo[e.GetName()]);
|
|
|
+
|
|
|
+ }
|
|
|
+ partWithXrayInfo.GetXray().SetElementQuantifyData(eleChemistry);
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
+ bool result = false;
|
|
|
if (isFEI)
|
|
|
{
|
|
|
for (int i = 0; i < a_listParticles.Count; i++)
|
|
@@ -74,8 +120,8 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return true;
|
|
|
+ result = true;
|
|
|
+ //return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -87,12 +133,24 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
COTSParticleClr[] parts = a_listParticles.ToArray();
|
|
|
|
|
|
|
|
|
- return eds.GetXRayByFeatures((uint)a_nXRayAQTime, parts, a_bElementInfo);
|
|
|
+ result= eds.GetXRayByFeatures((uint)a_nXRayAQTime, parts, a_bElementInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result == true)
|
|
|
+ {
|
|
|
+ foreach (var p in a_listParticles)
|
|
|
+ {
|
|
|
+ ProcessXrayInfo(p);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
public bool GetXRayByPoints(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
+ bool result = false;
|
|
|
if (isFEI)
|
|
|
{
|
|
|
for (int i = 0; i < a_listParticles.Count; i++)
|
|
@@ -118,7 +176,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
a_listParticles[i].GetXray().SetElementQuantifyData(elementChemistryClrs);
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ result= true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -139,8 +197,18 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
|
|
|
COTSParticleClr[] parts = a_listParticles.ToArray();
|
|
|
|
|
|
- return eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);
|
|
|
+ result= eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);
|
|
|
+ }
|
|
|
+ if (result == true)
|
|
|
+ {
|
|
|
+ foreach (var p in a_listParticles)
|
|
|
+ {
|
|
|
+ ProcessXrayInfo(p);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)
|