|
@@ -96,23 +96,23 @@ namespace OxfordExtenderWrapper
|
|
|
};
|
|
|
enum OxfordCommandType
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
GetMagnification = 0,
|
|
|
SetMagnification = 1,
|
|
|
|
|
|
-
|
|
|
+
|
|
|
GetWorkingDistance = 2,
|
|
|
SetWorkingDistance = 3,
|
|
|
|
|
|
-
|
|
|
+
|
|
|
GetBrightness = 4,
|
|
|
SetBrightness = 5,
|
|
|
|
|
|
-
|
|
|
+
|
|
|
GetContrast = 6,
|
|
|
SetContrast = 7,
|
|
|
|
|
|
-
|
|
|
+
|
|
|
GetSEMVoltage = 8,
|
|
|
SetSEMVoltage = 9,
|
|
|
|
|
@@ -139,14 +139,14 @@ namespace OxfordExtenderWrapper
|
|
|
//获取分辨率
|
|
|
GetImageResolution = 25,
|
|
|
//设置分辨率
|
|
|
- SetImageResolution= 26,
|
|
|
+ SetImageResolution = 26,
|
|
|
//获取bitmap
|
|
|
GetBitmap = 27,
|
|
|
|
|
|
//X-ray
|
|
|
//点采集
|
|
|
XrayPointCollection = 29,
|
|
|
- COLLECT_XRAYPOINTS=30,
|
|
|
+ COLLECT_XRAYPOINTS = 30,
|
|
|
//面采集
|
|
|
XrayAreaCollection = 31,
|
|
|
COLLECT_XRAYFEATURES = 32,
|
|
@@ -160,8 +160,8 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
public enum ImageRegionType
|
|
|
{
|
|
|
- FullField=0,
|
|
|
- Rectangle=1
|
|
|
+ FullField = 0,
|
|
|
+ Rectangle = 1
|
|
|
|
|
|
}
|
|
|
public ImageAquistionParam()
|
|
@@ -208,7 +208,7 @@ namespace OxfordExtenderWrapper
|
|
|
this.listElement = new Dictionary<string, double>();
|
|
|
}
|
|
|
public double dMilliSecondsTime;
|
|
|
- public List<Segment> a_listChord=new List<Segment>();
|
|
|
+ public List<Segment> a_listChord = new List<Segment>();
|
|
|
public uint[] XrayData;
|
|
|
public Dictionary<string, double> listElement;
|
|
|
public bool b_quant;
|
|
@@ -234,14 +234,14 @@ namespace OxfordExtenderWrapper
|
|
|
public List<AreaXrayParam> XrayPrmForFeatures;
|
|
|
public int AreaXrayDataReceived;
|
|
|
}
|
|
|
- public class ExtenderWrapper:MarshalByRefObject
|
|
|
+ public class ExtenderWrapper : MarshalByRefObject
|
|
|
{
|
|
|
|
|
|
NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
private oxfordCommandData currentCommand;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//控制电镜
|
|
|
private IMicroscopeController microscopeController = null;
|
|
|
/// <summary>
|
|
@@ -262,18 +262,18 @@ namespace OxfordExtenderWrapper
|
|
|
private ISEMQuantSettings quantSettings = null;
|
|
|
|
|
|
//private IEdChordListAcquisitionController _edsChordListController = null;
|
|
|
-
|
|
|
+
|
|
|
private IEdChordListSettings _edsChordListSetting;
|
|
|
private int XRayChannelLength = 2000;
|
|
|
|
|
|
private int EDSColletionTimeOut = 10000;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const int g_nOxfordControllerProcessTime = 4;
|
|
|
const int g_nOxfordControllerEnergyRange = 20;
|
|
|
|
|
|
-
|
|
|
+ const int XrayQuantityLimitPerTime = 256;
|
|
|
|
|
|
private bool m_bXrayDone = false;
|
|
|
//电压
|
|
@@ -298,8 +298,8 @@ namespace OxfordExtenderWrapper
|
|
|
private double m_dStageR;
|
|
|
private double m_dStageT;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
private byte[] m_ImageBit = null;
|
|
|
private long m_nImageWidth = 0;
|
|
|
private long m_nImageHeight = 0;
|
|
@@ -341,7 +341,7 @@ namespace OxfordExtenderWrapper
|
|
|
InitMicroscopeController();
|
|
|
InitImageAcquisition();
|
|
|
InitXrayAcquistion();
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -349,25 +349,20 @@ namespace OxfordExtenderWrapper
|
|
|
log.Error(e.Message);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//结束
|
|
|
public void CloseExtender()
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
- CloseMicroscopeController();
|
|
|
- CloseImageAcquisition();
|
|
|
- CloseXrayAcquistion();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+ CloseMicroscopeController();
|
|
|
+ CloseImageAcquisition();
|
|
|
+ CloseXrayAcquistion();
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public bool AquisitionImage(ref ImageAquistionParam p)
|
|
|
{
|
|
|
currentCommand.grabImgParam = p;
|
|
@@ -393,18 +388,18 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
Application.DoEvents();
|
|
|
int time2;
|
|
|
-
|
|
|
- time2 = Environment.TickCount;
|
|
|
- if (time2 - time1 > EDSColletionTimeOut*6)
|
|
|
- {
|
|
|
- currentCommand.returnType = false;
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 6)
|
|
|
+ {
|
|
|
+ currentCommand.returnType = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
catch (InvalidSettingsException settingsException)
|
|
@@ -420,7 +415,7 @@ namespace OxfordExtenderWrapper
|
|
|
string msg = string.Format(@"AcquisitionStartException: {0}", startException.Message);
|
|
|
NLog.LogManager.GetCurrentClassLogger().Error(msg);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (currentCommand.returnType == true)
|
|
|
{
|
|
|
|
|
@@ -435,12 +430,12 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool MoveStageXY(float x, float y)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
currentCommand.moveStagePrm = new MoveStageParam();
|
|
|
currentCommand.moveStagePrm.x = x;
|
|
|
currentCommand.moveStagePrm.y = y;
|
|
|
currentCommand.commandType = OxfordCommandType.MoveStageXY;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
@@ -451,18 +446,18 @@ namespace OxfordExtenderWrapper
|
|
|
m_StageUpdated = false;
|
|
|
this.microscopeController.SetStageConditions(stageDictionary);
|
|
|
currentCommand.returnType = true;
|
|
|
-
|
|
|
+
|
|
|
int time1 = Environment.TickCount;
|
|
|
int time2;
|
|
|
|
|
|
while (!m_StageUpdated)
|
|
|
{
|
|
|
Application.DoEvents();
|
|
|
-
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
time2 = Environment.TickCount;
|
|
|
- if (time2-time1 > 60000)
|
|
|
+ if (time2 - time1 > 60000)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
break;
|
|
@@ -480,7 +475,7 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool XrayAreaCollecting(ref AreaXrayParam p)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
currentCommand.areaXrayPrm = p;
|
|
|
currentCommand.commandType = OxfordCommandType.XrayAreaCollection;
|
|
|
m_bXrayDone = false;
|
|
@@ -493,12 +488,12 @@ namespace OxfordExtenderWrapper
|
|
|
Chord chord = new Chord(seg.X, seg.Y, seg.Length);
|
|
|
Chords.Add(chord);
|
|
|
}
|
|
|
- var chordsList = new ChordList(Chords, m_dImagePixelsize);
|
|
|
+ var chordsList = new ChordList(Chords, m_dImagePixelsize);
|
|
|
EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreateChordListRegion(chordsList);
|
|
|
EdSpectrumAcquisitionController.BeginMultipleAcquisition();
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
|
|
|
|
|
|
var time1 = Environment.TickCount;
|
|
@@ -511,10 +506,10 @@ namespace OxfordExtenderWrapper
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
Application.DoEvents();
|
|
|
var time2 = Environment.TickCount;
|
|
|
- if (time2-time1 > EDSColletionTimeOut * 6)
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 6)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
break;
|
|
@@ -533,7 +528,7 @@ namespace OxfordExtenderWrapper
|
|
|
string msg = string.Format(@"Acquisition Start Exception:{0}", acquisitionStartException.Message);
|
|
|
log.Error(msg);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (currentCommand.returnType == true)
|
|
|
{
|
|
|
|
|
@@ -547,7 +542,7 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool XrayPointCollecting(ref PointXrayParam p)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
currentCommand.pointXrayPrm = p;
|
|
|
currentCommand.commandType = OxfordCommandType.XrayPointCollection;
|
|
|
|
|
@@ -558,13 +553,13 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
SetXrayAcquisitionParam(p.dMilliSecondsTime);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreatePointRegion(new System.Windows.Point(p.x * m_dImagePixelsize, p.y * m_dImagePixelsize));
|
|
|
EdSpectrumAcquisitionController.BeginMultipleAcquisition();
|
|
|
try
|
|
|
{
|
|
|
m_bXrayDone = false;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
|
|
|
|
|
@@ -580,7 +575,7 @@ namespace OxfordExtenderWrapper
|
|
|
Application.DoEvents();
|
|
|
|
|
|
var time2 = Environment.TickCount;
|
|
|
- if (time2-time1 > EDSColletionTimeOut * 6)
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 6)
|
|
|
{
|
|
|
EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
log.Warn("XrayStartAcquisition 超时!");
|
|
@@ -603,7 +598,7 @@ namespace OxfordExtenderWrapper
|
|
|
string msg = string.Format(@"Acquisition Start Exception:{0}", acquisitionStartException.Message);
|
|
|
log.Error(msg);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (currentCommand.returnType == true)
|
|
|
{
|
|
|
|
|
@@ -617,18 +612,66 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool CollectXrayByPoints(ref List<PointXrayParam> a_listPoints, uint a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
+ int nSize = a_listPoints.Count;
|
|
|
+ List<PointXrayParam> singleGroup = new List<PointXrayParam>();
|
|
|
+
|
|
|
+
|
|
|
+ int nTimes = nSize / XrayQuantityLimitPerTime;
|
|
|
+ for (int i = 0; i < nTimes; i++)
|
|
|
+ {
|
|
|
+ singleGroup.Clear();
|
|
|
|
|
|
+ for (int m = 0; m < XrayQuantityLimitPerTime; m++)
|
|
|
+ {
|
|
|
+ singleGroup.Add(a_listPoints[i * XrayQuantityLimitPerTime + m]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectXrayByPointsOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
|
|
|
+ {
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ int nLast = nSize % XrayQuantityLimitPerTime;
|
|
|
+ if (nLast != 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ singleGroup.Clear();
|
|
|
+ for (int m = 0; m < nLast; m++)
|
|
|
+ {
|
|
|
+ singleGroup.Add(a_listPoints[m]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectXrayByPointsOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public bool CollectXrayByPointsOnHardwareLimit(ref List<PointXrayParam> a_listPoints, uint a_nXRayAQTime, bool a_bElementInfo)
|
|
|
+ {
|
|
|
+ if (a_listPoints.Count > XrayQuantityLimitPerTime)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
currentCommand.XrayPrmForPoints = a_listPoints;
|
|
|
currentCommand.commandType = OxfordCommandType.COLLECT_XRAYPOINTS;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//log.Info("线程:开始采集多点xray");
|
|
|
var PointXrayDatas = currentCommand.XrayPrmForPoints;
|
|
|
currentCommand.PointXrayDataReceived = 0;
|
|
|
|
|
|
m_bXrayDone = false;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var dMilliSecondsTime = PointXrayDatas[0].dMilliSecondsTime;
|
|
|
SetXrayAcquisitionParam(dMilliSecondsTime);
|
|
@@ -677,18 +720,18 @@ namespace OxfordExtenderWrapper
|
|
|
Application.DoEvents();
|
|
|
|
|
|
var time2 = Environment.TickCount;
|
|
|
-
|
|
|
- if (time2-time1 > EDSColletionTimeOut * PointXrayDatas.Count)
|
|
|
+
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * PointXrayDatas.Count)
|
|
|
{
|
|
|
EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
-
|
|
|
+
|
|
|
currentCommand.returnType = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (currentCommand.returnType == true)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
@@ -699,18 +742,66 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool CollectXrayByFeatures(ref List<AreaXrayParam> a_listFeatures, double a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
+ int nSize = a_listFeatures.Count;
|
|
|
+ List<AreaXrayParam> singleGroup = new List<AreaXrayParam>();
|
|
|
+
|
|
|
+
|
|
|
+ int nTimes = nSize / XrayQuantityLimitPerTime;
|
|
|
+ for (int i = 0; i < nTimes; i++)
|
|
|
+ {
|
|
|
+ singleGroup.Clear();
|
|
|
+
|
|
|
+ for (int m = 0; m < XrayQuantityLimitPerTime; m++)
|
|
|
+ {
|
|
|
+ singleGroup.Add(a_listFeatures[i * XrayQuantityLimitPerTime + m]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectXrayByFeaturesOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
|
|
|
+ {
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ int nLast = nSize % XrayQuantityLimitPerTime;
|
|
|
+ if (nLast != 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ singleGroup.Clear();
|
|
|
+ for (int m = 0; m < nLast; m++)
|
|
|
+ {
|
|
|
+ singleGroup.Add(a_listFeatures[m]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectXrayByFeaturesOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public bool CollectXrayByFeaturesOnHardwareLimit(ref List<AreaXrayParam> a_listFeatures, double a_nXRayAQTime, bool a_bElementInfo)
|
|
|
+ {
|
|
|
+ if (a_listFeatures.Count > XrayQuantityLimitPerTime)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
currentCommand.XrayPrmForFeatures = a_listFeatures;
|
|
|
|
|
|
|
|
|
currentCommand.commandType = OxfordCommandType.COLLECT_XRAYFEATURES;
|
|
|
var p = currentCommand.XrayPrmForFeatures;
|
|
|
currentCommand.AreaXrayDataReceived = 0;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
m_bXrayDone = false;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var dMilliSecondsTime = p[0].dMilliSecondsTime;
|
|
|
SetXrayAcquisitionParam(p[0].dMilliSecondsTime);
|
|
@@ -724,13 +815,13 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
if (seg.Length >= 3)
|
|
|
{
|
|
|
- chord = new Chord(seg.X+1, seg.Y, seg.Length-2);//get the middle part
|
|
|
+ chord = new Chord(seg.X + 1, seg.Y, seg.Length - 2);//get the middle part
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
- chord = new Chord(seg.X, seg.Y, seg.Length);
|
|
|
+ chord = new Chord(seg.X, seg.Y, seg.Length);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Chords.Add(chord);
|
|
|
}
|
|
|
var chordsList = new ChordList(Chords, m_dImagePixelsize);
|
|
@@ -774,13 +865,13 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
Application.DoEvents();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
var time2 = Environment.TickCount;
|
|
|
- if (time2-time1 > EDSColletionTimeOut * p.Count)
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * p.Count)
|
|
|
{
|
|
|
EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
currentCommand.returnType = false;
|
|
|
break;
|
|
|
}
|
|
@@ -799,8 +890,8 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//控制电镜初始化
|
|
|
void InitMicroscopeController()
|
|
@@ -811,7 +902,7 @@ namespace OxfordExtenderWrapper
|
|
|
this.microscopeController.ColumnConnected += this.OnMicroscopeColumnConnected;
|
|
|
this.microscopeController.StageConnected += this.OnMicroscopeStageConnected;
|
|
|
this.microscopeController.ChangeCompleted += this.OnMicroscopeChangeCompleted;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//ReadMicroscopeColumn();
|
|
|
|
|
@@ -824,7 +915,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
if (microscopeController != null)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
this.microscopeController.ColumnChange -= this.OnMicroscopeColumnChange;
|
|
|
this.microscopeController.StageChange -= this.OnMicroscopeStageChange;
|
|
|
this.microscopeController.ColumnConnected -= this.OnMicroscopeColumnConnected;
|
|
@@ -832,7 +923,7 @@ namespace OxfordExtenderWrapper
|
|
|
this.microscopeController.ChangeCompleted -= this.OnMicroscopeChangeCompleted;
|
|
|
microscopeController = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//读取当前的电镜控制值
|
|
@@ -888,12 +979,12 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
if (stageCapabilities.StageX.CanRead)
|
|
|
{
|
|
|
- this.m_dStageX = stageConditions.StageX*1000.0;
|
|
|
+ this.m_dStageX = stageConditions.StageX * 1000.0;
|
|
|
}
|
|
|
|
|
|
if (stageCapabilities.StageY.CanRead)
|
|
|
{
|
|
|
- this.m_dStageY = stageConditions.StageY*1000.0;
|
|
|
+ this.m_dStageY = stageConditions.StageY * 1000.0;
|
|
|
}
|
|
|
|
|
|
if (stageCapabilities.StageZ.CanRead)
|
|
@@ -915,14 +1006,14 @@ namespace OxfordExtenderWrapper
|
|
|
//电镜控制改变事件
|
|
|
private void OnMicroscopeColumnChange(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
ReadMicroscopeColumn();
|
|
|
}
|
|
|
|
|
|
//样品台控制改变事件
|
|
|
private void OnMicroscopeStageChange(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
ReadStage();
|
|
|
}
|
|
|
|
|
@@ -935,7 +1026,7 @@ namespace OxfordExtenderWrapper
|
|
|
//样品台控制连接或断开时的事件
|
|
|
private void OnMicroscopeStageConnected(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
ReadStage();
|
|
|
}
|
|
|
|
|
@@ -946,9 +1037,9 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
if (e.Success)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
m_StageUpdated = true;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -966,7 +1057,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
m_ExternalScanUpdated = true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
ReadMicroscopeColumn();
|
|
|
ReadStage();
|
|
@@ -998,7 +1089,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
return false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -1029,7 +1120,7 @@ namespace OxfordExtenderWrapper
|
|
|
if (time2 - time1 > 10000)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -1061,7 +1152,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
return false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -1114,7 +1205,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+
|
|
|
m_CollumnUpdated = false;
|
|
|
this.microscopeController.SetColumnConditions(columnDictionary);
|
|
|
int time1 = Environment.TickCount;
|
|
@@ -1153,11 +1244,11 @@ namespace OxfordExtenderWrapper
|
|
|
//break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//样品台
|
|
|
public float[] GetStagePosition()
|
|
|
{
|
|
@@ -1175,15 +1266,15 @@ namespace OxfordExtenderWrapper
|
|
|
public Boolean SetStagePosition(float[] set)
|
|
|
{
|
|
|
double stageX = (double)set[0];
|
|
|
-
|
|
|
+
|
|
|
double stageY = (double)set[1];
|
|
|
-
|
|
|
+
|
|
|
double stageZ = (double)set[2];
|
|
|
-
|
|
|
+
|
|
|
double stageT = (double)set[3];
|
|
|
-
|
|
|
+
|
|
|
double stageR = (double)set[4];
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
@@ -1240,7 +1331,7 @@ namespace OxfordExtenderWrapper
|
|
|
public Boolean SetStageGotoX(float set)
|
|
|
{
|
|
|
double stageX = (double)set;
|
|
|
-
|
|
|
+
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
|
{ Stage.StageX, (double)stageX/1000.0 }
|
|
@@ -1266,7 +1357,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
|
|
|
double stageY = (double)set;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
@@ -1292,7 +1383,7 @@ namespace OxfordExtenderWrapper
|
|
|
public Boolean SetStageGotoZ(float set)
|
|
|
{
|
|
|
double stageZ = (double)set;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
@@ -1337,7 +1428,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
return false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -1345,7 +1436,7 @@ namespace OxfordExtenderWrapper
|
|
|
public Boolean SetStageGotoR(float set)
|
|
|
{
|
|
|
double stageR = (double)set;
|
|
|
-
|
|
|
+
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
|
{ Stage.StageR, (double)stageR }
|
|
@@ -1368,10 +1459,10 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#region 拍图
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//图像扫描尺寸
|
|
|
public double[] ImageScanSize =
|
|
@@ -1391,7 +1482,7 @@ namespace OxfordExtenderWrapper
|
|
|
4096,
|
|
|
8192
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
|
|
|
public double GetDImagePixelsize()
|
|
|
{
|
|
@@ -1408,11 +1499,11 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
imageAcquisitionController = AcquireFactory.CreateImageServer();
|
|
|
imageAcquisitionSettings = AcquireFactory.CreateImageSettings();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
imageAcquisitionController.ExperimentStarted += this.OnImageExperimentStarted;
|
|
|
imageAcquisitionController.ExperimentFinished += this.OnImageExperimentFinished;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
void InitXrayAcquistion()
|
|
|
{
|
|
@@ -1421,12 +1512,12 @@ namespace OxfordExtenderWrapper
|
|
|
EdSpectrumProcessing = ProcessingFactory.CreateSpectrumProcessing();
|
|
|
// Use the autoIdSettings to define elements that are known or elements that you want to exclude. They also list elements that cannot be identified
|
|
|
autoIdSettings = ProcessingFactory.CreateAutoIdSettings();
|
|
|
-
|
|
|
+
|
|
|
quantSettings = ProcessingFactory.CreateSEMQuantSettings();
|
|
|
|
|
|
EdSpectrumAcquisitionController.ExperimentFinished += this.OnEdSpectrumExperimentFinished;
|
|
|
//EdSpectrumAcquisitionController.ExperimentStarted += this.OnEdSpectrumExperimentStarted;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
//控制电镜释放
|
|
|
void CloseImageAcquisition()
|
|
@@ -1437,7 +1528,7 @@ namespace OxfordExtenderWrapper
|
|
|
imageAcquisitionController.ExperimentFinished -= this.OnImageExperimentFinished;
|
|
|
imageAcquisitionController = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
void CloseXrayAcquistion()
|
|
|
{
|
|
@@ -1469,7 +1560,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
if (!ReadImageData(electronImage, out m_ImageBit, out m_nImageWidth, out m_nImageHeight, out m_dImagePixelsize))
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
NLog.LogManager.GetCurrentClassLogger().Error("图像采集完成,获取图像像素失败!");
|
|
|
}
|
|
|
|
|
@@ -1532,7 +1623,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
//a_dDwellTime : 1~100000之间的数
|
|
|
//a_sImageType : 1: SE, 2: Bse
|
|
|
-
|
|
|
+
|
|
|
public bool SetImageAcquistionSetting(ImageAquistionParam p)
|
|
|
{
|
|
|
|
|
@@ -1571,20 +1662,20 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
scanSettings.AcquisitionRegion.CreateFullFieldRegion(pixelSize);
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
|
|
|
- scanSettings.AcquisitionRegion.CreateRectangleRegion(p.ImgRectRegion,pixelSize);
|
|
|
+ scanSettings.AcquisitionRegion.CreateRectangleRegion(p.ImgRectRegion, pixelSize);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
#endregion
|
|
@@ -1604,24 +1695,24 @@ namespace OxfordExtenderWrapper
|
|
|
EdSpectrumSettings.EdSettings.ProcessTime = 4;
|
|
|
EdSpectrumSettings.EdSettings.EnergyRange = 20;
|
|
|
EdSpectrumSettings.EdSettings.NumberOfChannels = 4096;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- private bool GetAtomicNumberByEleName(string name,out int atomicNum)
|
|
|
+ private bool GetAtomicNumberByEleName(string name, out int atomicNum)
|
|
|
{
|
|
|
var allelenames = theElementNameList.Split(',');
|
|
|
for (int i = 0; i < allelenames.Length; i++)
|
|
|
{
|
|
|
if (allelenames[i] == name)
|
|
|
{
|
|
|
- atomicNum= i+1;
|
|
|
+ atomicNum = i + 1;
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- atomicNum=0;
|
|
|
+ atomicNum = 0;
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Called when IEdSpectrumAcquisitionController Experiment Finished
|
|
|
/// </summary>
|
|
@@ -1632,7 +1723,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
IEdSpectrumAcquisitionController edSpectrumAcquisitionController = sender as IEdSpectrumAcquisitionController;
|
|
|
|
|
|
- uint[] m_XrayData;
|
|
|
+ uint[] m_XrayData;
|
|
|
|
|
|
NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
|
|
|
IEdSpectrum edSpectrum = e.Value;
|
|
@@ -1648,7 +1739,7 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
|
|
|
//Quantify processing
|
|
|
- bool bquant=false;
|
|
|
+ bool bquant = false;
|
|
|
if (currentCommand.commandType == OxfordCommandType.XrayPointCollection)
|
|
|
{
|
|
|
bquant = currentCommand.pointXrayPrm.b_quant;
|
|
@@ -1684,20 +1775,20 @@ namespace OxfordExtenderWrapper
|
|
|
int atomicnum;
|
|
|
if (GetAtomicNumberByEleName(ele, out atomicnum))
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
autoIdSettings.SetKnownElement(atomicnum, true);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
log.Warn(autoIdSettings.KnownElements);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
EdSpectrumProcessing.IdentifyElements(e.Value, autoIdSettings);
|
|
|
// While it is possible to choose other elements, Oxygen is the only supported element by stoichiometry.
|
|
|
quantSettings.CombinedElement = 8;
|
|
@@ -1708,7 +1799,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
var ie = Results.GetEnumerator();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
while (ie.MoveNext())
|
|
|
{
|
|
@@ -1763,7 +1854,7 @@ namespace OxfordExtenderWrapper
|
|
|
m_bXrayDone = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1814,14 +1905,14 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
public bool IsAcquiringSpectrum()
|
|
|
{
|
|
|
return EdSpectrumAcquisitionController.IsAcquiring;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
public void BeginMultipleAquisition()
|
|
@@ -1836,7 +1927,7 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
public bool GetSemBeamOn()
|
|
|
{
|
|
|
var beamon = microscopeController.ColumnConditions.BeamOn;
|
|
@@ -1844,16 +1935,16 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
return false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
public bool SetSemBeamOnOrOff(bool val)
|
|
|
{
|
|
|
- double beamon ;
|
|
|
+ double beamon;
|
|
|
if (val)
|
|
|
{
|
|
|
beamon = 1;
|