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

The main class for the Operator Console Application. More...

#include <OperatorConsole.h>

Inheritance diagram for COperatorConsoleApp:
[legend]

Public Member Functions

 COperatorConsoleApp ()
 COperatorConsoleApp construction. More...
 
 ~COperatorConsoleApp ()
 
void Quit ()
 
BOOL InitInstance ()
 COperatorConsoleApp initialization. More...
 
int GetImageWidth ()
 
int GetImageHeight ()
 
bool ReadINISettings (void)
 This function reads in items for the setup dialog from imatest.ini. More...
 
void WriteINISettings (void)
 This function writes items for the setup dialog to imatest.ini. More...
 
bool ReInit (void)
 This function allows for reallocation of the various image buffers when we change the image size. More...
 
bool ReadPassFail (void)
 This function reads in the pass/fail variable values as in the pass/fail file listed in the imatest INI file. More...
 
bool WritePassFail (void)
 This function writes the pass/fail variables to the pass/fail file listed in the imatest INI file. More...
 
 COperatorConsoleApp ()
 
 ~COperatorConsoleApp ()
 
void Quit ()
 
BOOL InitInstance ()
 
int GetImageWidth ()
 
int GetImageHeight ()
 
bool ReadINISettings (void)
 This function reads in items for the setup dialog from imatest.ini. More...
 
void WriteINISettings (void)
 This function writes items for the setup dialog to imatest.ini. More...
 
bool ReInit (void)
 This function allows for reallocation of the various image buffers when we change the image size. More...
 
bool ReadPassFail (void)
 This function reads in the pass/fail variable values as in the pass/fail file listed in the imatest INI file. More...
 
bool WritePassFail (void)
 This function writes the pass/fail variables to the pass/fail file listed in the imatest INI file. More...
 
void SaveLog (void)
 A public function to save the contents of the log CEdit to m_logFileName. More...
 

Static Public Member Functions

static bool FileExists (LPCTSTR filePathName, char *errorMsg, int len)
 
static bool FileExists (LPCTSTR filePathName, char *errorMsg, int len)
 

Public Attributes

CPassFailSettings m_PFSettings
 Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini. More...
 

Protected Member Functions

bool AllocateImageBuf ()
 
bool CheckFiles (CString &msg)
 
void CloseLibs ()
 Function that closes the Imatest library. Note that once closed, the library cannot be reinitialized. More...
 
void GetResults (ImageTest *test)
 
void GetStdoutMsg (StdoutThread &data, CString &str)
 
const char * GetTestName ()
 
bool Init ()
 Init perform application-specific initialization. More...
 
bool InitBlemishAcq ()
 
bool InitBlemishThread ()
 
bool InitCamera ()
 
bool InitCameraThread ()
 
bool InitLibs ()
 Function that initializes the Imatest library. Must be called before any Imatest library functions are used. More...
 
bool InitModelessThread ()
 
bool InitOutput ()
 
bool InitSFRplusAcq ()
 
bool InitSFRplusThread ()
 
bool LoadConfig ()
 
void MakeHandles ()
 
void OnBlemishDone (WPARAM wParam, LPARAM lParam)
 Called after MSG_BLEMISH_DONE is received. More...
 
void OnFrameReady (WPARAM wParam, LPARAM lParam)
 Called after MSG_FRAME_READY is received. More...
 
void OnPassFail (WPARAM wParam, LPARAM lParam)
 Called after MSG_PASS_FAIL is received. More...
 
void OnRunTest (WPARAM wParam, LPARAM lParam)
 Called after MSG_RUN_TEST is received. More...
 
void OnSFRplusDone (WPARAM wParam, LPARAM lParam)
 Called after MSG_SFRPLUS_DONE is received. More...
 
void OnSetBlemish (WPARAM wParam, LPARAM lParam)
 Called after MSG_SET_BLEMISH is received. More...
 
void OnSetSFRplus (WPARAM wParam, LPARAM lParam)
 Called after MSG_SET_SFRPLUS is received. More...
 
void OnShowJSON (UINT wParam, LONG lParam)
 Called after MSG_JSON is received. More...
 
void OnStop (WPARAM wParam, LPARAM lParam)
 Called after MSG_STOP is received. More...
 
void OnStart (WPARAM wParam, LPARAM lParam)
 Called after MSG_START is received. More...
 
void OnSetup (WPARAM wParam, LPARAM lParam)
 Called after MSG_SETUP is received. More...
 
void OnUpdateStderr ()
 Called after MSG_STDERR is received. More...
 
void OnUpdateStdout ()
 Called after MSG_STDOUT is received. More...
 
bool SaveConfig ()
 
void SaveLog (const char *filePathName)
 
BOOL PreTranslateMessage (MSG *pMsg)
 Intercepts messages of interest before Windows or MFC. More...
 
BOOL SendAppMessage (int msg)
 
void LogTime ()
 
void UpdateResults (ImageTest *test)
 
void UpdateResultsSFRplus (ImageTest *test)
 
void UpdateStderr ()
 
void UpdateStdout ()
 
bool AllocateImageBuf ()
 
bool CheckFiles (CString &msg)
 
void CloseLibs ()
 Function that closes the Imatest library. Note that once closed, the library cannot be reinitialized. More...
 
void GetResults (ImageTest *test)
 
void GetStdoutMsg (StdoutThread &data, CString &str)
 
const char * GetTestName ()
 
bool Init ()
 
bool InitBlemishAcq ()
 
bool InitBlemishThread ()
 
bool InitCamera ()
 
bool InitCameraThread ()
 
bool InitLibs ()
 Function that initializes the Imatest library. Must be called before any Imatest library functions are used. More...
 
bool InitModelessThread ()
 
bool InitOutput ()
 
bool InitSFRplusAcq ()
 
bool InitSFRplusThread ()
 
bool LoadConfig ()
 
void MakeHandles ()
 
void OnBlemishDone (WPARAM wParam, LPARAM lParam)
 Called after MSG_BLEMISH_DONE is received. More...
 
void OnFrameReady (WPARAM wParam, LPARAM lParam)
 Called after MSG_FRAME_READY is received. More...
 
void OnPassFail (WPARAM wParam, LPARAM lParam)
 Called after MSG_PASS_FAIL is received. More...
 
void OnRunTest (WPARAM wParam, LPARAM lParam)
 Called after MSG_RUN_TEST is received. More...
 
void OnSFRplusDone (WPARAM wParam, LPARAM lParam)
 Called after MSG_SFRPLUS_DONE is received. More...
 
void OnSetBlemish (WPARAM wParam, LPARAM lParam)
 Called after MSG_SET_BLEMISH is received. More...
 
void OnSetSFRplus (WPARAM wParam, LPARAM lParam)
 Called after MSG_SET_SFRPLUS is received. More...
 
void OnSetImatestCamera (WPARAM wParam, LPARAM lParam)
 
void OnSetDirectshowCamera (WPARAM wParam, LPARAM lParam)
 
void OnShowJSON (UINT wParam, LONG lParam)
 Called after MSG_JSON is received. More...
 
void OnStop (WPARAM wParam, LPARAM lParam)
 Called after MSG_STOP is received. More...
 
void OnStart (WPARAM wParam, LPARAM lParam)
 Called after MSG_START is received. More...
 
void OnSetup (WPARAM wParam, LPARAM lParam)
 Called after MSG_SETUP is received. More...
 
void OnUpdateStderr ()
 Called after MSG_STDERR is received. More...
 
void OnUpdateStdout ()
 Called after MSG_STDOUT is received. More...
 
bool SaveConfig ()
 
void SaveLog (const CString &filePathName)
 
BOOL PreTranslateMessage (MSG *pMsg)
 Intercepts messages of interest before Windows or MFC. More...
 
BOOL SendAppMessage (int msg)
 
void LogTime ()
 
void UpdateResults (ImageTest *test)
 
void UpdateResultsSFRplus (ImageTest *test)
 
void UpdateStderr ()
 
void UpdateStdout ()
 

Protected Attributes

AppStatus m_status
 
Config m_configRAW
 for using raw files: will eventually come from a dialog (uses hard coded values for now) More...
 
Config m_configRGB
 for using rgb data: will eventually come from a dialog (uses hard coded values for now) More...
 
Configm_config
 pointer to current config struct to use More...
 
char * m_fileImage
 buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) More...
 
char * m_cameraImage
 buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) More...
 
FileAcquisition m_blemishAcq
 raw data for blemish tests (no longer needed, now that live capture is working) More...
 
FileAcquisition m_sfrPlusAcq
 raw data for SFRplus tests (no longer needed, now that live capture is working) More...
 
ImageAcquisitionm_acq
 pointer to current acquisition object being used More...
 
ImatestLibAcq m_camera
 live acquisition using Imatest acquire_image() More...
 
int m_width
 
int m_height
 
setup_settings m_setup
 this contains settings from/for the setup dialog More...
 
BlemishTest m_blemish
 this will run the blemish tests More...
 
SFRplusTest m_sfrPlus
 this will run the SFRplus tests More...
 
ThreadControl m_blemishControl
 this is the thread control for running Blemish tests More...
 
ThreadControl m_sfrPlusControl
 this is the thread control for running SFRplus tests More...
 
ThreadControl m_cameraControl
 this captures images from the acquisition source More...
 
ThreadControlm_test
 the current test being run (either &m_blemishControl or &sfrPlusControl) More...
 
ModelessDialogThreadm_jsonDlgThread
 
TestResults m_results
 
StdoutThread m_stdoutThread
 
StderrThread m_stderrThread
 
CString m_stdoutStr
 our copy of the contents of m_stdout More...
 
CString m_stderrStr
 our copy of the contents of m_stderr More...
 
AppFlags m_flags
 
ImatestLibAcq m_imatest_cam
 live acquisition using Imatest acquire_image() More...
 
SimpleDirectShowAcq m_directshow_cam
 live acquisition using a camera More...
 
ImageAcquisitionm_camera
 
ThreadControl m_ImatestCameraControl
 
ThreadControl m_DirectShowCameraControl
 
ThreadControlm_cameraControl
 points to the current image source's control thread More...
 

Private Attributes

CString m_password
 This contains the administrator password. More...
 
bool m_passFailIsUnlocked
 Indicates whether the administrator has chosen to unlock access to pass/fail settings for the duration that the executable runs. More...
 
image_source_t m_image_source
 
CString m_logFileName
 Contains the file name for the log file (log file is filled with the contents of the log edit box upon app closure). More...
 

Detailed Description

The main class for the Operator Console Application.

This class interfaces with the display (controlled by the COperatorConsoleDlg class) through a messaging-passing interface. Therefore, all data relevant to the operation of the program are owned by COperatorConsoleApp and not COperatorConsoleDlg.

Constructor & Destructor Documentation

COperatorConsoleApp::COperatorConsoleApp ( )

COperatorConsoleApp construction.

References ADMIN_PASSWORD, INI_FILENAME, m_acq, m_cameraImage, m_config, m_fileImage, m_flags, CPassFailSettings::m_ini_file, m_jsonDlgThread, m_passFailIsUnlocked, m_password, m_PFSettings, and m_test.

125 {
126  // support Restart Manager
127  m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
128 
129  // Place all significant initialization in InitInstance
130  m_acq = NULL;
131  m_test = NULL;
132  m_fileImage = NULL;
133  m_cameraImage = NULL;
134  m_jsonDlgThread = NULL;
135  m_config = NULL;
136  memset(&m_flags, 0, sizeof(m_flags));
138  m_PFSettings.m_ini_file.Remove('\n');
139  m_PFSettings.m_ini_file.Remove('\r');
141  m_passFailIsUnlocked = false; // Keep this initialized to false unless you want to completely disable password-protection for pass/fail settings!
142 #if defined(STDIO_DEBUG)
143  printf("Hello from constructor [stdout]\n");
144  cout << "Hello from constructor [cout]" << endl;
145 #endif
146 }
ImageAcquisition * m_acq
pointer to current acquisition object being used
Definition: OperatorConsole.h:242
CString m_ini_file
fully-qualified filename for the Imatest ini file
Definition: PassFailSettings.h:215
AppFlags m_flags
Definition: OperatorConsole.h:265
CPassFailSettings m_PFSettings
Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini.
Definition: OperatorConsole.h:278
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258
bool m_passFailIsUnlocked
Indicates whether the administrator has chosen to unlock access to pass/fail settings for the duratio...
Definition: OperatorConsole.h:281
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
#define ADMIN_PASSWORD
Definition: OperatorConsole.h:72
ModelessDialogThread * m_jsonDlgThread
Definition: OperatorConsole.h:259
CString m_password
This contains the administrator password.
Definition: OperatorConsole.h:280
#define INI_FILENAME
Definition: OperatorConsole.h:104
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
COperatorConsoleApp::~COperatorConsoleApp ( )

References m_cameraImage, and m_fileImage.

149 {
150  if (m_fileImage != NULL)
151  {
152  delete [] m_fileImage;
153  }
154 
155  if (m_cameraImage != NULL)
156  {
157  delete [] m_cameraImage;
158  }
159 
160 }
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
COperatorConsoleApp::COperatorConsoleApp ( )
COperatorConsoleApp::~COperatorConsoleApp ( )

Member Function Documentation

bool COperatorConsoleApp::AllocateImageBuf ( )
protected

References ImageAcquisition::BytesPerFrame(), m_blemishAcq, m_camera, m_cameraImage, and m_fileImage.

Referenced by Init(), and ReInit().

545 {
546  if (m_fileImage!=NULL)
547  {
548  delete [] m_fileImage;
549  }
550  if (m_cameraImage!=NULL)
551  {
552  delete [] m_cameraImage;
553  }
554 
555  m_fileImage = new char[m_blemishAcq.BytesPerFrame()];
556  m_cameraImage = new char[m_camera.BytesPerFrame()];
557 
558  return m_fileImage != NULL && m_cameraImage != NULL;
559 }
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
unsigned int BytesPerFrame()
Definition: ImageAcquisition.h:41
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::AllocateImageBuf ( )
protected
bool COperatorConsoleApp::CheckFiles ( CString &  msg)
protected

References FileExists(), IMAGE_NAME, INI_FILENAME, LOGO_NAME, RAW_BLEMISH_IMAGE, and RAW_SFRPLUS_IMAGE.

Referenced by Init(), and ReInit().

896 {
898  int numFiles = sizeof(files) / sizeof (*files);
899  int i;
900  char str[256];
901  bool success = true;
902 
903 
904  msg.Empty();
905 
906  //
907  // Try to open all of the hard-coded files.
908  //
909  for (i = 0; i < numFiles; i++)
910  {
911  if (!FileExists(files[i], str, sizeof(str)))
912  {
913  msg.AppendFormat("%s\r\n", str);
914  success = false;
915  }
916  }
917 
918  return success;
919 }
#define IMAGE_NAME
Definition: OperatorConsole.h:65
#define LOGO_NAME
Definition: OperatorConsole.h:64
static bool FileExists(LPCTSTR filePathName, char *errorMsg, int len)
Definition: OperatorConsole.cpp:921
#define RAW_SFRPLUS_IMAGE
Definition: OperatorConsole.h:67
#define INI_FILENAME
Definition: OperatorConsole.h:104
#define RAW_BLEMISH_IMAGE
Definition: OperatorConsole.h:66

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::CheckFiles ( CString &  msg)
protected
void COperatorConsoleApp::CloseLibs ( )
protected

Function that closes the Imatest library. Note that once closed, the library cannot be reinitialized.

References imatest_libraryTerminate(), AppFlags::imatestIT, m_flags, and AppFlags::matlab.

Referenced by InitInstance().

505 {
506  if (m_flags.imatestIT)
507  {
509  m_flags.imatestIT = false;
510  }
511 
512  if (m_flags.matlab)
513  {
514  mclTerminateApplication(); // terminate MATLAB runtime
515  m_flags.matlab = false;
516  }
517 }
LIB_imatest_library_C_API void MW_CALL_CONV imatest_libraryTerminate(void)
unsigned int imatestIT
imatestIT lib has been initialized
Definition: OperatorConsole.h:159
AppFlags m_flags
Definition: OperatorConsole.h:265
unsigned int matlab
MATLAB lib has been initialized.
Definition: OperatorConsole.h:158

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::CloseLibs ( )
protected

Function that closes the Imatest library. Note that once closed, the library cannot be reinitialized.

bool COperatorConsoleApp::FileExists ( LPCTSTR  filePathName,
char *  errorMsg,
int  len 
)
static

Referenced by CheckFiles().

922 {
923  bool exists;
924  CFile file;
925  CFileException exception;
926 
927  //
928  // Try to open the file, and if successful, close it. If we could open it, then it exists
929  //
930  if (!file.Open(filePathName, CFile::modeRead | CFile::shareExclusive, NULL, &exception))
931  {
932  exception.GetErrorMessage(errorMsg, len);
933  exists = false;
934  }
935  else
936  {
937  file.Close();
938  exists = true;
939  }
940 
941  return exists;
942 }

Here is the caller graph for this function:

static bool COperatorConsoleApp::FileExists ( LPCTSTR  filePathName,
char *  errorMsg,
int  len 
)
static
int COperatorConsoleApp::GetImageHeight ( )
inline

References setup_settings::height, and m_setup.

186 {return m_setup.height;}
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int height
image height in pixels
Definition: setup_settings.h:30
int COperatorConsoleApp::GetImageHeight ( )
inline

References setup_settings::height, and m_setup.

199 {return m_setup.height;}
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int height
image height in pixels
Definition: setup_settings.h:30
int COperatorConsoleApp::GetImageWidth ( )
inline

References m_setup, and setup_settings::width.

185 {return m_setup.width;}
int width
image width in pixels
Definition: setup_settings.h:29
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int COperatorConsoleApp::GetImageWidth ( )
inline

References m_setup, and setup_settings::width.

198 {return m_setup.width;}
int width
image width in pixels
Definition: setup_settings.h:29
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
void COperatorConsoleApp::GetResults ( ImageTest test)
protected

References TestResults::failInfo, ImageTest::GetFailInfo(), ImageTest::GetJSON(), ImageTest::GetLog(), ImageTest::GetName(), ImageTest::GetSummary(), TestResults::json, TestResults::log, m_results, TestResults::name, and TestResults::summary.

Referenced by UpdateResults().

