image_metrics_test.h
Go to the documentation of this file.
1 
9 #pragma once
12 #include "interop/util/length_of.h"
13 
14 
15 namespace illumina{ namespace interop { namespace unittest
16 {
17 
23  struct image_metric_v1 : metric_test<model::metrics::image_metric, 1>
24  {
25  enum{
27  disable_binary_data=true // The order here could change
28  };
34  {
35  metrics = metric_set_t(VERSION);
36  typedef metric_t::ushort_t ushort_t;
37  const ushort_t channel_count = metric_t::MAX_CHANNELS;
38  const ushort_t min_contrast1[] = {896, 1725,738,812};
39  const ushort_t min_contrast2[] = {908, 1770,739,806};
40  const ushort_t min_contrast3[] = {923, 1829,734,802};
41 
42  const ushort_t max_contrast1[] = {4840, 8144,3308,4974};
43  const ushort_t max_contrast2[] = {4829, 8159,3302,4985};
44  const ushort_t max_contrast3[] = {4829, 8236,3304,4947};
45  metrics.insert(metric_t(1, 1101, 1, channel_count, to_vector(min_contrast1), to_vector(max_contrast1)));
46  metrics.insert(metric_t(1, 1102, 1, channel_count, to_vector(min_contrast2), to_vector(max_contrast2)));
47  metrics.insert(metric_t(1, 1103, 1, channel_count, to_vector(min_contrast3), to_vector(max_contrast3)));
48  }
53  template<class Collection>
54  static void create_binary_data(Collection& buffer)
55  {
56  const signed char tmp[] =
57  {1
58  ,12,1,0,77,4,1,0,0,0,-128,3,-24,18,1,0,77,4,1,0,1
59  ,0,-67,6,-48,31,1,0,77,4,1,0,2,0,-30,2,-20,12,1,0,77
60  ,4,1,0,3,0,44,3,110,19,1,0,78,4,1,0,0,0,-116,3,-35
61  ,18,1,0,78,4,1,0,1,0,-22,6,-33,31,1,0,78,4,1,0,2
62  ,0,-29,2,-26,12,1,0,78,4,1,0,3,0,38,3,121,19,1,0,79
63  ,4,1,0,0,0,-101,3,-35,18,1,0,79,4,1,0,1,0,37,7,44
64  ,32,1,0,79,4,1,0,2,0,-34,2,-24,12,1,0,79,4,1,0,3
65  ,0,34,3,83,19
66  };
67  buffer.assign(tmp, tmp+util::length_of(tmp));
68  }
69  };
70 
76  struct image_metric_v2 : metric_test<model::metrics::image_metric, 2>
77  {
83  {
84  metrics = metric_set_t(header_t(2), VERSION);
85  typedef metric_t::ushort_t ushort_t;
86  const ushort_t channel_count = metrics.channel_count();
87  const ushort_t min_contrast1[] = {231, 207};
88  const ushort_t min_contrast2[] = {229, 205};
89  const ushort_t min_contrast3[] = {231, 222};
90 
91  const ushort_t max_contrast1[] = {462, 387};
92  const ushort_t max_contrast2[] = {457, 387};
93  const ushort_t max_contrast3[] = {473, 416};
94  metrics.insert(metric_t(7, 1114, 1, channel_count, to_vector(min_contrast1), to_vector(max_contrast1)));
95  metrics.insert(metric_t(7, 1214, 1, channel_count, to_vector(min_contrast2), to_vector(max_contrast2)));
96  metrics.insert(metric_t(7, 2114, 1, channel_count, to_vector(min_contrast3), to_vector(max_contrast3)));
97  }
102  template<class Collection>
103  static void create_binary_data(Collection& buffer)
104  {
105  const signed char tmp[] =
106  {
107  2,14,2
108  ,7,0,90,4,1,0,-25,0,-49,0,-50,1,-125,1
109  ,7,0,-66,4,1,0,-27,0,-51,0,-55,1,-125,1
110  ,7,0,66,8,1,0,-25,0,-34,0,-39,1,-96,1
111  };
112  buffer.assign(tmp, tmp+util::length_of(tmp));
113  }
114  };
115 
121  struct image_metric_v3 : metric_test<model::metrics::image_metric, 3>
122  {
128  {
129  metrics = metric_set_t(header_t(2), VERSION);
130  typedef metric_t::ushort_t ushort_t;
131  const ushort_t channel_count = metrics.channel_count();
132  const ushort_t min_contrast1[] = {231, 207};
133  const ushort_t min_contrast2[] = {229, 205};
134  const ushort_t min_contrast3[] = {231, 222};
135 
136  const ushort_t max_contrast1[] = {462, 387};
137  const ushort_t max_contrast2[] = {457, 387};
138  const ushort_t max_contrast3[] = {473, 416};
139  metrics.insert(metric_t(7, 111014, 1, channel_count, to_vector(min_contrast1), to_vector(max_contrast1)));
140  metrics.insert(metric_t(7, 121014, 1, channel_count, to_vector(min_contrast2), to_vector(max_contrast2)));
141  metrics.insert(metric_t(7, 211014, 1, channel_count, to_vector(min_contrast3), to_vector(max_contrast3)));
142 
143  }
148  template<class Collection>
149  static void create_binary_data(Collection& buffer)
150  {
151  const signed char tmp[] =
152  {3,16,2,7,0,-90,-79,1,0,1,0,-25,0,-49,0,-50,1,-125,1,7,0,-74
153  ,-40,1,0,1,0,-27,0,-51,0,-55,1,-125,1,7,0,70,56,3,0,1,0,-25
154  ,0,-34,0,-39,1,-96,1
155  };
156  buffer.assign(tmp, tmp+util::length_of(tmp));
157  }
158  };
159 
160 }}}
161 
void insert(const metric_type &metric)
Definition: metric_set.h:267
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: image_metrics_test.h:82
Definition: enum_description.h:15
Definition: image_metrics_test.h:76
Definition: image_metrics_test.h:121
static std::vector< T > to_vector(const T(&vals)[N])
Definition: metric_test.h:85
::uint16_t ushort_t
Definition: base_metric.h:141
model::metrics::image_metric metric_t
Definition: metric_test.h:57
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: image_metrics_test.h:33
Definition: metric_test.h:41
model::metric_base::metric_set< model::metrics::image_metric > metric_set_t
Definition: metric_test.h:59
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: image_metrics_test.h:127
static void create_binary_data(Collection &buffer)
Definition: image_metrics_test.h:54
static void create_binary_data(Collection &buffer)
Definition: image_metrics_test.h:103
metric_t::header_type header_t
Definition: metric_test.h:61
size_t length_of(const T &val)
Definition: length_of.h:55
Definition: image_metrics_test.h:23
static void create_binary_data(Collection &buffer)
Definition: image_metrics_test.h:149