|
|
@@ -40,7 +40,7 @@ namespace OTSModelSharp
|
|
|
protected EDSController m_EDSHardwareMgr;
|
|
|
|
|
|
protected Queue<COTSFieldData> fieldQueue=new Queue<COTSFieldData>();
|
|
|
- protected COTSFieldData curFldData;
|
|
|
+ //protected COTSFieldData curFldData;
|
|
|
protected IClassifyEngine m_classifyEngine;
|
|
|
public CSmplMeasure()
|
|
|
{
|
|
|
@@ -310,7 +310,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
m_strWorkingFolder = a_strWorkingFolder + m_Sample.GetName() + "\\";
|
|
|
}
|
|
|
- bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_allpieldcenter,out List<System.Drawing.Point> a_listFieldCenter)
|
|
|
+ bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_allpieldcenter,out List<System.Drawing.Point> a_listUnMsrFieldCenter)
|
|
|
{
|
|
|
|
|
|
// sample measure parameters
|
|
|
@@ -329,13 +329,13 @@ namespace OTSModelSharp
|
|
|
if (!pFieldMgr.Init(m_Sample.GetMsrArea(), poImageScanParam, poSEMDataMsr, listCompletedCenter))
|
|
|
{
|
|
|
log.Error("CalculateFieldsCenters: failed to init field centres list manager.");
|
|
|
- a_listFieldCenter = new List<System.Drawing.Point>();
|
|
|
+ a_listUnMsrFieldCenter = new List<System.Drawing.Point>();
|
|
|
a_allpieldcenter = new List<Point>();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// get field centers list
|
|
|
- a_listFieldCenter = pFieldMgr.GetUnmeasuredFieldCentrePoints();// GetFieldCentrePoints();
|
|
|
+ a_listUnMsrFieldCenter = pFieldMgr.GetUnmeasuredFieldCentrePoints();// GetFieldCentrePoints();
|
|
|
|
|
|
a_allpieldcenter = pFieldMgr.GetFieldCentrePoints();
|
|
|
|
|
|
@@ -512,7 +512,7 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
|
|
|
- public virtual void ClassifyFieldParticles()
|
|
|
+ public virtual void ClassifyFieldParticles(COTSFieldData curFldData)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -544,7 +544,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
public void Dispose()
|
|
|
{
|
|
|
- if (semState == null)
|
|
|
+ if (semState != null)
|
|
|
{
|
|
|
sm.MoveSEMToPoint(semState.Pos);
|
|
|
sm.m_SemHardwareMgr.SetMagnification(semState.Magnification);
|
|
|
@@ -619,19 +619,8 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
m_pSampleRstFile.SetSEMStage(pStage);
|
|
|
-
|
|
|
- // calculate field centers
|
|
|
- //List<System.Drawing.Point> umMeasuredlistFieldCenter;
|
|
|
- //List<System.Drawing.Point> alllistFieldCenter;
|
|
|
-
|
|
|
- //if (!CalculateUnMeasuredFieldsCenters(out alllistFieldCenter,out umMeasuredlistFieldCenter))
|
|
|
- //{// failed to calculate field centers
|
|
|
- // log.Error("DoMeasure: failed to calculate field centers.");
|
|
|
- // pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
|
|
|
- // // record end time
|
|
|
- // pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
|
|
|
- // return;
|
|
|
- //}
|
|
|
+
|
|
|
+
|
|
|
//-----save the static measure result file data into xml file and the dynamic data of every field will be saved into sqlite database
|
|
|
log.Info("Create result file!");
|
|
|
if (!m_pSampleRstFile.CreateResultFiles())
|
|
|
@@ -643,13 +632,35 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
//------
|
|
|
+ List<System.Drawing.Point> umMeasuredlistFieldCenter;
|
|
|
+ List<System.Drawing.Point> allFieldCenter;
|
|
|
+
|
|
|
+ if (!CalculateUnMeasuredFieldsCenters(out allFieldCenter, out umMeasuredlistFieldCenter))
|
|
|
+ {// failed to calculate field centers
|
|
|
+ log.Error("DoMeasure: failed to calculate field centers.");
|
|
|
+ pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
|
|
|
+ // record end time
|
|
|
+ pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
- //int nNewFieldId = 0;
|
|
|
- //int numOfAllFields = pStatus.GetCompletedFields() + umMeasuredlistFieldCenter.Count;//
|
|
|
- //int completedFields = pStatus.GetCompletedFields();
|
|
|
- //log.Info("Unmeasured fields:" + umMeasuredlistFieldCenter.Count);
|
|
|
var FldDatas = m_Sample.GetFieldsData();
|
|
|
+ if (FldDatas.Count < allFieldCenter.Count)
|
|
|
+ {
|
|
|
+ // calculate field centers
|
|
|
+ foreach (Point fldcenter in umMeasuredlistFieldCenter)
|
|
|
+ {
|
|
|
+ m_Sample.AddFieldData(fldcenter);
|
|
|
+ }
|
|
|
+
|
|
|
+ FldDatas = m_Sample.GetFieldsData();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
for (int i = 0; i < FldDatas.Count; ++i)
|
|
|
{// check and break if stop button is clicked
|
|
|
|
|
|
@@ -673,7 +684,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
// check if sample measurement completes
|
|
|
COTSImgScanPrm pScanParam = m_Sample.GetMsrParams().GetImageScanParam();
|
|
|
- //int nTotalFieldSize = (int)umMeasuredlistFieldCenter.Count;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
@@ -748,25 +759,21 @@ namespace OTSModelSharp
|
|
|
{
|
|
|
|
|
|
// add the field into the field
|
|
|
- //m_pSampleRstFile.AddAField(curFldData);
|
|
|
+
|
|
|
curFld.SetIsMeasureComplete(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //++nNewFieldId;
|
|
|
|
|
|
double measuredArea = 0; // this area should be the field area
|
|
|
- var a_pBSEImg = curFldData.GetBSEImage();
|
|
|
+ var a_pBSEImg = curFld.GetBSEImage();
|
|
|
|
|
|
- double dPixelSize = curFldData.GetPixelSize();
|
|
|
+ double dPixelSize = curFld.GetPixelSize();
|
|
|
|
|
|
|
|
|
measuredArea = a_pBSEImg.GetHeight() * a_pBSEImg.GetWidth()* dPixelSize * dPixelSize + 0.5; //Get measured area
|
|
|
- if (!CumulateFieldData(curFldData.GetListAnalysisParticles(), measuredArea))
|
|
|
+ if (!CumulateFieldData(curFld.GetListAnalysisParticles(), measuredArea))
|
|
|
{ // failed to call SaveFieldFile method
|
|
|
log.Error("ImageProcess: call CumulateFieldData method.");
|
|
|
pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
|
|
|
@@ -783,7 +790,7 @@ namespace OTSModelSharp
|
|
|
MsgFieldEnd.STMSampleRetData.iRetDataType = MSAMPLE_RET.FIELD_DATA;
|
|
|
MsgFieldEnd.STMSampleRetData.SFieldData.iCompleteFieldCount = pStatus.GetCompletedFields();
|
|
|
MsgFieldEnd.STMSampleRetData.SFieldData.iMeasureFieldCount = m_Sample.GetFieldsData().Count;
|
|
|
- MsgFieldEnd.STMSampleRetData.SFieldData.iSParticleCount = (int)curFldData.GetListAnalysisParticles().Count;
|
|
|
+ MsgFieldEnd.STMSampleRetData.SFieldData.iSParticleCount = (int)curFld.GetListAnalysisParticles().Count;
|
|
|
MsgFieldEnd.STMSampleRetData.SFieldData.FieldPos.X = Convert.ToInt32(poiFieldCentre.X);
|
|
|
MsgFieldEnd.STMSampleRetData.SFieldData.FieldPos.Y = Convert.ToInt32(poiFieldCentre.Y);
|
|
|
|
|
|
@@ -857,14 +864,14 @@ namespace OTSModelSharp
|
|
|
//first step:remove background of the bse image and compound all the finded particles.
|
|
|
|
|
|
log.Info("Begin to process image and get all particles!");
|
|
|
- GetOriginalParticles();
|
|
|
+ GetOriginalParticles(ref curFldData);
|
|
|
|
|
|
// second step :filter the finded particles.
|
|
|
log.Info("Begin to filter particles!");
|
|
|
|
|
|
- FilterParticles(curFldData);
|
|
|
+ FilterParticles(ref curFldData);
|
|
|
|
|
|
- CalculateParticleAbsolutPos();
|
|
|
+ CalculateParticleAbsolutPos(ref curFldData);
|
|
|
|
|
|
log.Info("Begin to Calculate the image property of every particle!");
|
|
|
var analysisparts = curFldData.GetListAnalysisParticles();
|
|
|
@@ -886,19 +893,19 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
log.Info("Begin to classify particles! particle num:" + curFldData.GetListAnalysisParticles().Count);
|
|
|
- ClassifyFieldParticles();
|
|
|
+ ClassifyFieldParticles(curFldData);
|
|
|
|
|
|
|
|
|
|
|
|
// save field files
|
|
|
m_Sample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
|
|
|
|
|
|
- StartSaveFileThread(curFldData);
|
|
|
+ StartSaveFileThread(ref curFldData);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
- public void GetOriginalParticles()
|
|
|
+ public void GetOriginalParticles(ref COTSFieldData curFldData)
|
|
|
{
|
|
|
// measure status
|
|
|
CMsrSampleStatus pStatus = m_Sample.GetMsrStatus();
|
|
|
@@ -931,10 +938,10 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- public void FilterParticles(COTSFieldData fld)
|
|
|
+ public void FilterParticles(ref COTSFieldData curFldData)
|
|
|
{
|
|
|
|
|
|
- if (fld.NoAnalysisParticle())
|
|
|
+ if (curFldData.NoAnalysisParticle())
|
|
|
{
|
|
|
log.Warn("There's no analysis particles!");
|
|
|
return;
|
|
|
@@ -978,8 +985,8 @@ namespace OTSModelSharp
|
|
|
|
|
|
double quantifyThreshold = m_Sample.GetMsrParams().GetXRayParam().GetFeatureModeMinSize();
|
|
|
|
|
|
- var smallparts = fld.ListSmallParticles;
|
|
|
- var bigparts = fld.ListBigParticles;
|
|
|
+ var smallparts = curFldData.ListSmallParticles;
|
|
|
+ var bigparts = curFldData.ListBigParticles;
|
|
|
|
|
|
|
|
|
foreach (var part in listXray1)
|
|
|
@@ -996,15 +1003,15 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
|
|
|
- fld.ListSmallParticles = smallparts;
|
|
|
- fld.ListBigParticles = bigparts;
|
|
|
+ curFldData.ListSmallParticles = smallparts;
|
|
|
+ curFldData.ListBigParticles = bigparts;
|
|
|
//fld.SmallParticlePercentage=percentage;
|
|
|
log.Info("SmallQuantifyParts (<" + quantifyThreshold.ToString("f2") + "): " + smallparts.Count);
|
|
|
log.Info("BigQuantifyParts (>=" + quantifyThreshold.ToString("f2") + "): " + bigparts.Count);
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
- public void CollectParticlesXrayData(COTSFieldData fld)
|
|
|
+ public void CollectParticlesXrayData(COTSFieldData curFldData)
|
|
|
{
|
|
|
// get x-ray parameters
|
|
|
COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
|
|
|
@@ -1014,14 +1021,14 @@ namespace OTSModelSharp
|
|
|
List<COTSParticleClr> smallparts = new List<COTSParticleClr>();
|
|
|
List<COTSParticleClr> bigparts = new List<COTSParticleClr>();
|
|
|
|
|
|
- foreach (var p in fld.ListSmallParticles)
|
|
|
+ foreach (var p in curFldData.ListSmallParticles)
|
|
|
{
|
|
|
if (p.IsXrayParticle())
|
|
|
{
|
|
|
smallparts.Add(p);
|
|
|
}
|
|
|
}
|
|
|
- foreach (var p in fld.ListBigParticles)
|
|
|
+ foreach (var p in curFldData.ListBigParticles)
|
|
|
{
|
|
|
if (p.IsXrayParticle())
|
|
|
{
|
|
|
@@ -1402,14 +1409,14 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
|
|
|
- var cmds = pDBFileMgr.GetSavingIncADataToDBCmds(curFldData.GetListAnalysisParticles(), fldData.GetOTSPosition());
|
|
|
+ var cmds = pDBFileMgr.GetSavingIncADataToDBCmds(fldData.GetListAnalysisParticles(), fldData.GetOTSPosition());
|
|
|
|
|
|
pDBFileMgr.ExecuteNonQueryBatch(ref cmds);
|
|
|
|
|
|
|
|
|
CPosXrayDBMgr PosXrayDBMgr = pDBFileMgr.GetPosXrayDBMgr();
|
|
|
var listAnalysisPosXray = new List<CPosXrayClr>();
|
|
|
- foreach (var p in curFldData.GetListXrayParticles())
|
|
|
+ foreach (var p in fldData.GetListXrayParticles())
|
|
|
{
|
|
|
listAnalysisPosXray.Add(p.GetXray());
|
|
|
}
|
|
|
@@ -1449,7 +1456,7 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
|
|
|
- protected void StartSaveFileThread(COTSFieldData a_pFieldMgr)
|
|
|
+ protected void StartSaveFileThread(ref COTSFieldData a_pFieldMgr)
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -1468,7 +1475,7 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- public void ParticleSpecialTreatment(COTSFieldData fld)
|
|
|
+ public void ParticleSpecialTreatment(ref COTSFieldData fld)
|
|
|
{
|
|
|
//we adopt such a strategy here:if some particles satisfy the predefined condition then we go through the second collecting with max EDS time,so that we got a more acurate result.
|
|
|
Dictionary<COTSParticleClr, int> mapPartXray = new Dictionary<COTSParticleClr, int>(); //std.map<COTSParticlePtr, int> mapPartXray = new std.map<COTSParticlePtr, int>();
|
|
|
@@ -1502,7 +1509,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- public void CalculateParticleAbsolutPos()
|
|
|
+ public void CalculateParticleAbsolutPos(ref COTSFieldData curFldData)
|
|
|
{
|
|
|
double dPixelSize = m_Sample.CalculatePixelSize();
|
|
|
CSEMStageData pCSEMStageData = m_pMsrThread.GetProjResultData().GetSEMStageData();
|