868 {
869  test->GetSummary(m_results.summary); // the summary results of the test (these get displayed in the dialog)
870  test->GetFailInfo(m_results.failInfo); // reasons that image failed the test
871  test->GetLog(m_results.log); // log message(s)
872  test->GetName(m_results.name); // the name of the test that was run
873  test->GetJSON(m_results.json);
874 }
void GetJSON(CString &dst)
Definition: ImageTest.h:98
TestResults m_results
Definition: OperatorConsole.h:260
void GetName(CString &name)
Definition: ImageTest.h:99
void GetLog(CString &dst)
Definition: ImageTest.h:96
CString summary
the summary results of the test
Definition: OperatorConsole.h:143
CString json
holds the JSON output of a test
Definition: OperatorConsole.h:144
CString failInfo
reasons that image failed the test
Definition: OperatorConsole.h:145
CString log
log message(s)
Definition: OperatorConsole.h:146
void GetSummary(CString &dst)
Definition: ImageTest.h:100
void GetFailInfo(CString &dst)
Definition: ImageTest.h:97
CString name
the name of the test that was run
Definition: OperatorConsole.h:142

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::GetResults ( ImageTest test)
protected
void COperatorConsoleApp::GetStdoutMsg ( StdoutThread data,
CString &  str 
)
protected

References StdoutThread::Get(), and COperatorConsoleDlg::LogMessage().

Referenced by OnUpdateStderr(), and OnUpdateStdout().

808 {
809  COperatorConsoleDlg *dlg = (COperatorConsoleDlg *)m_pMainWnd;
810 
811  data.Get(str, true); // get the message
812 
813  if (!str.IsEmpty())
814  {
815  str.Replace("\n", "\r\n"); // convert \n to \r\n
816  dlg->LogMessage(str, false); // copy the message to the log display in the dialog
817  }
818 }
void Get(CString &dst, bool clear)
Definition: StdoutThread.h:34
void LogMessage(LPCTSTR msg, bool timestamp=true)
Definition: OperatorConsoleDlg.cpp:416
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::GetStdoutMsg ( StdoutThread data,
CString &  str 
)
protected
const char* COperatorConsoleApp::GetTestName ( )
inlineprotected

References ThreadControl::m_data, and m_test.

Referenced by OnRunTest().

194 { return (m_test == NULL) ? "" : ((ImageTest *)m_test->m_data)->m_name;}
void * m_data
pointer to whatever is useful
Definition: ThreadControl.h:77
An abstract class that defines an image test to be performed.
Definition: ImageTest.h:86
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258

Here is the caller graph for this function:

const char* COperatorConsoleApp::GetTestName ( )
inlineprotected

References ThreadControl::m_data, and m_test.

212 { return (m_test == NULL) ? "" : ((ImageTest *)m_test->m_data)->m_name;}
void * m_data
pointer to whatever is useful
Definition: ThreadControl.h:77
An abstract class that defines an image test to be performed.
Definition: ImageTest.h:86
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258
bool COperatorConsoleApp::Init ( )
protected

Init perform application-specific initialization.

none

Returns
value true if successful, false otherwise

Description Init does the following things: It checks all of the hard coded filenames to be sure that the files exist It initializes the blemish and sfrplus file acquisition objects (loads the raw files into buffers) It initializes the camera object Allocates a buffer to hold a single image frame Creates and starts the blemish and sfrplus threads Creates and starts the modeless dialog thread Initializes the MATLAB and ImatestIT libraries Initializes the blemish and sfrplus modules

If any of the initialization steps fails, an appropriate message is displayed in an Alert Box.

References AllocateImageBuf(), CAMERA_HEIGHT, CAMERA_WIDTH, CheckFiles(), FILE_ROOT, ImageAcquisition::GetInfo(), idle, setup_settings::ini_file, INI_FILENAME, Config::Init(), InitBlemishAcq(), InitBlemishThread(), InitCamera(), InitCameraThread(), InitModelessThread(), InitSFRplusAcq(), InitSFRplusThread(), m_blemishAcq, m_camera, m_config, m_configRAW, m_configRGB, m_height, Config::m_iniFilePathName, Config::m_partNumber, Config::m_programPath, Config::m_serialNumber, m_setup, m_sfrPlusAcq, m_status, m_width, OnSetSFRplus(), setup_settings::part_number, PART_NUMBER, setup_settings::program_path, PROGRAMPATH, RAW_EXTENSION, RAW_HEIGHT_BLEMISH, RAW_WIDTH_BLEMISH, RGB_EXTENSION, setup_settings::serial_number, and SERIAL_NUMBER.

Referenced by InitInstance().

299 {
300  CString errMsg;
301  bool success = false;
302 
303 #ifdef IMATEST_CAMERA
304  //m_width = CAMERA_WIDTH;
305  //m_height = CAMERA_HEIGHT;
306 #elif !defined FAKE_CAMERA
309 #else
312 #endif
313 
314  //
315  // Initialize the Config object. These values are used in the calls to blemish_shell() and sfrplus_shell().
316  // Right now they're all hard coded (they're defined in OperatorConsole.h)
317  //
320 
321 
322 
323 #if defined USE_RGB_DATA
325 #else
327 #endif
332  if (!CheckFiles(errMsg)) // make sure that all of the hard coded files exist
333  {
334  success = false;
335  }
336  else if (!InitBlemishAcq()) // loads the raw blemish file into a buffer
337  {
338  errMsg = m_blemishAcq.GetInfo();
339  }
340  else if (!InitSFRplusAcq()) // loads the raw sfrplus file into a buffer
341  {
342  errMsg = m_sfrPlusAcq.GetInfo();
343  }
344  else if (!InitCamera())
345  {
346  errMsg = m_camera.GetInfo();
347  }
348  else if (!AllocateImageBuf()) // allocate a buffer large enough to hold an image [must be done after call to m_blemishAcq.Open()]
349  {
350  errMsg = "Unable to allocate image buffers.";
351  }
352  else if (!InitBlemishThread())
353  {
354  errMsg = "Unable to create Blemish thread.";
355  }
356  else if (!InitSFRplusThread())
357  {
358  errMsg = "Unable to create SFRplus thread.";
359  }
360  else if (!InitCameraThread())
361  {
362  errMsg = "Unable to create Capture thread.";
363  }
364  else if (!InitModelessThread())
365  {
366  errMsg = "Unable to create thread for modeless dialog.";
367  }
368  else
369  {
370  OnSetSFRplus(0, 0); // the default test is set to SFRplus
371  m_status = idle;
372 
373  success = true;
374  }
375 
376  if (!errMsg.IsEmpty())
377  {
378  AfxMessageBox(errMsg);
379  }
380 
381  return success;
382 }
#define FILE_ROOT
Definition: OperatorConsole.h:108
AppStatus m_status
Definition: OperatorConsole.h:234
bool AllocateImageBuf()
Definition: OperatorConsole.cpp:544
#define RGB_EXTENSION
Definition: OperatorConsole.h:107
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
CString part_number
[OPTIONAL INPUT] The user supplied camera part number to be used in the JSON output ...
Definition: setup_settings.h:38
#define CAMERA_HEIGHT
Definition: OperatorConsole.h:92
CString program_path
The Imatest IT program path.
Definition: setup_settings.h:41
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
void OnSetSFRplus(WPARAM wParam, LPARAM lParam)
Called after MSG_SET_SFRPLUS is received.
Definition: OperatorConsole.cpp:649
const char * m_iniFilePathName
Fully-qualified ini file name (including full path)
Definition: Config.h:38
#define PART_NUMBER
Definition: OperatorConsole.h:110
const char * m_programPath
Path to Imatest.
Definition: Config.h:37
#define RAW_WIDTH_BLEMISH
Definition: OperatorConsole.h:68
Definition: OperatorConsole.h:133
bool InitBlemishThread()
Definition: OperatorConsole.cpp:434
#define CAMERA_WIDTH
Definition: OperatorConsole.h:91
#define PROGRAMPATH
Definition: OperatorConsole.h:105
bool InitSFRplusThread()
Definition: OperatorConsole.cpp:451
CString serial_number
[OPTIONAL INPUT] The user supplied camera part serial to be used in the JSON output ...
Definition: setup_settings.h:39
CString ini_file
The fully-qualified file name (including full path) for the imatest.ini file.
Definition: setup_settings.h:40
CString & GetInfo()
Definition: ImageAcquisition.h:44
Config m_configRGB
for using rgb data: will eventually come from a dialog (uses hard coded values for now) ...
Definition: OperatorConsole.h:236
bool InitBlemishAcq()
Definition: OperatorConsole.cpp:385
bool InitModelessThread()
Definition: OperatorConsole.cpp:519
Config m_configRAW
for using raw files: will eventually come from a dialog (uses hard coded values for now) ...
Definition: OperatorConsole.h:235
FileAcquisition m_sfrPlusAcq
raw data for SFRplus tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:241
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
const char * m_partNumber
Camera part number.
Definition: Config.h:42
#define INI_FILENAME
Definition: OperatorConsole.h:104
bool InitCameraThread()
Definition: OperatorConsole.cpp:464
#define RAW_EXTENSION
Definition: OperatorConsole.h:106
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
#define RAW_HEIGHT_BLEMISH
Definition: OperatorConsole.h:69
void Init(LPCTSTR iniFileName, LPCTSTR programPath, LPCTSTR ext, LPCTSTR fileRoot, LPCTSTR serialNum, LPCTSTR partNum, int nColors)
Definition: Config.cpp:35
#define SERIAL_NUMBER
Definition: OperatorConsole.h:109
int m_height
Definition: OperatorConsole.h:251
bool InitCamera()
Definition: OperatorConsole.cpp:409
bool InitSFRplusAcq()
Definition: OperatorConsole.cpp:397
const char * m_serialNumber
Camera serial number.
Definition: Config.h:41
int m_width
Definition: OperatorConsole.h:250
bool CheckFiles(CString &msg)
Definition: OperatorConsole.cpp:895

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::Init ( )
protected
bool COperatorConsoleApp::InitBlemishAcq ( )
protected

References FileAcquisition::Init(), m_blemishAcq, FileAcquisition::Open(), RAW_BLEMISH_IMAGE, RAW_HEIGHT_BLEMISH, and RAW_WIDTH_BLEMISH.

Referenced by Init(), and ReInit().

386 {
387  bool success = false;
388 
390  {
391  success = m_blemishAcq.Open();
392  }
393 
394  return success;
395 }
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
#define RAW_WIDTH_BLEMISH
Definition: OperatorConsole.h:68
bool Init(int width, int height, const char *filename)
Initializes the buffers inherited from class ImageAcquisition with 2 bytes per pixel.
Definition: FileAcquisition.cpp:44
bool Open()
Definition: FileAcquisition.cpp:54
#define RAW_BLEMISH_IMAGE
Definition: OperatorConsole.h:66
#define RAW_HEIGHT_BLEMISH
Definition: OperatorConsole.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitBlemishAcq ( )
protected
bool COperatorConsoleApp::InitBlemishThread ( )
protected

References AppFlags::blemishThread, ImageAcquisition::GetHeight(), ImageAcquisition::GetWidth(), setup_settings::height, ThreadControl::Init(), ImageTest::Init(), m_blemish, m_blemishAcq, m_blemishControl, m_cameraImage, m_config, m_fileImage, m_flags, m_setup, MSG_BLEMISH_DONE, ImageTest::ThreadProc(), and setup_settings::width.

Referenced by Init(), and ReInit().

435 {
436 #if defined USE_RGB_DATA
437 
439 
440 #else
442 #endif
443 
445 
446 
447  return m_flags.blemishThread;
448 }
BlemishTest m_blemish
this will run the blemish tests
Definition: OperatorConsole.h:253
ThreadControl m_blemishControl
this is the thread control for running Blemish tests
Definition: OperatorConsole.h:255
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
unsigned int blemishThread
Definition: OperatorConsole.h:154
AppFlags m_flags
Definition: OperatorConsole.h:265
int GetWidth()
Definition: ImageAcquisition.h:45
int width
image width in pixels
Definition: setup_settings.h:29
void Init(void *raw_pixels, int width, int height, const Config *config)
Definition: ImageTest.cpp:53
bool Init(UINT threadMsg, DWORD parentID, AFX_THREADPROC threadProc, void *data)
Definition: ThreadControl.cpp:52
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int GetHeight()
Definition: ImageAcquisition.h:43
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
#define MSG_BLEMISH_DONE
Definition: OperatorConsole.h:119
int height
image height in pixels
Definition: setup_settings.h:30
static UINT __cdecl ThreadProc(void *param)
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object ...
Definition: ImageTest.cpp:380

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitBlemishThread ( )
protected
bool COperatorConsoleApp::InitCamera ( )
protected

References CAMERA_HEIGHT, CAMERA_WIDTH, setup_settings::epiphan_deviceID, setup_settings::height, IMAGE_NAME, setup_settings::ini_file, ImageAcquisition::Init(), m_camera, ImatestLibAcq::m_device_ID, ImatestLibAcq::m_ini_file, m_setup, ImatestLibAcq::m_source_ID, ImatestLibAcq::Open(), setup_settings::sourceID, and setup_settings::width.

Referenced by Init(), and ReInit().

410 {
411  bool success = false;
412 
413 #ifdef IMATEST_CAMERA
415  {
416  success = m_camera.Open();
420  }
421 #elif !defined FAKE_CAMERA
423  {
424  success = m_camera.Open();
425  }
426 #else
428  success = m_camera.Open();
429 #endif
430 
431  return success;
432 }
int sourceID
sourceID for acquire_image()
Definition: setup_settings.h:33
int m_source_ID
The source ID for acquire_image() that indicates what type of device is in use.
Definition: ImatestLibAcq.h:42
#define CAMERA_HEIGHT
Definition: OperatorConsole.h:92
int epiphan_deviceID
Used for Epiphan only: the device ID (0 or 1 only)
Definition: setup_settings.h:32
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
#define IMAGE_NAME
Definition: OperatorConsole.h:65
#define CAMERA_WIDTH
Definition: OperatorConsole.h:91
CString ini_file
The fully-qualified file name (including full path) for the imatest.ini file.
Definition: setup_settings.h:40
int m_device_ID
[Used Epiphan only]: indicates from which of the two sources to capture
Definition: ImatestLibAcq.h:43
int width
image width in pixels
Definition: setup_settings.h:29
virtual bool Init(int width, int height, int bytesPerPixel=4)
may be overridden, but be sure to call parent function also
Definition: ImageAcquisition.cpp:43
std::string m_ini_file
The fully-qualified name (including full path) of an Imatest INI file.
Definition: ImatestLibAcq.h:44
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int height
image height in pixels
Definition: setup_settings.h:30
bool Open()
Definition: ImatestLibAcq.cpp:53

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitCamera ( )
protected
bool COperatorConsoleApp::InitCameraThread ( )
protected

References AppFlags::cameraThread, ThreadControl::Init(), m_camera, m_cameraControl, m_flags, MSG_FRAME_READY, and ImageAcquisition::ThreadProc().

Referenced by Init().

465 {
467 
468  return m_flags.cameraThread;
469 }
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
AppFlags m_flags
Definition: OperatorConsole.h:265
unsigned int cameraThread
Definition: OperatorConsole.h:156
#define MSG_FRAME_READY
Definition: OperatorConsole.h:126
static UINT __cdecl ThreadProc(LPVOID param)
Definition: ImageAcquisition.cpp:72
bool Init(UINT threadMsg, DWORD parentID, AFX_THREADPROC threadProc, void *data)
Definition: ThreadControl.cpp:52
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitCameraThread ( )
protected
BOOL COperatorConsoleApp::InitInstance ( )

COperatorConsoleApp initialization.

References CloseLibs(), Init(), InitLibs(), InitOutput(), m_setup, CSetup::m_setup_settings, Quit(), ReadINISettings(), and ReadPassFail().

171 {
172 #if defined(STDIO_DEBUG)
173  printf("Hello from %s [stdout]\n", __FUNCTION__);
174  cout << "Hello from" << __FUNCTION__ << "[cout]" << endl;
175 #endif
176 
177  //TODO: call AfxInitRichEdit2() to initialize richedit2 library.
178  // InitCommonControlsEx() is required on Windows XP if an application
179  // manifest specifies use of ComCtl32.dll version 6 or later to enable
180  // visual styles. Otherwise, any window creation will fail.
181  INITCOMMONCONTROLSEX InitCtrls;
182  InitCtrls.dwSize = sizeof(InitCtrls);
183  // Set this to include all the common control classes you want to use
184  // in your application.
185  InitCtrls.dwICC = ICC_WIN95_CLASSES;
186  InitCommonControlsEx(&InitCtrls);
187 
188  CWinApp::InitInstance();
189 
190 
191  AfxEnableControlContainer();
192  AfxInitRichEdit(); // this must be called once before displaying a dialog that uses RichEdit control
193 
194  // Create the shell manager, in case the dialog contains
195  // any shell tree view or shell list view controls.
196  CShellManager *pShellManager = new CShellManager;
197 
198  // Activate "Windows Native" visual manager for enabling themes in MFC controls
199  CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
200 
201  m_pMainWnd = NULL;
202 
203  InitOutput(); // this sets up a pipe for handling stdout results from the DLLs
204 
205 
206 #if defined(STDIO_DEBUG)
207  fprintf(stdout, "Hello from stdout.\n"); // for debugging
208  fprintf(stderr, "Hello from stderr.\n"); // for debugging
209  cout << "Hello from cout." << endl; // for debugging
210 #endif
211  if (!InitLibs()) // InitLibs must be called before any calls to Imatest library functions
212  {
213  cerr << "Unable to initialize the Imatest library." << endl;
214  }
215 
216 
217  if (!ReadINISettings()) // if we're unable to read the ini file, we must generate image dimensions from user input before continuing
218  {
219  CSetup setup(NULL, m_setup);
220  setup.DoModal();
221  INT_PTR nRet = setup.DoModal();
222  if (nRet == IDOK)
223  {
224  m_setup = setup.m_setup_settings;
225  }
226 
227  }
228  if (!ReadPassFail())
229  {
230 
231  }
232  if (!Init()) // do our application-specific initialization
233  {
234  cout << "Application Initialization Failed" << endl;
235  Quit(); // if init failed, clean up anything that was done in Init()
236  }
237  else
238  {
240  m_pMainWnd = &dlg;
241 
242  INT_PTR nResponse = dlg.DoModal();
243  if (nResponse == IDOK)
244  {
245  // TODO: Place code here to handle when the dialog is
246  // dismissed with OK
247  }
248  else if (nResponse == IDCANCEL)
249  {
250  // TODO: Place code here to handle when the dialog is
251  // dismissed with Cancel
252  }
253  else if (nResponse == -1)
254  {
255  TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
256  TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
257  }
258 
259  }
260 
261  Quit(); // This was originally missing, but I think it should be here TDC
262  CloseLibs();
263 
264 
265  // Delete the shell manager created above.
266  if (pShellManager != NULL)
267  {
268  delete pShellManager;
269  }
270 
271  // Since the dialog has been closed, return FALSE so that we exit the
272  // application, rather than start the application's message pump.
273  return FALSE;
274 }
void Quit()
Definition: OperatorConsole.cpp:680
void CloseLibs()
Function that closes the Imatest library. Note that once closed, the library cannot be reinitialized...
Definition: OperatorConsole.cpp:504
The class underlying the setup dialog.
Definition: Setup.h:34
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
bool ReadPassFail(void)
This function reads in the pass/fail variable values as in the pass/fail file listed in the imatest I...
Definition: OperatorConsole.cpp:1363
bool Init()
Init perform application-specific initialization.
Definition: OperatorConsole.cpp:298
bool InitOutput()
Definition: OperatorConsole.cpp:528
bool InitLibs()
Function that initializes the Imatest library. Must be called before any Imatest library functions ar...
Definition: OperatorConsole.cpp:473
bool ReadINISettings(void)
This function reads in items for the setup dialog from imatest.ini.
Definition: OperatorConsole.cpp:1032

