/// <summary> /// </summary> /// <param name="syncMetric"></param> /// <param name="accountName"></param> /// <returns> /// </returns> public async Task<bool> UploadSyncData(SyncMetric syncMetric, string accountName) { try { var analyticsService = new AnalyticsService(new BaseClientService.Initializer { ApplicationName = ApplicationInfo.ProductName, ApiKey = "AIzaSyBrpqcL6Nh1vVecfhIbxGVnyGHMZ8-aH6k" }); var batchRequest = new BatchRequest(analyticsService); var metric = new CustomMetric { Name = "SyncMetric", Kind = "string" }; var insertRequest = analyticsService.Management.CustomMetrics.Insert(metric, "", ""); batchRequest.Queue<CustomMetric>(insertRequest, InsertMetricCallback); await batchRequest.ExecuteAsync(); } catch (Exception ex) { Logger.Error(ex); return false; } return true; }
/// <summary> /// </summary> /// <param name="syncMetric"></param> /// <param name="accountName"></param> /// <returns> /// </returns> public async Task <bool> UploadSyncData(SyncMetric syncMetric, string accountName) { try { var analyticsService = new AnalyticsService(new BaseClientService.Initializer { ApplicationName = ApplicationInfo.ProductName, ApiKey = "AIzaSyBrpqcL6Nh1vVecfhIbxGVnyGHMZ8-aH6k" }); var batchRequest = new BatchRequest(analyticsService); var metric = new CustomMetric { Name = "SyncMetric", Kind = "string" }; var insertRequest = analyticsService.Management.CustomMetrics.Insert(metric, "", ""); batchRequest.Queue <CustomMetric>(insertRequest, InsertMetricCallback); await batchRequest.ExecuteAsync(); } catch (Exception ex) { Logger.Error(ex); return(false); } return(true); }
public void CreateHistogram_Throws_When_Argument_Is_Counter() { // arrange var customMetric = new CustomMetric("foo", "bar", MetricType.Counter, Array.Empty<string>()); // act + assert Assert.Throws<ArgumentException>(() => this.meter.CreateHistogram<int>(customMetric)); }
public void CreateObservableGauge_Throws_When_Argument_Is_Counter() { // arrange var customMetric = new CustomMetric("foo", "bar", MetricType.Counter, Array.Empty<string>()); // act + assert Assert.Throws<ArgumentException>(() => this.meter.CreateObservableGauge(customMetric, () => 1)); }
private void InsertMetricCallback(CustomMetric content, RequestError error, int index, HttpResponseMessage message) { if (!message.IsSuccessStatusCode) { Logger.Warn(message.StatusCode); } }
/// <summary>Snippet for GetCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomMetricResourceNames() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) CustomMetricName name = CustomMetricName.FromProperty("[PROPERTY]"); // Make the request CustomMetric response = analyticsAdminServiceClient.GetCustomMetric(name); }
/// <summary>Snippet for GetCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomMetric() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) string name = "properties/[PROPERTY]/customMetrics"; // Make the request CustomMetric response = analyticsAdminServiceClient.GetCustomMetric(name); }
public async Task DeleteAsyncTest() { var testNumber = 1; // Create a test workspace var workspace = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber); // Create a test patient with a dose var patientItem = await TestHelper.CreatePatientAsync(_testClassName, testNumber, Path.Combine("Becker^Matthew", "RD.dcm")); // Create patient scorecards object var patientScorecards = new PatientScorecards(_proKnow, workspace.Id, patientItem.Id); // Create computed metric var computedMetric = new ComputedMetric("VOLUME_PERCENT_DOSE_RANGE_ROI", "PTV", 30, 60, new List <MetricBin>() { new MetricBin("IDEAL", new byte[] { Color.Green.R, Color.Green.G, Color.Green.B }), new MetricBin("GOOD", new byte[] { Color.LightGreen.R, Color.LightGreen.G, Color.LightGreen.B }, 20), new MetricBin("ACCEPTABLE", new byte[] { Color.Yellow.R, Color.Yellow.G, Color.Yellow.B }, 40, 60), new MetricBin("MARGINAL", new byte[] { Color.Orange.R, Color.Orange.G, Color.Orange.B }, null, 80), new MetricBin("UNACCEPTABLE", new byte[] { Color.Red.R, Color.Red.G, Color.Red.B }) }); // Create custom metric var customMetricItem = await _proKnow.CustomMetrics.CreateAsync($"{_testClassName}-{testNumber}", "dose", "number"); // Add objectives to custom metric customMetricItem.Objectives = new List <MetricBin>() { new MetricBin("PASS", new byte[] { 18, 191, 0 }, null, 90), new MetricBin("FAIL", new byte[] { 255, 0, 0 }) }; // Convert custom metric to schema expected by CreateAsync (name and objectives only) var customMetric = new CustomMetric(customMetricItem.Name, customMetricItem.Objectives); // Create patient scorecard var computedMetrics = new List <ComputedMetric>() { computedMetric }; var customMetrics = new List <CustomMetric>() { customMetric }; var patientScorecardItem = await patientScorecards.CreateAsync($"{_testClassName}-{testNumber}", computedMetrics, customMetrics); // Delete the patient scorecard await patientScorecards.DeleteAsync(patientScorecardItem.Id); // Verify the patient scorecard was deleted var patientScorecardSummary = await patientScorecards.FindAsync(t => t.Name == $"{_testClassName}-{testNumber}"); Assert.IsNull(patientScorecardSummary); }
/// <summary>Snippet for UpdateCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void UpdateCustomMetric() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) CustomMetric customMetric = new CustomMetric(); FieldMask updateMask = new FieldMask(); // Make the request CustomMetric response = analyticsAdminServiceClient.UpdateCustomMetric(customMetric, updateMask); }
/// <summary>Snippet for CreateCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateCustomMetric() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) string parent = "properties/[PROPERTY]"; CustomMetric customMetric = new CustomMetric(); // Make the request CustomMetric response = analyticsAdminServiceClient.CreateCustomMetric(parent, customMetric); }
/// <summary>Snippet for CreateCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateCustomMetricResourceNames() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) PropertyName parent = PropertyName.FromProperty("[PROPERTY]"); CustomMetric customMetric = new CustomMetric(); // Make the request CustomMetric response = analyticsAdminServiceClient.CreateCustomMetric(parent, customMetric); }
static void Main(string[] args) { NumericsTest test = new NumericsTest(); test.Test(); var log4_net_config = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "log4net.config"); XmlConfigurator.Configure(new FileInfo(log4_net_config)); int batch_size = 32; uint w = 60; uint h = 20; float learning_rate = 1e-4f; float weight_decay = 1e-4f; ReadData rdtrain = new ReadData("data\\train\\", batch_size); ReadData rdval = new ReadData("data\\val\\", batch_size); //var first = rdtrain.First(); Context ctx = new Context(DeviceType.KGpu, 0); //NDArray dataArray = new NDArray(new Shape((uint)batchSize, 3, W, H), ctx, false); //NDArray labelArray = new NDArray(new Shape((uint)batchSize,4), ctx, false); //Symbol data1 = Symbol.Variable("data1"); //Symbol data2 = Symbol.Variable("data2"); var pnet = get_ocrnet(batch_size); Speedometer speed = new Speedometer(batch_size, 50); CustomMetric custom_metric = new CustomMetric((l, p) => Accuracy(l, p, batch_size)); Optimizer optimizer = new CcSgd(momentum: 0.9f, learning_rate: 0.001f, wd: 0.00001f, rescale_grad: 1.0f / batch_size); FeedForward model = new FeedForward(pnet, new List <Context> { ctx }, num_epoch: 10, optimizer: optimizer, initializer: new Xavier(factor_type: FactorType.In, magnitude: 2.34f) ); model.Fit(rdtrain, rdval, custom_metric, batch_end_callback: new List <Action <mxnet.csharp.util.BatchEndParam> > { speed.Call }); Console.WriteLine(""); }
/// <summary> /// Updates an existing view (CustomMetric). This method supports patch semantics. /// Documentation:https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customMetrics/update /// /// </summary> /// <param name="service">Valid Authenticated Analytics Service </param> /// <param name="Body">relevant portions of a management.CustomMetric resource, according to the rules of patch semantics.</param> /// <param name="accountId">Account ID to which the web property belongs </param> /// <param name="webPropertyId">Web property Id</param> /// <param name="profilesId">profile ID</param> /// <returns>CustomMetric resourcehttps://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customMetrics#resource </returns> public static CustomMetric CustomMetricUpdate(AnalyticsService service, CustomMetric body, string accountId, string webPropertyId, string profilesId) { try { return(service.Management.CustomMetrics.Update(body, accountId, webPropertyId, profilesId).Execute()); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public void CreateObservableGauge_Success_Case() { // arrange var customMetric = new CustomMetric("foo", "bar", MetricType.ObservableGauge, Array.Empty<string>()); // act var result = this.meter.CreateObservableGauge<int>(customMetric, () => 1); // assert Assert.Equal(customMetric.Name, result.Name); Assert.Equal(customMetric.Description, result.Description); }
public void CreateHistogram_Success_Case() { // arrange var customMetric = new CustomMetric("foo", "bar", MetricType.Histogram, Array.Empty<string>()); // act var result = this.meter.CreateHistogram<int>(customMetric); // assert Assert.Equal(customMetric.Name, result.Name); Assert.Equal(customMetric.Description, result.Description); }
/// <summary>Snippet for GetCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomMetricRequestObject() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) GetCustomMetricRequest request = new GetCustomMetricRequest { CustomMetricName = CustomMetricName.FromProperty("[PROPERTY]"), }; // Make the request CustomMetric response = analyticsAdminServiceClient.GetCustomMetric(request); }
/// <summary>Snippet for UpdateCustomMetric</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void UpdateCustomMetricRequestObject() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create(); // Initialize request argument(s) UpdateCustomMetricRequest request = new UpdateCustomMetricRequest { CustomMetric = new CustomMetric(), UpdateMask = new FieldMask(), }; // Make the request CustomMetric response = analyticsAdminServiceClient.UpdateCustomMetric(request); }
/// <summary>Snippet for CreateCustomMetricAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateCustomMetricRequestObjectAsync() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = await AnalyticsAdminServiceClient.CreateAsync(); // Initialize request argument(s) CreateCustomMetricRequest request = new CreateCustomMetricRequest { ParentAsPropertyName = PropertyName.FromProperty("[PROPERTY]"), CustomMetric = new CustomMetric(), }; // Make the request CustomMetric response = await analyticsAdminServiceClient.CreateCustomMetricAsync(request); }
private static void TrainTest() { int batch_size = 32; ReadData rdtrain = new ReadData("data\\train\\", batch_size); ReadData rdval = new ReadData("data\\val\\", batch_size); Context ctx = new Context(DeviceType.KGpu, 0); var pnet = get_ocrnet(batch_size); Speedometer speed = new Speedometer(batch_size, 50); DoCheckpoint doCheckpoint = new DoCheckpoint("checkpoint\\cnn"); CustomMetric customMetric = new CustomMetric((l, p) => Accuracy(l, p, batch_size), "Accuracy"); Optimizer optimizer = new CcSgd(momentum: 0.9f, learningRate: 0.001f, wd: 0.00001f, rescaleGrad: 1.0f / batch_size); FeedForward model = new FeedForward(pnet, new List <Context> { ctx }, numEpoch: 1, optimizer: optimizer, initializer: new Xavier(factorType: FactorType.In, magnitude: 2.34f) ); model.Fit(rdtrain, rdval, customMetric, batchEndCallback: new List <BatchEndDelegate> { speed.Call }, epochEndCallback: new List <EpochEndDelegate> { doCheckpoint.Call }); model.Save("checkpoint\\cnn"); ReadData rdpredict = new ReadData("data\\train\\", batch_size, true); var testOut = model.Predict(rdpredict, 1); Console.WriteLine(""); }
public async Task CreateAsyncTest() { var testNumber = 1; // Create a test workspace var workspace = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber); // Create a test patient with a dose var patientItem = await TestHelper.CreatePatientAsync(_testClassName, testNumber, Path.Combine("Becker^Matthew", "RD.dcm")); // Create patient scorecards object var patientScorecards = new PatientScorecards(_proKnow, workspace.Id, patientItem.Id); // Create computed metric var computedMetric = new ComputedMetric("VOLUME_PERCENT_DOSE_RANGE_ROI", "PTV", 30, 60, new List <MetricBin>() { new MetricBin("IDEAL", new byte[] { Color.Green.R, Color.Green.G, Color.Green.B }), new MetricBin("GOOD", new byte[] { Color.LightGreen.R, Color.LightGreen.G, Color.LightGreen.B }, 20), new MetricBin("ACCEPTABLE", new byte[] { Color.Yellow.R, Color.Yellow.G, Color.Yellow.B }, 40, 60), new MetricBin("MARGINAL", new byte[] { Color.Orange.R, Color.Orange.G, Color.Orange.B }, null, 80), new MetricBin("UNACCEPTABLE", new byte[] { Color.Red.R, Color.Red.G, Color.Red.B }) }); // Create custom metric var customMetricItem = await _proKnow.CustomMetrics.CreateAsync($"{_testClassName}-{testNumber}", "dose", "number"); // Add objectives to custom metric customMetricItem.Objectives = new List <MetricBin>() { new MetricBin("PASS", new byte[] { 18, 191, 0 }, null, 90), new MetricBin("FAIL", new byte[] { 255, 0, 0 }) }; // Convert custom metric to schema expected by CreateAsync (name and objectives only) var customMetric = new CustomMetric(customMetricItem.Name, customMetricItem.Objectives); // Create patient scorecard var computedMetrics = new List <ComputedMetric>() { computedMetric }; var customMetrics = new List <CustomMetric>() { customMetric }; var patientScorecardItem = await patientScorecards.CreateAsync($"{_testClassName}-{testNumber}", computedMetrics, customMetrics); // Verify created patient scorecard Assert.AreEqual($"{_testClassName}-{testNumber}", patientScorecardItem.Name); Assert.AreEqual(1, patientScorecardItem.ComputedMetrics.Count); var createdComputedMetric = patientScorecardItem.ComputedMetrics[0]; Assert.AreEqual(computedMetric.Type, createdComputedMetric.Type); Assert.AreEqual(computedMetric.RoiName, createdComputedMetric.RoiName); Assert.AreEqual(computedMetric.Arg1, createdComputedMetric.Arg1); Assert.AreEqual(computedMetric.Arg2, createdComputedMetric.Arg2); Assert.AreEqual(computedMetric.Objectives.Count, createdComputedMetric.Objectives.Count); for (var i = 0; i < createdComputedMetric.Objectives.Count; i++) { Assert.AreEqual(computedMetric.Objectives[i].Label, createdComputedMetric.Objectives[i].Label); Assert.AreEqual(computedMetric.Objectives[i].Color[0], createdComputedMetric.Objectives[i].Color[0]); Assert.AreEqual(computedMetric.Objectives[i].Color[1], createdComputedMetric.Objectives[i].Color[1]); Assert.AreEqual(computedMetric.Objectives[i].Color[2], createdComputedMetric.Objectives[i].Color[2]); Assert.AreEqual(computedMetric.Objectives[i].Min, createdComputedMetric.Objectives[i].Min); Assert.AreEqual(computedMetric.Objectives[i].Max, createdComputedMetric.Objectives[i].Max); } Assert.AreEqual(1, patientScorecardItem.CustomMetrics.Count); var createdCustomMetricItem = patientScorecardItem.CustomMetrics[0]; Assert.AreEqual(customMetricItem.Id, createdCustomMetricItem.Id); Assert.AreEqual(customMetricItem.Objectives.Count, createdCustomMetricItem.Objectives.Count); for (var i = 0; i < createdCustomMetricItem.Objectives.Count; i++) { Assert.AreEqual(customMetricItem.Objectives[i].Label, createdCustomMetricItem.Objectives[i].Label); Assert.AreEqual(customMetricItem.Objectives[i].Color[0], createdCustomMetricItem.Objectives[i].Color[0]); Assert.AreEqual(customMetricItem.Objectives[i].Color[1], createdCustomMetricItem.Objectives[i].Color[1]); Assert.AreEqual(customMetricItem.Objectives[i].Color[2], createdCustomMetricItem.Objectives[i].Color[2]); Assert.AreEqual(customMetricItem.Objectives[i].Min, createdCustomMetricItem.Objectives[i].Min); Assert.AreEqual(customMetricItem.Objectives[i].Max, createdCustomMetricItem.Objectives[i].Max); } }
/// <summary> /// Create a new custom metric. /// Documentation https://developers.google.com/analytics/v3/reference/customMetrics/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated analytics service.</param> /// <param name="accountId">Account ID for the custom metric to create.</param> /// <param name="webPropertyId">Web property ID for the custom dimension to create.</param> /// <param name="body">A valid analytics v3 body.</param> /// <returns>CustomMetricResponse</returns> public static CustomMetric Insert(analyticsService service, string accountId, string webPropertyId, CustomMetric body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (accountId == null) { throw new ArgumentNullException(accountId); } if (webPropertyId == null) { throw new ArgumentNullException(webPropertyId); } // Make the request. return(service.CustomMetrics.Insert(body, accountId, webPropertyId).Execute()); } catch (Exception ex) { throw new Exception("Request CustomMetrics.Insert failed.", ex); } }
/// <summary> /// Updates an existing view (CustomMetric). This method supports patch semantics. /// Documentation:https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customMetrics/update /// /// </summary> /// <param name="service">Valid Authenticated Analytics Service </param> /// <param name="Body">relevant portions of a management.CustomMetric resource, according to the rules of patch semantics.</param> /// <param name="accountId">Account ID to which the web property belongs </param> /// <param name="webPropertyId">Web property Id</param> /// <param name="profilesId">profile ID</param> /// <returns>CustomMetric resourcehttps://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customMetrics#resource </returns> public static CustomMetric CustomMetricUpdate(AnalyticsService service, CustomMetric body, string accountId, string webPropertyId, string profilesId) { try { return service.Management.CustomMetrics.Update(body, accountId, webPropertyId, profilesId).Execute(); } catch (Exception ex) { Console.WriteLine(ex.Message); return null; } }
public async Task SaveAsyncTest() { var testNumber = 2; // Create a test workspace var workspace = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber); // Create a test patient with a dose var patientItem = await TestHelper.CreatePatientAsync(_testClassName, testNumber, Path.Combine("Becker^Matthew", "RD.dcm")); // Create patient scorecards object var patientScorecards = new PatientScorecards(_proKnow, workspace.Id, patientItem.Id); // Create computed metric var computedMetric = new ComputedMetric("VOLUME_PERCENT_DOSE_RANGE_ROI", "PTV", 30, 60, new List <MetricBin>() { new MetricBin("IDEAL", new byte[] { Color.Green.R, Color.Green.G, Color.Green.B }), new MetricBin("GOOD", new byte[] { Color.LightGreen.R, Color.LightGreen.G, Color.LightGreen.B }, 20), new MetricBin("ACCEPTABLE", new byte[] { Color.Yellow.R, Color.Yellow.G, Color.Yellow.B }, 40, 60), new MetricBin("MARGINAL", new byte[] { Color.Orange.R, Color.Orange.G, Color.Orange.B }, null, 80), new MetricBin("UNACCEPTABLE", new byte[] { Color.Red.R, Color.Red.G, Color.Red.B }) }); // Create custom metric var customMetricItem = await _proKnow.CustomMetrics.CreateAsync($"{_testClassName}-{testNumber}", "dose", "number"); // Add objectives to custom metric customMetricItem.Objectives = new List <MetricBin>() { new MetricBin("PASS", new byte[] { 18, 191, 0 }, null, 90), new MetricBin("FAIL", new byte[] { 255, 0, 0 }) }; // Convert custom metric to schema expected by CreateAsync (name and objectives only) var customMetric = new CustomMetric(customMetricItem.Name, customMetricItem.Objectives); // Create patient scorecard var computedMetrics = new List <ComputedMetric>() { computedMetric }; var customMetrics = new List <CustomMetric>() { customMetric }; var patientScorecardItem = await patientScorecards.CreateAsync($"{_testClassName}-{testNumber}", computedMetrics, customMetrics); // Modify name patientScorecardItem.Name = $"{_testClassName}-{testNumber}-2"; // Modify computed metrics var computedMetric2 = new ComputedMetric("MIN_DOSE_ROI", "PTV", null, null, new List <MetricBin>() { new MetricBin("BAD", new byte[] { 0, 255, 0 }), new MetricBin("ACCEPTABLE", new byte[] { 0, 0, 0 }, 60, 63), new MetricBin("GOOD", new byte[] { 255, 0, 0 }) }); patientScorecardItem.ComputedMetrics = new List <ComputedMetric>() { computedMetric2 }; // Modify custom metrics var customMetricItem2 = await _proKnow.CustomMetrics.CreateAsync($"{_testClassName}-{testNumber}-2", "patient", "number"); customMetricItem2.Objectives = new List <MetricBin>() { new MetricBin("PASS", new byte[] { 0, 255, 0 }, null, 85), new MetricBin("FAIL", new byte[] { 255, 0, 0 }) }; patientScorecardItem.CustomMetrics = new List <CustomMetricItem>() { customMetricItem2 }; //TODO--Modify custom metric value and verify that it is saved // Save changes await patientScorecardItem.SaveAsync(); // Verify that the changes were saved var patientScorecardSummary2 = await patientScorecards.FindAsync(t => t.Id == patientScorecardItem.Id); var patientScorecardItem2 = await patientScorecardSummary2.GetAsync(); Assert.AreEqual($"{_testClassName}-{testNumber}-2", patientScorecardItem2.Name); Assert.AreEqual(1, patientScorecardItem2.ComputedMetrics.Count); Assert.AreEqual(computedMetric2.Type, patientScorecardItem2.ComputedMetrics[0].Type); Assert.AreEqual(computedMetric2.RoiName, patientScorecardItem2.ComputedMetrics[0].RoiName); Assert.AreEqual(computedMetric2.Arg1, patientScorecardItem2.ComputedMetrics[0].Arg1); Assert.AreEqual(computedMetric2.Arg2, patientScorecardItem2.ComputedMetrics[0].Arg2); Assert.AreEqual(computedMetric2.Objectives.Count, patientScorecardItem2.ComputedMetrics[0].Objectives.Count); for (int i = 0; i < computedMetric2.Objectives.Count; i++) { Assert.AreEqual(computedMetric2.Objectives[i].Label, patientScorecardItem2.ComputedMetrics[0].Objectives[i].Label); Assert.AreEqual(computedMetric2.Objectives[i].Color[0], patientScorecardItem2.ComputedMetrics[0].Objectives[i].Color[0]); Assert.AreEqual(computedMetric2.Objectives[i].Color[1], patientScorecardItem2.ComputedMetrics[0].Objectives[i].Color[1]); Assert.AreEqual(computedMetric2.Objectives[i].Color[2], patientScorecardItem2.ComputedMetrics[0].Objectives[i].Color[2]); Assert.AreEqual(computedMetric2.Objectives[i].Min, patientScorecardItem2.ComputedMetrics[0].Objectives[i].Min); Assert.AreEqual(computedMetric2.Objectives[i].Max, patientScorecardItem2.ComputedMetrics[0].Objectives[i].Max); } Assert.AreEqual(1, patientScorecardItem2.CustomMetrics.Count); Assert.AreEqual(customMetricItem2.Id, patientScorecardItem2.CustomMetrics[0].Id); Assert.AreEqual(customMetricItem2.Objectives.Count, patientScorecardItem2.CustomMetrics[0].Objectives.Count); for (int i = 0; i < customMetricItem2.Objectives.Count; i++) { Assert.AreEqual(customMetricItem2.Objectives[i].Label, patientScorecardItem2.CustomMetrics[0].Objectives[i].Label); Assert.AreEqual(customMetricItem2.Objectives[i].Color[0], patientScorecardItem2.CustomMetrics[0].Objectives[i].Color[0]); Assert.AreEqual(customMetricItem2.Objectives[i].Color[1], patientScorecardItem2.CustomMetrics[0].Objectives[i].Color[1]); Assert.AreEqual(customMetricItem2.Objectives[i].Color[2], patientScorecardItem2.CustomMetrics[0].Objectives[i].Color[2]); Assert.AreEqual(customMetricItem2.Objectives[i].Min, patientScorecardItem2.CustomMetrics[0].Objectives[i].Min); Assert.AreEqual(customMetricItem2.Objectives[i].Max, patientScorecardItem2.CustomMetrics[0].Objectives[i].Max); } }