/// <summary> /// /// </summary> /// <returns></returns> public override bool Execute() { if (!IsInitialized) { _logger?.Error($"{this.GetType().Name} Run is not initialized yet."); return(false); } _logger?.Info($"{this.GetType().Name} Run started."); while (!_dirReader.IsEndOfDirectory()) { _watch1.Restart(); string name = string.Empty; _dirReader.GetNextImage(_dynamicResult, ref name); LogElapsedTime(_watch1, $"Image reading: {Path.GetFileName(name)}"); _preProc.Execute(_dynamicResult, name); //_preProc.Run(_dynamicResult, name); LogElapsedTime(_watch1, $"Image pre-processing: {Path.GetFileName(name)}"); _borderSearcher.Execute(_dynamicResult, name); //_borderSearcher.Run(_images[1], _masks[1], ref _borderPoints2, name); LogElapsedTime(_watch1, $"Border search: {Path.GetFileName(name)}"); _columnDataCalculator.Execute(_dynamicResult, string.Empty); LogElapsedTime(_watch1, $"Column data, statistical calculation: {Path.GetFileName(name)}"); IColumnMeasurementResult result1 = new ColumnMeasurementResult { Name = "img1", ColumnMeanVector = _meanVector1, ColumnStdVector = _stdVector1 }; IColumnMeasurementResult result2 = new ColumnMeasurementResult { Name = "img2", ColumnMeanVector = _meanVector2, ColumnStdVector = _stdVector2 }; _saver.SaveResult(result1, name, ""); _saver.SaveResult(result2, name, ""); LogElapsedTime(_watch1, $"Result saving: {Path.GetFileName(name)}"); IWaferEdgeFindData waferEdgeFindData1 = null; IWaferEdgeFindData waferEdgeFindData2 = null; _edgeFinder.Execute(_dynamicResult, ref waferEdgeFindData1); //_edgeFinder.Run(_images[1], _masks[1], ref waferEdgeFindData2); LogElapsedTime(_watch1, "Edge finder"); IWaferFittingData waferEdgeFittingData1 = null; IWaferFittingData waferEdgeFittingData2 = null; _edgeFitter.Execute(waferEdgeFindData1, ref waferEdgeFittingData1); _edgeFitter.Execute(waferEdgeFindData2, ref waferEdgeFittingData2); LogElapsedTime(_watch1, "Edge fitter"); Console.WriteLine(); } _logger?.Info($"{this.GetType().Name} Run ended."); return(true); }
public override bool Execute() { if (!IsInitialized) { _logger?.Error($"{this.GetType().Name} Execute is not initialized yet."); return(false); } _logger?.Info($"{this.GetType().Name} Execute started."); while (!_dirReader.IsEndOfDirectory()) { _watch1.Restart(); _dynamicResult = new List <NamedData>(); string name = string.Empty; _dirReader.GetNextImage(_dynamicResult, ref name); string path = Path.Combine(_saver1.OutputFolder, Path.GetFileName(name) ?? string.Empty); LogElapsedTime(_watch1, $"Image reading: {name}"); _preProc.Execute(_dynamicResult, path); LogElapsedTime(_watch1, $"Image pre-processing: {name}"); _borderSearcher.Execute(_dynamicResult, path); LogElapsedTime(_watch1, $"Border search: {Path.GetFileName(name)}"); _columnDataCalculator1.Execute(_dynamicResult, path); LogElapsedTime(_watch1, $"Column data, statistical calculation 1: {Path.GetFileName(name)}"); _columnDataCalculator2.Execute(_dynamicResult, path); LogElapsedTime(_watch1, $"Column data, statistical calculation 2: {Path.GetFileName(name)}"); bool result = (_saver1 as INamedDataResultSaver).SaveResult(_dynamicResult, name, "Result"); //IColumnMeasurementResult result2 = new ColumnMeasurementResult //{ // Name = name, // ColumnMeanVector = _meanVector1, // ColumnStdVector = _stdVector1 //}; //_saver2.SaveResult(result2 as IMeasurementResult, name, "MeanAndStd"); //IColumnMeasurementResult result3 = new ColumnMeasurementResult //{ // Name = name, // ColumnMeanVector = _meanVector1, // ColumnStdVector = _stdVector1 //}; //_saver2.SaveResult(result3 as IMeasurementResult, name, "Noise"); IWaferEdgeFindData waferEdgeFindData1 = null; //_edgeFinder.Run(_dynamicResult, ref waferEdgeFindData1); //result1.LeftLineSpread = waferEdgeFindData1.LeftLineSpread; //result1.RightLineSpread = waferEdgeFindData1.RightLineSpread; //result1.TopLineSpread = waferEdgeFindData1.TopLineSpread; //result1.BottomLineSpread = waferEdgeFindData1.BottomLineSpread; LogElapsedTime(_watch1, "Edge finder"); //_saver1.SaveResult(result1 as IMeasurementResult, name, ""); LogElapsedTime(_watch1, $"Result saving: {Path.GetFileName(name)}"); } _logger?.Info($"{this.GetType().Name} Run ended."); return(true); }