Here is the call graph for this function:

BOOL COperatorConsoleApp::InitInstance ( )
bool COperatorConsoleApp::InitLibs ( )
protected

Function that initializes the Imatest library. Must be called before any Imatest library functions are used.

References imatest_libraryInitialize(), AppFlags::imatestIT, m_flags, and AppFlags::matlab.

Referenced by InitInstance().

474 {
475  CString str;
476 
477  m_flags.matlab = mclInitializeApplication(NULL, 0); // try to initialize the MATLAB library
478 
479  if (!m_flags.matlab)
480  {
481  str = "Unable to initialize MATLAB library";
482  }
483  else
484  {
485  //
486  // Try to initialize Blemish and SFRplus libraries
487  //
489 
490  if (!m_flags.imatestIT)
491  {
492  str = "Unable to initialize imatest library.";
493  }
494  }
495 
496  if (!str.IsEmpty())
497  {
498  AfxMessageBox(str);
499  }
500 
501  return m_flags.matlab && m_flags.imatestIT;
502 }
unsigned int imatestIT
imatestIT lib has been initialized
Definition: OperatorConsole.h:159
AppFlags m_flags
Definition: OperatorConsole.h:265
LIB_imatest_library_C_API bool MW_CALL_CONV imatest_libraryInitialize(void)
unsigned int matlab
MATLAB lib has been initialized.
Definition: OperatorConsole.h:158

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitLibs ( )
protected

Function that initializes the Imatest library. Must be called before any Imatest library functions are used.

bool COperatorConsoleApp::InitModelessThread ( )
protected

References m_flags, m_jsonDlgThread, and AppFlags::modelessThread.

Referenced by Init().

520 {
521  m_jsonDlgThread = (ModelessDialogThread *)AfxBeginThread(RUNTIME_CLASS(ModelessDialogThread));
522 
524 
525  return m_flags.modelessThread;
526 }
unsigned int modelessThread
Definition: OperatorConsole.h:157
AppFlags m_flags
Definition: OperatorConsole.h:265
ModelessDialogThread * m_jsonDlgThread
Definition: OperatorConsole.h:259
a thread class for creating modeless dialogs which can operate without halting the main dialog ...
Definition: ModelessDialogThread.h:35

Here is the caller graph for this function:

bool COperatorConsoleApp::InitModelessThread ( )
protected
bool COperatorConsoleApp::InitOutput ( )
protected

References StdoutThread::InitThread(), m_flags, m_stderrThread, m_stdoutThread, MSG_STDERR, MSG_STDOUT, AppFlags::stdErr, AppFlags::stdOut, and STDOUT_BUFSIZE.

Referenced by InitInstance().

529 {
530  m_flags.stdOut = false;
531  m_flags.stdErr = false;
532 
533 #if defined REDIRECT_STDIO
536  m_flags.stdOut = true;
537  m_flags.stdErr = true;
538 #endif
539 
540  return m_flags.stdOut && m_flags.stdErr;
541 }
#define MSG_STDOUT
Definition: OperatorConsole.h:124
StdoutThread m_stdoutThread
Definition: OperatorConsole.h:261
unsigned int stdOut
stdout pipe is open
Definition: OperatorConsole.h:160
StderrThread m_stderrThread
Definition: OperatorConsole.h:262
bool InitThread(int bufLen, UINT threadMsg, DWORD parentID)
Definition: StdoutThread.cpp:48
AppFlags m_flags
Definition: OperatorConsole.h:265
unsigned int stdErr
stderr pipe is open
Definition: OperatorConsole.h:161
#define MSG_STDERR
Definition: OperatorConsole.h:125
#define STDOUT_BUFSIZE
Definition: OperatorConsole.cpp:39

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitOutput ( )
protected
bool COperatorConsoleApp::InitSFRplusAcq ( )
protected

References FileAcquisition::Init(), m_sfrPlusAcq, FileAcquisition::Open(), RAW_HEIGHT_SFRPLUS, RAW_SFRPLUS_IMAGE, and RAW_WIDTH_SFRPLUS.

Referenced by Init(), and ReInit().

398 {
399  bool success = false;
400 
402  {
403  success = m_sfrPlusAcq.Open();
404  }
405 
406  return success;
407 }
bool Init(int width, int height, const char *filename)
Initializes the buffers inherited from class ImageAcquisition with 2 bytes per pixel.
Definition: FileAcquisition.cpp:44
#define RAW_WIDTH_SFRPLUS
Definition: OperatorConsole.h:70
FileAcquisition m_sfrPlusAcq
raw data for SFRplus tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:241
bool Open()
Definition: FileAcquisition.cpp:54
#define RAW_SFRPLUS_IMAGE
Definition: OperatorConsole.h:67
#define RAW_HEIGHT_SFRPLUS
Definition: OperatorConsole.h:71

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitSFRplusAcq ( )
protected
bool COperatorConsoleApp::InitSFRplusThread ( )
protected

References ImageAcquisition::GetHeight(), ImageAcquisition::GetWidth(), setup_settings::height, ThreadControl::Init(), ImageTest::Init(), m_cameraImage, m_config, m_fileImage, m_flags, m_setup, m_sfrPlus, m_sfrPlusAcq, m_sfrPlusControl, MSG_SFRPLUS_DONE, AppFlags::sfrplusThread, ImageTest::ThreadProc(), and setup_settings::width.

Referenced by Init(), and ReInit().

452 {
453 #if defined USE_RGB_DATA
455 #else
457 #endif
459 
460  return m_flags.sfrplusThread;
461 }
SFRplusTest m_sfrPlus
this will run the SFRplus tests
Definition: OperatorConsole.h:254
ThreadControl m_sfrPlusControl
this is the thread control for running SFRplus tests
Definition: OperatorConsole.h:256
AppFlags m_flags
Definition: OperatorConsole.h:265
int GetWidth()
Definition: ImageAcquisition.h:45
#define MSG_SFRPLUS_DONE
Definition: OperatorConsole.h:120
int width
image width in pixels
Definition: setup_settings.h:29
unsigned int sfrplusThread
Definition: OperatorConsole.h:155
void Init(void *raw_pixels, int width, int height, const Config *config)
Definition: ImageTest.cpp:53
bool Init(UINT threadMsg, DWORD parentID, AFX_THREADPROC threadProc, void *data)
Definition: ThreadControl.cpp:52
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
FileAcquisition m_sfrPlusAcq
raw data for SFRplus tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:241
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int GetHeight()
Definition: ImageAcquisition.h:43
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
int height
image height in pixels
Definition: setup_settings.h:30
static UINT __cdecl ThreadProc(void *param)
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object ...
Definition: ImageTest.cpp:380

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::InitSFRplusThread ( )
protected
bool COperatorConsoleApp::LoadConfig ( )
protected
bool COperatorConsoleApp::LoadConfig ( )
protected
void COperatorConsoleApp::LogTime ( )
protected
877 {
878  CTime t = CTime::GetCurrentTime();
879  CString str = t.Format("%c ");
880 
881  ((COperatorConsoleDlg *)m_pMainWnd)->LogMessage(str);
882 
883 }
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
void COperatorConsoleApp::LogTime ( )
protected
void COperatorConsoleApp::MakeHandles ( )
protected
void COperatorConsoleApp::MakeHandles ( )
protected
void COperatorConsoleApp::OnBlemishDone ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_BLEMISH_DONE is received.

References m_blemish, m_status, MSG_RUN_TEST, quitting, runningTest, SendAppMessage(), and UpdateResults().

Referenced by PreTranslateMessage().

772 {
773  if (m_status != quitting)
774  {
775  UpdateResults(&m_blemish); // right now blemish doesn't have any special results, so we can just call UpdateResults() directly
776 
777  if (m_status == runningTest)
778  {
779  SendAppMessage(MSG_RUN_TEST); // send message to app to run again
780  }
781  }
782 }
AppStatus m_status
Definition: OperatorConsole.h:234
BlemishTest m_blemish
this will run the blemish tests
Definition: OperatorConsole.h:253
Definition: OperatorConsole.h:132
void UpdateResults(ImageTest *test)
Definition: OperatorConsole.cpp:830
#define MSG_RUN_TEST
Definition: OperatorConsole.h:118
Definition: OperatorConsole.h:134
BOOL SendAppMessage(int msg)
Definition: OperatorConsole.cpp:885

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnBlemishDone ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_BLEMISH_DONE is received.

void COperatorConsoleApp::OnFrameReady ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_FRAME_READY is received.

References ImageAcquisition::GetFrame(), m_camera, m_cameraControl, m_cameraImage, m_test, and ThreadControl::Run().

Referenced by PreTranslateMessage().

761 {
762 #if defined START_TEST_FROM_FRAME_READY
764  m_test->Run(); // tell the thread to run 1 test (it will send our thread a message when it's done)
765 #else
766  ((COperatorConsoleDlg *)m_pMainWnd)->UpdateImage(m_cameraImage); // display it in the dialog
767  m_cameraControl.Run(); // get another frame
768 #endif
769 }
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
void GetFrame(void *buf)
Definition: ImageAcquisition.h:38
void Run()
Definition: ThreadControl.cpp:103
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnFrameReady ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_FRAME_READY is received.

void COperatorConsoleApp::OnPassFail ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_PASS_FAIL is received.

References CPassFailSettings::b_isReadOnly, CPasswordDialog::getResponse(), CPasswordDialog::getUnlockStatus(), m_passFailIsUnlocked, m_password, m_PFSettings, CPassFail::PFSettings, and WritePassFail().

Referenced by PreTranslateMessage().

1315 {
1316 
1317  if (!m_passFailIsUnlocked)
1318  {
1319  CPasswordDialog pwdDialog;
1320  INT_PTR nRetPwd = pwdDialog.DoModal();
1321  if (nRetPwd==IDOK && m_password.Compare(pwdDialog.getResponse())==0 ) // if the user enters the correct password and clicks 'OK'
1322  {
1323  m_passFailIsUnlocked = pwdDialog.getUnlockStatus();
1324  CPassFail passfail(m_PFSettings, NULL);
1325  INT_PTR nRet = passfail.DoModal();
1326  if (nRet==IDOK)
1327  {
1329  {
1330  m_PFSettings = passfail.PFSettings;
1331  WritePassFail();
1332  }
1333  else
1334  {
1335  cout << "Pass/Fail file is read-only. No changes were saved." << endl;
1336  }
1337  }
1338  }
1339  else if (nRetPwd==IDOK && m_password.Compare(pwdDialog.getResponse())!=0 )
1340  {
1341  cout << "Incorrect password." << endl;
1342  }
1343  }
1344  else
1345  {
1346  CPassFail passfail(m_PFSettings, NULL);
1347  INT_PTR nRet = passfail.DoModal();
1348  if (nRet==IDOK)
1349  {
1351  {
1352  m_PFSettings = passfail.PFSettings;
1353  WritePassFail();
1354  }
1355  else
1356  {
1357  cout << "Pass/Fail file is read-only. No changes were saved." << endl;
1358  }
1359  }
1360  }
1361 }
CPassFailSettings m_PFSettings
Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini.
Definition: OperatorConsole.h:278
a class for a simple password query dialog
Definition: PasswordDialog.h:29
bool b_isReadOnly
for checking if the Pass/Fail file is read-only
Definition: PassFailSettings.h:214
bool m_passFailIsUnlocked
Indicates whether the administrator has chosen to unlock access to pass/fail settings for the duratio...
Definition: OperatorConsole.h:281
const CString getResponse(void)
returns what the user entered as the password
Definition: PasswordDialog.cpp:62
CString m_password
This contains the administrator password.
Definition: OperatorConsole.h:280
The class underlying the PassFail dialog.
Definition: PassFail.h:27
const bool getUnlockStatus(void)
returns whether the user decided to unlock access to pass/fail settings until the program closes ...
Definition: PasswordDialog.cpp:82
bool WritePassFail(void)
This function writes the pass/fail variables to the pass/fail file listed in the imatest INI file...
Definition: OperatorConsole.cpp:1909

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnPassFail ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_PASS_FAIL is received.

void COperatorConsoleApp::OnRunTest ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_RUN_TEST is received.

References ImageAcquisition::GetFrame(), GetTestName(), m_acq, m_camera, m_cameraControl, m_cameraImage, m_fileImage, m_test, and ThreadControl::Run().

Referenced by PreTranslateMessage().

738 {
739  CString str;
740 
741 #if !defined NO_LOG
742  str.Format("%s started\n", GetTestName());
743  ((COperatorConsoleDlg *)m_pMainWnd)->LogMessage(str);
744 #endif
745 
746 #if !defined USE_RGB_DATA
747  m_acq->GetFrame((void *)m_fileImage); // get the latest image from the Acquisition object (will eventually come from camera
748 #endif
749 
750 #ifdef IMATEST_CAMERA
752  m_cameraControl.Run(); // capture 1 frame from the camera (we'll run the test after the frame is captured)
753 #elif !defined START_TEST_FROM_FRAME_READY
754  m_test->Run(); // tell the thread to run 1 test (it will send our thread a message when it's done)
755 #else
756  m_cameraControl.Run(); // capture 1 frame from the camera (we'll run the test after the frame is captured)
757 #endif
758 }
const char * GetTestName()
Definition: OperatorConsole.h:194
ImageAcquisition * m_acq
pointer to current acquisition object being used
Definition: OperatorConsole.h:242
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
char * m_fileImage
buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage) ...
Definition: OperatorConsole.h:238
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
void GetFrame(void *buf)
Definition: ImageAcquisition.h:38
void Run()
Definition: ThreadControl.cpp:103
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnRunTest ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_RUN_TEST is received.

void COperatorConsoleApp::OnSetBlemish ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SET_BLEMISH is received.

References m_acq, m_blemishAcq, m_blemishControl, and m_test.

Referenced by PreTranslateMessage().

644 {
646  m_acq = &m_blemishAcq;
647 }
ThreadControl m_blemishControl
this is the thread control for running Blemish tests
Definition: OperatorConsole.h:255
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
ImageAcquisition * m_acq
pointer to current acquisition object being used
Definition: OperatorConsole.h:242
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258

Here is the caller graph for this function:

void COperatorConsoleApp::OnSetBlemish ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SET_BLEMISH is received.

void COperatorConsoleApp::OnSetDirectshowCamera ( WPARAM  wParam,
LPARAM  lParam 
)
protected

References m_camera, m_cameraControl, m_directshow_cam, and m_DirectShowCameraControl.

2266 {
2269 
2270 }
SimpleDirectShowAcq m_directshow_cam
live acquisition using a camera
Definition: OperatorConsole.h:273
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
ThreadControl m_DirectShowCameraControl
Definition: OperatorConsole.h:285
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257
void COperatorConsoleApp::OnSetImatestCamera ( WPARAM  wParam,
LPARAM  lParam 
)
protected

References m_camera, m_cameraControl, m_imatest_cam, and m_ImatestCameraControl.

2258 {
2261 
2262 }
ThreadControl m_ImatestCameraControl
Definition: OperatorConsole.h:284
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257
ImatestLibAcq m_imatest_cam
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:272
void COperatorConsoleApp::OnSetSFRplus ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SET_SFRPLUS is received.

References m_acq, m_sfrPlusAcq, m_sfrPlusControl, and m_test.

Referenced by Init(), PreTranslateMessage(), and ReInit().

650 {
652  m_acq = &m_sfrPlusAcq;
653 }
ImageAcquisition * m_acq
pointer to current acquisition object being used
Definition: OperatorConsole.h:242
ThreadControl m_sfrPlusControl
this is the thread control for running SFRplus tests
Definition: OperatorConsole.h:256
ThreadControl * m_test
the current test being run (either &m_blemishControl or &sfrPlusControl)
Definition: OperatorConsole.h:258
FileAcquisition m_sfrPlusAcq
raw data for SFRplus tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:241

Here is the caller graph for this function:

void COperatorConsoleApp::OnSetSFRplus ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SET_SFRPLUS is received.

void COperatorConsoleApp::OnSetup ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SETUP is received.

References setup_settings::epiphan_deviceID, setup_settings::height, setup_settings::ini_file, m_blemish, m_camera, m_config, ImatestLibAcq::m_device_ID, ImatestLibAcq::m_ini_file, Config::m_iniFilePathName, ImageTest::m_iniFilePathName, Config::m_partNumber, ImageTest::m_partNumber, Config::m_programPath, ImageTest::m_programPath, Config::m_serialNumber, ImageTest::m_serialNumber, m_setup, CSetup::m_setup_settings, m_sfrPlus, ImatestLibAcq::m_source_ID, setup_settings::part_number, setup_settings::program_path, ReInit(), setup_settings::serial_number, setup_settings::sourceID, setup_settings::width, and WriteINISettings().

Referenced by PreTranslateMessage().

