|
@@ -36,6 +36,13 @@ namespace OTSModelSharp
|
|
|
|
|
|
curFldData.SetId(nNewFieldId);
|
|
|
curFldData.SetOTSPosition(fldCenter);
|
|
|
+
|
|
|
+ Point semPos = new Point();
|
|
|
+ CSEMStageData a_pCSEMStageData = m_pMsrThread.GetProjResultData().GetSEMStageData();
|
|
|
+ a_pCSEMStageData.ConverOTSToSEMPoint(fldCenter, ref semPos);
|
|
|
+ curFldData.SemPos = semPos;
|
|
|
+
|
|
|
+
|
|
|
GetOriginalParticles();
|
|
|
|
|
|
// second step :filter the finded particles.
|
|
@@ -70,67 +77,54 @@ namespace OTSModelSharp
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
- public void CalculateParticleAbsolutPos()
|
|
|
- {
|
|
|
- double dPixelSize = m_Sample.CalculatePixelSize();
|
|
|
- CSEMStageData pCSEMStageData = m_pMsrThread.GetProjResultData().GetSEMStageData();
|
|
|
- foreach (var p in curFldData.GetListAnalysisParticles())
|
|
|
- {
|
|
|
-
|
|
|
- Point fldOtsPos = new Point(curFldData.OTSPos.X, curFldData.OTSPos.Y);
|
|
|
- Point semPos = new Point();
|
|
|
- pCSEMStageData.ConverOTSToSEMPoint(fldOtsPos, ref semPos);
|
|
|
- p.SetAbsolutPos(semPos);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
// save field data
|
|
|
- protected void SaveFieldMgrData()
|
|
|
- {
|
|
|
- while (bSaveThreadWorking)
|
|
|
- {
|
|
|
- while (fieldQueue.Count() > 0)
|
|
|
- {
|
|
|
- CFieldDataClean f = (CFieldDataClean) fieldQueue.Dequeue();
|
|
|
- double pixelSize = m_Sample.CalculatePixelSize();
|
|
|
+ //protected void SaveFieldMgrData()
|
|
|
+ //{
|
|
|
+ // while (bSaveThreadWorking)
|
|
|
+ // {
|
|
|
+ // while (fieldQueue.Count() > 0)
|
|
|
+ // {
|
|
|
+ // CFieldDataClean f = (CFieldDataClean) fieldQueue.Dequeue();
|
|
|
+ // //double pixelSize = m_Sample.CalculatePixelSize();
|
|
|
|
|
|
|
|
|
|
|
|
- //save to disk first ,then pop . if the size is 0,then we know all the saving work is done.
|
|
|
- SaveFieldFiles(f,m_pSampleRstFile.GetFieldFileSubFolderStr());
|
|
|
+ // //save to disk first ,then pop . if the size is 0,then we know all the saving work is done.
|
|
|
+ // SaveFieldData(f,m_pSampleRstFile.GetFieldFileSubFolderStr());
|
|
|
|
|
|
|
|
|
- }
|
|
|
- if (fieldQueue.Count() == 0)
|
|
|
- {
|
|
|
- bSaveThreadWorking = false; //must set this flag,so the main thread can know this thread has exited.
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
+ // }
|
|
|
+ // if (fieldQueue.Count() == 0)
|
|
|
+ // {
|
|
|
+ // bSaveThreadWorking = false; //must set this flag,so the main thread can know this thread has exited.
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
- protected void StartSaveFileThread(COTSFieldData a_pFieldMgr)
|
|
|
- {
|
|
|
+ //protected void StartSaveFileThread(COTSFieldData a_pFieldMgr)
|
|
|
+ //{
|
|
|
|
|
|
|
|
|
- fieldQueue.Enqueue(a_pFieldMgr);
|
|
|
+ // fieldQueue.Enqueue(a_pFieldMgr);
|
|
|
|
|
|
|
|
|
- if (fieldQueue.Count() > 0) //if there's data in the queue and the previous thread has finished then start a new thread.
|
|
|
- {
|
|
|
- if (bSaveThreadWorking == false)
|
|
|
- {
|
|
|
- bSaveThreadWorking = true;
|
|
|
+ // if (fieldQueue.Count() > 0) //if there's data in the queue and the previous thread has finished then start a new thread.
|
|
|
+ // {
|
|
|
+ // if (bSaveThreadWorking == false)
|
|
|
+ // {
|
|
|
+ // bSaveThreadWorking = true;
|
|
|
|
|
|
- m_thread_ptr = new System.Threading.Thread(this.SaveFieldMgrData);//m_thread_ptr = shared_ptr<thread>(new thread(&CSmplMeasureInc::SaveFieldMgrData, this));
|
|
|
- m_thread_ptr.Start();//m_thread_ptr->detach();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // m_thread_ptr = new System.Threading.Thread(this.SaveFieldMgrData);//m_thread_ptr = shared_ptr<thread>(new thread(&CSmplMeasureInc::SaveFieldMgrData, this));
|
|
|
+ // m_thread_ptr.Start();//m_thread_ptr->detach();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
public void FilterParticles(CFieldDataClean fld)
|
|
|
{
|
|
@@ -143,7 +137,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
CSampleParam pMsrParam = m_Sample.GetMsrParams();
|
|
|
COTSImageProcParam pImgProcessParam = pMsrParam.GetImageProcessParam();
|
|
|
- var pXRayParam = pMsrParam.GetXRayParam();
|
|
|
+
|
|
|
curFldData.InitParticles(pImgProcessParam, dPixelSize);
|
|
|
if (curFldData.NoAnalysisParticle())
|
|
|
{
|
|
@@ -152,7 +146,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
var listXray = curFldData.GetListAnalysisParticles().OrderByDescending(x => x.GetActualArea()).ToList();
|
|
|
var listXray1 = new List<COTSParticleClr>();
|
|
|
-
|
|
|
+ var pXRayParam = pMsrParam.GetXRayParam();
|
|
|
if (listXray.Count > pXRayParam.GetXrayLimit())
|
|
|
{
|
|
|
for (var i = 0; i < pXRayParam.GetXrayLimit(); i++)
|
|
@@ -213,16 +207,15 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
var pStatus = m_Sample.GetMsrStatus();
|
|
|
+ curFldData.CreateXrayList(bigparts); // big particle using the full xray strategy.
|
|
|
|
|
|
- if (bigparts.Count > 0)
|
|
|
- {
|
|
|
|
|
|
- //// particle x-ray analysis
|
|
|
- ////=============================================
|
|
|
- curFldData.CreateXrayList(bigparts); // big particle using the full xray strategy.
|
|
|
+ curFldData.CreateXrayList(smallparts); //small particle using the fast xray strategy
|
|
|
|
|
|
+ if (bigparts.Count > 0)
|
|
|
+ {
|
|
|
|
|
|
- curFldData.CreateXrayList(smallparts); //small particle using the fast xray strategy
|
|
|
+
|
|
|
var workmode = pXRayParam.GetScanMode();
|
|
|
// get x-ray list (analysis) by particle features
|
|
|
if (workmode == OTS_X_RAY_SCAN_MODE.FeatureMode)
|
|
@@ -256,40 +249,7 @@ namespace OTSModelSharp
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
- public void ParticleSpecialTreatment(CFieldDataClean 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>();
|
|
|
- double edsTime = 0; //to store the EDSTime returned from the engine.
|
|
|
- var bigparts = fld.ListBigParticles;
|
|
|
- var m_ClassifyEngine = new CClassifyEngine();
|
|
|
- for (int i = 0; i < bigparts.Count(); i++)
|
|
|
- {
|
|
|
- var engine = m_ClassifyEngine.GetParticleEngine(m_Sample.GetMsrParams().GetSTDName());
|
|
|
- var p = bigparts[i];
|
|
|
-
|
|
|
- // there will be very less particle satisfied the condition ,so we use only one MaxEDS time,though we set MaxEDSTime for every rule separately .Here we store the last one.
|
|
|
- //if the particle satisfied the MaxEDS condition then we go through the second colleting.Here we record the particle and the EDSTime and the corresponding xray position.
|
|
|
- edsTime = engine.IfNeedMaxEDS(p);
|
|
|
- if (edsTime > 0)
|
|
|
- {
|
|
|
- mapPartXray[p] = i;
|
|
|
- }
|
|
|
- }
|
|
|
- List<COTSParticleClr> partsMax = new List<COTSParticleClr>();
|
|
|
- if (mapPartXray.Count() > 0)
|
|
|
- {
|
|
|
- foreach (var p in mapPartXray)
|
|
|
- {
|
|
|
- partsMax.Add(p.Key);
|
|
|
- }
|
|
|
- List<CPosXrayClr> maxEDSXrays = new List<CPosXrayClr>();
|
|
|
- m_EDSHardwareMgr.GetXRayByFeatures(partsMax, edsTime, true);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public override void ClassifyFieldParticles()
|
|
|
{
|
|
@@ -340,10 +300,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
}
|
|
|
- public void SaveFieldParticlesData()
|
|
|
- {
|
|
|
- StartSaveFileThread(curFldData);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public void GetOriginalParticles()
|
|
|
{
|
|
@@ -410,105 +367,113 @@ namespace OTSModelSharp
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public bool SaveFieldFiles(CFieldDataClean fldData, string filedFileFoler)
|
|
|
- {
|
|
|
+ //public bool SaveFieldFiles(CFieldDataClean fldData, string filedFileFoler)
|
|
|
+ //{
|
|
|
|
|
|
- string strFieldFileFolder = filedFileFoler;
|
|
|
+ // string strFieldFileFolder = filedFileFoler;
|
|
|
|
|
|
- CBSEImageFileMgr pBSEImgFileMgr = new CBSEImageFileMgr();
|
|
|
- pBSEImgFileMgr.SetBSEImg(fldData.GetBSEImage());
|
|
|
- int nId = fldData.GetId();
|
|
|
- string sFieldId;
|
|
|
- sFieldId = nId.ToString();
|
|
|
+ // CBSEImageFileMgr pBSEImgFileMgr = new CBSEImageFileMgr();
|
|
|
+ // pBSEImgFileMgr.SetBSEImg(fldData.GetBSEImage());
|
|
|
+ // int nId = fldData.GetId();
|
|
|
+ // string sFieldId;
|
|
|
+ // sFieldId = nId.ToString();
|
|
|
|
|
|
|
|
|
- string strBSEFilePathname = strFieldFileFolder + "\\" + m_pSampleRstFile.SMPL_MSR_RESULT_FIELDS_BSE + sFieldId + pBSEImgFileMgr.BMP_IMG_FILE_EXT;
|
|
|
- if (!pBSEImgFileMgr.SaveIntoBitmap(strBSEFilePathname))
|
|
|
- {
|
|
|
- log.Info("SaveFieldFiles: save BSE file failed.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // IncA Data list
|
|
|
+ // string strBSEFilePathname = strFieldFileFolder + "\\" + m_pSampleRstFile.SMPL_MSR_RESULT_FIELDS_BSE + sFieldId + pBSEImgFileMgr.BMP_IMG_FILE_EXT;
|
|
|
+ // if (!pBSEImgFileMgr.SaveIntoBitmap(strBSEFilePathname))
|
|
|
+ // {
|
|
|
+ // log.Info("SaveFieldFiles: save BSE file failed.");
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
|
|
|
- CIncAFileMgr pDBFileMgr = m_pSampleRstFile.DBFileMgr;
|
|
|
+ // // IncA Data list
|
|
|
|
|
|
+ // CIncAFileMgr pDBFileMgr = m_pSampleRstFile.DBFileMgr;
|
|
|
|
|
|
|
|
|
- //pDBFileMgr.BeginTransaction();
|
|
|
- pDBFileMgr.SaveStatusDataToDB();
|
|
|
- var fldDB = pDBFileMgr.GetFieldDB();
|
|
|
- fldDB.SaveAField(fldData.GetId(), fldData.GetOTSPosition(),fldData.SemPos);
|
|
|
- if (!pDBFileMgr.SaveIncADataToDB(fldData.GetListAnalysisParticles(), fldData.GetOTSPosition()))
|
|
|
- {
|
|
|
- log.Info("SaveFieldFiles: save inclusion file failed.");
|
|
|
- return false;
|
|
|
- }
|
|
|
- //save the xray data and element data.
|
|
|
- CPosXrayDBMgr PosXrayDBMgr = pDBFileMgr.GetPosXrayDBMgr();
|
|
|
- var m_listAnalysisPosXray = new List<CPosXrayClr>();
|
|
|
- foreach (var p in fldData.GetListAnalysisParticles())
|
|
|
- {
|
|
|
- m_listAnalysisPosXray.Add(p.GetXray());
|
|
|
- }
|
|
|
-
|
|
|
- if (!PosXrayDBMgr.SaveXray(m_listAnalysisPosXray, true))
|
|
|
- {
|
|
|
- log.Info("SaveFieldFiles: save analysis x-ray failed.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+
|
|
|
+ // pDBFileMgr.SaveStatusDataToDB();
|
|
|
+ // var fldDB = pDBFileMgr.GetFieldDB();
|
|
|
|
|
|
- //save the small particle info
|
|
|
- CSmallParticleInfoDB smallPartDB = pDBFileMgr.GetSmallParticleInfoDB();
|
|
|
- Dictionary<int, List<COTSParticleClr>> mapSmallParts = new Dictionary<int, List<COTSParticleClr>>();
|
|
|
- foreach (COTSParticleClr smallP in fldData.ListSmallParticles)
|
|
|
- {
|
|
|
- if (mapSmallParts.ContainsKey((int)smallP.GetType()))
|
|
|
- {
|
|
|
- mapSmallParts[(int)smallP.GetType()].Add(smallP);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var plist = new List<COTSParticleClr>();
|
|
|
- plist.Add(smallP);
|
|
|
- mapSmallParts.Add((int)smallP.GetType(), plist);
|
|
|
+ // fldDB.SaveAField(fldData.GetId(), fldData.GetOTSPosition(),fldData.SemPos);
|
|
|
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- List<CSmallParticleInfo> smallparts = new List<CSmallParticleInfo>();
|
|
|
|
|
|
- foreach (KeyValuePair<int, List<COTSParticleClr>> particles in mapSmallParts)
|
|
|
- {
|
|
|
- CSmallParticleInfo partInfo = new CSmallParticleInfo();
|
|
|
- partInfo.FieldId = particles.Value[0].GetFieldId();
|
|
|
- partInfo.AveGray = particles.Value[0].GetAveGray();
|
|
|
- partInfo.Quantity = (int)(particles.Value.Count / fldData.SmallParticlePercentage);
|
|
|
- partInfo.TypeId = particles.Key;
|
|
|
- partInfo.TypeColor = particles.Value[0].GetTypeColor();
|
|
|
- partInfo.TypeName = particles.Value[0].GetTypeName();
|
|
|
- double area = 0;
|
|
|
- foreach (var p in particles.Value)
|
|
|
- {
|
|
|
- area += p.GetActualArea();
|
|
|
- }
|
|
|
- //partInfo.Area = Convert.ToInt32(area / f.SmallParticlePercentage);
|
|
|
- partInfo.Area =(int) area ;
|
|
|
- smallparts.Add(partInfo);
|
|
|
- }
|
|
|
- List<KeyValuePair<string, SQLiteParameter[]>> cmds = new List<KeyValuePair<string, SQLiteParameter[]>>();
|
|
|
- foreach (CSmallParticleInfo smallp in smallparts)
|
|
|
- {
|
|
|
- var cmd= smallPartDB.SaveAKindOfSmallParticle(smallp, new CPosXrayClr(), new System.Drawing.Point(0, 0));
|
|
|
- cmds.Add(cmd);
|
|
|
- }
|
|
|
|
|
|
- pDBFileMgr.ExecuteNonQueryBatch(ref cmds);
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ // var analysisParts = fldData.GetListAnalysisParticles();
|
|
|
+ // if (!pDBFileMgr.SaveIncADataToDB(analysisParts, fldData.GetOTSPosition()))
|
|
|
+ // {
|
|
|
+ // log.Info("SaveFieldFiles: save inclusion file failed.");
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // //save the xray data and element data.
|
|
|
+ // CPosXrayDBMgr PosXrayDBMgr = pDBFileMgr.GetPosXrayDBMgr();
|
|
|
+ // var m_listAnalysisPosXray = new List<CPosXrayClr>();
|
|
|
+
|
|
|
+ // foreach (var p in analysisParts)
|
|
|
+ // {
|
|
|
+ // m_listAnalysisPosXray.Add(p.GetXray());
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (!PosXrayDBMgr.SaveXray(m_listAnalysisPosXray, true))
|
|
|
+ // {
|
|
|
+ // log.Info("SaveFieldFiles: save analysis x-ray failed.");
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // //save the small particle info
|
|
|
+ // //CSmallParticleInfoDB smallPartDB = pDBFileMgr.GetSmallParticleInfoDB();
|
|
|
+ // //Dictionary<int, List<COTSParticleClr>> mapSmallParts = new Dictionary<int, List<COTSParticleClr>>();
|
|
|
+ // //foreach (COTSParticleClr smallP in fldData.ListSmallParticles)
|
|
|
+ // //{
|
|
|
+ // // if (mapSmallParts.ContainsKey((int)smallP.GetType()))
|
|
|
+ // // {
|
|
|
+ // // mapSmallParts[(int)smallP.GetType()].Add(smallP);
|
|
|
+ // // }
|
|
|
+ // // else
|
|
|
+ // // {
|
|
|
+ // // var plist = new List<COTSParticleClr>();
|
|
|
+ // // plist.Add(smallP);
|
|
|
+ // // mapSmallParts.Add((int)smallP.GetType(), plist);
|
|
|
+
|
|
|
+ // // }
|
|
|
+
|
|
|
+ // //}
|
|
|
+ // //List<CSmallParticleInfo> smallparts = new List<CSmallParticleInfo>();
|
|
|
+
|
|
|
+ // //foreach (KeyValuePair<int, List<COTSParticleClr>> particles in mapSmallParts)
|
|
|
+ // //{
|
|
|
+ // // CSmallParticleInfo partInfo = new CSmallParticleInfo();
|
|
|
+ // // partInfo.FieldId = particles.Value[0].GetFieldId();
|
|
|
+ // // partInfo.AveGray = particles.Value[0].GetAveGray();
|
|
|
+ // // partInfo.Quantity = (int)(particles.Value.Count / fldData.SmallParticlePercentage);
|
|
|
+ // // partInfo.TypeId = particles.Key;
|
|
|
+ // // partInfo.TypeColor = particles.Value[0].GetTypeColor();
|
|
|
+ // // partInfo.TypeName = particles.Value[0].GetTypeName();
|
|
|
+ // // double area = 0;
|
|
|
+ // // foreach (var p in particles.Value)
|
|
|
+ // // {
|
|
|
+ // // area += p.GetActualArea();
|
|
|
+ // // }
|
|
|
+ // // //partInfo.Area = Convert.ToInt32(area / f.SmallParticlePercentage);
|
|
|
+ // // partInfo.Area =(int) area ;
|
|
|
+ // // smallparts.Add(partInfo);
|
|
|
+ // //}
|
|
|
+ // //List<KeyValuePair<string, SQLiteParameter[]>> cmds = new List<KeyValuePair<string, SQLiteParameter[]>>();
|
|
|
+ // //foreach (CSmallParticleInfo smallp in smallparts)
|
|
|
+ // //{
|
|
|
+ // // var cmd= smallPartDB.SaveAKindOfSmallParticle(smallp, new CPosXrayClr(), new System.Drawing.Point(0, 0));
|
|
|
+ // // cmds.Add(cmd);
|
|
|
+ // //}
|
|
|
+
|
|
|
+ // //pDBFileMgr.ExecuteNonQueryBatch(ref cmds);
|
|
|
+
|
|
|
+ // return true;
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
}
|