From 8e2e60ef069776aa6c3aab6a12e03ba1b228eea0 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 30 Aug 2020 10:54:09 +0300 Subject: Color Calibrations. Applied buttons to import data from file and save data in to the current RML calibration tables. Added shadow effect to popup search combobox. --- .../ViewModels/CalibrationDataViewVM.cs | 10 +++++ .../ViewModels/ColorCalibrationViewVM.cs | 44 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs index b34ef83bc..fd69fef35 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Calibration; +using Tango.BL.Entities; using Tango.Core.Commands; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; @@ -106,5 +107,14 @@ namespace Tango.MachineStudio.RML.ViewModels _notification.ShowError("An error occurred while trying to export the calibration data."); } } + + public void ApplyCalibrationData(LiquidType liquidType, List newpoints) + { + CalibrationDataVM vm = LiquidsCalibrationData.FirstOrDefault(x => x.LiquidType == liquidType); + if(vm != null) + { + newpoints.ForEach(x => vm.CalibrationPoints.Add(x)); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index 4a6895df3..f7e93a4e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -89,10 +89,12 @@ namespace Tango.MachineStudio.RML.ViewModels get { return _hasError; } set { _hasError = value; RaisePropertyChangedAuto(); } } - + + public RelayCommand ImportDataCommand { get; set; } public RelayCommand CreateGraphCommand { get; set; } public RelayCommand CreateLinearizationGraphCommand { get; set; } public RelayCommand ExportGraphCommand { get; set; } + public RelayCommand ApplyCalibrationDataCommand { get; set; } public string LiquidTypeName @@ -189,9 +191,11 @@ namespace Tango.MachineStudio.RML.ViewModels }; Factor = 0; HasError = false; + ImportDataCommand = new RelayCommand(ImportDataForCalcFactorExcel); CreateGraphCommand = new RelayCommand(CreateGraph); CreateLinearizationGraphCommand = new RelayCommand(CreateLinearizationGraph); ExportGraphCommand = new RelayCommand(ExportGraph); + ApplyCalibrationDataCommand = new RelayCommand(ApplyCalibrationData); this.Points = new List(); TargetPoints = new List(); LinearizationPoints = new List(); @@ -236,7 +240,32 @@ namespace Tango.MachineStudio.RML.ViewModels } return 0.0; } + + private void ImportDataForCalcFactorExcel() + { + OpenFileDialog dlg = new OpenFileDialog(); + try + { + dlg.Title = $"Import excel file for calculate Factor"; + dlg.Filter = "Excel Files|*.xlsx"; + if (dlg.ShowDialog().Value) + { + List items;//List items + ColorLinearizationModel model = new ColorLinearizationModel(); + model.GetDataFromFile(dlg.FileName, out items); + if (items.Count == 0) + return; + Measurements.Clear(); + items.ForEach(x => Measurements.Add(new CalibrationMeasurementModel(x))); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing excel file " + dlg.FileName); + _notification.ShowError("An error occurred while trying to import the selected excel file. Please check the file format if valid and is available to read."); + } + } #region CreateGraph private async void CreateGraph(object obj) @@ -420,6 +449,19 @@ namespace Tango.MachineStudio.RML.ViewModels Y = point.Y, }; } + + /// + /// Applies the calibration data. + /// + protected void ApplyCalibrationData() + { + if (LinearizationPoints.Count == 0) + return; + + List points = new List(); + LinearizationPoints.ToList().ForEach(x => points.Add(new CalibrationDataPointVM(x.X, x.Y))); + ViewModelLocator.MainViewVM.CalibrationDataViewVM.ApplyCalibrationData(LiquidType, points); + } #endregion } } -- cgit v1.3.1 From 66f00e5729e48811cc7d5d6f728988cd64f225e7 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 31 Aug 2020 09:10:47 +0300 Subject: Calibration Color. LAB graph is added to Linearization tab. --- .../Models/ColorLinearizationModel.cs | 17 +++++- .../ViewModels/ColorCalibrationViewVM.cs | 68 ++++++++++++++++++++-- .../Views/ColorCalibrationView.xaml | 41 +++++++++---- .../Views/ColorCalibrationView.xaml.cs | 1 + 4 files changed, 108 insertions(+), 19 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs index 53e15f976..f82c04bbc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -24,9 +25,19 @@ namespace Tango.MachineStudio.RML.Models public void GetDataFromFile(string fileName, out List items) { - ExcelReader reader = new ExcelReader(fileName); - items = reader.GetDataByIndex("Sheet1", 2); - reader.Dispose(); + items = null; + try + { + using (ExcelReader reader = new ExcelReader(fileName)) + { + items = reader.GetDataByIndex("Sheet1", 2); + } + } + catch (Exception ex) + { + Console.WriteLine($" Error in GetDataFromFile {fileName} exception: {ex.Message}" + Environment.NewLine); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index f7e93a4e6..31d89005e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -41,7 +41,7 @@ namespace Tango.MachineStudio.RML.ViewModels public BL.Entities.LiquidType LiquidType { get { return _liquidType; } - set { _liquidType = value; RaisePropertyChangedAuto(); } + set { _liquidType = value; RaisePropertyChangedAuto(); RaisePropertyChanged("LiquidTypeName"); } } private List _liquidTypes; @@ -99,7 +99,7 @@ namespace Tango.MachineStudio.RML.ViewModels public string LiquidTypeName { - get { return LiquidType == null ?"" : LiquidType.Name; } + get { return LiquidType == null ?"" : LiquidType.Name; } } public Plot PlotControl { get; set; } @@ -162,7 +162,23 @@ namespace Tango.MachineStudio.RML.ViewModels } } - + private double _LabMinVal; + + public double LabMinVal + { + get { return _LabMinVal; } + set { _LabMinVal = value; RaisePropertyChangedAuto(); } + } + + private double _LabMaxVal; + + public double LabMaxVal + { + get { return _LabMaxVal; } + set { _LabMaxVal = value; RaisePropertyChangedAuto(); } + } + + public Plot LABLinearizationPlotControl { get; set; } public Plot LinearizationPlotControl { get; set; } private IList _linearizationPoints; /// @@ -178,6 +194,31 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private IList _LPoints; + + public IList LPoints + { + get { return _LPoints; } + set { _LPoints = value; } + } + + private IList _APoints; + + public IList APoints + { + get { return _APoints; } + set { _APoints = value; } + } + + private IList _BPoints; + + public IList BPoints + { + get { return _BPoints; } + set { _BPoints = value; } + } + + #endregion public ColorCalibrationViewVM(INotificationProvider notification) @@ -199,6 +240,9 @@ namespace Tango.MachineStudio.RML.ViewModels this.Points = new List(); TargetPoints = new List(); LinearizationPoints = new List(); + LPoints = new List(); + APoints = new List(); + BPoints = new List(); } public void Loading() @@ -254,7 +298,7 @@ namespace Tango.MachineStudio.RML.ViewModels List items;//List items ColorLinearizationModel model = new ColorLinearizationModel(); model.GetDataFromFile(dlg.FileName, out items); - if (items.Count == 0) + if (items == null || items.Count == 0) return; Measurements.Clear(); items.ForEach(x => Measurements.Add(new CalibrationMeasurementModel(x))); @@ -345,7 +389,7 @@ namespace Tango.MachineStudio.RML.ViewModels List items; model.GetDataFromFile(fileName, out items); - if (items.Count == 0) + if (items == null || items.Count == 0) return; List outputPoints = new List(); @@ -355,6 +399,20 @@ namespace Tango.MachineStudio.RML.ViewModels }); LinearizationPoints.Clear(); + LPoints.Clear(); + APoints.Clear(); + BPoints.Clear(); + LabMinVal = LabMaxVal = 0; + + LabMinVal = items.Min(x => Math.Min(x.L, Math.Min(x.A, x.B))); + LabMaxVal = items.Max(x => Math.Max(x.L, Math.Max(x.A, x.B))); + foreach (var labItem in items) + { + LPoints.Add(new DataPoint(labItem.InkPercentage, labItem.L)); + APoints.Add(new DataPoint(labItem.InkPercentage, labItem.A)); + BPoints.Add(new DataPoint(labItem.InkPercentage, labItem.B)); + } + LABLinearizationPlotControl.InvalidatePlot(true); if (outputPoints == null || outputPoints.Count != items.Count) return; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml index d05959f9a..22832829d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml @@ -29,8 +29,8 @@ - - + + @@ -103,16 +103,16 @@ - - - + + + - - + + @@ -160,14 +160,33 @@ - - + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs index d56b3c6c9..c29bb68fb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs @@ -34,6 +34,7 @@ namespace Tango.MachineStudio.RML.Views ColorCalibrationViewVM vm = (ColorCalibrationViewVM)DataContext; vm.PlotControl = CalibrationPlot; vm.LinearizationPlotControl = LinearizationPlot; + vm.LABLinearizationPlotControl = LABLinearizationPlot; vm.Loading(); } } -- cgit v1.3.1 From 4de15ad6ddfac834cb6af2a2b72bdb358f25b72b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 2 Sep 2020 15:54:54 +0300 Subject: Block MS from importing existing CCT file. --- .../Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs | 6 ++++++ Software/Visual_Studio/Utilities/Tango.CctOptimizer.CLI/Program.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 548ea7d8c..cadd1fb95 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -883,6 +883,12 @@ namespace Tango.MachineStudio.RML.ViewModels String file = GetCCTFileOpen(); if (file != null) { + if (CCTS.ToList().Exists(x => x.FileName == Path.GetFileName(file))) + { + _notification.ShowError("The selected CCT file already exists on the database. Please select the CCT file from the dropdown box."); + return; + } + CctModel cctModel = new CctModel(); cctModel.Guid = Guid.NewGuid().ToString(); cctModel.IsNew = true; diff --git a/Software/Visual_Studio/Utilities/Tango.CctOptimizer.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.CctOptimizer.CLI/Program.cs index 7d364ffb7..2306163d1 100644 --- a/Software/Visual_Studio/Utilities/Tango.CctOptimizer.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.CctOptimizer.CLI/Program.cs @@ -67,7 +67,7 @@ namespace Tango.CctOptimizer.CLI } //DUPLICATES - List toExamine = allCCT.Where(x => !notUsedCCT.Contains(x)).ToList(); + List toExamine = allCCT.Where(x => x.FileName != null).Where(x => !notUsedCCT.Contains(x)).ToList(); List uniqueCCTs = toExamine.DistinctBy(x => x.FileName).ToList(); List duplicates = new List(); -- cgit v1.3.1 From 92b1cd2bd7f4f42d7613ba424ef568a3a476bd89 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 6 Sep 2020 14:38:46 +0300 Subject: Color Calibration. Added Error notification to Linearization process. Clear graphs on start new process. Memory testing C++ code in debug. --- .../ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp | 19 ++++++- .../Models/ColorLinearizationModel.cs | 4 +- .../ViewModels/ColorCalibrationViewVM.cs | 65 +++++++++++++++------- 3 files changed, 64 insertions(+), 24 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp index 2d956611b..1b186d43c 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp @@ -13,6 +13,19 @@ #include using namespace std; +#define _CRTDBG_MAP_ALLOC +#include +#include +#include + +#ifdef _DEBUG +#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) +// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the +// allocations to be of _CLIENT_BLOCK type +#else +#define DBG_NEW new +#endif + #define MDRThr 1.0 #define epsTol 0.05 #define PI 4*atan(1.0) @@ -21,12 +34,14 @@ using namespace std; Tango::ColorLib::ColorCalibrator::ColorCalibrator(): m_nsize(0), m_nlcm(NULL), m_LabData(NULL), m_inkChannel(0), m_targetVal(NULL), m_CalIndex(0), m_inkpercentage(NULL) { + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); } Tango::ColorLib::ColorCalibrator::~ColorCalibrator() { ClearData(); + _CrtDumpMemoryLeaks(); } void Tango::ColorLib::ColorCalibrator::ClearData() @@ -124,8 +139,8 @@ size_t Tango::ColorLib::ColorCalibrator::GetLinearizationMeasurements(uint8_t * const char* c_error = error_message.c_str(); if (strlen(c_error) > 0) { - linearizationOutput->has_haserror = true; - linearizationOutput->haserror = true; + //linearizationOutput->has_haserror = true; + //linearizationOutput->haserror = true; linearizationOutput->errormessage = strdup(c_error); } //Pack Output diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs index f82c04bbc..23179b3f2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.RML.Models } - public void GetDataFromFile(string fileName, out List items) + public void GetDataFromFile(string fileName, out List items, ref string errors) { items = null; try @@ -35,7 +35,7 @@ namespace Tango.MachineStudio.RML.Models } catch (Exception ex) { - Console.WriteLine($" Error in GetDataFromFile {fileName} exception: {ex.Message}" + Environment.NewLine); + errors = ex.Message; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index 31d89005e..8daa1b085 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -253,6 +253,15 @@ namespace Tango.MachineStudio.RML.ViewModels } + public void ClearResults() + { + Points.Clear(); + TargetPoints.Clear(); + ErrorMessage = ""; + HasError = false; + Factor = 0.0; + } + private double GetLiquidFactor() { try @@ -295,11 +304,17 @@ namespace Tango.MachineStudio.RML.ViewModels dlg.Filter = "Excel Files|*.xlsx"; if (dlg.ShowDialog().Value) { + ClearResults(); + List items;//List items ColorLinearizationModel model = new ColorLinearizationModel(); - model.GetDataFromFile(dlg.FileName, out items); - if (items == null || items.Count == 0) + string error = ""; + model.GetDataFromFile(dlg.FileName, out items, ref error); + if (false == String.IsNullOrEmpty(error) || items == null || items.Count == 0) + { + _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read."); return; + } Measurements.Clear(); items.ForEach(x => Measurements.Add(new CalibrationMeasurementModel(x))); } @@ -316,7 +331,7 @@ namespace Tango.MachineStudio.RML.ViewModels { if (_liquidType == null) return; - + ClearResults(); string labType = ColorCalibrationExt.DisplayLiquidTypeToLABType[_liquidType.Type]; await Task.Factory.StartNew(() => { @@ -324,8 +339,6 @@ namespace Tango.MachineStudio.RML.ViewModels }); DataPoint targetPoint = GetTargetPoint(); - Points.Clear(); - TargetPoints.Clear(); To = 0; From = 0; @@ -387,23 +400,30 @@ namespace Tango.MachineStudio.RML.ViewModels if (fileName == null) return; + LinearizationPoints.Clear(); + LinearizationPlotControl.InvalidatePlot(true); + LPoints.Clear(); + APoints.Clear(); + BPoints.Clear(); + LabMinVal = LabMaxVal = 0; + LABLinearizationPlotControl.InvalidatePlot(true); + List items; - model.GetDataFromFile(fileName, out items); - if (items == null || items.Count == 0) + string errors = ""; + model.GetDataFromFile(fileName, out items, ref errors); + if(false == String.IsNullOrEmpty(errors) || items == null || items.Count == 0) + { + _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read."); return; + } - List outputPoints = new List(); + List outputPoints = new List(); + await Task.Factory.StartNew(() => { outputPoints = GetLinearizationMeasurements(items); }); - LinearizationPoints.Clear(); - LPoints.Clear(); - APoints.Clear(); - BPoints.Clear(); - LabMinVal = LabMaxVal = 0; - LabMinVal = items.Min(x => Math.Min(x.L, Math.Min(x.A, x.B))); LabMaxVal = items.Max(x => Math.Max(x.L, Math.Max(x.A, x.B))); foreach (var labItem in items) @@ -450,6 +470,17 @@ namespace Tango.MachineStudio.RML.ViewModels items.ForEach(x => linearizationInput.Measurements.Add(new LinearizationMeasurement { L = x.L, A = x.A, B = x.B, InkPercentage = x.InkPercentage })); linearizationInput.LiquidType = PMR.ColorLab.LiquidType.TryParse(_liquidType.Type.ToString(), out PMR.ColorLab.LiquidType outValue) ? outValue : PMR.ColorLab.LiquidType.Black; + LinearizationOutput result = _linearizationMeasurementscalibrator.GetLinearizationMeasurements(linearizationInput); + + if(!String.IsNullOrEmpty(result.ErrorMessage)) + { + LogManager.Log(result.ErrorMessage, "GetLinearizationMeasurements returns error." + result.ErrorMessage); + InvokeUI(() => + { + _notification.ShowError("Linearization failed. " + result.ErrorMessage); + }); + } + LAB lab; if (ColorCalibrationExt.TargetLiquidTypeToLAB.TryGetValue(_liquidType.Type, out lab)) { @@ -457,12 +488,6 @@ namespace Tango.MachineStudio.RML.ViewModels linearizationInput.TargetA = lab.A; linearizationInput.TargetB = lab.B; } - LinearizationOutput result = _linearizationMeasurementscalibrator.GetLinearizationMeasurements(linearizationInput); - - if(!String.IsNullOrEmpty(result.ErrorMessage)) - { - //LogManager.Log(result.ErrorMessage, "Error occurred while trying to call GetLinearizationMeasurements."); - } return result.InkPercentage.ToList(); } catch (Exception ex) -- cgit v1.3.1 From 803252a58a397711c69a905d104bb2cfe74cfc66 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 7 Sep 2020 12:31:15 +0300 Subject: Calibration Color. Bug in showing graph. . ColorLib. Set preprocessor definitions MEMERY_TEST to t est memory leaks. --- .../ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp | 30 +++++++++------ .../ColorLib/Tango.ColorLib_v4/ColorConverter.cpp | 45 +++++++++------------- .../ViewModels/ColorCalibrationViewVM.cs | 1 + .../Views/ColorCalibrationView.xaml | 2 +- 4 files changed, 38 insertions(+), 40 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp index 1b186d43c..5eae7299c 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorCalibrator.cpp @@ -13,18 +13,20 @@ #include using namespace std; -#define _CRTDBG_MAP_ALLOC -#include -#include -#include - -#ifdef _DEBUG -#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) -// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the -// allocations to be of _CLIENT_BLOCK type -#else -#define DBG_NEW new -#endif +#ifdef MEMORY_TEST + #define _CRTDBG_MAP_ALLOC + #include + #include + #include +#endif + +//#ifdef _DEBUG +//#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) +//// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the +//// allocations to be of _CLIENT_BLOCK type +//#else +//#define DBG_NEW new +//#endif #define MDRThr 1.0 #define epsTol 0.05 @@ -34,14 +36,18 @@ using namespace std; Tango::ColorLib::ColorCalibrator::ColorCalibrator(): m_nsize(0), m_nlcm(NULL), m_LabData(NULL), m_inkChannel(0), m_targetVal(NULL), m_CalIndex(0), m_inkpercentage(NULL) { +#ifdef MEMORY_TEST _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); +#endif // MEMORY_TEST } Tango::ColorLib::ColorCalibrator::~ColorCalibrator() { ClearData(); +#ifdef MEMORY_TEST _CrtDumpMemoryLeaks(); +#endif // MEMORY_TEST } void Tango::ColorLib::ColorCalibrator::ClearData() diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorConverter.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorConverter.cpp index d63d42326..faa4e9e8f 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorConverter.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v4/ColorConverter.cpp @@ -28,18 +28,21 @@ #include "GradientOutputStop.pb-c.h" #include "LiquidVolume.pb-c.h" -#define _CRTDBG_MAP_ALLOC -#include -#include -#include - -#ifdef _DEBUG -#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) -// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the -// allocations to be of _CLIENT_BLOCK type -#else -#define DBG_NEW new -#endif +#ifdef MEMORY_TEST + + #define _CRTDBG_MAP_ALLOC + #include + #include + #include +#endif // MEMORY_TEST + +//#ifdef _DEBUG +//#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) +//// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the +//// allocations to be of _CLIENT_BLOCK type +//#else +//#define DBG_NEW new +//#endif #define dL 2.0 #define dC 2.0 @@ -103,22 +106,10 @@ Tango::ColorLib::ColorConverter::~ColorConverter() delete[] m_ProcessRangesMaxP; m_ProcessRangesMaxP = NULL; } - /* if (m_ProcessRangesMinP != NULL) - { - delete[] m_ProcessRangesMinP; - m_ProcessRangesMinP = NULL; - }*/ - /*if (m_ProcessRangesMaxInkUptake != NULL) - { - delete[] m_ProcessRangesMaxInkUptake; - m_ProcessRangesMaxInkUptake = NULL; - } - if (m_ProcessRangesMinInkUptake != NULL) - { - delete[] m_ProcessRangesMinInkUptake; - m_ProcessRangesMinInkUptake = NULL; - }*/ +#ifdef MEMORY_TEST _CrtDumpMemoryLeaks(); +#endif // MEMORY_TEST + } void Tango::ColorLib::ColorConverter::ProcessHiveNeighbors(ConversionInput *conversionInput, VectorXd Lab, diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index 8daa1b085..f04eccd90 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -332,6 +332,7 @@ namespace Tango.MachineStudio.RML.ViewModels if (_liquidType == null) return; ClearResults(); + PlotControl.InvalidatePlot(true); string labType = ColorCalibrationExt.DisplayLiquidTypeToLABType[_liquidType.Type]; await Task.Factory.StartNew(() => { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml index e4b6b1f05..116500f80 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml @@ -112,7 +112,7 @@ - + -- cgit v1.3.1