978 {
979  int oldWidth = m_setup.width;
980  int oldHeight = m_setup.height;
981 
982  CSetup setup(NULL, m_setup);
983  INT_PTR nRet = setup.DoModal();
984  if (nRet==IDOK)
985  {
986  m_setup = setup.m_setup_settings;
987  m_camera.m_device_ID = m_setup.epiphan_deviceID; // update the device_ID used by acquire_image
988  m_camera.m_source_ID = m_setup.sourceID; // update the source_ID used by acquire_image
989  m_camera.m_ini_file.assign(m_setup.ini_file); //TDC
990 
991 
992  // transfer the configuration details to the other classes
997 
1002 
1007 
1008  WriteINISettings(); // store new settings
1009  if ( oldWidth != m_setup.width || oldHeight != m_setup.height)
1010  {
1011  // image dimensions have changed, so we must reallocate
1012  try
1013  {
1014  if (!ReInit())
1015  {
1016  cout << "Unable to reinitialize." << endl;
1017  }
1018  }
1019  catch (std::exception & ex)
1020  {
1021  cout << "Error occurred during reinitialization." << endl;
1022  cerr << ex.what() << endl;
1023  }
1024  }
1025  }
1026 }
BlemishTest m_blemish
this will run the blemish tests
Definition: OperatorConsole.h:253
SFRplusTest m_sfrPlus
this will run the SFRplus tests
Definition: OperatorConsole.h:254
bool ReInit(void)
This function allows for reallocation of the various image buffers when we change the image size...
Definition: OperatorConsole.cpp:1258
int sourceID
sourceID for acquire_image()
Definition: setup_settings.h:33
int m_source_ID
The source ID for acquire_image() that indicates what type of device is in use.
Definition: ImatestLibAcq.h:42
const char * m_partNumber
Definition: ImageTest.h:133
CString part_number
[OPTIONAL INPUT] The user supplied camera part number to be used in the JSON output ...
Definition: setup_settings.h:38
int epiphan_deviceID
Used for Epiphan only: the device ID (0 or 1 only)
Definition: setup_settings.h:32
CString program_path
The Imatest IT program path.
Definition: setup_settings.h:41
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
const char * m_iniFilePathName
Fully-qualified ini file name (including full path)
Definition: Config.h:38
const char * m_programPath
Path to Imatest.
Definition: Config.h:37
The class underlying the setup dialog.
Definition: Setup.h:34
const char * m_serialNumber
Definition: ImageTest.h:132
CString serial_number
[OPTIONAL INPUT] The user supplied camera part serial to be used in the JSON output ...
Definition: setup_settings.h:39
CString ini_file
The fully-qualified file name (including full path) for the imatest.ini file.
Definition: setup_settings.h:40
int m_device_ID
[Used Epiphan only]: indicates from which of the two sources to capture
Definition: ImatestLibAcq.h:43
int width
image width in pixels
Definition: setup_settings.h:29
void WriteINISettings(void)
This function writes items for the setup dialog to imatest.ini.
Definition: OperatorConsole.cpp:1168
std::string m_ini_file
The fully-qualified name (including full path) of an Imatest INI file.
Definition: ImatestLibAcq.h:44
const char * m_programPath
Definition: ImageTest.h:135
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
const char * m_partNumber
Camera part number.
Definition: Config.h:42
const char * m_iniFilePathName
Definition: ImageTest.h:134
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
int height
image height in pixels
Definition: setup_settings.h:30
const char * m_serialNumber
Camera serial number.
Definition: Config.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnSetup ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SETUP is received.

void COperatorConsoleApp::OnSFRplusDone ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SFRPLUS_DONE is received.

References m_sfrPlus, m_status, MSG_RUN_TEST, quitting, runningTest, SendAppMessage(), and UpdateResultsSFRplus().

Referenced by PreTranslateMessage().

785 {
786  if (m_status != quitting)
787  {
789 
790  if (m_status == runningTest)
791  {
792  SendAppMessage(MSG_RUN_TEST); // send message to app to run again
793  }
794  }
795 }
AppStatus m_status
Definition: OperatorConsole.h:234
SFRplusTest m_sfrPlus
this will run the SFRplus tests
Definition: OperatorConsole.h:254
Definition: OperatorConsole.h:132
void UpdateResultsSFRplus(ImageTest *test)
Definition: OperatorConsole.cpp:820
#define MSG_RUN_TEST
Definition: OperatorConsole.h:118
Definition: OperatorConsole.h:134
BOOL SendAppMessage(int msg)
Definition: OperatorConsole.cpp:885

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnSFRplusDone ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_SFRPLUS_DONE is received.

void COperatorConsoleApp::OnShowJSON ( UINT  wParam,
LONG  lParam 
)
protected

Called after MSG_JSON is received.

References TestResults::json, m_jsonDlgThread, m_results, TestResults::name, ModelessDialogThread::SetText(), ModelessDialogThread::SetTitle(), and ModelessDialogThread::Show().

Referenced by PreTranslateMessage().

671 {
672  if (m_jsonDlgThread != NULL)
673  {
676  m_jsonDlgThread->Show(true);
677  }
678 }
void Show(bool show)
Definition: ModelessDialogThread.cpp:75
TestResults m_results
Definition: OperatorConsole.h:260
CString json
holds the JSON output of a test
Definition: OperatorConsole.h:144
void SetTitle(LPCTSTR title)
Definition: ModelessDialogThread.cpp:83
ModelessDialogThread * m_jsonDlgThread
Definition: OperatorConsole.h:259
CString name
the name of the test that was run
Definition: OperatorConsole.h:142
void SetText(LPCTSTR text)
Definition: ModelessDialogThread.cpp:91

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnShowJSON ( UINT  wParam,
LONG  lParam 
)
protected

Called after MSG_JSON is received.

void COperatorConsoleApp::OnStart ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_START is received.

Referenced by PreTranslateMessage().

Here is the caller graph for this function:

void COperatorConsoleApp::OnStart ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_START is received.

void COperatorConsoleApp::OnStop ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_STOP is received.

Referenced by PreTranslateMessage().

Here is the caller graph for this function:

void COperatorConsoleApp::OnStop ( WPARAM  wParam,
LPARAM  lParam 
)
protected

Called after MSG_STOP is received.

void COperatorConsoleApp::OnUpdateStderr ( )
protected

Called after MSG_STDERR is received.

References GetStdoutMsg(), m_stderrStr, and m_stderrThread.

Referenced by PreTranslateMessage().

803 {
805 }
StderrThread m_stderrThread
Definition: OperatorConsole.h:262
CString m_stderrStr
our copy of the contents of m_stderr
Definition: OperatorConsole.h:264
void GetStdoutMsg(StdoutThread &data, CString &str)
Definition: OperatorConsole.cpp:807

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnUpdateStderr ( )
protected

Called after MSG_STDERR is received.

void COperatorConsoleApp::OnUpdateStdout ( )
protected

Called after MSG_STDOUT is received.

References GetStdoutMsg(), m_stdoutStr, and m_stdoutThread.

Referenced by PreTranslateMessage().

798 {
800 }
StdoutThread m_stdoutThread
Definition: OperatorConsole.h:261
void GetStdoutMsg(StdoutThread &data, CString &str)
Definition: OperatorConsole.cpp:807
CString m_stdoutStr
our copy of the contents of m_stdout
Definition: OperatorConsole.h:263

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::OnUpdateStdout ( )
protected

Called after MSG_STDOUT is received.

BOOL COperatorConsoleApp::PreTranslateMessage ( MSG *  pMsg)
protected

Intercepts messages of interest before Windows or MFC.

The threads and dialog communicate with the application object by sending messages.

This function pulls out the messages of interest to us before they get intercepted by Windows or MFC.

Returns
value of TRUE means that we've processed the message
values of FALSE means that Windows/MFC needs to deal with the message

References MSG_BLEMISH_DONE, MSG_FRAME_READY, MSG_JSON, MSG_PASS_FAIL, MSG_RUN_TEST, MSG_SET_BLEMISH, MSG_SET_SFRPLUS, MSG_SETUP, MSG_SFRPLUS_DONE, MSG_START, MSG_STDERR, MSG_STDOUT, MSG_STOP, OnBlemishDone(), OnFrameReady(), OnPassFail(), OnRunTest(), OnSetBlemish(), OnSetSFRplus(), OnSetup(), OnSFRplusDone(), OnShowJSON(), OnStart(), OnStop(), OnUpdateStderr(), and OnUpdateStdout().

573 {
574  BOOL handled = FALSE;
575 
576  switch (pMsg->message)
577  {
578  case MSG_START:
579  OnStart((WPARAM)0, (LPARAM)0);
580  handled = TRUE;
581  break;
582 
583  case MSG_STOP:
584  OnStop((WPARAM)0, (LPARAM)0);
585  handled = TRUE;
586  break;
587 
588  case MSG_FRAME_READY:
589  OnFrameReady(pMsg->wParam, pMsg->lParam);
590  break;
591 
592  case MSG_RUN_TEST:
593  OnRunTest((WPARAM)0, (LPARAM)0);
594  handled = TRUE;
595  break;
596 
597  case MSG_BLEMISH_DONE:
598  OnBlemishDone(pMsg->wParam, pMsg->lParam);
599  handled = TRUE;
600  break;
601 
602  case MSG_SFRPLUS_DONE:
603  OnSFRplusDone(pMsg->wParam, pMsg->lParam);
604  handled = TRUE;
605  break;
606 
607  case MSG_SET_BLEMISH:
608  OnSetBlemish(pMsg->wParam, pMsg->lParam);
609  handled = TRUE;
610  break;
611 
612  case MSG_SET_SFRPLUS:
613  OnSetSFRplus(pMsg->wParam, pMsg->lParam);
614  handled = TRUE;
615  break;
616 
617  case MSG_JSON:
618  OnShowJSON(pMsg->wParam, pMsg->lParam);
619  handled = TRUE;
620  break;
621 
622  case MSG_STDOUT:
623  OnUpdateStdout();
624  break;
625 
626  case MSG_STDERR:
627  OnUpdateStderr();
628  break;
629 
630  case MSG_SETUP:
631  OnSetup(pMsg->wParam, pMsg->lParam);
632  handled = TRUE;
633  break;
634  case MSG_PASS_FAIL:
635  OnPassFail(pMsg->wParam, pMsg->lParam);
636  handled = TRUE;
637  break;
638  }
639 
640  return handled;
641 }
#define MSG_STDOUT
Definition: OperatorConsole.h:124
void OnPassFail(WPARAM wParam, LPARAM lParam)
Called after MSG_PASS_FAIL is received.
Definition: OperatorConsole.cpp:1314
void OnStart(WPARAM wParam, LPARAM lParam)
Called after MSG_START is received.
#define MSG_SET_SFRPLUS
Definition: OperatorConsole.h:122
void OnShowJSON(UINT wParam, LONG lParam)
Called after MSG_JSON is received.
Definition: OperatorConsole.cpp:670
void OnSetSFRplus(WPARAM wParam, LPARAM lParam)
Called after MSG_SET_SFRPLUS is received.
Definition: OperatorConsole.cpp:649
void OnRunTest(WPARAM wParam, LPARAM lParam)
Called after MSG_RUN_TEST is received.
Definition: OperatorConsole.cpp:737
#define MSG_JSON
Definition: OperatorConsole.h:123
void OnSetBlemish(WPARAM wParam, LPARAM lParam)
Called after MSG_SET_BLEMISH is received.
Definition: OperatorConsole.cpp:643
void OnUpdateStderr()
Called after MSG_STDERR is received.
Definition: OperatorConsole.cpp:802
#define MSG_SFRPLUS_DONE
Definition: OperatorConsole.h:120
#define MSG_START
Definition: OperatorConsole.h:116
void OnBlemishDone(WPARAM wParam, LPARAM lParam)
Called after MSG_BLEMISH_DONE is received.
Definition: OperatorConsole.cpp:771
void OnUpdateStdout()
Called after MSG_STDOUT is received.
Definition: OperatorConsole.cpp:797
#define MSG_PASS_FAIL
Definition: OperatorConsole.h:128
#define MSG_FRAME_READY
Definition: OperatorConsole.h:126
#define MSG_STDERR
Definition: OperatorConsole.h:125
#define MSG_RUN_TEST
Definition: OperatorConsole.h:118
void OnSetup(WPARAM wParam, LPARAM lParam)
Called after MSG_SETUP is received.
Definition: OperatorConsole.cpp:977
void OnStop(WPARAM wParam, LPARAM lParam)
Called after MSG_STOP is received.
#define MSG_STOP
Definition: OperatorConsole.h:117
#define MSG_BLEMISH_DONE
Definition: OperatorConsole.h:119
#define MSG_SETUP
Definition: OperatorConsole.h:127
#define MSG_SET_BLEMISH
Definition: OperatorConsole.h:121
void OnSFRplusDone(WPARAM wParam, LPARAM lParam)
Called after MSG_SFRPLUS_DONE is received.
Definition: OperatorConsole.cpp:784
void OnFrameReady(WPARAM wParam, LPARAM lParam)
Called after MSG_FRAME_READY is received.
Definition: OperatorConsole.cpp:760

Here is the call graph for this function:

BOOL COperatorConsoleApp::PreTranslateMessage ( MSG *  pMsg)
protected

Intercepts messages of interest before Windows or MFC.

void COperatorConsoleApp::Quit ( )

This function gets called when the user wants to Quit the application (either by closing the window or pressing the Quit button). Before we quit, we need to wait for the blemish and sfrplus threads to finish.

We tell the threads to finish by sending a Quit message to them. However, if a test is in progress, that thread won't process the Quit message until the test finished. This can take a few seconds, so we post a Log message and turn on the Wait cursor until the threads finish.

References AppFlags::blemishThread, AppFlags::cameraThread, LOG_FILENAME, m_blemishControl, m_cameraControl, m_flags, m_jsonDlgThread, m_sfrPlusControl, m_status, m_stderrThread, m_stdoutThread, AppFlags::modelessThread, MSG_MODELESS_QUIT, StdoutThread::Quit(), ThreadControl::Quit(), quitting, SaveLog(), AppFlags::sfrplusThread, AppFlags::stdErr, and AppFlags::stdOut.

Referenced by InitInstance().

681 {
691  CWaitCursor waitcursor;
692 
693  m_status = quitting; // this tells us not to run another test
694 
696  {
697  m_sfrPlusControl.Quit(); // wait for the sfrplus thread to quit
698  m_flags.sfrplusThread = false;
699 
700  }
701 
703  {
704  m_blemishControl.Quit(); // wait for the blemish thread to quit
705  m_flags.blemishThread = false;
706  }
707 
708  if (m_flags.cameraThread)
709  {
710  m_cameraControl.Quit(); // wait for the camera thread to quit
711  m_flags.cameraThread = false;
712  }
713 
715  {
716  ::PostThreadMessage(m_jsonDlgThread->m_nThreadID, MSG_MODELESS_QUIT, 0, 0); // tell the json dialog thread to quit
717  ::WaitForSingleObject(m_jsonDlgThread->m_hThread, INFINITE); // wait for it to quit (thread gets deleted automatically)
718  m_flags.modelessThread = false;
719  }
720 
721 #if defined(REDIRECT_STDIO)
722  if (m_flags.stdOut)
723  {
724  m_stdoutThread.Quit(); // close the stdout pipe and wait for the thread to quit
725  m_flags.stdOut = false;
726  }
727  if (m_flags.stdErr)
728  {
729  m_stderrThread.Quit(); // close the stderr pipe and wait for the thread to quit
730  m_flags.stdErr = false;
731  }
732 #endif
733 
735 }
AppStatus m_status
Definition: OperatorConsole.h:234
StdoutThread m_stdoutThread
Definition: OperatorConsole.h:261
unsigned int stdOut
stdout pipe is open
Definition: OperatorConsole.h:160
#define MSG_MODELESS_QUIT
Definition: ModelessDialogThread.h:30
ThreadControl m_blemishControl
this is the thread control for running Blemish tests
Definition: OperatorConsole.h:255
StderrThread m_stderrThread
Definition: OperatorConsole.h:262
unsigned int blemishThread
Definition: OperatorConsole.h:154
unsigned int modelessThread
Definition: OperatorConsole.h:157
ThreadControl m_sfrPlusControl
this is the thread control for running SFRplus tests
Definition: OperatorConsole.h:256
AppFlags m_flags
Definition: OperatorConsole.h:265
unsigned int cameraThread
Definition: OperatorConsole.h:156
#define LOG_FILENAME
Definition: OperatorConsole.cpp:44
unsigned int sfrplusThread
Definition: OperatorConsole.h:155
void SaveLog(void)
A public function to save the contents of the log CEdit to m_logFileName.
Definition: OperatorConsole.cpp:1007
unsigned int stdErr
stderr pipe is open
Definition: OperatorConsole.h:161
ModelessDialogThread * m_jsonDlgThread
Definition: OperatorConsole.h:259
void Quit()
Definition: ThreadControl.cpp:92
Definition: OperatorConsole.h:134
void Quit()
Definition: StdoutThread.cpp:35
ThreadControl m_cameraControl
this captures images from the acquisition source
Definition: OperatorConsole.h:257

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::Quit ( )
bool COperatorConsoleApp::ReadINISettings ( void  )

This function reads in items for the setup dialog from imatest.ini.

bool COperatorConsoleApp::ReadINISettings ( void  )

This function reads in items for the setup dialog from imatest.ini.

References setup_settings::bayer, setup_settings::bits_per_pixel, setup_settings::epiphan_deviceID, setup_settings::height, INI_FILENAME, m_setup, setup_settings::omnivision_reg_file, setup_settings::sourceID, and setup_settings::width.

Referenced by InitInstance().

