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

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

#include <BlemishTest.h>

Inheritance diagram for BlemishTest:
[legend]

Public Member Functions

 BlemishTest (void)
 
virtual ~BlemishTest (void)
 
 BlemishTest (void)
 
virtual ~BlemishTest (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 ParseResults (string &results)
 Parses the JSON output of an sfrPlus test to determine the pass/fail status of the various metrics. More...
 
void ParseResults (string &results)
 This must be implemented by subclass. More...
 
- 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)
 

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
 
- 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...
 

Detailed Description

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

Constructor & Destructor Documentation

BlemishTest::BlemishTest ( void  )

References gTestID, NUM_TESTS, and TEST_NAME.

53 {
54  m_name = TEST_NAME;
55  m_tests = gTestID;
57  m_imatestFunc = blemish_shell;
58 }
int m_numTests
Definition: ImageTest.h:146
static const TestID gTestID[]
Definition: BlemishTest.cpp:39
const TestID * m_tests
Definition: ImageTest.h:145
#define TEST_NAME
Definition: BlemishTest.cpp:31
const char * m_name
Definition: ImageTest.h:136
#define NUM_TESTS
Definition: BlemishTest.cpp:36
ImatestShellFunc m_imatestFunc
Definition: ImageTest.h:148
BlemishTest::~BlemishTest ( void  )
virtual
62 {
63 }
BlemishTest::BlemishTest ( void  )
virtual BlemishTest::~BlemishTest ( void  )
virtual

Member Function Documentation

void BlemishTest::ParseResults ( string &  results)
protectedvirtual

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

Implements ImageTest.

References JSONNode::as_array(), JSONNode::as_bool(), getIntFromArray(), getStringArray(), PIXEL_ERROR_REGIONS, JSONNode::size(), and sumArrayInt().

150 {
151  CString summary;
152  JSONNode pixelErrors;
153  JSONNode blemishSize;
154  JSONNode passfail;
155  JSONNode data;
156  json_string sizes;
157  int total;
158  int dead;
159  int hot;
160  int blemishes;
161  const char *format = "Total pixel errors %d\r\nDead pixels %d\r\nHot pixels %d\r\nBlemishes %d\r\nBlemish size (pixels) %s";
162 
163  InitResults();
164 
165  if (GetDataNode(results, data))
166  {
167  //
168  // Get the results of interest from the data node
169  //
170  try
171  {
172  pixelErrors = data.at("pixelErrors").as_array();
173  total = sumArrayInt(pixelErrors, PIXEL_ERROR_REGIONS);
174  dead = getIntFromArray(data, "nDeadPixels");
175  hot = getIntFromArray(data, "nHotPixels");
176  blemishes = getIntFromArray(data, "N_blemish_count");
177  blemishSize = data.at("blemishSizePxls").as_array();
178 
179  // Note: blemishSize is limited to 50 entries in the Imatest library and does
180  // not necessarily equal the JSON entry "N_blemish_count" = blemishes
181  if ( blemishes < (int)blemishSize.size())
182  {
183  getStringArray(blemishSize, blemishes, &sizes);
184  }
185  else
186  {
187  getStringArray(blemishSize, blemishSize.size(), &sizes);
188  }
189  summary.Format(format, total, dead, hot, blemishes, sizes.c_str());
190  m_summary.Set(summary);
191  }
192 
193  catch(...)
194  {
195  CString log;
196  log.AppendFormat("%s Error parsing results\n", (LPCTSTR)m_timestamp.Get());
197  AppendLog(log);
198  }
199 
200  //
201  // Now get the pass/fail results
202  //
203  if (GetPassFailNode(data, passfail)) // this will copy any errors into m_log
204  {
205  try
206  {
207  m_passed = passfail.at("all_tests_passed").as_array()[0].as_bool();
208 
209  if (!m_passed)
210  {
211  ParseFailures(&passfail);
212  }
213  }
214 
215  catch(...)
216  {
217  CString str("Unable to find pass/fail result");
218  m_failInfo.Set(str);
219  m_log.Append(str);
220  m_passed = false;
221  }
222  }
223  }
224 }
int getIntFromArray(JSONNode node, char *name)
Definition: jsonhelpers.cpp:16
bool as_bool(void) const json_nothrow json_read_priority
Definition: JSONNode.h:693
void InitResults()
Definition: ImageTest.cpp:426
int sumArrayInt(JSONNode node, int count)
Definition: jsonhelpers.cpp:9
bool m_passed
Definition: ImageTest.h:144
bool Append(CString &str)
Definition: CriticalCString.cpp:87
Timestamp m_timestamp
Definition: ImageTest.h:139
void AppendLog(CString &log)
Definition: ImageTest.h:109
bool GetPassFailNode(JSONNode &data, JSONNode &passFail, bool logErrors=true)
Definition: ImageTest.cpp:302
Definition: JSONNode.h:132
#define PIXEL_ERROR_REGIONS
Definition: BlemishTest.cpp:34
const CString & Get()
Definition: Timestamp.cpp:32
JSONNode as_array(void) const json_nothrow json_read_priority
Definition: JSONNode.cpp:84
json_index_t size(void) const json_nothrow json_read_priority
Definition: JSONNode.h:630
CriticalCString m_log
log message(s)
Definition: ImageTest.h:180
CriticalCString m_summary
the summary results of the test (these get displayed in the dialog)
Definition: ImageTest.h:178
bool GetDataNode(string &results, JSONNode &data, bool logErrors=true)
Definition: ImageTest.cpp:274
void ParseFailures(const JSONNode *data)
Definition: ImageTest.cpp:343
void Set(CString &str)
Definition: CriticalCString.cpp:52
void getStringArray(JSONNode &array, int len, std::string *s)
Definition: jsonhelpers.cpp:29
CriticalCString m_failInfo
reasons that image failed the test
Definition: ImageTest.h:179

Here is the call graph for this function:

void BlemishTest::ParseResults ( string &  results)
protectedvirtual

This must be implemented by subclass.

Implements ImageTest.


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