Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SFRplusTest Class Reference

contains the details of an sfrPlus test to be performed including all relevant fields for determining pass or fail More...

#include <SFRplusTest.h>

Inheritance diagram for SFRplusTest:
[legend]

Public Member Functions

 SFRplusTest (void)
 
virtual ~SFRplusTest (void)
 
const bool * GetQSO ()
 
 SFRplusTest (void)
 
virtual ~SFRplusTest (void)
 
const bool * GetQSO ()
 
void ClearQSO (void)
 
- Public Member Functions inherited from ImageTest
 ImageTest (void)
 
virtual ~ImageTest (void)
 
virtual void Run ()
 Runs the test pointed to by m_imatestFunc. More...
 
virtual void Run (void *raw_pixels, int width, int height, const Config *config)
 
void GetLog (CString &dst)
 
void GetFailInfo (CString &dst)
 
void GetJSON (CString &dst)
 
void GetName (CString &name)
 
void GetSummary (CString &dst)
 
void Init (void *raw_pixels, int width, int height, const Config *config)
 
bool Passed ()
 
void SetBuffer (void *buf)
 
 ImageTest (void)
 
virtual ~ImageTest (void)
 
virtual void Run ()
 
virtual void Run (void *raw_pixels, int width, int height, const Config *config)
 
void GetLog (CString &dst)
 
void GetFailInfo (CString &dst)
 
void GetJSON (CString &dst)
 
void GetName (CString &name)
 
void GetSummary (CString &dst)
 
void Init (void *raw_pixels, int width, int height, const Config *config)
 
bool Passed ()
 
void SetBuffer (void *buf)
 

Protected Member Functions

void GetResults (JSONNode &passfail)
 Gets the pass/fail results for a range of pass/fail metrics to be displayed in summary dialog. More...
 
void ParseResults (string &results)
 Parses the JSON output of an sfrPlus test to determine the pass/fail status of the various metrics. More...
 
void ParseOverlay (JSONNode &data, JSONNode &passfail)
 Determines the pass/fail result for each quadrant. More...
 
void GetResults (JSONNode &passfail)
 
void ParseResults (string &results)
 This must be implemented by subclass. More...
 
void ParseOverlay (JSONNode &data, JSONNode &passfail)
 
- Protected Member Functions inherited from ImageTest
bool AllocateRGB ()
 
void AppendLog (CString &log)
 
void ClearLog ()
 
void ClearJSON ()
 
void ClearFailInfo ()
 
void ClearSummary ()
 
void DeleteRGB ()
 
bool GetDataNode (string &results, JSONNode &data, bool logErrors=true)
 
bool GetPassFailNode (JSONNode &data, JSONNode &passFail, bool logErrors=true)
 
void PlanesFromRGB ()
 converts from m_rawPixels to m_rgb More...
 
void GetString (JSONNode &node, const char *name, json_string &string, bool logErrors=true)
 
void InitResults ()
 
void ParseFailures (const JSONNode *data)
 
void RGBFromPlanes (UINT *rgb)
 converts from m_rgb to rgb More...
 
void SaveImage (RGBQUAD *buf, const char *filename)
 
void SetJSON (string &src)
 
void SetSummary (CString &src)
 
bool AllocateRGB ()
 
void AppendLog (CString &log)
 
void ClearLog ()
 
void ClearJSON ()
 
void ClearFailInfo ()
 
void ClearSummary ()
 
void DeleteRGB ()
 
bool GetDataNode (string &results, JSONNode &data, bool logErrors=true)
 
bool GetPassFailNode (JSONNode &data, JSONNode &passFail, bool logErrors=true)
 
void PlanesFromRGB ()
 
void GetString (JSONNode &node, const char *name, json_string &string, bool logErrors=true)
 
void InitResults ()
 
void ParseFailures (const JSONNode *data)
 
void RGBFromPlanes (UINT *rgb)
 
void SaveImage (RGBQUAD *buf, const char *filename)
 
void SetJSON (string &src)
 
void SetSummary (CString &src)
 

Protected Attributes

bool m_qso [eNumQuadrants]
 pass/fail for each quadrant More...
 
- Protected Attributes inherited from ImageTest
const void * m_rawPixels
 
unsigned char * m_rgb
 
bool m_passed
 
const TestIDm_tests
 
int m_numTests
 
Timer m_time
 
ImatestShellFunc m_imatestFunc
 
CriticalCString m_jsonResults
 the full results of the test in JSON format More...
 
CriticalCString m_summary
 the summary results of the test (these get displayed in the dialog) More...
 
CriticalCString m_failInfo
 reasons that image failed the test More...
 
CriticalCString m_log
 log message(s) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ImageTest
static UINT __cdecl ThreadProc (void *param)
 param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object More...
 
static UINT __cdecl ThreadProc (void *param)
 param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object More...
 
- Public Attributes inherited from ImageTest
int m_width
 
int m_height
 
int m_ncolors
 