1033 {
1034  bool result = false;
1035  mwArray vararginParam = mwArray(1,3,mxCELL_CLASS);
1036  mwArray readKeys = mwArray(1,5,mxCELL_CLASS);
1037  mwArray inifilename(INI_FILENAME);
1038  mwArray mode("read");
1039  mwArray section_ovt("ovt"),section_imatest("imatest"),section_op("op_console"),section;
1040  mwArray subsection_blank(""), subsection_current("current"),subsection;
1041  mwArray key_acquire("acquire"),key_width("width"),key_height("height"),key_bitdepth("bitdepth"),key_bayer("bayer_pattern"),key_omniregister("register_files"),key_epiphan_deviceid("deviceID");
1042  mwArray value_int("i"), value_string(""), value_double("d");
1043  mwArray default_0(0), default_emptystring("");
1044 
1045  // NOTE: the mwArray::Get function has input syntax Get(number of indexes, i1, i2,...in)
1046 
1047  // first read the 'acquire' key from [imatest]
1048  readKeys.Get(2,1,1).Set(section_imatest);
1049  readKeys.Get(2,1,2).Set(subsection_blank);
1050  readKeys.Get(2,1,3).Set(key_acquire);
1051  readKeys.Get(2,1,4).Set(value_int);
1052  readKeys.Get(2,1,5).Set(default_0);
1053 
1054  vararginParam.Get(2,1,1).Set(inifilename);
1055  vararginParam.Get(2,1,2).Set(mode);
1056  vararginParam.Get(2,1,3).Set(readKeys);
1057  mwArray readSett = mwArray(1,1,mxCELL_CLASS);
1058  try
1059  {
1060  inifile(1,readSett,vararginParam);
1061 
1062  }
1063  catch (const mwException& e)
1064  {
1065  cout << "Run Error!" << endl;
1066  cerr << e.what() << endl;
1067  }
1068 
1069  m_setup.sourceID = (int)readSett.Get(1,1).Get(1,1);
1070 
1071 
1072  if (m_setup.sourceID ==2)
1073  {
1074  section = section_ovt;
1075  subsection = subsection_current;
1076  }
1077  else
1078  {
1079  section = section_op;
1080  subsection = subsection_blank;
1081  }
1082 
1083  readKeys = mwArray(6,5,mxCELL_CLASS);
1084  // to read the Epiphan 'device_ID' key
1085  readKeys.Get(2,1,1).Set(section);
1086  readKeys.Get(2,1,2).Set(subsection);
1087  readKeys.Get(2,1,3).Set(key_epiphan_deviceid);
1088  readKeys.Get(2,1,4).Set(value_int);
1089  readKeys.Get(2,1,5).Set(default_0);
1090 
1091  // to read the 'width' key
1092  readKeys.Get(2,2,1).Set(section);
1093  readKeys.Get(2,2,2).Set(subsection);
1094  readKeys.Get(2,2,3).Set(key_width);
1095  readKeys.Get(2,2,4).Set(value_int);
1096  readKeys.Get(2,2,5).Set(default_0);
1097 
1098  // to read the 'height' key
1099  readKeys.Get(2,3,1).Set(section);
1100  readKeys.Get(2,3,2).Set(subsection);
1101  readKeys.Get(2,3,3).Set(key_height);
1102  readKeys.Get(2,3,4).Set(value_int);
1103  readKeys.Get(2,3,5).Set(default_0);
1104 
1105  // to read the 'bitdepth' key
1106  readKeys.Get(2,4,1).Set(section);
1107  readKeys.Get(2,4,2).Set(subsection);
1108  readKeys.Get(2,4,3).Set(key_bitdepth);
1109  readKeys.Get(2,4,4).Set(value_int);
1110  readKeys.Get(2,4,5).Set(default_0);
1111 
1112  // to read the 'bayer_pattern' key
1113  readKeys.Get(2,5,1).Set(section);
1114  readKeys.Get(2,5,2).Set(subsection);
1115  readKeys.Get(2,5,3).Set(key_bayer);
1116  readKeys.Get(2,5,4).Set(value_int);
1117  readKeys.Get(2,5,5).Set(default_0);
1118 
1119  // to read the 'register_files' key
1120  readKeys.Get(2,6,1).Set(section);
1121  readKeys.Get(2,6,2).Set(subsection);
1122  readKeys.Get(2,6,3).Set(key_omniregister);
1123  readKeys.Get(2,6,4).Set(value_string);
1124  readKeys.Get(2,6,5).Set(default_emptystring);
1125 
1126  vararginParam.Get(1,1).Set(inifilename);
1127  vararginParam.Get(1,2).Set(mode);
1128  vararginParam.Get(1,3).Set(readKeys);
1129 
1130  readSett = mwArray(1,6,mxCELL_CLASS);
1131 
1132  try
1133  {
1134  inifile(1,readSett,vararginParam);
1135  }
1136  catch (const mwException& e)
1137  {
1138  cout << "Run Error!" << endl;
1139  cerr << e.what() << endl;
1140  }
1141 
1142  // copy the values into the corresponding fields in m_setup
1143  m_setup.epiphan_deviceID = (int)readSett.Get(1,1).Get(1,1);
1144  m_setup.width = (int)readSett.Get(1,1).Get(1,2);
1145  m_setup.height = (int)readSett.Get(1,1).Get(1,3);
1146  m_setup.bits_per_pixel = (int)readSett.Get(1,1).Get(1,4);
1147  m_setup.bayer = (int)readSett.Get(1,1).Get(1,5);
1148  m_setup.omnivision_reg_file = readSett.Get(1,1).Get(1,6).ToString();
1149 
1150  m_setup.omnivision_reg_file.Remove('\n'); // inifile() reads newline and carriage return characters into the string
1151  m_setup.omnivision_reg_file.Remove('\r'); // which causes the setup window to be unable to find the file. These characters must be removed.
1152 
1153  if (m_setup.omnivision_reg_file.Compare("[]")==0) // Matlab returns empty strings slightly differently when cells are involved...
1154  {
1156  }
1157 
1158  if ( m_setup.width > 0 && m_setup.height > 0) // we must have the width and height > 0 since we will be allocating buffers soon
1159  {
1160  result = true;
1161  }
1162 
1163  return result;
1164 }
int sourceID
sourceID for acquire_image()
Definition: setup_settings.h:33
CString omnivision_reg_file
[OPTIONAL INPUT] Used for Omnivision only: a fully-qualified filename (including full path) for a fil...
Definition: setup_settings.h:37
int epiphan_deviceID
Used for Epiphan only: the device ID (0 or 1 only)
Definition: setup_settings.h:32
int bits_per_pixel
Used for Omnivision only: number of bits per pixel (8,10,12 only)
Definition: setup_settings.h:31
int width
image width in pixels
Definition: setup_settings.h:29
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
#define INI_FILENAME
Definition: OperatorConsole.h:104
int bayer
Used for Omnivision only: Bayer pattern index.
Definition: setup_settings.h:35
int height
image height in pixels
Definition: setup_settings.h:30

Here is the caller graph for this function:

bool COperatorConsoleApp::ReadPassFail ( void  )

This function reads in the pass/fail variable values as in the pass/fail file listed in the imatest INI file.

bool COperatorConsoleApp::ReadPassFail ( void  )

This function reads in the pass/fail variable values as in the pass/fail file listed in the imatest INI file.

References addDataTypeAndKey(), SFRplusPassFail::All_Edge_IDs_detected, entry< T >::assign_value(), minMaxEntry< T >::assign_value(), SFRplusPassFail::b_enable, BlemishPassFail::b_enable, OISPassFail::b_enable, OtherPassFail::b_enable, CPassFailSettings::b_isReadOnly, entry< T >::b_isUsed, vecEntry< T >::b_isUsed, SFRplusPassFail::Bayer_decode, CPassFailSettings::blemish, BlemishPassFail::Blemish_maximum_count, BlemishPassFail::Blemish_size_pixels, SFRplusPassFail::Chart_mean_pixel_level_bounds, SFRplusPassFail::Chart_radial_pixel_shift_max, SFRplusPassFail::Color_expected_detected, SFRplusPassFail::Convergence_angle_max, entry< T >::data_type, minMaxEntry< T >::data_type, vecEntry< T >::data_type, BlemishPassFail::Dead_pixel_clusters_max, BlemishPassFail::Dead_pixels_max, BlemishPassFail::Defective_pixels_max_count, entry< T >::description, OtherPassFail::ent_vec, SFRplusPassFail::FOV_degrees_diagonal_min, minMaxEntry< T >::group_name, vecEntry< T >::group_name, SFRplusPassFail::High_pixel_saturation_fraction_max, SFRplusPassFail::Horizontal_bars_OK_min, BlemishPassFail::Hot_pixel_clusters_max, BlemishPassFail::Hot_pixels_max, OISPassFail::L_MTF50_delta2_gain_summary_all_dB_min, SFRplusPassFail::Low_pixel_saturation_fraction_max, CPassFailSettings::m_ini_file, CPassFailSettings::m_pass_fail_file, m_PFSettings, SFRplusPassFail::Mirrored_chart, SFRplusPassFail::MTF50P_CP_weighted_mean_min, SFRplusPassFail::MTF50P_ratio_min, entry< T >::name, SFRplusPassFail::name, OISPassFail::name, OtherPassFail::name, SFRplusPassFail::numEntries, BlemishPassFail::numEntries, OISPassFail::numEntries, CPassFailSettings::ois, BlemishPassFail::Optical_center_offset_max, BlemishPassFail::Optical_center_offset_X_max, BlemishPassFail::Optical_center_offset_Y_max, CPassFailSettings::other, SFRplusPassFail::passfail_ini_file_date, OISPassFail::R_improve_ALL_dB_min, OISPassFail::R_improve_H_dB_min, OISPassFail::R_improve_V_dB_min, BlemishPassFail::Relative_illumination_corner_diff_pct_max, BlemishPassFail::Relative_illumination_worst_corner_pct_min, SFRplusPassFail::Rotation_degrees_max, SFRplusPassFail::Secondary_readout_1_center_mean_min, SFRplusPassFail::Secondary_readout_1_outer_mean_min, SFRplusPassFail::Secondary_readout_1_outer_min_min, SFRplusPassFail::Secondary_readout_1_outer_quadrant_delta_max, SFRplusPassFail::Secondary_readout_1_outer_quadrant_mean_min_min, SFRplusPassFail::Secondary_readout_2_center_mean_min, SFRplusPassFail::Secondary_readout_2_outer_mean_min, SFRplusPassFail::Secondary_readout_2_outer_min_min, SFRplusPassFail::Secondary_readout_2_outer_quadrant_delta_max, SFRplusPassFail::Secondary_readout_2_outer_quadrant_mean_min_min, CPassFailSettings::sfrplus, SFRplusPassFail::Stepchart_expected_detected, BlemishPassFail::Uniformity_BoverG_corners_pct_max, BlemishPassFail::Uniformity_RoverG_corners_pct_max, SFRplusPassFail::upside_down, entry< T >::value, and vecEntry< T >::value.

Referenced by InitInstance().

1364 {
1365  bool result=false;
1366 
1367  // First we must find the name of the Pass/Fail file as listed in imatest.ini
1368  mwArray vararginParam = mwArray(1,3,mxCELL_CLASS);
1369  mwArray readKeys = mwArray(1,5,mxCELL_CLASS);
1370  mwArray inifilename(m_PFSettings.m_ini_file.GetString());
1371  mwArray mode("read");
1372  mwArray section("api");
1373  mwArray subsection_blank("");
1374  mwArray key_passFail("passFail");
1375  mwArray value_int("i"), value_string(""), value_double("d");
1376  int badval = -123456;
1377  std::string badstring = "-123456%^&%%$**#";
1378  mwArray default_0(badval), default_emptystring(badstring.c_str()),default_dbl((double)badval);
1379 
1380 
1381 
1382  readKeys.Get(1,1).Set(section);
1383  readKeys.Get(1,2).Set(subsection_blank);
1384  readKeys.Get(1,3).Set(key_passFail);
1385  readKeys.Get(1,4).Set(value_string);
1386  readKeys.Get(1,5).Set(default_emptystring);
1387 
1388  vararginParam.Get(1,1).Set(inifilename);
1389  vararginParam.Get(1,2).Set(mode);
1390  vararginParam.Get(1,3).Set(readKeys);
1391 
1392  mwArray readSett = mwArray(1,1,mxCELL_CLASS);
1393  try
1394  {
1395  inifile(1,readSett,vararginParam);
1396  }
1397  catch (const mwException& e)
1398  {
1399  cout << "Run Error! Unable to read Pass/Fail file" << endl;
1400  cerr << e.what() << endl;
1401  }
1402 
1403  m_PFSettings.m_pass_fail_file.SetString(_T(readSett.Get(1,1).Get(1,1).ToString()));
1404  m_PFSettings.m_pass_fail_file.Remove('\n');
1405  m_PFSettings.m_pass_fail_file.Remove('\r');
1406 
1407  //Now we find the Pass/Fail file and check if it is read-only
1408 
1409 
1410  if ( GetFileAttributes(m_PFSettings.m_pass_fail_file) % 2 == 1) // this returns an odd number if and only if the file is read-only
1411  {
1412  m_PFSettings.b_isReadOnly = TRUE;
1413  }
1414 
1415  // Next we need to figure out which pass/fail modules are in the ini. We will just 'readAll', which returns the full list of sections.
1416  //[keys,sections,subsections] = INIFILE(fName,'readall')
1417 
1418  mwArray keys;
1419  mwArray sections;
1420  mwArray subsections;
1421  mwArray passFailFile(m_PFSettings.m_pass_fail_file.GetString());
1422  mwArray mode_readall("readall"),mode_read("read");
1423 
1424  mwArray varargout = mwArray(1,3,mxCELL_CLASS);
1425  varargout.Get(1,1).Set(keys);
1426  varargout.Get(1,2).Set(sections);
1427  varargout.Get(1,3).Set(subsections);
1428 
1429  mwArray varargin = mwArray(1,2,mxCELL_CLASS);
1430  varargin.Get(1,1).Set(passFailFile);
1431  varargin.Get(1,2).Set(mode_readall);
1432  try
1433  {
1434  inifile(3, varargout,varargin);
1435  }
1436  catch (const mwException& e)
1437  {
1438  cout << "Run Error! Unable to read Pass/Fail file" << endl;
1439  cerr << e.what() << endl;
1440  }
1441 
1442  std::size_t numSections = varargout.Get(1,2).NumberOfElements();
1443  for (std::size_t idx = 1; idx <= numSections; ++idx)
1444  {
1445  CString section = _T(varargout.Get(1,2).Get(1,idx).ToString());
1446 
1447  section.Remove('\n');
1448  section.Remove('\r');
1449 
1450  if (section.CompareNoCase(_T("SFRplus")) ==0)
1451  {
1452  m_PFSettings.sfrplus.b_enable = true;
1453  }
1454  else if(section.CompareNoCase(_T("Blemish"))==0)
1455  {
1456  m_PFSettings.blemish.b_enable = true;
1457  }
1458  else if(section.CompareNoCase(_T("OIS"))==0)
1459  {
1460  m_PFSettings.ois.b_enable = true;
1461  }
1462  else
1463  {
1464  m_PFSettings.other.b_enable = true;
1465  m_PFSettings.other.name = section;
1466  }
1467  }
1468 
1469  // Next we can read in the keys for the 'other' section from what we already have for which all values are strings
1470 
1471 
1473  {
1474  mwArray dims = varargout.Get(1,1).GetDimensions();
1475  std::vector<int> vdims;
1476  std::size_t arr_dims = varargout.Get(1,1).NumberOfDimensions();
1477 
1478  vdims.resize(arr_dims);
1479 
1480  dims.GetData(&vdims[0], arr_dims);
1481  std::size_t numRows = (std::size_t)vdims[0];
1482  for (std::size_t idx=1; idx <=numRows; ++idx)
1483  {
1484  CString section = _T(varargout.Get(1,1).Get(2,idx,1).ToString());
1485  section.Remove('\n');
1486  section.Remove('\r');
1487  CString cstrkey;
1488  CString cstrval;
1489  entry<CString> ent;
1490  if (section.CompareNoCase(m_PFSettings.other.name) ==0)
1491  {
1492  cstrkey = _T(varargout.Get(1,1).Get(2,idx,3).ToString());
1493  cstrkey.Remove('\n');
1494  cstrkey.Remove('\r');
1495  cstrval = _T(varargout.Get(1,1).Get(2,idx,4).ToString());
1496  cstrval.Remove('\n');
1497  cstrval.Remove('\r');
1498  ent.name = cstrkey;
1499  ent.value = cstrval;
1500  ent.data_type = "";
1501  ent.description = _T("");
1502  m_PFSettings.other.ent_vec.push_back(ent);
1503  }
1504  }
1505 
1506 
1507  }
1508 
1509  // Now we get to read in the other sections in a manner that respects their data type since a few of the inputs are vectors.
1510  // Now is a good time to grab a cup of tea...
1511 
1513  {
1514 
1515  readKeys = mwArray(m_PFSettings.blemish.numEntries,5,mxCELL_CLASS);
1516  varargin = mwArray(1,3,mxCELL_CLASS);
1517  mwArray section_Blemish("Blemish");
1518 
1519 
1520  std::vector<std::string> data_types;
1521  std::vector<CString> blem_keys;
1522  // the entry<T> corresponding to a given index in blem_keys will correspond to the same index + 1 in readKeys
1537  // add the contents of blem_keys and data_types to readKeys
1538  for (std::size_t idx = 0; idx < m_PFSettings.blemish.numEntries; ++idx)
1539  {
1540  mwArray key(blem_keys[idx].GetString());
1541  mwArray value(data_types[idx].c_str());
1542  mwArray default_ret;
1543 
1544  if (data_types[idx].compare("i")==0)
1545  {
1546  default_ret = default_0;
1547  }
1548  else if( data_types[idx].compare("d")==0)
1549  {
1550  default_ret = default_dbl;
1551  }
1552  else
1553  {
1554  default_ret = default_emptystring;
1555  }
1556 
1557  readKeys.Get(2,idx+1,1).Set(section_Blemish);
1558  readKeys.Get(2,idx+1,2).Set(subsection_blank);
1559  readKeys.Get(2,idx+1,3).Set(key);
1560  readKeys.Get(2,idx+1,4).Set(value);
1561  readKeys.Get(2,idx+1,5).Set(default_ret);
1562  }
1563 
1564  varargin.Get(1,1).Set(passFailFile);
1565  varargin.Get(1,2).Set(mode_read);
1566  varargin.Get(1,3).Set(readKeys);
1567  readSett = mwArray(1,m_PFSettings.blemish.numEntries,mxCELL_CLASS);
1568  try
1569  {
1570  inifile(1,readSett,varargin);
1571  }
1572  catch (const mwException& e)
1573  {
1574  cout << "Run Error! Unable to read Blemish keys from Pass/Fail file" << endl;
1575  cerr << e.what() << endl;
1576  }
1577 
1578  // now to copy the values into m_PFSettings.blemish
1579 
1580  std::vector<int> intVecBuf;
1581  std::size_t vecSize;
1582  vecSize = readSett.Get(1,1).Get(1,1).NumberOfElements();
1583  intVecBuf.resize(vecSize);
1584  readSett.Get(1,1).Get(1,1).GetData(&intVecBuf[0], vecSize);
1586  if (intVecBuf[0] != badval)
1587  {
1588  for ( std::size_t idx=0; idx < vecSize; ++idx)
1589  {
1590  m_PFSettings.blemish.Blemish_maximum_count.value[idx] = intVecBuf[idx];
1591  }
1593  }
1594 
1595  vecSize = readSett.Get(1,1).Get(1,2).NumberOfElements();
1596  intVecBuf.clear();
1597  intVecBuf.resize(vecSize);
1599  readSett.Get(1,1).Get(1,2).GetData(&intVecBuf[0], vecSize);
1600  if (intVecBuf[0] != badval)
1601  {
1602  for ( std::size_t idx=0; idx < vecSize; ++idx)
1603  {
1604  m_PFSettings.blemish.Blemish_size_pixels.value[idx] = intVecBuf[idx];
1605  }
1607  }
1608 
1609  int intBuf = 0;
1610  double dblBuf = 0.0;
1611 
1612  readSett.Get(1,1).Get(1,3).GetData(&intBuf, 1);
1614 
1615  readSett.Get(1,1).Get(1,4).GetData(&intBuf, 1);
1617 
1618  readSett.Get(1,1).Get(1,5).GetData(&intBuf, 1);
1620 
1621  readSett.Get(1,1).Get(1,6).GetData(&intBuf, 1);
1623 
1624  readSett.Get(1,1).Get(1,7).GetData(&intBuf, 1);
1626 
1627  readSett.Get(1,1).Get(1,8).GetData(&dblBuf, 1);
1629 
1630  readSett.Get(1,1).Get(1,9).GetData(&dblBuf, 1);
1632 
1633  readSett.Get(1,1).Get(1,10).GetData(&dblBuf, 1);
1635 
1636  readSett.Get(1,1).Get(1,11).GetData(&dblBuf, 1);
1638 
1639  readSett.Get(1,1).Get(1,12).GetData(&dblBuf, 1);
1641 
1642  readSett.Get(1,1).Get(1,13).GetData(&dblBuf, 1);
1644 
1645  readSett.Get(1,1).Get(1,14).GetData(&dblBuf, 1);
1647 
1648 
1649  }
1650 
1652  {
1653 
1654 
1655  readKeys = mwArray(m_PFSettings.sfrplus.numEntries,5,mxCELL_CLASS);
1656  varargin = mwArray(1,3,mxCELL_CLASS);
1657  mwArray section_sfr(m_PFSettings.sfrplus.name.GetString());
1658 
1659  std::vector<std::string> data_types;
1660  std::vector<CString> sfr_keys;
1661  // the entry<T> corresponding to a given index in sfr_keys will correspond to the same index + 1 in readKeys
1689 
1690  // add the contents of sfr_keys and data_types to readKeys
1691  for (std::size_t idx = 0; idx < m_PFSettings.sfrplus.numEntries; ++idx)
1692  {
1693  mwArray key(sfr_keys[idx].GetString());
1694  mwArray value(data_types[idx].c_str());
1695  mwArray default_ret;
1696 
1697  if (data_types[idx].compare("i")==0)
1698  {
1699  default_ret = default_0;
1700  }
1701  else if(data_types[idx].compare("d")==0)
1702  {
1703  default_ret = default_dbl;
1704  }
1705  else
1706  {
1707  default_ret = default_emptystring;
1708  }
1709  readKeys.Get(2,idx+1,1).Set(section_sfr);
1710  readKeys.Get(2,idx+1,2).Set(subsection_blank);
1711  readKeys.Get(2,idx+1,3).Set(key);
1712  readKeys.Get(2,idx+1,4).Set(value);
1713  readKeys.Get(2,idx+1,5).Set(default_ret);
1714  }
1715 
1716  int intBuf = 0;
1717  double dblBuf = 0.0;
1718  std::vector<int> intVecBuf;
1719  std::vector<double> dblVecBuf;
1720  varargin.Get(1,1).Set(passFailFile);
1721  varargin.Get(1,2).Set(mode_read);
1722  varargin.Get(1,3).Set(readKeys);
1723  readSett = mwArray(1,m_PFSettings.sfrplus.numEntries,mxCELL_CLASS);
1724 
1725  try
1726  {
1727  inifile(1,readSett,varargin);
1728  }
1729  catch (const mwException& e)
1730  {
1731  cout << "Run Error! Unable to read SFRplus keys from Pass/Fail file" << endl;
1732  cerr << e.what() << endl;
1733  }
1734  // copy the values read from file to the appropriate entries in m_PFSettings.sfrplus
1735  readSett.Get(1,1).Get(1,1).GetData(&intBuf, 1);
1737 
1738  readSett.Get(1,1).Get(1,2).GetData(&intBuf, 1);
1740 
1741  std::size_t vecSize = readSett.Get(1,1).Get(1,3).NumberOfElements();
1742  dblVecBuf.resize(vecSize);
1743  readSett.Get(1,1).Get(1,3).GetData(&dblVecBuf[0], vecSize);
1745 
1746  readSett.Get(1,1).Get(1,4).GetData(&dblBuf, 1);
1748 
1749  readSett.Get(1,1).Get(1,5).GetData(&intBuf, 1);
1751 
1752  readSett.Get(1,1).Get(1,6).GetData(&dblBuf, 1);
1753  m_PFSettings.sfrplus.Convergence_angle_max.assign_value(dblBuf,(double)badval);
1754 
1755  readSett.Get(1,1).Get(1,7).GetData(&dblBuf, 1);
1757 
1758  readSett.Get(1,1).Get(1,8).GetData(&dblBuf, 1);
1760 
1761  readSett.Get(1,1).Get(1,9).GetData(&intBuf, 1);
1763 
1764  readSett.Get(1,1).Get(1,10).GetData(&dblBuf, 1);
1766 
1767  readSett.Get(1,1).Get(1,11).GetData(&intBuf, 1);
1769 
1770  readSett.Get(1,1).Get(1,12).GetData(&dblBuf, 1);
1772 
1773  readSett.Get(1,1).Get(1,13).GetData(&dblBuf, 1);
1774  m_PFSettings.sfrplus.MTF50P_ratio_min.assign_value(dblBuf,(double)badval);
1775 
1776  m_PFSettings.sfrplus.passfail_ini_file_date.value = _T(readSett.Get(1,1).Get(1,14).ToString());
1779  if (m_PFSettings.sfrplus.passfail_ini_file_date.value.Compare(_T(badstring.c_str())) != 0)
1780  {
1782  if (m_PFSettings.sfrplus.passfail_ini_file_date.value.Compare(_T("[]")) == 0)
1783  {
1785  }
1786  }
1787  else
1788  {
1790  }
1791 
1792  readSett.Get(1,1).Get(1,15).GetData(&dblBuf, 1);
1793  m_PFSettings.sfrplus.Rotation_degrees_max.assign_value(dblBuf,(double)badval);
1794 
1795  readSett.Get(1,1).Get(1,16).GetData(&dblBuf, 1);
1797 
1798  readSett.Get(1,1).Get(1,17).GetData(&dblBuf, 1);
1800 
1801  readSett.Get(1,1).Get(1,18).GetData(&dblBuf, 1);
1803 
1804  readSett.Get(1,1).Get(1,19).GetData(&dblBuf, 1);
1806 
1807  readSett.Get(1,1).Get(1,20).GetData(&dblBuf, 1);
1809 
1810  readSett.Get(1,1).Get(1,21).GetData(&dblBuf, 1);
1812 
1813  readSett.Get(1,1).Get(1,22).GetData(&dblBuf, 1);
1815 
1816  readSett.Get(1,1).Get(1,23).GetData(&dblBuf, 1);
1818 
1819  readSett.Get(1,1).Get(1,24).GetData(&dblBuf, 1);
1821 
1822  readSett.Get(1,1).Get(1,25).GetData(&dblBuf, 1);
1824 
1825  readSett.Get(1,1).Get(1,26).GetData(&intBuf, 1);
1827 
1828  readSett.Get(1,1).Get(1,27).GetData(&intBuf, 1);
1830 
1831  }
1832 
1834  {
1835 
1836  readKeys = mwArray(m_PFSettings.ois.numEntries,5,mxCELL_CLASS);
1837  varargin = mwArray(1,3,mxCELL_CLASS);
1838  mwArray section_ois(m_PFSettings.ois.name.GetString());
1839 
1840  std::vector<std::string> data_types;
1841  std::vector<CString> ois_keys;
1842 
1847  // add the contents of ois_keys and data_types to readKeys
1848  for (std::size_t idx = 0; idx < m_PFSettings.ois.numEntries; ++idx)
1849  {
1850  mwArray key(ois_keys[idx].GetString());
1851  mwArray value(data_types[idx].c_str());
1852  mwArray default_ret;
1853 
1854  if (data_types[idx].compare("i")==0)
1855  {
1856  default_ret = default_0;
1857  }
1858  else if(data_types[idx].compare("d")==0)
1859  {
1860  default_ret = default_dbl;
1861  }
1862  else
1863  {
1864  default_ret = default_emptystring;
1865  }
1866  readKeys.Get(2,idx+1,1).Set(section_ois);
1867  readKeys.Get(2,idx+1,2).Set(subsection_blank);
1868  readKeys.Get(2,idx+1,3).Set(key);
1869  readKeys.Get(2,idx+1,4).Set(value);
1870  readKeys.Get(2,idx+1,5).Set(default_ret);
1871  }
1872 
1873  int intBuf = 0;
1874  double dblBuf = 0.0;
1875  std::vector<int> intVecBuf;
1876 
1877  varargin.Get(1,1).Set(passFailFile);
1878  varargin.Get(1,2).Set(mode_read);
1879  varargin.Get(1,3).Set(readKeys);
1880  readSett = mwArray(1,m_PFSettings.ois.numEntries,mxCELL_CLASS);
1881 
1882  try
1883  {
1884  inifile(1,readSett,varargin);
1885  }
1886  catch (const mwException& e)
1887  {
1888  cout << "Run Error!" << endl;
1889  cerr << e.what() << endl;
1890  }
1891  // copy the values read from file to the appropriate entries in m_PFSettings.ois
1892  readSett.Get(1,1).Get(1,1).GetData(&intBuf, 1);
1894 
1895  readSett.Get(1,1).Get(1,2).GetData(&intBuf, 1);
1897 
1898  readSett.Get(1,1).Get(1,3).GetData(&intBuf, 1);
1900 
1901  readSett.Get(1,1).Get(1,4).GetData(&intBuf, 1);
1903  }
1904 
1905  return result;
1906 }
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:184
entry< double > Chart_radial_pixel_shift_max
Definition: PassFailSettings.h:119
bool b_enable
Indicates that the OIS field was found in the pass/fail file.
Definition: PassFailSettings.h:186
bool b_isUsed
Indicates that this particular variable was found in the pass/fail file and thus should be displayed ...
Definition: PassFailSettings.h:36
entry< double > Secondary_readout_2_outer_min_min
Definition: PassFailSettings.h:138
vecEntry< long > Blemish_maximum_count
Definition: PassFailSettings.h:154
T value
the value of the pass/fail variable
Definition: PassFailSettings.h:33
entry< double > Secondary_readout_2_outer_quadrant_delta_max
Definition: PassFailSettings.h:139
entry< long > R_improve_V_dB_min
Definition: PassFailSettings.h:181
entry< long > All_Edge_IDs_detected
Definition: PassFailSettings.h:116
entry< double > Secondary_readout_1_center_mean_min
Definition: PassFailSettings.h:131
OtherPassFail other
Definition: PassFailSettings.h:213
entry< double > Secondary_readout_2_outer_mean_min
Definition: PassFailSettings.h:137
std::size_t numEntries
The number of variables in this struct. This MUST be updated if new keys are added.
Definition: PassFailSettings.h:170
entry< double > Secondary_readout_2_center_mean_min
Definition: PassFailSettings.h:136
entry< long > Dead_pixels_max
Definition: PassFailSettings.h:157
CString group_name
The name to be displayed for the collection.
Definition: PassFailSettings.h:84
entry< double > Rotation_degrees_max
Definition: PassFailSettings.h:130
void addDataTypeAndKey(const std::string &candidateDT, const CString &candidateKey, std::vector< std::string > &data_types, std::vector< CString > &keys)
Adds a data_type string and key string to the std::vector<std::string> data_types and keys...
Definition: OperatorConsole.cpp:116
std::string data_type
an indicator for the data_type to be used by inifile()
Definition: PassFailSettings.h:91
std::vector< T > value
A vector containing all the values of the variable.
Definition: PassFailSettings.h:90
entry< long > Horizontal_bars_OK_min
Definition: PassFailSettings.h:124
entry< double > Secondary_readout_2_outer_quadrant_mean_min_min
Definition: PassFailSettings.h:140
entry< double > Optical_center_offset_max
Definition: PassFailSettings.h:161
void assign_value(const T &input, const T &badVal)
A member function for conditionally assigning the variable 'value' to 'input'.
Definition: PassFailSettings.h:42
entry< long > Dead_pixel_clusters_max
Definition: PassFailSettings.h:156
CString m_ini_file
fully-qualified filename for the Imatest ini file
Definition: PassFailSettings.h:215
entry< long > Mirrored_chart
Definition: PassFailSettings.h:126
CString group_name
The overall name for the pair.
Definition: PassFailSettings.h:54
std::string data_type
an indicator for the data_type to be used by inifile()
Definition: PassFailSettings.h:63
std::vector< entry< CString > > ent_vec
Definition: PassFailSettings.h:193
entry< long > L_MTF50_delta2_gain_summary_all_dB_min
Definition: PassFailSettings.h:179
CPassFailSettings m_PFSettings
Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini.
Definition: OperatorConsole.h:278
Blemish blemish
Definition: PassFailSettings.h:211
bool b_isReadOnly
for checking if the Pass/Fail file is read-only
Definition: PassFailSettings.h:214
entry< double > Low_pixel_saturation_fraction_max
Definition: PassFailSettings.h:125
entry< long > R_improve_H_dB_min
Definition: PassFailSettings.h:180
entry< long > Hot_pixels_max
Definition: PassFailSettings.h:160
entry< double > Relative_illumination_corner_diff_pct_max
Definition: PassFailSettings.h:164
std::size_t numEntries
The number of variables in this struct. This MUST be updated if new keys are added.
Definition: PassFailSettings.h:185
entry< double > FOV_degrees_diagonal_min
Definition: PassFailSettings.h:122
void assign_value(const std::vector< T > &input, const T &badVal)
A member function for conditionally assigning the variable 'value' to 'input'.
Definition: PassFailSettings.h:70
entry< double > Optical_center_offset_X_max
Definition: PassFailSettings.h:162
entry< CString > passfail_ini_file_date
Definition: PassFailSettings.h:129
entry< double > Secondary_readout_1_outer_quadrant_delta_max
Definition: PassFailSettings.h:134
OISPassFail ois
Definition: PassFailSettings.h:212
entry< long > Color_expected_detected
Definition: PassFailSettings.h:120
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:144
bool b_enable
Indicates that the Blemish field was found in the pass/fail file.
Definition: PassFailSettings.h:171
std::string data_type
an indicator for the data_type to be used by inifile()
Definition: PassFailSettings.h:34
entry< double > MTF50P_CP_weighted_mean_min
Definition: PassFailSettings.h:128
bool b_isUsed
Indicates that this particular variable was found in the pass/fail file and thus should be displayed ...
Definition: PassFailSettings.h:93
vecEntry< long > Blemish_size_pixels
Definition: PassFailSettings.h:155
std::size_t numEntries
The number of variables in this struct. This MUST be updated if new keys are added.
Definition: PassFailSettings.h:145
CString name
the pass/fail variable (or key) name as given in the Imatest documentation
Definition: PassFailSettings.h:31
entry< double > Secondary_readout_1_outer_mean_min
Definition: PassFailSettings.h:132
minMaxEntry< double > Chart_mean_pixel_level_bounds
Definition: PassFailSettings.h:118
entry< long > Stepchart_expected_detected
Definition: PassFailSettings.h:141
entry< long > upside_down
Definition: PassFailSettings.h:142
entry< double > Relative_illumination_worst_corner_pct_min
Definition: PassFailSettings.h:165
entry< double > Convergence_angle_max
Definition: PassFailSettings.h:121
entry< long > Hot_pixel_clusters_max
Definition: PassFailSettings.h:159
entry< double > High_pixel_saturation_fraction_max
Definition: PassFailSettings.h:123
entry< double > Secondary_readout_1_outer_min_min
Definition: PassFailSettings.h:133
bool b_enable
Indicates that the SFRPlus field was found in the pass/fail file.
Definition: PassFailSettings.h:146
entry< double > Uniformity_RoverG_corners_pct_max
Definition: PassFailSettings.h:167
entry< double > Optical_center_offset_Y_max
Definition: PassFailSettings.h:163
entry< long > R_improve_ALL_dB_min
Definition: PassFailSettings.h:182
entry< long > Bayer_decode
Definition: PassFailSettings.h:117
entry< long > Defective_pixels_max_count
Definition: PassFailSettings.h:158
entry< double > Secondary_readout_1_outer_quadrant_mean_min_min
Definition: PassFailSettings.h:135
CString description
The description of this variable to be displayed.
Definition: PassFailSettings.h:32
entry< double > MTF50P_ratio_min
Definition: PassFailSettings.h:127
SFRplusPassFail sfrplus
Definition: PassFailSettings.h:210
CString m_pass_fail_file
fully-qualified filename for the Pass/Fail file
Definition: PassFailSettings.h:216
entry< double > Uniformity_BoverG_corners_pct_max
Definition: PassFailSettings.h:166
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:195
bool b_enable
The number of variables in this struct. This MUST be updated if new keys are added.
Definition: PassFailSettings.h:196

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::ReInit ( void  )

This function allows for reallocation of the various image buffers when we change the image size.

bool COperatorConsoleApp::ReInit ( void  )

This function allows for reallocation of the various image buffers when we change the image size.

References AllocateImageBuf(), CheckFiles(), ImageAcquisition::GetInfo(), idle, InitBlemishAcq(), InitBlemishThread(), InitCamera(), InitSFRplusAcq(), InitSFRplusThread(), m_blemishAcq, m_blemishControl, m_camera, m_sfrPlusAcq, m_sfrPlusControl, m_status, OnSetSFRplus(), and ThreadControl::Quit().

Referenced by OnSetup().

1259 {
1260 
1261  CString errMsg;
1262  bool success = false;
1263 
1266 
1267  if (!CheckFiles(errMsg)) // make sure that all of the hard coded files exist
1268  {
1269  success = false;
1270  }
1271  else if (!InitBlemishAcq()) // loads the raw blemish file into a buffer
1272  {
1273  errMsg = m_blemishAcq.GetInfo();
1274  }
1275  else if (!InitSFRplusAcq()) // loads the raw sfrplus file into a buffer
1276  {
1277  errMsg = m_sfrPlusAcq.GetInfo();
1278  }
1279  else if (!InitCamera())
1280  {
1281  errMsg = m_camera.GetInfo();
1282  }
1283  else if (!AllocateImageBuf()) // allocate a buffer large enough to hold an image [must be done after call to m_blemishAcq.Open()]
1284  {
1285  errMsg = "Unable to allocate image buffers.";
1286  }
1287  else if (!InitBlemishThread())
1288  {
1289  errMsg = "Unable to create Blemish thread.";
1290  }
1291  else if (!InitSFRplusThread())
1292  {
1293  errMsg = "Unable to create SFRplus thread.";
1294  }
1295  else
1296  {
1297  OnSetSFRplus(0, 0); // the default test is set to SFRplus
1298  m_status = idle;
1299  success = true;
1300  ((COperatorConsoleDlg *)m_pMainWnd)->ReInitDialog();
1301  }
1302 
1303 
1304  if (!errMsg.IsEmpty())
1305  {
1306  AfxMessageBox(errMsg);
1307  }
1308 
1309  return success;
1310 
1311 }
AppStatus m_status
Definition: OperatorConsole.h:234
bool AllocateImageBuf()
Definition: OperatorConsole.cpp:544
ThreadControl m_blemishControl
this is the thread control for running Blemish tests
Definition: OperatorConsole.h:255
FileAcquisition m_blemishAcq
raw data for blemish tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:240
ThreadControl m_sfrPlusControl
this is the thread control for running SFRplus tests
Definition: OperatorConsole.h:256
ImatestLibAcq m_camera
live acquisition using Imatest acquire_image()
Definition: OperatorConsole.h:244
void OnSetSFRplus(WPARAM wParam, LPARAM lParam)
Called after MSG_SET_SFRPLUS is received.
Definition: OperatorConsole.cpp:649
Definition: OperatorConsole.h:133
bool InitBlemishThread()
Definition: OperatorConsole.cpp:434
bool InitSFRplusThread()
Definition: OperatorConsole.cpp:451
CString & GetInfo()
Definition: ImageAcquisition.h:44
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
bool InitBlemishAcq()
Definition: OperatorConsole.cpp:385
FileAcquisition m_sfrPlusAcq
raw data for SFRplus tests (no longer needed, now that live capture is working)
Definition: OperatorConsole.h:241
void Quit()
Definition: ThreadControl.cpp:92
bool InitCamera()
Definition: OperatorConsole.cpp:409
bool InitSFRplusAcq()
Definition: OperatorConsole.cpp:397
bool CheckFiles(CString &msg)
Definition: OperatorConsole.cpp:895