const char * m_extension
 
const char * m_fileroot
 
const char * m_serialNumber
 
const char * m_partNumber
 
const char * m_iniFilePathName
 
const char * m_programPath
 
const char * m_name
 
long long m_elapsed
 
CString m_elapsedStr
 
Timestamp m_timestamp
 

Detailed Description

contains the details of an sfrPlus test to be performed including all relevant fields for determining pass or fail

Constructor & Destructor Documentation

SFRplusTest::SFRplusTest ( void  )

References gTestID, NUM_TESTS, and TEST_NAME.

76 {
77  m_name = TEST_NAME;
78  m_tests = gTestID;
80  m_imatestFunc = sfrplus_shell;
81 }
int m_numTests
Definition: ImageTest.h:146
#define TEST_NAME
Definition: SFRplusTest.cpp:42
const TestID * m_tests
Definition: ImageTest.h:145
static const TestID gTestID[]
Definition: SFRplusTest.cpp:50
#define NUM_TESTS
Definition: SFRplusTest.cpp:47
const char * m_name
Definition: ImageTest.h:136
ImatestShellFunc m_imatestFunc
Definition: ImageTest.h:148
SFRplusTest::~SFRplusTest ( void  )
virtual
85 {
86 }
SFRplusTest::SFRplusTest ( void  )
virtual SFRplusTest::~SFRplusTest ( void  )
virtual

Member Function Documentation

void SFRplusTest::ClearQSO ( void  )

References eNumQuadrants.

299 {
300  for (int i1 = 0; i1 < eNumQuadrants; ++i1)
301  {
302  m_qso[i1] = false;
303  }
304 }
bool m_qso[eNumQuadrants]
pass/fail for each quadrant
Definition: SFRplusTest.h:48
Definition: qso.h:41
const bool* SFRplusTest::GetQSO ( )
inline

References m_qso.

36 {return m_qso;}
bool m_qso[eNumQuadrants]
pass/fail for each quadrant
Definition: SFRplusTest.h:48
const bool* SFRplusTest::GetQSO ( )
inline

References m_qso.

Referenced by COperatorConsoleApp::UpdateResultsSFRplus().

36 {return m_qso;}
bool m_qso[eNumQuadrants]
pass/fail for each quadrant
Definition: SFRplusTest.h:48

Here is the caller graph for this function:

void SFRplusTest::GetResults ( JSONNode passfail)
protected

Gets the pass/fail results for a range of pass/fail metrics to be displayed in summary dialog.

201 {
202  CString summary;
203  json_string center1, outer1, center2, outer2, fov, hConverge, vConverge, rotation;
204  char *format = "MTF#1 Center %s\r\nMTF#1 Outer %s\r\nMTF#2 Center %s\r\nMTF#2 Outer %s\r\nFOV %s\r\nH Tilt %s\r\nV Tilt %s\r\nRotation %s\r\n";
205 
206  //
207  // Get the data values (they're stored in the pass/fail section)
208  // GetString() gets the value and handles any exceptions.
209  //
210  GetString(passfail, "Secondary_readout_1_center_mean", center1);
211  GetString(passfail, "Secondary_readout_1_outer_mean", outer1);
212  GetString(passfail, "Secondary_readout_2_center_mean", center2);
213  GetString(passfail, "Secondary_readout_2_outer_mean", outer2);
214  GetString(passfail, "FOV_degrees_diagonal", fov);
215  GetString(passfail, "Horizontal_convergence_angle_degrees", hConverge);
216  GetString(passfail, "Vertical_convergence_angle_degrees", vConverge);
217  GetString(passfail, "Rotation_degrees", rotation);
218 
219  summary.Format(format, center1.c_str(), outer1.c_str(), center2.c_str(), outer2.c_str(), fov.c_str(), hConverge.c_str(), vConverge.c_str(), rotation.c_str());
220  m_summary.Set(summary);
221 }
void GetString(JSONNode &node, const char *name, json_string &string, bool logErrors=true)
Definition: ImageTest.cpp:328
CriticalCString m_summary
the summary results of the test (these get displayed in the dialog)
Definition: ImageTest.h:178
void Set(CString &str)
Definition: CriticalCString.cpp:52
void SFRplusTest::GetResults ( JSONNode passfail)
protected
void SFRplusTest::ParseOverlay ( JSONNode data,
JSONNode passfail 
)
protected

Determines the pass/fail result for each quadrant.

References JSONNode::as_array(), JSONNode::as_float(), eCenter, eNumQuadrants, and getFloatArray().