Here is the call graph for this function:

Here is the caller graph for this function:

bool COperatorConsoleApp::SaveConfig ( )
protected
bool COperatorConsoleApp::SaveConfig ( )
protected
void COperatorConsoleApp::SaveLog ( const char *  filePathName)
protected
945 {
946  UINT len;
947  CString str;
948  CFile file(filePathName, CFile::modeWrite | CFile::modeCreate);
949 
950 
951 
952  //
953  // Copy the contents of the log window into a string
954  //
955  if (m_pMainWnd)
956  ((COperatorConsoleDlg *)m_pMainWnd)->GetLog(str);
957 
958  //
959  // str may have lines ending with \r\n or just \n. We want all lines to end with \r\n, so first we need to
960  // convert any \r\n combinations to \n. Then we can go back and replace all of the \n characters with \r\n.
961  //
962  str.Replace("\r\n", "\n");
963  str.Replace("\n", "\r\n");
964 
965  len = (UINT)str.GetLength();
966 
967  //
968  // Write the string to a file. Note that the file has *not* been opened in TEXT mode.
969  // This means that the string will be written to the file as-is. There will be *no*
970  // automatic replacing of \n with \r\n. That's okay, because the text from the
971  // log window already has \r\n in it.
972  //
973  file.Write(str, len);
974 }
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
void COperatorConsoleApp::SaveLog ( const CString &  filePathName)
protected
1014 {
1015  UINT len;
1016  CString str;
1017  CFile file(filePathName, CFile::modeWrite | CFile::modeCreate);
1018 
1019 
1020  //
1021  // Copy the contents of the log window into a string
1022  //
1023  if (m_pMainWnd){
1024  ((COperatorConsoleDlg *)m_pMainWnd)->GetLog(str);
1025  }
1026 
1027  //
1028  // str may have lines ending with \r\n or just \n. We want all lines to end with \r\n, so first we need to
1029  // convert any \r\n combinations to \n. Then we can go back and replace all of the \n characters with \r\n.
1030  //
1031  str.Replace("\r\n", "\n");
1032  str.Replace("\n", "\r\n");
1033  len = (UINT)str.GetLength();
1034 
1035  //
1036  // Write the string to a file. Note that the file has *not* been opened in TEXT mode.
1037  // This means that the string will be written to the file as-is. There will be *no*
1038  // automatic replacing of \n with \r\n. That's okay, because the text from the
1039  // log window already has \r\n in it.
1040  //
1041  file.Write(str, len);
1042  file.Close();
1043 }
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
void COperatorConsoleApp::SaveLog ( void  )

A public function to save the contents of the log CEdit to m_logFileName.

References m_logFileName.

Referenced by Quit().

1008 {
1010 }
void SaveLog(void)
A public function to save the contents of the log CEdit to m_logFileName.
Definition: OperatorConsole.cpp:1007
CString m_logFileName
Contains the file name for the log file (log file is filled with the contents of the log edit box upo...
Definition: OperatorConsole.h:306

Here is the caller graph for this function:

BOOL COperatorConsoleApp::SendAppMessage ( int  msg)
protected

Referenced by OnBlemishDone(), and OnSFRplusDone().

886 {
887  BOOL result;
888 
889  result = ::PostThreadMessage(m_nThreadID, msg, 0, 0);
890 
891  return result;
892 }

Here is the caller graph for this function:

BOOL COperatorConsoleApp::SendAppMessage ( int  msg)
protected
void COperatorConsoleApp::UpdateResults ( ImageTest test)
protected

References TestResults::failInfo, GetResults(), TestResults::json, TestResults::log, COperatorConsoleDlg::LogMessage(), m_cameraImage, ImageTest::m_elapsed, ImageTest::m_elapsedStr, ImageTest::m_name, m_results, ImageTest::Passed(), TestResults::summary, COperatorConsoleDlg::UpdateFPS(), COperatorConsoleDlg::UpdateImage(), COperatorConsoleDlg::UpdateStatus(), and COperatorConsoleDlg::UpdateSummary().

Referenced by OnBlemishDone(), and UpdateResultsSFRplus().

831 {
832  CString str;
833  bool passed = test->Passed();
834  COperatorConsoleDlg *dlg = (COperatorConsoleDlg *)m_pMainWnd;
835 
836 
837 #if !defined NO_LOG
838  str.Format("%s took %s sec\n", test->m_name, test->m_elapsedStr);
839  dlg->LogMessage(str);
840 #endif
841 
842 #if defined START_TEST_FROM_FRAME_READY
843  dlg->UpdateImage(m_cameraImage); // display the image in the dialog
844 #endif
845 
846  //
847  // Copy strings from the test object into our application
848  // object so that we can display them in the dialog.
849  //
850  GetResults(test);
851 
852  //
853  // Update the dialog with the test results
854  //
855  dlg->LogMessage(m_results.log, false); // update any log messages from the test
856  dlg->UpdateStatus(passed, m_results.failInfo); // status (pass/fail)
857  dlg->UpdateSummary(m_results.summary); // summary (results)
858  dlg->UpdateFPS(test->m_elapsed); // frame rate
859 
860  //
861  // Update the values in the json string, replacing \n with \r\n so
862  // that the line breaks will work when displayed in a dialog.
863  //
864  m_results.json.Replace("\n", "\r\n");
865 }
void UpdateSummary(LPCTSTR summary)
Definition: OperatorConsoleDlg.cpp:358
CString m_elapsedStr
Definition: ImageTest.h:138
TestResults m_results
Definition: OperatorConsole.h:260
void UpdateFPS(long long ms)
Definition: OperatorConsoleDlg.cpp:376
void LogMessage(LPCTSTR msg, bool timestamp=true)
Definition: OperatorConsoleDlg.cpp:416
CString summary
the summary results of the test
Definition: OperatorConsole.h:143
CString json
holds the JSON output of a test
Definition: OperatorConsole.h:144
bool Passed()
Definition: ImageTest.h:102
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
CString failInfo
reasons that image failed the test
Definition: OperatorConsole.h:145
CString log
log message(s)
Definition: OperatorConsole.h:146
void UpdateStatus(bool passed, LPCTSTR reason)
Definition: OperatorConsoleDlg.cpp:337
long long m_elapsed
Definition: ImageTest.h:137
char * m_cameraImage
buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage) ...
Definition: OperatorConsole.h:239
void GetResults(ImageTest *test)
Definition: OperatorConsole.cpp:867
void UpdateImage(void *buf)
Definition: OperatorConsoleDlg.cpp:332
const char * m_name
Definition: ImageTest.h:136

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::UpdateResults ( ImageTest test)
protected
void COperatorConsoleApp::UpdateResultsSFRplus ( ImageTest test)
protected

References SFRplusTest::GetQSO(), m_sfrPlus, COperatorConsoleDlg::UpdateQuadrants(), and UpdateResults().

Referenced by OnSFRplusDone().

821 {
822  COperatorConsoleDlg *dlg = (COperatorConsoleDlg *)m_pMainWnd;
823  const bool *qso = m_sfrPlus.GetQSO(); // QSO overlay (tic-tac-toe)
824 
825  UpdateResults(test);
826  dlg->UpdateQuadrants(qso);
827 }
SFRplusTest m_sfrPlus
this will run the SFRplus tests
Definition: OperatorConsole.h:254
The class underlying the main dialog.
Definition: OperatorConsoleDlg.h:32
void UpdateResults(ImageTest *test)
Definition: OperatorConsole.cpp:830
void UpdateQuadrants(const bool *data)
Definition: OperatorConsoleDlg.cpp:364
const bool * GetQSO()
Definition: SFRplusTest.h:36

Here is the call graph for this function:

Here is the caller graph for this function:

void COperatorConsoleApp::UpdateResultsSFRplus ( ImageTest test)
protected
void COperatorConsoleApp::UpdateStderr ( )
protected
void COperatorConsoleApp::UpdateStderr ( )
protected
void COperatorConsoleApp::UpdateStdout ( )
protected
void COperatorConsoleApp::UpdateStdout ( )
protected
void COperatorConsoleApp::WriteINISettings ( void  )

This function writes items for the setup dialog to imatest.ini.

void COperatorConsoleApp::WriteINISettings ( void  )

This function writes items for the setup dialog to imatest.ini.

References setup_settings::bayer, setup_settings::bits_per_pixel, setup_settings::epiphan_deviceID, setup_settings::height, m_config, Config::m_iniFilePathName, m_setup, setup_settings::omnivision_reg_file, setup_settings::sourceID, and setup_settings::width.

Referenced by OnSetup().

1169 {
1170  mwArray vararginParam = mwArray(1,4,mxCELL_CLASS);
1171  mwArray writeKeys = mwArray(7,4,mxCELL_CLASS);
1172  mwArray inifilename(m_config->m_iniFilePathName);
1173  mwArray mode("write"),style("plain");
1174  mwArray section_ovt("ovt"),section_imatest("imatest"),section_op("op_console"),section("");
1175  mwArray subsection_blank(""), subsection_current("current"),subsection("");
1176  mwArray key_acquire("acquire"),key_width("width"),key_height("height"),key_bitdepth("bitdepth");
1177  mwArray key_bayer("bayer_pattern"),key_omniregister("register_files"),key_epiphan_deviceid("deviceID");
1178  mwArray val_acquire(m_setup.sourceID), val_width(m_setup.width), val_height(m_setup.height), val_bitdepth(m_setup.bits_per_pixel);
1179  mwArray val_bayer(m_setup.bayer), val_omniregister(m_setup.omnivision_reg_file), val_epiphan_deviceid(m_setup.epiphan_deviceID);
1180 
1181  // NOTE: the mwArray::Get function has input syntax Get(number of indexes, i1, i2,...in)
1182  // first read the 'acquire' key from [imatest]
1183  writeKeys.Get(2,1,1).Set(section_imatest);
1184  writeKeys.Get(2,1,2).Set(subsection_blank);
1185  writeKeys.Get(2,1,3).Set(key_acquire);
1186  writeKeys.Get(2,1,4).Set(val_acquire);
1187 
1188  if (m_setup.sourceID ==2) // Omnivision
1189  {
1190  section = section_ovt;
1191  subsection = subsection_current;
1192  }
1193  else
1194  {
1195  section = section_op;
1196  subsection = subsection_blank;
1197  }
1198 
1199  // to write the Epiphan 'device_ID' key
1200  writeKeys.Get(2,2,1).Set(section);
1201  writeKeys.Get(2,2,2).Set(subsection);
1202  writeKeys.Get(2,2,3).Set(key_epiphan_deviceid);
1203  writeKeys.Get(2,2,4).Set(val_epiphan_deviceid);
1204 
1205  // to write the 'width' key
1206  writeKeys.Get(2,3,1).Set(section);
1207  writeKeys.Get(2,3,2).Set(subsection);
1208  writeKeys.Get(2,3,3).Set(key_width);
1209  writeKeys.Get(2,3,4).Set(val_width);
1210 
1211 
1212  // to write the 'height' key
1213  writeKeys.Get(2,4,1).Set(section);
1214  writeKeys.Get(2,4,2).Set(subsection);
1215  writeKeys.Get(2,4,3).Set(key_height);
1216  writeKeys.Get(2,4,4).Set(val_height);
1217 
1218 
1219  // to write the 'bitdepth' key
1220  writeKeys.Get(2,5,1).Set(section);
1221  writeKeys.Get(2,5,2).Set(subsection);
1222  writeKeys.Get(2,5,3).Set(key_bitdepth);
1223  writeKeys.Get(2,5,4).Set(val_bitdepth);
1224 
1225 
1226  // to write the 'bayer_pattern'
1227  writeKeys.Get(2,6,1).Set(section);
1228  writeKeys.Get(2,6,2).Set(subsection);
1229  writeKeys.Get(2,6,3).Set(key_bayer);
1230  writeKeys.Get(2,6,4).Set(val_bayer);
1231 
1232 
1233  // to write the 'register_files'
1234  writeKeys.Get(2,7,1).Set(section);
1235  writeKeys.Get(2,7,2).Set(subsection);
1236  writeKeys.Get(2,7,3).Set(key_omniregister);
1237  writeKeys.Get(2,7,4).Set(val_omniregister);
1238 
1239  vararginParam.Get(2,1,1).Set(inifilename);
1240  vararginParam.Get(2,1,2).Set(mode);
1241  vararginParam.Get(2,1,3).Set(writeKeys);
1242  vararginParam.Get(2,1,4).Set(style);
1243  try
1244  {
1245  inifile(vararginParam);
1246  }
1247  catch (const mwException& e)
1248  {
1249  cout << "Run Error!" << endl;
1250  cerr << e.what() << endl;
1251  }
1252 
1253 }
int sourceID
sourceID for acquire_image()
Definition: setup_settings.h:33
CString omnivision_reg_file
[OPTIONAL INPUT] Used for Omnivision only: a fully-qualified filename (including full path) for a fil...
Definition: setup_settings.h:37
int epiphan_deviceID
Used for Epiphan only: the device ID (0 or 1 only)
Definition: setup_settings.h:32
int bits_per_pixel
Used for Omnivision only: number of bits per pixel (8,10,12 only)
Definition: setup_settings.h:31
const char * m_iniFilePathName
Fully-qualified ini file name (including full path)
Definition: Config.h:38
int width
image width in pixels
Definition: setup_settings.h:29
setup_settings m_setup
this contains settings from/for the setup dialog
Definition: OperatorConsole.h:252
int bayer
Used for Omnivision only: Bayer pattern index.
Definition: setup_settings.h:35
Config * m_config
pointer to current config struct to use
Definition: OperatorConsole.h:237
int height
image height in pixels
Definition: setup_settings.h:30

Here is the caller graph for this function:

bool COperatorConsoleApp::WritePassFail ( void  )

This function writes the pass/fail variables to the pass/fail file listed in the imatest INI file.

bool COperatorConsoleApp::WritePassFail ( void  )

This function writes the pass/fail variables to the pass/fail file listed in the imatest INI file.

References addKeysAndValues(), SFRplusPassFail::All_Edge_IDs_detected, SFRplusPassFail::b_enable, BlemishPassFail::b_enable, OISPassFail::b_enable, OtherPassFail::b_enable, entry< T >::b_isUsed, minMaxEntry< T >::b_isUsed, vecEntry< T >::b_isUsed, SFRplusPassFail::Bayer_decode, CPassFailSettings::blemish, BlemishPassFail::Blemish_maximum_count, BlemishPassFail::Blemish_size_pixels, SFRplusPassFail::Chart_mean_pixel_level_bounds, SFRplusPassFail::Chart_radial_pixel_shift_max, SFRplusPassFail::Color_expected_detected, SFRplusPassFail::Convergence_angle_max, BlemishPassFail::Dead_pixel_clusters_max, BlemishPassFail::Dead_pixels_max, BlemishPassFail::Defective_pixels_max_count, OtherPassFail::ent_vec, SFRplusPassFail::FOV_degrees_diagonal_min, minMaxEntry< T >::group_name, vecEntry< T >::group_name, SFRplusPassFail::High_pixel_saturation_fraction_max, SFRplusPassFail::Horizontal_bars_OK_min, BlemishPassFail::Hot_pixel_clusters_max, BlemishPassFail::Hot_pixels_max, OISPassFail::L_MTF50_delta2_gain_summary_all_dB_min, SFRplusPassFail::Low_pixel_saturation_fraction_max, CPassFailSettings::m_ini_file, CPassFailSettings::m_pass_fail_file, m_PFSettings, SFRplusPassFail::Mirrored_chart, SFRplusPassFail::MTF50P_CP_weighted_mean_min, SFRplusPassFail::MTF50P_ratio_min, entry< T >::name, SFRplusPassFail::name, BlemishPassFail::name, OISPassFail::name, OtherPassFail::name, CPassFailSettings::ois, BlemishPassFail::Optical_center_offset_max, BlemishPassFail::Optical_center_offset_X_max, BlemishPassFail::Optical_center_offset_Y_max, CPassFailSettings::other, SFRplusPassFail::passfail_ini_file_date, OISPassFail::R_improve_ALL_dB_min, OISPassFail::R_improve_H_dB_min, OISPassFail::R_improve_V_dB_min, BlemishPassFail::Relative_illumination_corner_diff_pct_max, BlemishPassFail::Relative_illumination_worst_corner_pct_min, SFRplusPassFail::Rotation_degrees_max, SFRplusPassFail::Secondary_readout_1_center_mean_min, SFRplusPassFail::Secondary_readout_1_outer_mean_min, SFRplusPassFail::Secondary_readout_1_outer_min_min, SFRplusPassFail::Secondary_readout_1_outer_quadrant_delta_max, SFRplusPassFail::Secondary_readout_1_outer_quadrant_mean_min_min, SFRplusPassFail::Secondary_readout_2_center_mean_min, SFRplusPassFail::Secondary_readout_2_outer_mean_min, SFRplusPassFail::Secondary_readout_2_outer_min_min, SFRplusPassFail::Secondary_readout_2_outer_quadrant_delta_max, SFRplusPassFail::Secondary_readout_2_outer_quadrant_mean_min_min, CPassFailSettings::sfrplus, SFRplusPassFail::Stepchart_expected_detected, BlemishPassFail::Uniformity_BoverG_corners_pct_max, BlemishPassFail::Uniformity_RoverG_corners_pct_max, SFRplusPassFail::upside_down, writeEntValueString(), writeMinMaxEntValueString(), and writeVecEntValueString().

Referenced by OnPassFail().

1910 {
1911  bool result = false;
1912 
1913  mwArray varargin = mwArray(1,4,mxCELL_CLASS);
1914 
1915  mwArray inifilename(m_PFSettings.m_ini_file.GetString());
1916  mwArray passfailfilename(m_PFSettings.m_pass_fail_file.GetString());
1917  mwArray mode("write");
1918  mwArray style("plain");
1919  mwArray subsection_blank("");
1920  mwArray value_int("i"), value_string(""), value_double("d");
1921 
1922 
1924  {
1925  mwArray section(m_PFSettings.blemish.name.GetString());
1926  std::vector<std::string> keys;
1927  std::vector<std::string> vals;
1928 
1943  // add the contents of keys and vals to writeKeys
1944  mwArray writeKeys = mwArray(keys.size(),4,mxCELL_CLASS);
1945  for (std::size_t idx=0; idx < keys.size(); ++idx)
1946  {
1947  mwArray key(keys[idx].c_str());
1948  mwArray val(vals[idx].c_str());
1949  writeKeys.Get(2,idx+1,1).Set(section);
1950  writeKeys.Get(2,idx+1,2).Set(subsection_blank);
1951  writeKeys.Get(2,idx+1,3).Set(key);
1952  writeKeys.Get(2,idx+1,4).Set(val);
1953  }
1954 
1955  varargin.Get(1,1).Set(passfailfilename);
1956  varargin.Get(1,2).Set(mode);
1957  varargin.Get(1,3).Set(writeKeys);
1958  varargin.Get(1,4).Set(style);
1959 
1960  try
1961  {
1962  inifile(varargin);
1963  result = true;
1964  }
1965  catch (const mwException& e)
1966  {
1967  cout << "Run Error! Unable to write to Pass/Fail file" << endl;
1968  cerr << e.what() << endl;
1969  result = false;
1970  }
1971 
1972  }
1973 
1975  {
1976  mwArray section(m_PFSettings.ois.name.GetString());
1977  std::vector<std::string> keys;
1978  std::vector<std::string> vals;
1979 
1984 
1985  mwArray writeKeys = mwArray(keys.size(),4,mxCELL_CLASS);
1986  // add the contents of keys and vals to writeKeys
1987  for (std::size_t idx=0; idx < keys.size(); ++idx)
1988  {
1989  mwArray key(keys[idx].c_str());
1990  mwArray val(vals[idx].c_str());
1991  writeKeys.Get(2,idx+1,1).Set(section);
1992  writeKeys.Get(2,idx+1,2).Set(subsection_blank);
1993  writeKeys.Get(2,idx+1,3).Set(key);
1994  writeKeys.Get(2,idx+1,4).Set(val);
1995  }
1996 
1997  varargin.Get(1,1).Set(passfailfilename);
1998  varargin.Get(1,2).Set(mode);
1999  varargin.Get(1,3).Set(writeKeys);
2000  varargin.Get(1,4).Set(style);
2001 
2002  try
2003  {
2004  inifile(varargin);
2005  result = true;
2006  }
2007  catch (const mwException& e)
2008  {
2009  cout << "Run Error writing OIS keys to Pass/Fail file!" << endl;
2010  cerr << e.what() << endl;
2011  result = false;
2012  }
2013 
2014  }
2015 
2017  {
2018  mwArray writeKeys = mwArray(m_PFSettings.other.ent_vec.size(),4,mxCELL_CLASS);
2019  mwArray section(m_PFSettings.other.name.GetString());
2020  // add the contents of ent_vec to writeKeys
2021  for (std::size_t idx=0; idx < m_PFSettings.other.ent_vec.size(); ++idx)
2022  {
2023  mwArray key(m_PFSettings.other.ent_vec[idx].name.GetString());
2024  mwArray val(writeEntValueString(m_PFSettings.other.ent_vec[idx]).c_str());
2025  writeKeys.Get(2,idx+1,1).Set(section);
2026  writeKeys.Get(2,idx+1,2).Set(subsection_blank);
2027  writeKeys.Get(2,idx+1,3).Set(key);
2028  writeKeys.Get(2,idx+1,4).Set(val);
2029  }
2030 
2031  varargin.Get(1,1).Set(passfailfilename);
2032  varargin.Get(1,2).Set(mode);
2033  varargin.Get(1,3).Set(writeKeys);
2034  varargin.Get(1,4).Set(style);
2035 
2036  try
2037  {
2038  inifile(varargin);
2039  result = true;
2040  }
2041  catch (const mwException& e)
2042  {
2043  cout << "Run Error writing Blemish keys to Pass/Fail file!" << endl;
2044  cerr << e.what() << endl;
2045  result = false;
2046  }
2047 
2048  }
2049 
2051  {
2052  mwArray section(m_PFSettings.sfrplus.name.GetString());
2053  std::vector<std::string> keys;
2054  std::vector<std::string> vals;
2055 
2083 
2084  mwArray writeKeys = mwArray(keys.size(),4,mxCELL_CLASS);
2085  // add the contents of keys and vals to writeKeys
2086  for (std::size_t idx=0; idx < keys.size(); ++idx)
2087  {
2088  mwArray key(keys[idx].c_str());
2089  mwArray val(vals[idx].c_str());
2090  writeKeys.Get(2,idx+1,1).Set(section);
2091  writeKeys.Get(2,idx+1,2).Set(subsection_blank);
2092  writeKeys.Get(2,idx+1,3).Set(key);
2093  writeKeys.Get(2,idx+1,4).Set(val);
2094  }
2095 
2096  varargin.Get(1,1).Set(passfailfilename);
2097  varargin.Get(1,2).Set(mode);
2098  varargin.Get(1,3).Set(writeKeys);
2099  varargin.Get(1,4).Set(style);
2100 
2101  try
2102  {
2103  inifile(varargin);
2104  result = true;
2105  }
2106  catch (const mwException& e)
2107  {
2108  cout << "Run Error writing SFRplus keys to Pass/Fail file!" << endl;
2109  cerr << e.what() << endl;
2110  result = false;
2111  }
2112  }
2113 
2114  return result;
2115 }
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:184
entry< double > Chart_radial_pixel_shift_max
Definition: PassFailSettings.h:119
bool b_enable
Indicates that the OIS field was found in the pass/fail file.
Definition: PassFailSettings.h:186
bool b_isUsed
Indicates that this particular variable was found in the pass/fail file and thus should be displayed ...
Definition: PassFailSettings.h:36
entry< double > Secondary_readout_2_outer_min_min
Definition: PassFailSettings.h:138
vecEntry< long > Blemish_maximum_count
Definition: PassFailSettings.h:154
entry< double > Secondary_readout_2_outer_quadrant_delta_max
Definition: PassFailSettings.h:139
const std::string writeVecEntValueString(const vecEntry< T > &ent)
Converts the vecEntry<CString>.value into a single std::string to facilitate writing to the pass/fail...
Definition: OperatorConsole.cpp:89
entry< long > R_improve_V_dB_min
Definition: PassFailSettings.h:181
entry< long > All_Edge_IDs_detected
Definition: PassFailSettings.h:116
entry< double > Secondary_readout_1_center_mean_min
Definition: PassFailSettings.h:131
OtherPassFail other
Definition: PassFailSettings.h:213
entry< double > Secondary_readout_2_outer_mean_min
Definition: PassFailSettings.h:137
entry< double > Secondary_readout_2_center_mean_min
Definition: PassFailSettings.h:136
entry< long > Dead_pixels_max
Definition: PassFailSettings.h:157
void addKeysAndValues(const std::string &candidateKey, const std::string &candidateVal, std::vector< std::string > &keys, std::vector< std::string > &vals, bool b_addKey)
Conditionally adds a particular key (variable name) and value to the std::vector<std::string> keys...
Definition: OperatorConsole.cpp:104
CString group_name
The name to be displayed for the collection.
Definition: PassFailSettings.h:84
entry< double > Rotation_degrees_max
Definition: PassFailSettings.h:130
const std::string writeEntValueString(const entry< T > &ent)
Converts the entry<T>.value into a std::string to facilitate writing to the pass/fail file...
Definition: OperatorConsole.cpp:56
entry< long > Horizontal_bars_OK_min
Definition: PassFailSettings.h:124
entry< double > Secondary_readout_2_outer_quadrant_mean_min_min
Definition: PassFailSettings.h:140
entry< double > Optical_center_offset_max
Definition: PassFailSettings.h:161
entry< long > Dead_pixel_clusters_max
Definition: PassFailSettings.h:156
const std::string writeMinMaxEntValueString(const minMaxEntry< T > &ent)
Converts the minMaxEntry<CString>.min_val and .max_val into a std::string to facilitate writing to th...
Definition: OperatorConsole.cpp:78
CString m_ini_file
fully-qualified filename for the Imatest ini file
Definition: PassFailSettings.h:215
entry< long > Mirrored_chart
Definition: PassFailSettings.h:126
CString group_name
The overall name for the pair.
Definition: PassFailSettings.h:54
std::vector< entry< CString > > ent_vec
Definition: PassFailSettings.h:193
entry< long > L_MTF50_delta2_gain_summary_all_dB_min
Definition: PassFailSettings.h:179
CPassFailSettings m_PFSettings
Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini.
Definition: OperatorConsole.h:278
Blemish blemish
Definition: PassFailSettings.h:211
entry< double > Low_pixel_saturation_fraction_max
Definition: PassFailSettings.h:125
entry< long > R_improve_H_dB_min
Definition: PassFailSettings.h:180
entry< long > Hot_pixels_max
Definition: PassFailSettings.h:160
entry< double > Relative_illumination_corner_diff_pct_max
Definition: PassFailSettings.h:164
bool b_isUsed
Indicates that this particular variable was found in the pass/fail file and thus should be displayed ...
Definition: PassFailSettings.h:65
entry< double > FOV_degrees_diagonal_min
Definition: PassFailSettings.h:122
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:169
entry< double > Optical_center_offset_X_max
Definition: PassFailSettings.h:162
entry< CString > passfail_ini_file_date
Definition: PassFailSettings.h:129
entry< double > Secondary_readout_1_outer_quadrant_delta_max
Definition: PassFailSettings.h:134
OISPassFail ois
Definition: PassFailSettings.h:212
entry< long > Color_expected_detected
Definition: PassFailSettings.h:120
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:144
bool b_enable
Indicates that the Blemish field was found in the pass/fail file.
Definition: PassFailSettings.h:171
entry< double > MTF50P_CP_weighted_mean_min
Definition: PassFailSettings.h:128
bool b_isUsed
Indicates that this particular variable was found in the pass/fail file and thus should be displayed ...
Definition: PassFailSettings.h:93
vecEntry< long > Blemish_size_pixels
Definition: PassFailSettings.h:155
CString name
the pass/fail variable (or key) name as given in the Imatest documentation
Definition: PassFailSettings.h:31
entry< double > Secondary_readout_1_outer_mean_min
Definition: PassFailSettings.h:132
minMaxEntry< double > Chart_mean_pixel_level_bounds
Definition: PassFailSettings.h:118
entry< long > Stepchart_expected_detected
Definition: PassFailSettings.h:141
entry< long > upside_down
Definition: PassFailSettings.h:142
entry< double > Relative_illumination_worst_corner_pct_min
Definition: PassFailSettings.h:165
entry< double > Convergence_angle_max
Definition: PassFailSettings.h:121
entry< long > Hot_pixel_clusters_max
Definition: PassFailSettings.h:159
entry< double > High_pixel_saturation_fraction_max
Definition: PassFailSettings.h:123
entry< double > Secondary_readout_1_outer_min_min
Definition: PassFailSettings.h:133
bool b_enable
Indicates that the SFRPlus field was found in the pass/fail file.
Definition: PassFailSettings.h:146
entry< double > Uniformity_RoverG_corners_pct_max
Definition: PassFailSettings.h:167
entry< double > Optical_center_offset_Y_max
Definition: PassFailSettings.h:163
entry< long > R_improve_ALL_dB_min
Definition: PassFailSettings.h:182
entry< long > Bayer_decode
Definition: PassFailSettings.h:117
entry< long > Defective_pixels_max_count
Definition: PassFailSettings.h:158
entry< double > Secondary_readout_1_outer_quadrant_mean_min_min
Definition: PassFailSettings.h:135
entry< double > MTF50P_ratio_min
Definition: PassFailSettings.h:127
SFRplusPassFail sfrplus
Definition: PassFailSettings.h:210
CString m_pass_fail_file
fully-qualified filename for the Pass/Fail file
Definition: PassFailSettings.h:216
entry< double > Uniformity_BoverG_corners_pct_max
Definition: PassFailSettings.h:166
CString name
The name to be displayed for this assembly of variables.
Definition: PassFailSettings.h:195
bool b_enable
The number of variables in this struct. This MUST be updated if new keys are added.
Definition: PassFailSettings.h:196

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

ImageAcquisition * COperatorConsoleApp::m_acq
protected

pointer to current acquisition object being used

Referenced by COperatorConsoleApp(), OnRunTest(), OnSetBlemish(), and OnSetSFRplus().

BlemishTest COperatorConsoleApp::m_blemish
protected

this will run the blemish tests

Referenced by InitBlemishThread(), OnBlemishDone(), and OnSetup().

FileAcquisition COperatorConsoleApp::m_blemishAcq
protected

raw data for blemish tests (no longer needed, now that live capture is working)

Referenced by AllocateImageBuf(), Init(), InitBlemishAcq(), InitBlemishThread(), OnSetBlemish(), and ReInit().

ThreadControl COperatorConsoleApp::m_blemishControl
protected

this is the thread control for running Blemish tests

Referenced by InitBlemishThread(), OnSetBlemish(), Quit(), and ReInit().

ImatestLibAcq COperatorConsoleApp::m_camera
protected
ImageAcquisition* COperatorConsoleApp::m_camera
protected
ThreadControl COperatorConsoleApp::m_cameraControl
protected

this captures images from the acquisition source

Referenced by InitCameraThread(), OnFrameReady(), OnRunTest(), OnSetDirectshowCamera(), OnSetImatestCamera(), and Quit().

ThreadControl* COperatorConsoleApp::m_cameraControl
protected

points to the current image source's control thread

char * COperatorConsoleApp::m_cameraImage
protected

buffer to hold a single image frame from the camera (will eventually be combined with m_fileImage)

Referenced by AllocateImageBuf(), COperatorConsoleApp(), InitBlemishThread(), InitSFRplusThread(), OnFrameReady(), OnRunTest(), UpdateResults(), and ~COperatorConsoleApp().

Config * COperatorConsoleApp::m_config
protected

pointer to current config struct to use

Referenced by COperatorConsoleApp(), Init(), InitBlemishThread(), InitSFRplusThread(), OnSetup(), and WriteINISettings().

Config COperatorConsoleApp::m_configRAW
protected

for using raw files: will eventually come from a dialog (uses hard coded values for now)

Referenced by Init().

Config COperatorConsoleApp::m_configRGB
protected

for using rgb data: will eventually come from a dialog (uses hard coded values for now)

Referenced by Init().

SimpleDirectShowAcq COperatorConsoleApp::m_directshow_cam
protected

live acquisition using a camera

Referenced by OnSetDirectshowCamera().

ThreadControl COperatorConsoleApp::m_DirectShowCameraControl
protected

Referenced by OnSetDirectshowCamera().

char * COperatorConsoleApp::m_fileImage
protected

buffer to hold a single image frame from the file (will eventually be combined with m_cameraImage)

Referenced by AllocateImageBuf(), COperatorConsoleApp(), InitBlemishThread(), InitSFRplusThread(), OnRunTest(), and ~COperatorConsoleApp().

AppFlags COperatorConsoleApp::m_flags
protected
int COperatorConsoleApp::m_height
protected

Referenced by Init().

image_source_t COperatorConsoleApp::m_image_source
private
ImatestLibAcq COperatorConsoleApp::m_imatest_cam
protected

live acquisition using Imatest acquire_image()

Referenced by OnSetImatestCamera().

ThreadControl COperatorConsoleApp::m_ImatestCameraControl
protected

Referenced by OnSetImatestCamera().

ModelessDialogThread * COperatorConsoleApp::m_jsonDlgThread
protected
CString COperatorConsoleApp::m_logFileName
private

Contains the file name for the log file (log file is filled with the contents of the log edit box upon app closure).

Referenced by SaveLog().

bool COperatorConsoleApp::m_passFailIsUnlocked
private

Indicates whether the administrator has chosen to unlock access to pass/fail settings for the duration that the executable runs.

Referenced by COperatorConsoleApp(), and OnPassFail().

CString COperatorConsoleApp::m_password
private

This contains the administrator password.

Referenced by COperatorConsoleApp(), and OnPassFail().

CPassFailSettings COperatorConsoleApp::m_PFSettings

Contains the pass/fail criteria given by the pass/fail file listed in imatest.ini.

Referenced by COperatorConsoleApp(), OnPassFail(), ReadPassFail(), and WritePassFail().

TestResults COperatorConsoleApp::m_results
protected
setup_settings COperatorConsoleApp::m_setup
protected
SFRplusTest COperatorConsoleApp::m_sfrPlus
protected

this will run the SFRplus tests

Referenced by InitSFRplusThread(), OnSetup(), OnSFRplusDone(), and UpdateResultsSFRplus().

FileAcquisition COperatorConsoleApp::m_sfrPlusAcq
protected

raw data for SFRplus tests (no longer needed, now that live capture is working)

Referenced by Init(), InitSFRplusAcq(), InitSFRplusThread(), OnSetSFRplus(), and ReInit().

ThreadControl COperatorConsoleApp::m_sfrPlusControl
protected

this is the thread control for running SFRplus tests

Referenced by InitSFRplusThread(), OnSetSFRplus(), Quit(), and ReInit().

AppStatus COperatorConsoleApp::m_status
protected
CString COperatorConsoleApp::m_stderrStr
protected

our copy of the contents of m_stderr

Referenced by OnUpdateStderr().

StderrThread COperatorConsoleApp::m_stderrThread
protected

Referenced by InitOutput(), OnUpdateStderr(), and Quit().

CString COperatorConsoleApp::m_stdoutStr
protected

our copy of the contents of m_stdout

Referenced by OnUpdateStdout().

StdoutThread COperatorConsoleApp::m_stdoutThread
protected

Referenced by InitOutput(), OnUpdateStdout(), and Quit().

ThreadControl * COperatorConsoleApp::m_test
protected

the current test being run (either &m_blemishControl or &sfrPlusControl)

Referenced by COperatorConsoleApp(), GetTestName(), OnFrameReady(), OnRunTest(), OnSetBlemish(), and OnSetSFRplus().

int COperatorConsoleApp::m_width
protected

Referenced by Init().


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