227 {
228  int i;
229  double readout1[eNumQuadrants];
230  double readout2[eNumQuadrants];
231  double minCenter1, minCenter2; // minimum allowed values for center quadrant
232  double minOuter1, minOuter2; // minimum allowed values for outer (non-center) quadrants
233  double min1, min2;
234 
235  memset(m_qso, 0, sizeof(m_qso));
236 
237  try
238  {
239  //
240  // The readout data values are stored in the data section of the JSON buffer
241  //
242  getFloatArray(data.at("secondary_1_quadrant_mean").as_array(), readout1, eNumQuadrants); // get the readout1 data values
243  getFloatArray(data.at("secondary_2_quadrant_mean").as_array(), readout2, eNumQuadrants); // get the readout2 data values
244 
245  //
246  // The min allowed values are stored in the pass/fail section of the JSON buffer
247  //
248  minCenter1 = passfail.at("Secondary_readout_1_center_mean_min").as_array()[0].as_float(); // get the readout1 center min value
249  minCenter2 = passfail.at("Secondary_readout_2_center_mean_min").as_array()[0].as_float(); // get the readout2 center min value
250  minOuter1 = passfail.at("Secondary_readout_1_outer_mean_min").as_array()[0].as_float(); // get the readout1 outer min value
251  minOuter2 = passfail.at("Secondary_readout_2_outer_mean_min").as_array()[0].as_float(); // get the readout2 outer min value
252 
253  //
254  // See whether or not each quadrant passed the test.
255  //
256  for (i = 0; i < eNumQuadrants; i++)
257  {
258  if (i == eCenter)
259  {
260  min1 = minCenter1;
261  min2 = minCenter2;
262  }
263  else
264  {
265  min1 = minOuter1;
266  min2 = minOuter2;
267  }
268 
269  m_qso[i] = (readout1[i] >= min1) && (readout2[i] >= min2);
270  }
271  }
272 
273  catch (...)
274  {
275  CString log;
276  log.AppendFormat("%s Error parsing quadrant results\n", (LPCTSTR)m_timestamp.Get());
277  m_log.Append(log);
278  }
279 }
bool Append(CString &str)
Definition: CriticalCString.cpp:87
Timestamp m_timestamp
Definition: ImageTest.h:139
void getFloatArray(JSONNode &array, double *data, int len)
Definition: jsonhelpers.cpp:48
const CString & Get()
Definition: Timestamp.cpp:32
JSONNode as_array(void) const json_nothrow json_read_priority
Definition: JSONNode.cpp:84
Definition: qso.h:36
CriticalCString m_log
log message(s)
Definition: ImageTest.h:180
bool m_qso[eNumQuadrants]
pass/fail for each quadrant
Definition: SFRplusTest.h:48
Definition: qso.h:41
json_number as_float(void) const json_nothrow json_read_priority
Definition: JSONNode.h:688

Here is the call graph for this function:

void SFRplusTest::ParseOverlay ( JSONNode data,
JSONNode passfail 
)
protected
void SFRplusTest::ParseResults ( string &  results)
protectedvirtual

Parses the JSON output of an sfrPlus test to determine the pass/fail status of the various metrics.

Implements ImageTest.

168 {
169  CString summary;
170  JSONNode passfail;
171  JSONNode data;
172 
173 
174  if (GetDataNode(results, data) && GetPassFailNode(data, passfail))
175  {
176  try
177  {
178  m_passed = passfail.at(ALL_TESTS).as_array()[0].as_bool();
179 
180  if (!m_passed)
181  {
182  ParseFailures(&passfail);
183  }
184  }
185 
186  catch(...)
187  {
188  m_failInfo.Set("Couldn't find pass/fail result");
189  m_passed = false;
190  }
191 
192  GetResults(passfail); // get the results (they're stored in the pass fail node)
193  ParseOverlay(data, passfail);
194  }
195 }
bool as_bool(void) const json_nothrow json_read_priority
Definition: JSONNode.h:693
bool m_passed
Definition: ImageTest.h:144
bool GetPassFailNode(JSONNode &data, JSONNode &passFail, bool logErrors=true)
Definition: ImageTest.cpp:302
#define ALL_TESTS
Definition: SFRplusTest.cpp:46
Definition: JSONNode.h:132
JSONNode as_array(void) const json_nothrow json_read_priority
Definition: JSONNode.cpp:84
bool GetDataNode(string &results, JSONNode &data, bool logErrors=true)
Definition: ImageTest.cpp:274
void ParseOverlay(JSONNode &data, JSONNode &passfail)
Determines the pass/fail result for each quadrant.
Definition: SFRplusTest.cpp:226
void ParseFailures(const JSONNode *data)
Definition: ImageTest.cpp:343
void Set(CString &str)
Definition: CriticalCString.cpp:52
void GetResults(JSONNode &passfail)
Gets the pass/fail results for a range of pass/fail metrics to be displayed in summary dialog...
Definition: SFRplusTest.cpp:200
CriticalCString m_failInfo
reasons that image failed the test
Definition: ImageTest.h:179
void SFRplusTest::ParseResults ( string &  results)
protectedvirtual

This must be implemented by subclass.

Implements ImageTest.

Member Data Documentation

bool SFRplusTest::m_qso
protected

pass/fail for each quadrant

Referenced by GetQSO().


The documentation for this class was generated from the following files: