Home
Programmer`s Reference
Contents
1. BI SLO ee Oe Bp A Be Be 2 3 4 Measurement Array Measurement arrays are used within NeuroCheck for geometrical measurements created by function Gauge ROIs This function is capable of measuring relations between different regions Therefore its results cannot be assigned to individual regions and require a new data structure typedef struct unsigned int uiCount sPI_MEASVALUE pasMeasValue sSPI_MEASARRAY The structure elements have the following meaning Element Description uiCount Number of values in measurement array pasMeasValue Array of measurements A plug in check function must not change anything in this structure All elements are to be considered read only Individual measurements are described by the following structure typedef struct unsigned int uiNumber float fMeasValue LPSTR lpszName sPI_MEASVALUE The structure elements designate 56 NeuroCheck Programmer s Reference Element uiNumber fMeasValue lpszName 3 5 Symbolic Constants Description Identification number of the measurement Measurement value Can be modified for input objects Description of measurement as a zero terminated string this description is entered by the user For input data objects the contents of this string must not be changed by a plug in check function Creating a new output data object the plug in check function may assign the address of a static string inside the DLL to
2. Parameters uiIndex Index of plug in check function range 0 to return value of function PI_GetNumberOfFcts minus 1 psFctDesc Address of function info block The function has to fill this data structure with information about the function designated by uiIndex Return Value TRUE Function exists and its properties have been stored in osFctDesc FALSE Value of ui Index has been outside of the valid range sPI_FCT_DESC typedef struct version control unsigned int uiStructSize data unsigned int uiFunctionIld unsigned int uiHelpContext unsigned int uiNumOfInputData unsigned int uiNumOfOutputData uiSizeOfParameter uiNumOfViews unsigned in unsigned in ata oct unsigned in uiDataOutput pointer data int piTypeOfInputData int piTypeOfOutputData int piMaskFileOutput ine piMaskRs2320utput strings LPSTR lpszFunctionName LPSTR lpszDescription PSTR PSTR PSTR PSTR PSTR EE YE IA functions FNPluginFctInitialize FNP lugInFctExecute FNPlugInFctUnInitialize FNP lugInFctParameterDlg FNPlugIinFctViewCreate FNPlugInFctViewDestroy uu ae e ty o sPI_FCT_DESC Quick Reference 187 lpszHintPos lpszHintNeg alpszCustomViewNames alpszInputViewNames alpszOutputViewNames pfnInitialize pfnExecute pfnUnInitialize pfnParameterDlg pfnViewCreate pfnViewDestroy Describes capabilities and properties of a plug in check function
3. CIA Control Image Acquisition Meaning General Failure Set property failed Get property failed Method failed Automation failure Meaning General failure Not available for Runtime version Not available for Demo version Only available in Live mode Only available in Automatic mode NCheck not configured for OLE automation No check routine loaded Device not available not configured Index out of range Index of device out of range Index of input output bit out of range Row index out of range Column index out of range Unknown value for constant Check function has no target values Check function has no parameters 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 39 36 37 38 39 40 41 Quick Reference 215 Check function has no result Input structure invalid Input type invalid Could not set input value Input value invalid Element is read only File not found Cannot save check routine protected by password Cannot overwrite check routine protected by password Path not found Invalid dimensions for application window Not available under current security settings General failure for accessing device Error in SafeArray operation Invalid structure for SafeArray setting Warning at least one check routine is configured for image transfer from File Cannot read file created by demo version Check routine was created using a plug in extensi
4. na Cancel Appts Help Figure 1 property page for loading a plug in DLL into NeuroCheck 14 NeuroCheck Programmer s Reference gm a Error loading of the DLL will be indicated by a red icon The comment column will contain Information about the error If output of a global debug log file is activated on page Debug details on the error will be written to the file Nclog txt Each successfully loaded plug in DLL can be activated or deactivated A deactivated DLL will not be used but remains loaded Selecting a DLL and clicking the Remove button removes the DLL from the list The order of loading different DLLs depends on the order in the list of plug in DLLs This may be important if some plug in DLLs depend on each other The order of loading the DLLs can be changed with the arrow buttons Selecting a certain DLL in the list and clicking the Info button opens a message box with information about the DLL 1 2 Information About a Loaded Plug In DLL After successfully loading a plug in DLL the NeuroCheck Help menu will contain a new menu item About Plug In DLL Choosing this menu item displays a sub menu list with the names of all loaded plug in DLLs The names of not activated DLLs will be disabled Choosing the name of a activated DLL opens a message box with information about the DLL The appearance of this message box is defined by the programmer of the DLL Usually it will contain name version and purpose of the DL
5. Pl_GetNumberOfDataTypes extern C unsigned int WINAPI PI_GetNumberOfDataTypes void Informs NeuroCheck about the number of data types in the plug in DLL Return Value Returns the number of data types for which NeuroCheck has to allocated info blocks Pl_GetDataTypeDesc extern C BOOL WINAPI PI_GetDataTypeDesc unsigned short int uilIndex sPI_TYPE_DESC const psTypeDesc Informs NeuroCheck about the properties of a custom data types from the plug in DLL Parameters uilIndex Index of plug in data type range 0 to return value of function PI_GetNumberOfDataTypes minus 1 psTypeDesc Address of info block The function has to fill this data structure with information about the data type designated by ui Index Return Value TRUE Data type exists and its properties have been stored in osTypeDesc FALSE Value of ui Index has been outside of the valid range sPI_TYPE_DESC typedef struct version control unsigned int uiStructSize data unsigned int uiTypeld int ilIconIndex 188 NeuroCheck Programmer s Reference strings LPSTR lpszTypeDesc function pointer PFNPlugInTypeDataOutput pfnDataOutput PFNP lugInTypeDestroy pfinTypeDestroy sPI_TYPE_DESC Describes capabilities and properties of a plug in data type 9 2 Plug In Check Function Declaration This section lists the declarations required for the routines making up a plug in check function The routines of your plu
6. This section lists the properties of the CheckRoutine object All constants are listed in ncauto h Note C C programmers must access the properties as follows ptrObj gt GetPropertyName for reading a property ptrObj gt SetPropertyName NewValue for setting a property not available for read only properties The ptrObj placeholder represents a pointer to the NCApplication object PropertyName the name of the property and NewValue the new value the property is set to ActiveScreenLayout The ActiveScreenLayout property sets or returns the index of the screen layout of the automatic screen Syntax object ActiveScreenLayout value The object placeholder represents the CheckRoutine object OLE Automation 117 Return Type VT_l2 Remarks The ActiveScreenLayout property can only be changed in automatic mode ActiveScreenLayoutName The ActiveScreenLayoutName property returns the designation of the currently used screen layout of the automatic screen Syntax object ActiveScreenLayoutName The object placeholder represents the CheckRoutine object Return Type VT_BSTR Remarks The ActiveScreenLayoutName property is only accessible in automatic mode Application The Application property returns the application object Syntax object Application The object placeholder represents the CheckRoutine object Return Type VT_DISPATCH Author The Author property returns or sets the information about the author of the
7. Argument Type Description FileName VT_BSTR Name of the new file optionally including path Remarks The SaveAs method does not verify whether the saving operation overwrites an existing file unless this file represents a check routine protected by a password In this case the check routine cannot be saved and SaveAs returns FALSE Collection Properties and Methods The CheckRoutine object provides parts of the functionality of a collection object Therefore one additional property and one additional method are available _NewEnum Property The _NewEnum property provides an enumerator object that implements IEnumVARIANT It is used by collection handling like the For Each loop in Visual Basic OLE Automation 125 Return Type VT_DISPATCH Example The following Visual Basic example displays the name of each individual check of the check routine in a message box Dim SingleCheck As Object For Each SingleCheck In CheckRoutine MsgBox SingleCheck Name Next SingleCheck Item Method The Item method returns the given individual check object from the collection specified by argument SCIndex If no check object is available for argument SC ndex the Item method returns VT_EMPTY Syntax object ltem SCindex The object placeholder represents the CheckRoutine object Return Type VT_DISPATCH Argument Type Description SCIndex VT_VARIANT Indicates the individual check object to be returned Remarks If SC
8. Clear clipboard Clipboard Clear OLE Automation 161 Copy image of check to clipboard If SingleCheck CopyImageToClipboard intImageIndex _ NC_CF_COLOR_DIB intZoom Then now assign contents of clipboard to Picture property of PictureBox control pBox Picture Clipboard GetData End If Assign object variable for appropriate check function Define ROI Read paramters of check function Define ROI Dim iLeft iTop iRight iBottom With CheckFunction iLeft GetParameterItem 0 0 intZoom 100 iTop GetParameterItem 0 1 intZoom 100 iRight GetParameterItem 0 2 intZoom 100 iBottom GetParameterItem 0 3 intZoom 100 End With Draw the rectangular ROI pBox ScaleMode vbPixels pBox Line iLeft iTop iLeft iBottom RGB 0O 0 255 pBox Line iLeft iTop iRight iTop RGB 0 0 255 pBox Line iRight iBottom iLeft iBottom RGB 0 0 255 pBox Line iRight iBottom iRight iTop RGB 0 0 255 7 8 7 Access Digital Inputs and Outputs The following source code excerpt shows how to read a digital input start execution and set a digital output depending on the execution s result Const BoardIndex As Integer 0 Index of digital IO board Const InputIndex As Integer 0 Index of digital input to be read Const OutputIndex As Integer 1 Index of digital output to be set Dim varInputValue As Variant Value of digital input Verify if digital IO board is configured in NeuroCheck If
9. Return type VT_VARIANT Arguments None Returns an element of the check function s parameter matrix Return type VT_VARIANT Arguments VT_I2 Row Row index of element in parameter matrix 206 NeuroCheck Programmer s Reference GetParameters GetResultItem GetTargetValuelIt GetTargetValues HasCurrentResult HasParameters HasTargetValues SetParameterItem m VT_I2 Col Column index of element in parameter matrix Returns safearray containing the current parameter settings of the check function Return type VT_VARIANT Arguments None Returns an element of the check function s current result matrix requires at least one execution in automatic mode Return type VT_VARIANT Arguments VT_I2 Row Row index of element in result matrix VT_I2 Col Column index of element in result matrix Returns an element of the check function s target value matrix Return type VT_VARIANT Arguments VT_I2 Row Row index of element in target value matrix VT_I2 Col Column index of element in target value matrix Returns safearray containing the current target value settings of the check function Return type VT_VARIANT Arguments None Returns TRUE if the check function returns result values to the controller Return type VT_BOOL Arguments None Returns TRUE if the check function makes its parameter settings available to the controller Return type VT_BOOL Arguments
10. lt xsl value of select display gt lt xsl template gt the result will be The parameter Barcode type has been set to 2 which means EAN 8 Branchings Using the XSL elements lt xsl if gt lt xsl choose gt lt xsl when gt or lt xsl otherwise gt it is possible to make XSL statements conditional e g dependent on the value of XML attributes Example lt xsl template match nc parameter gt lt xsl choose gt lt xsl when test type list gt lt do something with this list gt lt xsl when gt lt xsl when test type vector gt lt do something with this vector gt lt xsl when gt lt xsl otherwise gt lt this seems to be neither list nor vector gt lt usl otherwise gt lt xsl choose gt lt xsl template gt Including images It is recommended to store included image files in the subdirectory XSL Images under the NeuroCheck installation directory and access them using an absolute directory specification For this use the XML element created_by_dir which contains the NeuroCheck installation directory e g C Program Files Ncheck Example lt img gt lt xsl attribute name src gt lt xsl value of select nc created_by_dir gt XSL Images clock gif lt xsl attribute gt lt img gt The absolute directory and the file name are concatenated by XSL 184 NeuroCheck Programmer s Reference e HTML If you want to use HTML tags in the XS
11. The recent version of the XSL syntax is only recognized by IE 6 0 and higher If you want to make use of some of the latest features of XSL you have to change the namespace declaration as follows lt xsl stylesheet xmlns xsl http www w3 org 1999 XSL Transform gt Please note that for this namespace the syntax of some XSL instructions for example the syntax of the test condition has to be changed e Element lt xsl1_description gt This element is situated near the top of the XSL file within the root node template This element and its child elements are evaluated when the XSL file is incorporated into NeuroCheck to display its contents in the list of XSL files These elements should therefore be used in their existing form and filled with your own data when you create your own XSL files e lt xsl1 template gt elements Display of the check routine data is done using XSL templates From a programmer s point of view these can be seen as subroutines that call each other It is advantageous to use separate templates for the check routine an individual check a check function and the parameters In the following example you will see how the template for an individual check makes use of the templates of all subordinated check functions lt xsl template match nc single_check gt lt xsl apply templates select nc cf_list nc check_function gt lt xsl template gt e Access to XML check routine data In order to access the check ro
12. exist for every plug in check function If the parameter dialog routine is missing pfnParameterD1g has to be assigned a NULL pointer If the custom visualization is missing pfnViewCreate and pfnViewDestroy have to be assigned a NULL pointer and uiNumOfViews has to be assigned a value of 0 2 7 Structure of a Plug In Data Type This section describes the possible capabilities of plug in data types and the declarations of the routines related to it A plug in data type is implemented through two distinct routines 1 Data output routine 2 Destroy routine The names of these functions are unimportant because NeuroCheck calls them through function pointers in the type description structure The declarations though are fixed All routines must exist for every plug in data type 2 7 1 Capabilities of Plug In Data Types Plug in data types can be used for passing arbitrary data between plug in check functions of the same DLL Each data object can be of in principle unlimited size NeuroCheck manages this data object as pointer Only the DLL routines themselves can change the data object so that the programmer of a plug in DLL can rely on NeuroCheck never to interfere with the inner workings of the object Plug in data types offer a convenient way to pass on arbitrary data to another plug in check function Using the view routines of the plug in check function this data can be visualized in NeuroCheck The data output routine enables output of th
13. lt 5 itt set values psTv i fRefValue 1 1f psTv i fLowTol 0 1f Tle gts eofor SAFEARRAYBOUND rgb 5 sizeof sNcGchkTargetValue 0 create a 1 dimensional safearray SAFEARRAY psa SafeArrayCreate VT_UI1 1 rgb if psa void pData SafeArrayAccessData psa void amp pData serialize the data into the char array memcpy pData psTv rgb gt cElements sizeof char release SafeArrayUnaccessData psa now pack the data into the VARIANT VARIANT arg VariantInit amp arg arg vt VI_UI1 VT_ARRAY arg parray psa transmit 170 NeuroCheck Programmer s Reference if FALSE pICf gt SetTargetValues arg TRACEO error n eoif psa delete psTv break eof case NC_FCT_GCHK default break eof function ModifyTargetValues 7 9 8 Check Function Result The following source code sample demonstrates how to read out the result of a check function after execution in automatic mode Function Identify Bar Code uses a simple structure to transfer its result data function Evaluate Classes an array of result values void ReadResult ICheckFunction pICf read current result data VARIANT arg piICf gt GetCurrentResult error check data is transfered between server and controller hidden in a safearray if arg vt VT_UI1 VT_ARRAY TRACEO error invalid return value n
14. 2 1 Driver Initialization cccceceeeceesceeseeececeeeceeeeseenseeeseeseeeseeeseeesees 87 62 2 Driver Setipias cueindi ti aushencathonin a tiaoeneedteeeis 87 6 2 3 Driver Testenine nenna esis Pathe See hee eee Ba 87 Remote Control Functions ccccceccesessecsseeseeeeeeeseceseceseessecseeeseeeseeseenseeees 88 6 3 1 Test for Start Signal 0 0 eeceescesecsecseceseeeeeeseceeeeeeneeneeneeneees 88 6 3 2 Retrieve Check Routine Selection Signal ccceceeseeeseeteeeeees 88 Result Output FUNCTIONS esines iit a i iE EER 88 6 4 1 Final Check Results vc 4 100 aeaucdiviegin aes iese NE ay 88 6 4 2 gt Floating Point Valitse ninian ineei RRB een alas 88 6 4 3 Integer Valtie 0 E E E 89 GAA SUID ere iraa r a Pal agai aa a Mee ev itiedtaastias 89 6 4 5 Actuating Transmission ccccesceseeseeseceeeeeeeseenseeseeeseeeseessees 89 OLE Au t matio iis A e n aea esti aata pda e a aaaeei seabed 91 Introd ction n aostrian ai iedera ai 91 REL Whati OLE mhirean ennan a Meterieiwnaet 91 7 1 2 What is OLE Automation 00 0 cccccceseeseeeceeeeeeseeeseenseeseeeseeeeens 91 7 1 3 Applications of OLE Automation in NeuroCheck ce 93 7 1 4 Capabilities of the NeuroCheck OLE Automation Interface 93 TAS Restrictions reserare e E Ra 94 7 1 6 Preparing NeuroCheck for Control by OLE Automation 94 7 1 7 Programming Language ccccesesseesseeseesseeeeeeeeeeeeeeseeeneeneeseeeas 95 7 1 8 Using Type
15. 3 Identify DataMatrix Code oo ce eeccesceeseeseeeseeeeeeseeeeeeeesseesseesees 149 BRAS Qount ROI vee fesse seeds cases caccaeis santaaetta doves testy ses wtauesie Meta 150 Td Evaluate Classes 2 siuinasinecuiabsc devise teen Mines 150 7 7 6 Check Allowances inneni k Bele eine a a a 151 TAi WEOPYe ROMS ae mne ea Tea e e a deg eas a e N 152 7 7 8 Determine Position no inina a E aR aE 152 TEI Capture TMa Seniora iT eTA E E E EEE 153 FIIO Transfer Image sens cdeten nnn T eee 153 7 7 11 Determine Thresh ld mmoisncosinnciccesis ieena 153 gR O DI TaT O I E E leds eA E 154 FEIS AClassiby ROIS en es eR A E R Aa 154 ERIA Sereen ROS 3 oe a aca E A E E 154 Tlos Rotate IMAG Srecna eiai ae e Al Pie a EES 155 FING Template Matching ii ccc islet anna n r a tea 155 7 8 Source Code Samples for Visual Basic cc ccccsscssesseeseesseseeseesesseeseeseesees 156 7 8 1 Attach and Detach Server Open a Check Routine 00 156 Contents 7 8 2 Access Single Checks and Check Functions cceceseereeees 158 7 8 3 Automatic Mode Execution ccccccesceeseeeseeeeeseeeteeeteesteeeeeeaes 158 7 8 4 Check Function Result ccececcccsesseesseeseeeteeeseesseeseeeseeneeeaes 159 7 8 5 Check Function Target Valutes cccccceccesseesceeseeeseeeseeseeeteenees 159 7 8 6 Display Image cececccecceesceeseeececseeeseeeseceseeeseeeeeeesteeeseeeseesees 160 7 8 7 Access Digital Inputs and Outputs 0 ce ceecesceeseeteeee
16. Assign object variable CheckFunction 1 Verify check function If CheckFunction FunctionID lt gt NC_FCT_GCHK Then Exit Function Dim Dim Dim Dim row As Integer strNameTarget As String strNameResult As String varResultValue As Variant With CheckFunction verify size of target and result matrix If RowsOfTargetValueMatrix lt gt RowsOfResultMatrix Then Exit Function End If For row 0 To RowsOfTargetValueMatrix 1 only change nominal value if it is used in GCHK If GetTargetValueItem row 0 Then compare names of measurement just to be sure strNameTarget GetTargetValueItem row 1 strNameResult GetResultItem row 0 If StrComp strNameTarget strNameResult lt gt 0 Then MsgBox Names differ for row amp CStr row End If get result value varResultValue GetResultItem row 1 set target value If Not SetTargetValueItem row 2 varResultValue Then MsgBox Could not set target value for amp strNameTarget End If End If Next row End With 7 8 6 Display Image The following source code excerpt shows how to copy a complete image in DIB Device Independent Bitmap format to the clipboard and how to assign the contents of the clipboard to a PictureBox control of the controller form It also shows how to read the parameter setting of check function Define ROIs in order to manually draw the corresponding ROI Get index of image and zoom factor or use constant NC_ZOOM_xxx
17. Classify ROIs or Identify bar code compute string values If a custom communication interface has been selected as destination device for the results of such a function NeuroCheck will call a function TransferString for every value to be transmitted The function is declared as extern C void TransferString char pChar unsigned int uiNumOfChars In pChar NeuroCheck passes the starting address of the string to be transmitted in uiNumOfChars the number of valid characters 6 4 5 Actuating Transmission For performance reasons it may be advisable not to perform an actual transmission in the transfer functions described above but instead to buffer the data passed to these functions internally in the DLL To enable programmers to optimize their DLL in such a way NeuroCheck calls a Flush function at the end of a check routine run when any output has been directed to a custom communication interface The function is declared as extern C BOOL Flush void The programmer can then use this function to perform the actual transmission A return value of 1 indicates to NeuroCheck that communication has been executed without problems whereas a return value of 0 indicates communication failure If a system log output window exists on the automatic screen NeuroCheck will report this failure 7 OLE Automation 7 1 7 1 1 This chapter documents the OLE automation interface exposed by NeuroCheck and contains excerpts from the NeuroCheck exam
18. If this device is a custom communication interface it will call a function declared as follows extern C BOOL TestStart void As long as this function returns 0 NeuroCheck continues polling Upon a return value of 1 NeuroCheck will start the check routine or wait for a check routine selection signal see below The function must be exported explicitly from the DLL NOTE this function can be used to start a check a predefined number of times automatically by using an internal counter to decide whether to return 1 or 0 6 3 2 Retrieve Check Routine Selection Signal When NeuroCheck has received a Start check signal in automatic mode and the Check routine selection signal is activated in the Remote Control dialog it will poll the device selected for this signal periodically If this device is a custom communication interface it will call a function declared as follows extern C BOOL GetTypeId unsigned short int pTypelId As long as this function returns 0 NeuroCheck continues polling Upon a return value of 1 NeuroCheck will try to load the check routine with the identification number returned in pTypelD The function must be exported explicitly from the DLL The valid range for check routine identification numbers is 0 to 99999 i e every positive integer that can be represented by five digits 6 4 Result Output Functions 6 4 1 Final Check Result After completing a check routine run NeuroCheck will send the final result of th
19. It takes three arguments the first one specifiying the field bus board the second one the number of bytes 1 byte 8 bits to be set the third one a pointer to a byte array filled with the new values of the output bytes The function returns TRUE if the output image could be set or FALSE if an error occurred Parameters iBoardIndex Index of field bus board iByteCount Number of bytes to be set length of output image buffer pbyOutputImage Pointer to new output image data length of buffer iByteCount 4 2 Bitmap Management Bitmap formats are essential for displaying images in Windows applications In order to free the plug in DLL programmer from implementing these formats himself the API provides several functions which allow convenient management of bitmaps A bitmap is passed as bitmap handle which basically can be seen as pointer to a bitmap object The bitmap objects created by the NeuroCheck API are kept within the API DLL The API also provides functions to retrieve certain information about the existing bitmap objects In order to release bitmap objects not used any longer the respective API functions must be used In any case all objects are released upon unloading Ncapi dll For convenient management of bitmaps the API provides the following functions CreateMonoBitmap extern C WINAPI HBITMAP CreateMonoBitmap int iWidth int iHeight int iZoom BYTE pbyGrayValues BOOL bOverlayColors The Creat eMonoB
20. Libraries secsnenensncerinn niiin 95 NeuroCheck Programmer s Reference 7 3 NCApplication Object cccecccessesceesceeseceeceeecseeeseensecnseceeeeeeeeeeeteeneeeseesees 96 7 3 1 Properties isha Seek ee Rai eran an eae 96 TBD Methods ar en a a r a ra heater lanes 109 7 3 3 aaao I ENE TA T T 116 TA CheckRoutine Obect sc ccssssescsseecicssgeenssnacusbevesssuscevevedadeanessivetdseevemesiiees 116 7 4 1 Properties 23 cee esscses nnen i a ess 116 PAD Methods dssdo a a e a a ee ei 123 7 4 3 Collection Properties and Methods cccesscesseeseeteeeteeeteeeees 124 PAA Wrapperininid dihaitivcicenntiieus cae eed bales Sevens 126 TS Singl Check Object x ete cces sisi toevtdeeessceereaustivten wade n a ses 126 7 5 1 Propertie sennen fetter ak i eae ee T EA 126 Dd Methods trestat igi hie aaia aa ai a a ees 130 7 5 3 Collection Properties and Methods ss sesseseesessesseseeserseeseese 133 POA Wrapper E E hh E codes adore Semis 135 7 6 CheckFunction object cccccccccccscesscessceseeeeeeseessecseeseeeseceaeceeeseeesseeereestens 135 7 6 1 Properties escc e08 et ieee eee eee cee eee 135 7 6 2 gt Methods icra sheet EAE A E E E tails 140 7 6 3 WLapPer cities eaten hentia n GAs E a E E ot On es 147 7 7 Check Functions with Additional Automation Functionality 147 7 7 1 Data Exchange ccccesccsscesseesseeseceteeseceseeeseeeeeeesseenseenseeeneeaees 148 TID Identify Bar Code sinsear aeta a aie 149 7 7
21. N PI_GE Data Types and Definitions 59 Maximum difference of gray levels inside region Description Average gradient inside region Maximum gradient inside region Standard deviation of gray levels inside region Description Average curvature Standard deviation of curvature values Minimum curvature Maximum curvature URV_CONTRAST Maximum amplitude of curvatures along the contour Results of Determine Position Constant PI_POS_OFFSET_X PI_POS_OFFSET_Y PI_POS_ROT_ANGLI Gl PI_POS_PIVOT_X PI_POS_PIVOT_Y Description Offset in X direction calculated by Determine Position Offset in Y direction calculated by Determine Position Rotation angle calculated by Determine Position Pivot X for Determine Position Pivot Y for Determine Position Results of Template Matching Constant PI_GEN_COR_QUALITY Description Quality correlation coefficient of region with its template PI_GEN_COR_SUBPIX_X X coordinate of region found by subpixel template matching PI_GEN_COR_SUBPIX_Y 60 3 5 3 NeuroCheck Programmer s Reference Y coordinate of region found by subpixel template matching PI_GEN_COR_ANGLE Angle of rotated template T Results of Classification Constant Description PI_GEN_CLASS Number of class determined by classifier or any other function which generates class information PI_GEN_CLASSQUALITY Quality of cl
22. PI_BNDAOI_COMPACT Description Area of region Circumference of region Form factor of region defined as Area 4 1 Circumference maximum value 1 for ideal circles else smaller PI_BNDAOTI_FIBRELENGTH Approximate length of a line following the shape of the region holding equal distance to both edges PI_BNDAOI_FIBREWIDTH Sum of distances from the fibre to both edges PI_BNDAOI_ELONGATION Border Contact Constant PI_AOI_ANY PI_AOI_UP PI_AOI_DOWN PI_AOI_LEFT PI_AOI_RIGHT Ratio of fibre length to width Description Region touches any image border Region touches top border of image Region touches bottom border of image Region touches left border of image Region touches right border of image Number of Enclosed Objects Constant PI_AOI_HOLI Gl n Gray Level Statistics Constant PI_ALL_ MEAN PI_ALL_ MIN PI_ALL_ MAX PI_ALL SIGMA Description Number of holes enclosed in the region Description Average gray level inside region Minimum gray level inside region Maximum gray level inside region Standard deviation of gray levels inside region PI_ALL_ CONTRAST Gradient Statistics Constant PI_ALL_GRADMEAN PI_ALL_GRADMAX PI_ALL_GRADSIGMA Curvature Statistics Constant PI_GE URV_MEAN PI_GE URV_SIGMA PI_GE URV_MAX Cc C CURV_MIN G Cc N N PI_GEN N
23. Range Undersampling Min edge height Target Value Check target code Target string Result Value DataMatrix code string 7 7 4 Count ROIs Function Count ROls allows target value setting and result data retrieval through OLE automation The pertaining structures are defined in Ncauto h 7 7 5 Target Value Check count Minimum Maximum Result Value Count Evaluate Classes 0 3 0 4 0 5 0 6 0 7 Item 0 0 0 1 Item 0 0 Item 0 0 0 1 0 2 Item 0 0 NeuroCheck Programmer s Reference VT_l4 VT_l4 VT_l4 VT_l4 VT_l4 Type VT_BOOL VT_BSTR Type VT_BSTR Type VT_BOOL VT_l4 VT_l4 Type VT_I4 Approximate code size in pixels 30 999 Reference angle Possible settings are defined in Ncauto h Range of angle 0 180 Sub sampling parameter 1 9 Contrast required for edges 10 255 Description If TRUE identified bar code is compared to target string DataMatrix code string to be present on the part Description String representing the identified DataMatrix code Description If TRUE number of ROIs in first group is compared to target value Minimum number of ROIs required in first group Maximum number of ROIs allowed in first group Description Current number of ROIs in first group Function Evaluate Classes allows target value setting and result data retrieval through OLE automation The pertainin
24. Serial interface manufacturer lt Back Cancel Help Figure 9 first page of hardware wizard for custom communication 84 NeuroCheck Programmer s Reference On the next page you have to enter the full path name of the device driver DLL or select it via the Browse button The you have to enter a descriptive string This string is used in the Device Manager to designate the interface and is mandatory Note that only a single custom communication DLL can be loaded at any time Hardware Wizard Page 2 Custom Communication Dey C Program Files Ncheck CustomComm DLL Custom Communicatior Figure 10 second page of hardware wizard for custom communication The final page of the Hardware Wizard merely informs you about the settings you have made on the previous pages Choosing Finish loads and tests the device driver DLL 6 1 2 Transmitting Data via the Custom Communication Interface In order to transmit data via the custom communication interface it has to be activated globally by checking the Destination custom comm device box on the Output page of the check routine window Custom Communication Interface 85 E Structure EF Input E Output Flow Check routine empty O Destination result file global mi Destination bitmap file go Destination serial interface ve Target custom comm device J Check Nr 1 Transfer image E Bitmap File Ta Fet modify image Th Fet crea
25. VT_BOOL Arguments VT_BSTR FileName Name of the check routine Closes check routine and exits application Return type None Arguments None Reads current state of a digital input Returns Boolean value for state of input or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of digital I O board VT_I2 InputNumber Number of input to be read ReadDigitalInputWord ReadDigitalOutput Reads current state of all 16 digital inputs of one board Returns decimal value of binary number encoding the state of 16 inputs or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of digital I O board Reads current state of a digital output Returns Boolean value for state of output or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of digital I O board VT_I2 OutputNumber Number of output to be read ReadDigitalOutputWord Reads current state of all 16 digital outputs of one board Returns decimal value of binary number encoding the state of the 16 outputs or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of digital I O board Quick Reference 201 ReadFieldBusInputBit Reads current state of an input bit of a field bus device Returns Boolean value for state of input bit or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of field bus board VT_I2 InputNum
26. a check function The parameter can be identified by its attribute id see also the corresponding files in the subdirectory Docs Xm1 of the NeuroCheck installation directory The same applies to the elements input_parameter output_parameter and window_parameter which represent the parameter settings of some other NeuroCheck objects Check routine in XML format 179 Parameter elements where the attribute type has the value type Vvector type list or type array contain arrays with a fixed or variable number of child elements This is the case for example for lists of objects or group wise parameter settings 8 2 11 Notes on element attributes In the following some attributes are described that have a similar meaning within several elements Example 1 lt cf_write_to_file name File output display Yes gt 1 lt cf_write_to_file gt Example 2 lt parameter id 53601 name Barcode type display EAN 8 gt 2 lt parameter gt Example 3 lt parameter id 50607 name Manual Threshold disabled 1 gt 100 lt parameter gt e Attribute name This attribute contains a plain language description of the element in example 1 File output This description is easier to understand for a human than the element name cf_write_to_file in example 1 In the case of check function parameters example 2 the attribute contains the designation of the parameter to be set in the dialog Barcode type The content of this attribute
27. allocates memory for the parameter area and executes the initialization routine of the plug in check function This initialization routine can provide services like setting default parameters opening communication channels initialize hardware etc The following figure illustrates the process The solid arrow going out from the initialization routine indicates that the routine is actually executed at this point for example to set parameter values NeuroCheck Plug In DLL Plug in function list Check Routine Info block function 1 Check Functions routine routine i routine Function object routine Function k _ Name Info block Parameter block function k Toe one Initialization routine Pointer gt i routine Execution routine init routine Deinitialization rout routine Dialog routine Pointer ial routine routine Info block routine function n routine routine Figure 8 initialization of plug in check function Setting Plug In Check Function Parameters If the plug in check function owns a parameter area and a dialog routine NeuroCheck will call this routine under the same conditions as for a built in function e g upon choosing Parameters from the Check Function menu Dialog display parameter value update and management of the internal structure of the parameter area are the business of the DLL alone Using an unstructured buffer area NeuroCheck provi
28. an enclosing rectangle only PI_OBJECTCONTOUR ROI also contains a valid contour but no region PI_OBJECTREGION ROI also contains a valid contour and a valid region iWidth iHeight Width and height of enclosing rectangle psContour Description of the object contour psRegion iFitType fFitParameters iNumber iGroupNumber bValid ix LY fMeasurement iShapeType iSearchReg psPoints Data Types and Definitions 49 Description of the object region Description of a model geometry calculated for the ROI The model geometry can be identified by symbolic constants defined inpi_types h Array with parameters of the calculated model geometry See Model Geometries Number of region inside layer Group number of region Validity of object intended for user defined screening function These must not delete a region but declare it invalid by setting this element to FALSE NeuroCheck will remove all invalid regions when the layer structure is read back to the internal NeuroCheck format Coordinates of the top left corner of the enclosing rectangle for input objects coordinates of reference point for output objects see Creating a new Region of Interest Feature array Only array elements for which the corresponding element in the bMeasurement array of the layer structure is TRUE contain valid information Features can be identified by symbolic constants defined in pi_types
29. and the one expected by the DLL Unique identification number for the plug in data type NeuroCheck uses this number for various purposes among them identifying data types used by a plug in check function For this reason plug in data types inside a single plug in DLLs must not use identical type IDs NOTE type IDs of plug in data types must not interfere with the type IDs of NeuroCheck data types Therefore the IDs must be within a range limited by symbolic constants DATATYPE_ID_MIN and DATATYPE_ID_MAX declared in pi_types h All values outside this range are reserverd for use by NeuroCheck GmbH and partners The symbolic constants currently are defined to 0x1000 and 0x2000 which leaves 4096 entries for custom use Identification number of icon that will be used by NeuroCheck for the plug in data type If i IconIndex contains a negative value then NeuroCheck will display a default icon for the plug in data type Descriptive text for the plug in data type The pointers has to refer to a static data element in the DLL The length of the string must not exceed 40 characters Interface Description 43 2 8 3 Function Pointers The function pointer area of the type description block contains the following elements Element Description pfnDataOutput Pointer to data output routine pfnTypeDestroy Pointer to destroy routine of plug in data type The pointers have been defined using function types declared in p
30. bitmap GetBitmapNumColors extern C WINAPI int GetBitmapNumColors HBITMAP hBmp The GetBitmapNumColors function returns the number of colors in color palette of bitmap The function returns 1 on error Parameters hBmp Handle of bitmap Return Values 0 TrueColor bitmap 256 256 color bitmap 70 NeuroCheck Programmer s Reference 1 Error LoadBitmapFromFile extern C WINAPI HBITMAP LoadBitmapFromFile LPCTSTR lpszFilename The LoadBitmapFromFile function loads a specified bitmap file The function returns the handle of the loaded bitmap on success or NULL on error Parameters lpszFilename Name of bitmap file to be loaded SaveBitmapToFile extern C WINAPI BOOL SaveBitmapToFile HBITMAP hBmp LPCTISTR lpszFilename The SaveBitmapToFile function saves the given bitmap to file The function returns TRUE on success FALSE on error Parameters hBmp Handle of bitmap to be saved lpszFilename Name of bitmap file GetAdvMemPrtr extern C WINAPI BYTE GetAdvMemPtr unsigned int uiSize The GetAdvMemPt r function serves for passing large images faster to NeuroCheck It reserves memory space of size uiSize for the image pointers in the sPI_ IMAGE structure i e for the struct members pbyGrayValue pbyRedValue pbyGreenValue and pbyBlueValue The function returns the pointer address for the reserved memory block This address is read only and must be assigned to one of the aforementioned mem
31. board to be read and one to return an integer value encoding the states of the inputs The function returns TRUE if the input word could be read or FALSE if an error occurred Parameters iBoardiIndex Index of digital I O board piInputWord Pointer to integer value used to return decimal value of binary number encoding the state of 16 inputs ReadDigitalOutputWord extern C WINAPI BOOL ReadDigitalOutputWord int iBoardIndex int pOutputWord The ReadDigitalOutputWord function reads the current states of all 16 digital outputs of one digital I O board It takes two arguments one which specifies the digital I O board to be read and one to return an integer value encoding the states of the outputs The function returns TRUE if the output word could be read or FALSE if an error occurred Parameters iBoardiIndex Index of digital I O board pOutputWord Pointer to integer value used to return decimal value of binary number encoding the state of 16 outputs NeuroCheck API Functionality 65 SetDigitalOutputWord extern C WINAPI BOOL SetDigitalOutputWord int iBoardIndex int iOutputWord The SetDigitalOutputWord function sets all 16 digital outputs of a digital I O board at once It takes two arguments the first one specifying the digital I O board the second one holding the values of the bits The function returns TRUE if the outputs could be set or FALSE if an error occurred Parameters iBoardIndex I
32. check routine See Figure 18 118 NeuroCheck Programmer s Reference Syntax object Author value The object placeholder represents the CheckRoutine object Return Type VT_BSTR Comments The Comments property returns or sets the additional description of the check routine See Figure 18 Syntax object Comments value The object placeholder represents the CheckRoutine object Return Type VT_BSTR Count The Count property returns the number of individual checks in the check routine Syntax object Count The object placeholder represents the CheckRoutine object Return Type VT_l2 CurrentCheckResult The CurrentCheckResult property returns the result of the most recent execution of the individual check specified by argument SCIndex OLE Automation 119 Syntax object CurrentCheckResult SCindex The object placeholder represents the CheckRoutine object Return Type VT_BOOL Argument Type Description SCIndex VT_I2 Number of the individual check whose result is to be retrieved CurrentResult The CurrentResult property returns the final result of the most recent execution of the complete check routine Syntax object CurrentResult The object placeholder represents the CheckRoutine object Return Type VT_BOOL FileName The FileName property returns the filename of the check routine not including path Syntax object FileName The object placeholder represents the CheckRoutine object R
33. contained in the DLL NeuroCheck uses this number to allocate the required number of function info blocks The following function returns information about the capabilities of individual plug in check functions extern C BOOL WINAPI PI_GetFctCaps unsigned short int uilIndex sPI_FCT_DESC const psFctDesc It is called in a loop after PI_GetNumberOfFcts once for each function The loop counter is passed in ui Index counted from 0 up to the return value of PI_GetNumberOfFcts minus 1 In psFctDesc NeuroCheck passes the address of the allocated function info block for the current function Function PI_GetFctCaps has to fill in the information about the check function indicated by the index into the members of this info structure 2 2 6 Information about Plug In Data Types Plug in check functions may create and use user defined data objects The information about the data types of these objects is retrieved from the DLL in a similar way as the check function capabilities The two routines serving this purpose are extern C unsigned int WINAPI PI_GetNumberOfDataTypes void is called after the iteration over the plug in check function capabilites It must return the number of user defined data types used by the plug in check functions NeuroCheck uses this number to allocate the required number of data type info blocks The following function returns information about the properties of individual plug in data types extern C BOO
34. data exchange method used You will see in section 7 7 1 that there are some interface functions using the SafeArray concept for data exchange These functions can be used most effectively in C C Although they can be applied in other languages even pointer challenged languages like Visual Basic other means of data exchange are much simpler to program though less efficient 7 1 8 Using Type Libraries Type libraries contain information about data types interfaces member functions and object classes exposed by an OLE server NeuroCheck provides a type library called NCheck t1b It is essential for programming the OLE interface in C C but can also be very helpful for Visual Basic or Delphi programmers Including the type library in their projects enables early binding and automatic syntax checking by the compiler and allows for convenient use of NeuroCheck s on line help within the development environment of the programming language 96 NeuroCheck Programmer s Reference 7 2 Exposed Automation Objects The following table lists the automation objects exposed by NeuroCheck Subsequent sections explain the properties of these automation objects in detail Object name Description NCApplication Top level object provides a standard way for OLE automation controllers to retrieve and navigate low level objects CheckRoutine Provides a way to change the settings of a NeuroCheck check routine SingleCheck Gives access to the propert
35. data objects may not be valid and thus be assigned NULL pointers In manual mode the view routine is called directly after a call to the execution routine or upon changing settings of the currently displayed view in the Result View pane e g view index or zoom factor Please note that in manual mode NeuroCheck allows subdivision of the Result View pane into two horizontal panes and thus actually provides two views So directly after a call to the execution routine the view routine is always executed twice In automatic mode the view routine is called immediately after execution of the plug in check function once for each of the function s visualization windows The view create routine is allowed access to the plug in check function s context parameter set and input and output data Thus the function can react to the current settings and perform a custom visualization This may include visualization of input and output data of final or intermediate results or even of specific messages 2 6 The Function Info Block 2 6 1 Function PI_GetFctCaps uilIndex psFctDesc has to fill the function info block whose address is passed in psF ctDesc for every possible index ui Index with the characteristics of the respective plug in check function This section describes the structure of the function info block and the meaning of its members Function Info Block Declaration The function info block is declared as follows detailed explanations of
36. distance distance of search rays Smoothing smoothing parameter Scan direction value indicating scan direction Check sum if TRUE the function performs a check sum test Characters number of charactes contained in the bar code Target values Check target code if TRUE code is compared to target string Target string bar code string to be present on the part Result values Bar code string string with the identified bar code NeuroCheck Programmer s Reference Identify DataMatrix Code Function ID DMCI 552 Functionality Parameter values Target values Result values Count ROIs Function ID OBC 510 Functionality Target values Result values Evaluate Classes Function ID CLE 543 Functionality Target Values Result values Description Code type value indicating type of DataMatrix code Code color value indicating color of code dark or light Code quality value indicating quality of code good or poor Code size approximate code size in pixels Reference value indicating reference angle Range range of angle Undersampling sub sampling parameter Minimum edge height contrast required for edges Check target code if TRUE code is compared to target string Target string bar code string to be present on the part DataMatrix code string string with the identified code Description Check count if TRUE ROI count of first group is ver
37. function pParameter Address of parameter area reserved for the function ppvDynInput Address of array with PI_MAXDYNDATA pointers to input data objects Only as many pointers are valid as have been requested in the function info block ppvDynOutput Address of array with PT_MAXDYNDATA pointers to output data objects Only as many pointers can be used as have been requested in the function info block Return Value TRUE Execution has been carried out successfully FALS An error occurred during execution The current check will terminate with status not O K Pl Parameter Dialog Routine BOOL WINAPI ParameterDialog HWND hwndApp sPI_CONTEXT_INFO const psContext void const pParameter void const const ppvInputData Handles the parameter input dialog of the check function This routine is not required to exist for a plug in check function Parameters hwndApp Handle for NeuroCheck application window psContext Pointer to structure containing context information for function pParameter Address of parameter block reserved for the function ppvinputData Address of array with PI_MAXDYNDATA pointers to input data objects Only as many pointers are valid as have been requested in the function info block Return Value IDOK Dialog has been left with OK parameter data has changed IDCANCI Dialog has been left with Cancel no change of parameter data B i 190 NeuroCheck Programmer s Reference Custom Vi
38. h Type of new ROI declared as symbolic constants in pi_types h Size of surrounding area in pixels for new ROI Description of new ROI for output object NULL for input object The elements of the structure are seperated into three categories e read only elements e modify write elements e write only elements Read only elements must not be changed for input objects nor be assigned for output objects For input objects only modify write can be changed Creating a new output data object the plug in check function has to assign the modify write and write only elements in the structure A plug in check function altering modify write elements in the structure for an input object has following effects Modify element iNumber Purpose Changes sorting of regions 50 NeuroCheck Programmer s Reference iGroupNumber Changes group membership of regions bValid Assigning FALSE lets region be removed iX iY Changes position of region fMeasurement i Changes value of feature i 3 3 3 Object Contour Polylines and ROIs created dynamically by object segmentation usually have an object contour described by the following structure typedef struct int iXStart int iYStart int iLength BYTE pbyChain SPI_CONTOUR The structure elements have the following meaning Element Description iXStart iYStart Coordinates of the first contour point relative
39. have the final result of a check routine run automatically transmitted via the custom communication interface choose Remote Control from the System menu switch to the Output page activate the Check result signal choose Change and select the Custom Custom Communication Interface 87 communication interface indicated by the antenna icon from the Select Signal Destination dialog box NeuroCheck will then invoke function Set CheckResult as soon as a check routine run has been completed 6 2 Administrative Functions 6 2 1 Driver Initialization Upon loading the driver from the Hardware Wizard or during program start up NeuroCheck calls an initialization function The programmer of the communication DLL can use this initialization function to check for the presence of the required communication hardware open communication channels etc The function is declared as extern C BOOL DllInit void It has to return 1 for a successful initialization 0 else The function must be exported explicitly from the DLL 6 2 2 Driver Setup The DLL can contain and export a function declared as follows extern C BOOL SetupDevice HWND hwndAppMain If this function exists and the user chooses Properties in the Device Manager while the custom communication interface is selected NeuroCheck will call this function It receives a handle to the main application window so that the programmer of the communication DLL can display his own dialog fo
40. isn 178 8 2 0 Element bodya a ce EE yee ee ee 178 8 2 7 Element lt single_check gt sessessesssessesesssrseesessssessessessrsressesees 178 8 2 8 Element lt check_function gt esessesssesessessessrsresersrsseesessesresreses 178 8 2 9 Elements lt cf_parameter gt and lt cf_target_values gt eee 178 8 2 10 Element lt parameter gt eccecccecceseeseeeseeeeeeeesseessesseeeseesseenaes 178 8 2 11 Notes on element attributes ceccesceesceeseeeteeeseeeeeeseeeeeees 179 8 2 12 Element lt binary_stream_encapsulation gt s s s 179 8 2 13 Purpose of the individual parts 20 0 0 cceceeseeseeseeeeeeeeeseeeteeesees 179 8 3 Using XSL files as rendering filter for the XML data eeeeseereeeees 180 8 3 1 Purpose of the XSL files 1 0 0 ec ee eceeseeeseeseeeseeeeenseeeeeeseeeneeesees 180 8 3 2 Creation of your own XSL files ee ecceseeeseeseeeseeeteeeeenseesees 181 8 3 3 Notes on the included XSL files 2 0 0 eceeseeseeteeeteeseeteeesees 182 7 9 1 9 2 9 3 9 4 9 5 9 6 9 7 NeuroCheck Programmer s Reference Quick Reference i 0icci cider sities tidied dnd decane 185 Plug In Interface Administrative Functions and Structures c cesses 185 Plug In Check Function Declaration ccccccesceeseeeeesseeseeeseeeseeseeeseenseenes 188 Plug In Data Type Declaration cccececceesseeseeeseeeseeeeeeeeeseenseeeeeeseenatenes 190 Plug In Data Exchange Structures c cecccesseeseeeseesseeeeeesee
41. manually or automatically and certain parameters for each of the two cases 154 NeuroCheck Programmer s Reference Parameter Item Type Description Use manual 0 0 VT_BOOL If TRUE the function uses the manual threshold threshold which can be set by OLE automation else it performs automatic threshold computation Manual threshold 0 1 VT_l4 Value of the manual threshold to be used Valid range 0 255 Result image 0 2 VT_l4 Parameter used for automatic threshold computation to adjust the predominance of light or dark areas in the result image Valid range 0 100 Defect 0 3 VT_l4 Parameter used for automatic threshold suppression computation to suppress disturbances caused by very bright or very dark image regions Valid range 0 49 7 7 12 Define ROIs Function Define ROIs allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The elements of the parameter structure define the location of the ROI defined first ROI with ID 0 if this is a rectangular ROI Parameter Item Type Description Left 0 0 VT_l4 X coordinate of top left corner Top 0 1 VT_l4 Y coordinate of top left corner Right 0 2 VT_l4 X coordinate of bottom right corner Bottom 0 3 vT_l4 Y coordinate of bottom right corner 7 7 13 Classify ROIs Function Classify ROIs allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The elements of the parameter s
42. number of check functions in the check Syntax object Count The object placeholder represents the SingleCheck object OLE Automation 127 Return Type VT_I2 CurrentResult The CurrentResult property returns the final result of the most recent execution of the single check Syntax object CurrentResult The object placeholder represents the SingleCheck object Return Type VT_BOOL Description The Description property returns or sets the description text of a check See Figure 18 Syntax object Description value The object placeholder represents the SingleCheck object Return Type VT_BSTR LastFunction The LastFunction property returns the index of the last check function whose result was O K for the most recent execution of the individual check i e the last check function that did not cause an not O K either by a target value violation or because of an internal error Syntax object LastFunction The object placeholder represents the SingleCheck object 128 NeuroCheck Programmer s Reference Return Type VT_I2 Remarks LastFunction can be used to obtain information about which check function caused the not O K of an individual check If the LastFunction property returns 1 either the individual check has not been executed so far ErrorCode property of first check function returns 1 or the first check function of the individual check returned not O K ErrorCode property greater or equal
43. of first single check and display check functions that provide target values Dim CheckFunction As Object For Each SingleCheck in CheckRoutine For Each CheckFunction in SingleCheck If CheckFunction HasTargetValues then MsgBox CheckFunction Name amp has target values End If Next CheckFunction Next SingleCheck 7 8 3 Automatic Mode Execution The following source code sample demonstrates how to execute the check routine in automatic mode and how to retrieve the final result of the check routine Private Sub cmdStart_Click On Error GoTo Err_cmdStart_Click Start execution of NeuroCheck If Not NeuroCheck Execute Then Error occured on execution give acoustic warning and display message box Beep evaluate LastError property of NeuroCheck done in separate function called GetLastErrorString MsgBox Execute failed amp vbCrLf amp GetLastErrorString NeuroCheck GoTo Exit_cmdStart_Click End If Verify result of check routine If CheckRoutine CurrentResult Then Result was OK Else OLE Automation 159 Result was not OK End If Display identified barcode in Label control of form see below Display image in PictureBox control of form see below Display borders of ROI used to identify Barcode see below Exit_cmdStart_Click Exit Sub Err_cmdStart_Click MsgBox Error amp Err amp amp Error Resume Exit_cmdStart_Click End Sub 7 8 4 Check Function Result The foll
44. of this sample the check box Provide API functionality on page Plug In of the General Software Settings dialog box must be activated Read Digital Input Word This plug in check function demonstrates the reading of an input word from a digital I O board Set Digital Output Word This plug in check function demonstrates the setting of an output word for a digital I O board Save Bitmap This plug in check function demonstrates the creation of a bitmap object and the saving of the bitmap to file using the NcApi functionality For extended examples on creating bitmaps please refer to PI_Visualize Update Counter This plug in check function creates a meas array with a single measurement containing the value of the current count value It demonstrates the setting of the modified flag of the current check routine The function has a parameter set which is updated for each execution of the plug in check function In order to save the parameter block upon closing NeuroCheck or for a type change the modified flag is set to TRUE Modify Field Bus Output Image This plug in check function demonstrates the access of a field bus device using the NcApi functionality It shifts the bytes of the output image Create Fast Color Image This plug in check function demonstrates the creation of an image using the NcApi function GetAdvMemPtr Implementing a Plug In DLL 81 PI_Visualization This sample demonstrates the usage of custom result
45. or equal to 1 Syntax object InterfaceVersion The object placeholder represents the NCApplication object Return Type VT_l2 LastError The LastError property returns a value indicating the most recent error that occured in NeuroCheck Reading LastError resets the property to its initial value i e to zero The error codes are listed in the Quick Reference section of this manual Syntax object LastError The object placeholder represents the NCApplication object Return Type VT_I4 Remarks The LastError property encodes both a general error type and a detailed error number With ErrorType denoting the general error type and ErrorDetail denoting the detailed error number LastError is computed as follows LastError ErrorType 256 ErrorDetail OLE Automation 103 In effect the least significant byte of the return value contains the ErrorDetail number one byte higher you will find the ErrorType value Example The following Visual Basic sample code reads the LastError property and returns the corresponding type and detail numbers for the non Visual Basic programmers the denotes an integer division Mod a modulo operation do critical operation here e g opening a check routine get debug information Dim LastErrorNumber as Integer LastErrorNumber NCApplication LastError If LastErrorNumber lt gt 0 Then MsgBox LastError returned amp CStr LastErrorNumber _ amp E
46. output to be set a bit value of 0 causes it to be reset provided that the corresponding bit in the BitMask argument is set Example The following example will set output number 0 and number 3 and reset output number 1 but it will not alter any of the other 13 outputs Therefore BitMask is 0000 0000 0000 101 1 in 0x000Bhex 11 dec and BitStates is 0000 0000 0000 1001 bin 0x0009hex Idec If Not NCApplication SetDigitalOutputWord 0 11 9 Then MsgBox Could not set digital outputs End If SetFieldBusOutputBit The SetFieldBusOutputBit method sets an output bit of a field bus device It takes three arguments specifying the field bus board the output bit to be set and the state the output bit will be set to The method returns TRUE if the output bit was set successfully or FALSE if an error occurred Syntax object SetFieldBusOutputBit Boardindex OutputNumber NewState The object placeholder represents the NCApplication object 116 NeuroCheck Programmer s Reference Return Type VT_BOOL Argument Type Description BoardIndex VT_l2 Index of field bus board counted from 0 OutputNumber VT_l2 Number of the output bit to be set counted from 0 NewState VT_BOOL State to which the output bit will be set 7 3 3 Wrapper The Visual C ClassWizard will create the following wrapper class from the type library class INCApplication public COleDispatchDriver 7 4 CheckRoutine Object 7 4 1 Properties le
47. pData amp sTv rgb gt cElements sizeof char release SafeArrayUnaccessData psa now pack the data into the VARIANT VARIANT arg VariantInit amp arg arg vt VT_UI1 VT_ARRAY arg parray psa transmit if FALSE pICf gt SetTargetValues arg TRACEO error n eoif psa break eof case NC_FCT_OBC case NC_FCT_GCHK Check Allowances define in ncauto h advanced functionality an array of structs is serialized into the safearray OLE Automation 169 SAFEARRAY psa arg parray unsigned int uiNumOfElements psa gt rgsabound 0 cElements sizeof sNcGchkTargetValue TRACE1 Su struct elements n uiNumOfElements if 0 uiNumOfElements return access data sNcGchkTargetValue psTv SafeArrayAccessData arg parray void amp psTv for unsigned int ui 0 ui lt uiNumOfElements ui float fRefValue psTv ui fRefValue CString szName psTv ui szName TRACE2 Ss f n const char szName fRefValue release access SafeArrayUnaccessData arg parray notify system that safearray is no longer needed SafeArrayDestroy arg parray do something with the data launch a dialog for instance and let the user modify the target values fife BS SS Se Se Se Se See Se Se Se Se Se Se Se Se Se See se Ses alloc structures write e g 5 new target values psTv new sNcGchkTargetValue 5 for int i 0 i
48. public data gt e Data within the XML file that cannot be displayed usually binary data are within so called CDATA sections that begin with lt CDATA and end with gt 8 2 2 Overview of the structure of the XML file of a check routine NeuroCheck check routines in XML format are stored in files with the extension chrx These files contain the same information as the corresponding check routine files in binary format chr The format of the XML check routine file adheres to the syntactic specification of the XML meta language The formal definition of the used elements can be found in the files in the subdirectory Docs Xm1 of the NeuroCheck installation directory With some basic knowledge of XML and experience with NeuroCheck the arrangement of the XML elements is easily understandable allowing for a visual interpretation of the XML file or a comparison of two similar XML check routines in an editor The prolog part of the XML file contains a reference to an XSL file which is necessary for the visual rendering of the data Please refer to chapter 8 3 1 for more information The reference may look as follows lt xml stylesheet href C Ncheck XSL CHRX_Detailed xsl type text xs1 gt The main element of the XML file contains the check routine data represented by an XML element by the name of neurocheck_check_routine This and its constituent parts will be explained in the following sections 8 2 3 Sample F
49. results of Compute Features cannot be accessed directly is that this would increase execution time also for all users including those which do not use OLE automation at all Therefore the less often used function Copy ROIs was chosen to give access to the feature values As a consequence in order to read the result values of Compute Features through OLE automation an instance of check function Copy ROIs has to be inserted after function Compute Features in the check routine 7 7 8 Determine Position Function Determine Position allows result data retrieval through OLE automation The pertaining structures are defined in Ncauto h Result Value Item Type Description X Offset 0 0 VT_R4 Offset in x direction of the reference object in the current image to the stored reference point Y Offset 0 1 VT_R4 Offset in y direction of reference object in the current image to the stored reference point Rotation 0 2 VT_R4 Rotation angle of the reference object in the current image relative to the stored orientation Pivot X 0 3 VT_R4 X coordinate of current pivot point Pivot Y 0 4 VT_R4 Y coordinate of current pivot point OLE Automation 153 7 7 9 Capture Image Function Capture Image allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The elements of the parameter structure define the location of the image section to be transferred into memory Parameter Item Type Description Cam
50. routine is executed whenever one of the events occurs which would open the parameter dialog of a build in check function in NeuroCheck e g choosing Parameters from the Check Function menu 2 5 6 Custom Visualization Routines For custom visualization a plug in check function must register two routines the view create routine and the view destroy routine They have to be declared as follows BOOL WINAPI ViewCreate sPI_CONTEXT_INFO const psContext sPI_VIEW_INFO const psViewInfo HANDLE hView void const pParameter Interface Description 31 void const const ppvInputData void const const ppvOutputData BOOL WINAPI ViewDestroy sPI_VIEW_INFO const psViewInfo HANDLE hView For the view create routine NeuroCheck again passes the function s current context information in psContext and the address of its parameter block in pParameter In addition both visualization routines are passed specific information for visualization in psViewInfo The following structure is used by NeuroCheck for visualization information typedef struct unsigned int uiViewIndex unsigned int uiViewType unsigned int uiAddInfo int iExecuteErrorCode sPI_VIEW_INFO The structure elements have the following meaning Element Description uiViewIndex Index of custom view registered for plug in check function uiViewType Type of view Can have only one possible value declared as symbolic constant in pi_types h PI_VIEW_BITM
51. sho swi cas cas create OleDispatchDriver object Application pINCApplication new INCApplication L bConnected FALSE bConnected pINCApplication gt CreateDispatch NeuroCheck Application Cn s y3 TRACEO OLE exception during create of IDispatch n FALSE bSuccess delete pINCApplication TRACEO error unable to launch server application n return t this point we are attached to server NeuroCheck V4 x a server process is running as a hidden software component there s no entry in the system s taskbar as long as the visibility state of the data object is set to hidden the default now read server information rt int iMajorVersion pINCApplication gt GetExeMajorVersion rt int iMinorVersion pINCApplication gt GetExeMinorVersion ring szPath pINCApplication gt GetPath g lLicenseNumber pINCApplication gt GetLicenseNumber rt int iLicenseLevel pINCApplication gt GetLicenseLevel tch iLicenseLevel e NC_VERSION_RUNTIME 0x02 TRACE1 connected to runtime version no ld n lLicenseNumber break e NC_VERSION_FULL 0x04 TRACE1 connected to Premium Edition no ld n lLicenseNumber break OLE Automation 163 case NC_VERSTON_PROFESSIONAL 0x10 TRACE1 connected to Professional Edition no ld n lLicenseNumber break default break quit server and detach again pINCApplication gt Quit delete pINCApplicat
52. state is a property of the main data object not the application object Therefore the visibility of the main application window has to be set through the data object EN _ CheckRoutine Heading Various applications CheckRoutine Description inf heck 2 oe eee CheckRoutine Author SJE Bar code identification SingleCheck Name ZA Code 2 5 on metal ___ s PPT Tinatar limaga SingleCheck Description ZG Define ROls CheckFunction Name EG Identify Bar Code EG Define ROls EG Identify Bar Code Figure 18 Descriptive properties of CheckRoutine SingleCheck and CheckFunction object 7 4 2 Methods This section lists the methods of the CheckRoutine object Save The Save method saves the check routine to the file specified in the FullName property of the check routine object It returns a Boolean value indicating success or failure Syntax object Save The object placeholder represents the CheckRoutine object 124 7 4 3 NeuroCheck Programmer s Reference Return Type VT_ BOOL Remarks The Save method fails if the check routine is protected by a password i e it returns FALSE SaveAs The SaveAs method saves changes to the check routine object in a different file specified by the FileName argument It returns a Boolean value indicating success or failure Syntax object SaveAs FileName The object placeholder represents the CheckRoutine object Return Type VT_ BOOL
53. the individual sections follow below typedef struct version control unsigned int uiStructSize data unsigned int uiFunctionld unsigned int uiHelpContext unsigned int uiNumOfInputData unsigned int uiNumOfOutputData uiSizeOfParameter uiNumOfViews unsigned in unsigned in Gtckect unsigned in uiDataOutput pointer data int piTypeOfInputData int piTypeOfOutputData int piMaskFileOutput int piMaskRs2320utput strings LPSTR lpszFunctionName LPSTR lpszDescription LPSTR lpszHintPos LPSTR lpszHintNeg LPSTR alpszCustomViewNames Interface Description 33 2 6 2 LPSTR alpszInputViewNames LPSTR alpszOutputViewNames functions PFNPlugInFctInitialize pfniInitialize PFNPlugInFctExecute pfnExecute PFNPlugInFctUnInitialize pfnUnInitialize PFNPlugInFctParameterDlg pfnParameterDlg PFNPlugInFctViewCreate pfnViewCreate PFNPlugInFctViewDestroy pfnViewDestroy sPI_FCT_DESC General Information The data area of the function info block contains the following elements Element uiStructSize uiFunctionId uiHelpContext uiNumOfInputData Description NeuroCheck allocates the info block and initializes each element to 0 with the exception of its first element uiSt ruct Size This element contains the size of the info block as returned by the sizeof function The value of uiSt ruct Size should be considered read only and can be used inside
54. the number of bytes 1 byte 8 bits to be read the third one a pointer to a byte array to be filled with the current input bytes The function returns TRUE if the input image could be read or FALSE if an error occurred Parameters iBoardiIndex Index of field bus board iByteCount Number of bytes to be read length of input image buffer pbyInputImage Pointer to input image data length of buffer iByteCount ReadFieldBusOutputlmage extern C WINAPI BOOL ReadFieldBusOutput Image int iBoardIndex int iByteCount BYTE pbyOutputImage The ReadFieldBusOutput Image function reads the current output image output state of a field bus device It takes three arguments the first one specifiying the field bus board the second one the number of bytes 1 byte 8 bits to be read the third one a pointer to a byte array to be filled with the current output bytes The function returns TRUE if the output image could be read or FALSE if an error occurred Parameters iBoardiIndex Index of field bus board iByteCount Number of bytes to be read length of output image buffer pbyOutputImage Pointer to output image data length of buffer iByteCount NeuroCheck API Functionality 67 SetFieldBusOutputimage extern C WINAPI BOOL SetFieldBusOutput Image int iBoardIndex int iByteCount BYTE pbyOutputImage The Set FieldBusOutput Image function sets a new output image output state of a field bus device
55. these names and acronyms Details on the various technologies related to OLE can be found in Microsoft s OLE programmer s reference and a variety of other volumes COM stands for Component Object Model This is the technology upon which OLE is built COM specifies a set of rules for the creation of binary objects that can communicate with each other By following these rules programmable objects can be written in any OLE capable programming language and accessed by any OLE capable application Recently COM has been further extended to function between various computers connected over a network and is consequently now called DCOM Distributed COM DCOM The most recent extension of COM OLE bears the name ActiveX Its most important aspect is the capability to exchange program functionality through the world wide Internet The distribution of programmable objects over the Internet allows for the integration of application capabilities into the hitherto rather static textual and graphical information on the World Wide Web 7 1 2 What is OLE Automation Above we introduced the term OLE automation for the technology of controlling another application s objects Like OLE it is build on the COM techology and is therefore also called ActiveX Automation In OLE automation there is a clear distinction between two different 92 NeuroCheck Programmer s Reference roles of programs e The application that supplies the programmable object is called the
56. to 1 Example The following Visual Basic code excerpt shows how to examine the cause of the failure of an individual check If Not SingleCheck CurrentResult Then If SingleCheck LastFunction lt 0 And _ SingleCheck Item 0 ErrorCode lt 0 Then MsgBox SingleCheck Name amp was not executed Else MsgBox SingleCheck Item SingleCheck LastFunction Name _ amp failed End If End If Name The Name property returns or sets the user defined name of a check See Figure 18 Syntax object Name value The object placeholder represents the SingleCheck object Return Type VT_BSTR NumOflmages The NumOflImages property returns the number of available images in the internal runtime data stack OLE Automation 129 Syntax object NumOflmages The object placeholder represents the SingleCheck object Return Type VT_l2 OID The OID property sets or returns the unique object identification number OID Syntax object OID The object placeholder represents the SingleCheck object Return Type VT_I4 Parent The Parent property returns the active CheckRoutine object Syntax object Parent The object placeholder represents the SingleCheck object Return Type VT_DISPATCH SClIndex The SCIndex property returns the index of the individual check within the collection of the check routine Syntax object SCIndex The object placeholder represents the SingleCheck object 130 7 5 2 NeuroCheck Program
57. 608 name Target gt 218641 lt parameter gt lt cf_target_values gt lt check_function gt lt cf_list gt lt single_check gt lt single_check gt lt single_check gt lt sc_list gt lt cr_automatic_screen_config gt lt cr_automatic_screen_config gt lt body gt lt neurocheck_check_routine gt 8 2 4 Element lt neurocheck_check_routine gt The element neurocheck_check_routine contains all data of the NeuroCheck check routine and information about the NeuroCheck installation Its xmlns attribute indicates that this element and all its child elements are defined in the NeuroCheck name space The element is divided into the child elements header and body 178 8 2 5 8 2 6 8 2 7 8 2 8 8 2 9 NeuroCheck Programmer s Reference Element lt header gt The header element contains important information about the NeuroCheck installation Its child element file _version for example is used to manage future changes of the format of the XML file Do not edit the structure or the contents of the child elements of the header element Element lt body gt The body element contains all data of the NeuroCheck check routine Its child elements are divided into logical blocks e g into the elements cr_properties sc_list and cr_automatic_screen_config etc with their respective child elements The element cr_properties contains all the properties of the check routine The individual checks are liste
58. AP handle to bitmap is returned uiAddInfo Additional informaion Value indicates current zoom factor of result view Can have one of the following values declared as symbolic constants in pi_types h NC_ZOOM_10 10 of original image size NC_ZOOM_25 25 of original image size NC_ZOOM_50 50 of original image size NC_ZOOM_100 100 of original image size NC_ZOOM_200 200 of original image size Hi ExecuteErrorCode Error code for most recent call to execution routine of the plug in check function Can have one of two values declared as symbolic constants in pi_types h NC_EXE_OK execution result was O K NC_EXE_NOK execution result was not O K All elements of the structure have to be considered read only In hView the view create routine returns a handle to a bitmap which will be displayed by NeuroCheck in the Result View pane of the plug in check function in manual mode or in its visualization window in automatic mode This handle will be passed at the succeeding call to the view destroy routine when the handle can be released In addition in ppvInputData and ppvOutputData the current input and output data objects of the most recent execution of the plug in check function are passed to the view create routine Both input and output objects should be considered read only Please note 32 NeuroCheck Programmer s Reference that if the execution result had been not O K the output
59. BINARY binary data elements DESCRIPTION description elements HTML ATTRIBUTES supplementary attributes The export options can be used to optimize execution speed If only the parameters of a check function are needed including binary data e g parameter block of plug in functions then iExportOptions could be set to NC_XML_EXPORT_CHILDREN NC_XML_EXPORT_BINARY LogMessage extern C WINAPI BOOL LogMessage int iWarningLevel LPCTSTR lpszSource LPCTSTR lpszMsg The LogMessage function writes a message to the NeuroCheck log file It can be used to easily output status or warning messages within the context of standard NeuroCheck messages and thus is very convenient for debugging a plug in DLL The message will only be written if logging is activated in NeuroCheck The function returns TRUE on success FALSE on error or if no logging is activated Parameters iWarningLevel Warning level 1 4 from fatal error to simple information Symbolic constants for the levels are declared in PI_NcApi h lpszSource Name of source e g name of plug in DLL of function lpszMsg Message to be written 4 4 Error Codes The API provides following function to retrieve the most recent error that occured for a function call to NeuroCheck API GetLastNcApiError extern C WINAPI int GetLastNcApiError void The GetLastNcApiError function returns a value indicating the most recent error that
60. C ClassWizard will create the following wrapper class from the type library class ICheckFunction public COleDispatchDriver 7 7 Check Functions with Additional Automation Functionality The following table lists the check functions providing additional functionality The functionality is explained in detail in subsequent sections Function name iD Parameters Target values Result data sere x Identify Barcode BCI 536 X X Identify DataMatrix X X Count ROIS x Evaluate Classes X CLE Check Allowances GCHK 527 x OCE Determine Position Capture Image Transfer Image Determine Threshold Define ROIs es aan a C C 148 7 7 1 NeuroCheck Programmer s Reference dynamic size of data exchange through array of structures specific to the respective function Data Exchange The OLE automation interface of NeuroCheck offers two different ways to perform transfer of parameter target value or result data for the check functions listed above Data Exchange by Element Data exchange by element means that parameters target value settings and current result values associated with a CheckFunction object are treated as a matrix of values The appropriate size of each matrix is given by the function s RowsOfxxxMatrix and ColsOfxxxMatrix properties where xxx stands for Parameter TargetValue or Result Each element of the matrix can be passed in a variable of type VT_VARIANT to the function s Getxx
61. CString csOutputString get string length PI_ITEM_INT psMyData gt ilIntegerValue ype PI_ITEM_FLOAT psMyData gt fFloatValue ype psDataOutputInfo gt psDatalItem 2 Example for output of a string Interface Description 41 int iStrLen int csOutputString GetLength zero terminated string iStrLen 1 allocate memory for string using the v heap api psItem gt pszData char VirtualAlloc NULL DWORD iStrLen sizeof char MEM_COMMIT PAGE_READWRITE copy string strcpy psItem gt pszData csOutputString GetBuffer iStrLen return TRUE DataOutput 2 7 3 Destroy Routine The destroy routine of a plug in check function has to be declared as follows excepting the actual name of course void WINAPI TypeDestroy void pbyData In pbyData NeuroCheck passes the address of the data object allocated previously inside the execution routine The destroy routine is called whenever a data object of this plug in data type is to be de allocated Usually this will be before the next execution of the single check containing the plug in check function that created such an object Inside the destroy routine the data passed in pbyData should be de allocated using an operator that matches the operator previously used for allocation 2 8 The Type Description Block Function PI_GetTypeDesc uiIndex psFctDesc has to fill the type description block whose address is passed
62. Check uses only the first elements of the two arrays up to the number of elements stated in uiNumOfInputData resp uiNumOfOutputData The information in these arrays is used for the Input Data Configuration dialog and for passing pointers to dynamic data objects during runtime Element Description piTypeOfInputData Pointer to be assigned with static array stating the types of expected input data objects piTypeOfOutputData Pointer to be assigned with static array stating the types of created output data objects The following symbolic constants are declared in pi_t ypes h for identifiying the possible types of data objects Interface Description 35 Constant Description PI_IMAGE Data object is an image PI_HISTO Data object is a histogram PI_LAYER Data object is a layer of regions of interest PI_MEASARRAY Data object is a measurement array In addition a plug in check function can also use data objects of user defined types registered in its plug in DLL 2 6 3 1 Example The following assignments describe the input output structure of a function using a gray level image a histogram and a layer of regions to create a measurement array and a user definined data type registered with ID 0x1003 uiNumOfInputData 3 static int InputData PI_IMAGE PI_HISTO PI_LAYER piTypeOfInputData InputData uiNumOfOutputData 2 static int OutputData PI_MEASARRAY 0x1003 piTypeOfOutputData Ou
63. Determine Position position calculation 523 524 525 526 527 528 529 531 532 536 537 538 539 540 541 54 wW N 54 544 54 54 54 0 i n Ww 54 549 550 33L 552 553 554 399 POSR PCA OCPY DGEO GCH GC DIG ISH Q P gt Ff U RK OC BCI OUR GCB OMG GMG Is OBCV H r H Q He D POT OBED RFBB SFBB DMCI OCT IOFIL ISL Quick Reference 213 Position ROIs Calibrate Pixels Copy ROIs objects Gauge ROIs define geometrical measurements Check Allowances geometry Derive Measurements geometry combine Capture Image in Parallel digitize asynchronously Shading Correction of image Compute Model Geometries for objects Identify Bar Code Unroll ROI object Calibrate measurements geometrical Combine ROIs merge objects Combine measurement lists merge geometries Smooth ROIs in image Compute Curvature of objects Evaluate Classes Transfer Image to Tray filing Draw ROIs objects Template Matching Color Matching Print Quality Inspection Create Edges as objects Read Field Bus Input Bit Set Field Bus Output Bit Identify DataMatrix Code Split ROIs object cut Filter Image in ROIs object Adjust Line Scan Image image shift lines 214 NeuroCheck Programmer s Reference 556 Error Type IDs Value WO NHN FF Oo Error Detail IDs Value 1 2 3 ad Oo O JN DBD Ww
64. ID Error writing log file entry Error for API function Get DeviceName 76 NeuroCheck Programmer s Reference 184 185 186 187 188 189 Error for API function Get SubDeviceName Error getting XML string Error getting XML string length Object identifier not found Check routine object has no parent Logging disabled 5 Implementing a Plug In DLL The implementation of a plug in DLL is demonstrated by several sample plug in DLLs The sample DLLs have been programmed using Microsoft Visual C 6 0 but you can of course use any language and or compiler which supports DLL compilation for implementing a plug in DLL Each project is contained in an own folder 5 1 Overview of the Sample Plug In DLLs The samples can be installed or copied from the NeuroCheck CD ROM If installed from CD ROM the sample projects can be found in the folder Programming PlugIn in the NeuroCheck installation path PI_Simple This is a very basic sample The sample DLL only contains one plug in check function The sample also shows how to display an info dialog for a plug in DLL e Modify Image The plug in check function simply takes an input image and modifies its gray level pixel values It has no parameters no custom visualization and no data output capabilities PI_Menu This sample demonstrates the use and implementation of plug in menu commands It implements three plug in menu commands to be called in manual mode and
65. ID including the zero termination character So the return value can be used immediately to allocate the string buffer for Get XMLSt ring If there is no object with the specified OID or if the XML export fails then the function returns 1 Parameters iOID Identification number of NeuroCheck object to be investigated iExportOptions Export options See Get XMLSt ring GetXMLString extern C WINAPI BOOL GetXMLString int iOID char pszXMLString unsigned int uiMaxStringLength int iExportOptions The Get XMLSt ring function returns the XML export string for the NeuroCheck object specified by its object identification number OID The string will be copied to the string buffer which must be allocated prior to calling this function The exact buffer size can be determined with Get XMLSt ringLength If the buffer is not large enough the XML string will simply be truncated The function returns TRUE on success FALSE on error Parameters iOID Identification number of NeuroCheck object to be investigated pszXMLString Pointer to previously allocated string buffer uiMaxStringLength Maximum length of string that can be copied to string buffer fis ExportOptions Export options Can be any combination of the following values declared as symbolic constants in pi_NcApi h 74 NeuroCheck Programmer s Reference NC_XML_EXPORT_ CHILDREN main XML child elements PROPERTIES all other XML child elements
66. Index is an integer value the Item method returns the individual check object with position SCIndex in the collection of the CheckRoutine object If SC ndex is a string the Item method always returns the first individual check in the collection whose name is equal to string SCIndex Example The following Visual Basic sample code shows how to access the first individual check of the check routine s collection and then the first individual check with name OCR provided there exists a check with this name Dim SingleCheck As Object Set SingleCheck CheckRoutine Item 0 126 NeuroCheck Programmer s Reference Set SingleCheck CheckRoutine Item OCR If SingleCheck is Nothing Then MsgBox Check OCR not found End If 7 4 4 Wrapper The Visual C ClassWizard will create the following wrapper class from the type library class ICheckRoutine public COleDispatchDriver 7 5 SingleCheck Object 7 5 1 Properties This section lists the properties of the SingleCheck object CheckEnabled The CheckEnabled property sets or returns the current execution state of the check object If TRUE execution of the check is enabled if FALSE it is disabled Syntax object CheckEnabled value The object placeholder represents the SingleCheck object Return Type VT_BOOL Remarks The CheckEnabled property replaces the methods IsCheckEnabled and EnableCheck Count The Count property returns the
67. L WINAPI PI_GetDataTypeDesc unsigned short int uilIndex sPI_TYPE_DESC const psTypeDesc It is called in a loop after PI_GetNumberOfDataTypes once for each type The loop counter is passed in ui Index counted from 0 up to the return value of PT_ GetNumberOfDataTypes minus 1 In psTypeDesc NeuroCheck passes the address of the allocated info block for the current type Function PI_GetDataTypeDesc has to fill in the information about the data type indicated by the index into the members of this info structure Interface Description 25 2 3 Memory Management 2 3 1 Output Data Objects of NeuroCheck Data Types Plug in check functions can create output data objects of the NeuroCheck data types image layer of regions histogram measurement list just like built in functions Data objects created by build in functions are deleted after the check routine has been completely executed To enable NeuroCheck to delete objects dynamically allocated by plug in check functions in the same way and to free the plug in DLL programmer from managing these objects himself all objects of a NeuroCheck data type must be allocated using the virtual heap API function extern C VOID WINAPI VirtualAlloc LPVOID IlpAddress DWORD dwSize DWORD flAllocationType DWORD f1Protect VirtualAlloc initializes all elements of the allocated memory block to 0 Important NeuroCheck de allocates all dynamical output data returned by the execution routine
68. L bSuccess Transmits or buffers final check result Required to be explicitly exported Parameters bSuccess Indicates final status of check routine FALSE for not O K TransferFloat extern C void TransferFloat float fValue Transmits or buffers a floating point value Required to be explicitly exported Parameters fValue Floating point value to be transmitted TransferInt extern C void TransferInt int iValue Transmits or buffers an integer value Required to be explicitly exported Parameters iValue Integer value to be transmitted 198 NeuroCheck Programmer s Reference TransferString extern C void TransferString char pChar unsigned int uiNumOfChars Transmits or buffers a string Required to be explicitly exported Parameters pChar uiNomoOfChars Flush Address of string to be transmitted Number of valid characters extern C BOOL Flush void Actuates transmission of buffered values at end of check routine run Required to be explicitly exported Result Values E 0 Successful transmission Error in transmission 9 7 OLE Automation Interface This section lists the available properties and methods of the OLE automation objects exposed by NeuroCheck Access to the properties is given as ro for read only and rw for read write NCApplication Object Property ActiveCamera ActiveCameraName ActiveCameraZoom ActiveCheckRoutine Application Caption Devic
69. L file you should use XHTML instead It is very similar to HTML but has a stricter syntax This means for example that all start tags have to be closed properly with end tags For example wrong correct lt img src my_image gif gt lt img src my_image gif gt lt H2 gt Title lt H2 gt lt h2 gt Title lt h2 gt lt br gt lt br gt lt ul gt lt ul gt lt li gt One lt 1li gt One lt 1li gt lt 1i gt Two lt li gt TIwo lt li gt lt ul gt lt ul gt e Cascading Style Sheets CSS It is possible to make use of Cascading Style Sheets from within the XSL file Insert references to such files in the lt htm1 gt lt head gt section of the root node template Example lt link rel Stylesheet type text css media screen gt lt xsl attribute name href gt lt xsl value of select nc created_by_dir gt XSL nc_screen css lt xsl attribute gt lt link gt 9 Quick Reference The following pages summarize all functions and data structures relevant for programming user extensions to NeuroCheck with their parameters For details on how to use the functions and interpret their results please refer to the previous chapters 9 1 Plug In Interface Administrative Functions and Structures DLLInfo extern C void WINAPI DllInfo HWND hwndMain Displays about box of plug in DLL Required to be explicitly exported from plug in DLL Parameters hwndMain Handle of the NeuroChe
70. L to distinguish between plug in extensions specific to different visual inspection systems The following figure shows the info dialog of the included sample DLL Plug In info x a NeuroCheck advanced Plug In DLL sample C DS GmbH 1997 2000 V5 0 Figure 2 info dialog of included sample DLL Successful loading of at least one plug in DLL is also indicated in the status bar by the plug in symbol as shown in the following figure Eag zey PXXHYYY Figure 3 plug in DLL indicator in status bar Hint Double clicking the plug in field in the status bar opens directly the page Plug In of the General Software Settings dialog box Using a Plug In DLL in NeuroCheck 15 1 3 Using the NeuroCheck API functionality coy If at least one plug in DLL has been loaded successfully the NeuroCheck API functionality can be activated Please note that this feature is only available if NeuroCheck can find file Ncapi d11 in its installation path Clicking the Info button opens a message box with information about the API functionality About API DLL BNEURO CHECK NeuroCheck API Dynamic Link Library Y5 1 3005 C Copyright 1999 2003 NeuroCheck GmbH Germany The NeuroCheck API provides a way to call certain functionality of the NeuroCheck main program from an external DLL Figure 4 info dialog of NeuroCheck API DLL If the use of the NeuroCheck API functionality is activated the plug in symb
71. MNEURO MCHECK Industrial Vision Systems Version 5 1 for Microsofte Windowse 9x NT 2000 XP Programmer s Reference Information in this document is subject to change without notice No part of this document may be reproduced or transmitted in any form or by any means electronic or mechanical for any purpose without the express written permission of NeuroCheck GmbH 2004 NeuroCheck GmbH All rights reserved Version 5 1 of May 24 2004 NeuroCheck is a registered trademark of NeuroCheck GmbH Microsoft MS DOS Windows Windows NT are either registered trademarks or trademarks of Microsoft Corporation Contents MPEP OCU CEO Mess occ A T T 9 1 Using a Plug In DLL in NeuroChe ck ceeeeceeeeeeeeneeeeeeeeeeeeeeeeneeens 13 1 1 Loading a Plug In DLL u eee ecccccceseeeseeeeeeseenseenseceneeeeeeeeeenseeeseseeeeneess 13 1 2 Information About a Loaded Plug In DLL 00 cece ecceeceeseeteeeeeeeeeeerenstees 14 1 3 Using the NeuroCheck API functionality 0 0 cccceeceesceeseeeeeeseeseeeeeeeeeneeees 15 1 4 Using Functions from a Plug In DLL ee ec cc eeceeseeeceesseeteeeeeeeseeeneeseeeeenes 15 1 4 1 Administration Frame for Plug In Check Functions 006 15 1 4 2 Using a Plug In Check Function in a Check Routine 16 1 5 The Plug In Menu ies iatea neiere rareco aar a a tect 17 2 InterfaGe Description saatan araea E ea raaua esea ki inada Kaea aaa 19 ZA Interface Struct re soninn nnn o e e a
72. NeuroCheck DeviceCount NC_DEVICE_DIGITALIO lt BoardIndex Then Exit Function End If Read first input of first digital IO board varInputValue NeuroCheck ReadDigitalInput BoardIndex InputIndex Verify type of input If VarType varInputValue lt gt vbBoolean Then an error occured for reading the digital IO board MsgBox Could not read digital input no amp CStr InputIndex End If If varInputValue Then Execute check and get result Dim bCheckResult As Boolean If NeuroCheck Execute Then bCheckResult CheckRoutine CurrentResult Else bCheckResult False End If Set digital second output depending of check result If Not NeuroCheck SetDigitalOutput _ BoardIndex OutputIndex bCheckResult Then 162 NeuroCheck Programmer s Reference MsgBox Could not set digital output no amp CStr Output Index End If End If 7 9 Source Code Samples for C C The source code in this section was taken mostly verbatim from the official NeuroCheck OLE automation Controller Example implemented in Visual C A simpler example is available in source code in the folder Programming OLE NcCppSimp1e in the NeuroCheck installation path 7 9 1 Contact Server The following code sample demonstrates how to establish the connection to the automation server request information about the server and detach the connection again void OnAttachServer NC BOO try cat if sho sho cst lon
73. None Returns TRUE if the check function makes its target value settings available to the controller Return type VT_BOOL Arguments None Sets an element of the check function s parameter matrix Returns success or failure of operation Return type VT_BOOL Arguments VT_I2 Row Row index of element in parameter matrix VT_I2 Col Column index of element in parameter matrix VT_VARIANT NewValue New value of specified element Quick Reference 207 SetParameters Sets parameters of the check function Returns success or failure of operation Return type VT_BOOL Arguments VT_VARIANT ParaSetting safearray containing parameters SetTargetValueltem Sets an element of the check function s target value matrix Returns success or failure of operation Return type VT_BOOL Arguments VT_I2 Row Row index of element in target value matrix VT_I2 Col Column index of element in target value matrix VI_VARIANT NewValue New value of specified element SetTargetValues Sets target values of the check function Returns success or failure of operation Return type VT_BOOL Arguments VT_VARIANT TargetSetting safearray containing target values Wrapper class ICheckFunction public COleDispatchDriver Check Functions with Additional Automation Functionality Identify Bar Code Function ID BCT 536 Functionality Description Parameter values Code type value indicating type of bar code Line
74. OLE automation server e The application using the functionality provided by the server is called the OLE automation client In effect the client controls server In this sense the server is the slave the client the master which may sound a bit confusing at first We have to distinguish further between two types of OLE automation servers e In process servers in the form of a dynamic link library DLL they are called in process because the DLL is loaded into the address space of the controlling process e Out of process servers i e stand alone executable files which expose an interface through which parts of their functionality can be controlled from the outside Since NeuroCheck obviously is a stand alone executable file it represents an out of process server which is why we will focus on this type of servers in the following A client must first connect to the server in order to use its functionality This connection is established through the Windows Automation Manager This in turn queries the system registry for information about the server Therefore NeuroCheck must be started at least once as an independent executable in order to register itself as an OLE automation server before you can control it through a client NeuroCheck will update the pertaining registry entry whenever it is started so if you are running various versions of NeuroCheck on the same PC the registry entry will always refer to the version most recent
75. PI_GetHelpFilePath LPSTR lpszPath to retrieve filename and path of the help file to be used for all help calls concerning plug in functions In lpszPath the address of a buffer with size _MAX_PATH is passed to the function so that the function can copy any legal path name into this buffer NeuroCheck will decide upon the file extension whether to call WinHelp hlp or HtmlHelp chm If no help file has been provided for the plug in DLL the function should return FALSE NeuroCheck will then ignore all help inquiries concerning plug in functions 2 2 4 Menu Command Handler The plug in DLL can implement additional menu commands for the Tools menu in manual and automatic mode This is explained in detail in section The Plug In Menu NeuroCheck reads the menus from the DLL resources When one of the custom menu commands is selected during runtime NeuroCheck calls function extern C void WINAPI PI_MenuCommand HWND hwndMain unsigned int uiCmdId with the handle of the main application window and the ID of the selected menu item as parameters 24 NeuroCheck Programmer s Reference 2 2 5 Information about Plug In Check Functions NeuroCheck requires information about the properties of the check functions defined in the DLL to be able to utilize them Two functions serve this purpose extern C unsigned int WINAPI PI_GetNumberOfFcts void is called immediately after loading the DLL and must return the number of check functions
76. RIANT CF Index check function object to be returned Wrapper class ISingleCheck CheckFunction object Property Activated Category CF Index Quick Reference 205 public COleDispatchDriver Type Access Description VT_BOOL rw reads sets activation status of check function VT_I2 ro returns category of the check function VT_I2 xo returns index of function in individual check collection ColsOfParameterMatrix VT_I2 xo returns number of columns of parameter matrix ColsOfResultMatrix VT_I2 ro returns number of columns of result matrix ColsOfTargetValueMatrix ErrorCode FunctionId Name OID Parent Method GetCurrentResult GetParameterItem VT_I2 xo returns number of columns of target value matrix VT_I2 xo returns the function s execution status after most recent execution of individual check VT_I2 xo returns the function s identification number VT_BSTR rw reads sets the function s name VT_I4 rw reads sets the object s identification number OID VT_DISPATCH ro returns the single check object RowsOfParameterMatrix VT_I2 xo returns number of rows of parameter matrix RowsOfResultMatrix VT_I2 ro returns number of rows of result matrix RowsOfTargetValueMatrix VT_I2 xo returns number of rows of target value matrix Description Returns safearray containing the result values of the check function requires at least one execution in automatic mode
77. Restrictions In contrast to plug in functions or custom communication which are integrated in NeuroCheck an OLE controller is an independent application OLE automation can be seen as remote control of NeuroCheck When controlled through OLE automation NeuroCheck acts as a slave The OLE client takes the role of the master which means that e The client takes the place of the usual user interface e The client is the sole entity allowed to initiate actions in NeuroCheck like the execution of an inspection run or a change of check routines In effect the client is responsible for the entire control and timing of the application Therefore the following restrictions apply when running NeuroCheck through OLE automation e Interactive use of NeuroCheck s application window is disabled e Input signals configured under System Remote Control start check select check routine adjust cameras are ignored e Self test is not available e Operating modes Test and Configure Automatic Screen are not accessible of course the usual restrictions related to a particular license level still apply even using OLE automation you will not be able to switch a runtime version to Manual mode e Settings for start up behavior made under System Options are ignored Preparing NeuroCheck for Control by OLE Automation As stated above certain restrictions apply when NeuroCheck is controlled by an OLE client This means that NeuroCheck must be configu
78. Source Source of image Can have one of the following values declared as symbolic constants in pi_types h PI_IMSRC_FILE bitmap file PI_IMSRC_CAM camera PI_IMSRC_TRAY image tray PI_IMSRC_UNKNOWN cannot be determined e g after an addition of images 46 NeuroCheck Programmer s Reference lpszSourceName Description of image source as a zero terminated string i e name of bitmap file or name of camera The contents of this string must not be changed by a plug in check function Each array with pixel values gray level or color represents the pixel matrix of the image and thus must have a size of uiWidth times uiHeight The pixels are ordered according to the NeuroCheck coordinate system which starts at origin 0 0 in the top left corner with its positive X axis pointing to the right and its positive Y axis pointing downwards In the array representation the lines of the image are simply appended For an input image object a plug in check function may only alter the pixel values of the gray level array and for color images only of the three color channels All other elements should be considered read only Allocating a new image object all elements except iSource and lpszSourceName can be assigned Each image must have a valid gray level array of the size specified by uiWidth and uiHeight The array must be allocated with VirtualAlloc In addition each color image must have a valid array for each color channel Please note tha
79. Standard deviation of gray levels inside region Maximum difference of gray levels inside region PI_ALL_GRADMEAN Average gradient inside region PI_ALL GRADMAX Maximum gradient inside region PI_ALL_GRADSIGMA Standard deviation of gray levels inside region PI_GEN_CURV_MEAN Average curvature PI_GEN_CURV_SIGMA Standard deviation of curvature values PI_GEN_CURV_MIN Minimum curvature PI_GEN_CURV_MAX Maximum curvature PI_GEN_CURV_CONTRAST Maximum amplitude of curvatures along the contour PI_GEN_COR_QUALITY Correlation coefficient of region with its template PI_GEN_COR_SUBPIX_X X coordinate of region found by subpixel template matching PI_GEN_COR_SUBPIX_Y Y coordinate of region found by subpixel template matching PI_GEN_COR_ANGLE Angle of rotated template PI_GEN_CLASS Number of class determined by classifier PI_GEN_CLASSQUALITY 196 NeuroCheck Programmer s Reference Quality of classification result equals the classification certainty PI_POS_OFFSET_X Offset X determined by Determine Position PI_POS_OFFSET_Y Offset Y determined by Determine Position PI_POS_ROT_ANGLE Rotation angle determined by Determine Position PI_POS_PIVOT_X Pivot X determined by Determine Position PI_POS_PIVOT_Y Pivot Y determined by Determine Position 9 6 Custom Communication Interface DLLInit extern C BOOL DllInit void Performs necessary initialization for the driver Required to be explicitly exported Return
80. T_I4 Type of bar code Possible settings are defined in Ncauto h Line distance 0 1 VT_I4 Distance of search rays for scanning ROI 1 99 Smoothing 0 2 VT_l4 Number of lines on both sides of search rays to be averaged 1 99 Scan direction 0 3 VT_l4 Direction for scanning ROI Possible settings are defined in Ncauto h Check sum 0 4 VT_BOOL If TRUE the function performs a check sum test on the bar code Only available for certain code types Characters 0 5 VT_l4 Number of characters contained in the code 1 99 Only available for certain code types Target Value Item Type Description Check target code 0 0 VI_BOOL If TRUE the identified bar code is compared to the target string Target string 0 1 VT_BSTR Barcode string to be present on the part Result Value Item Type Description Bar code string 0 0 VT_BSTR String representing the identified bar code 7 7 3 Identify DataMatrix Code Function Identify DataMatrix Code allows parameter and target value setting and result data retrieval through OLE automation The pertaining structures are defined in Ncauto h Parameters Item Type Description Code type 0 0 VT_I4 Type of code e g 12 12 Possible settings are defined in Ncauto h Code color 0 1 VT_I4 Color of code dark or light 0 1 See also defines in Ncauto h Code quality 0 2 VT_l4 Quality of code good or poor 0 1 See also defines in Ncauto h 150 Code size Reference
81. The arrays can be seen as mask for enabling the output of output data objects If element of index i is set to 0 or FALSE there will be no output for the data object with index i If the element is set to 1 or TRUE output of the respective object is enabled NeuroCheck will offer the necessary icons on the Data Output View in manual mode and write the required data to file or RS232 serial interface if e output to the respective destination has been activated in Data Output View globally for the whole check routine e output to the respective destination has been activated for the instance of the plug in check function locally e the plug in check function has been executed successfully during automatic mode Please note that output of images type PI_ IMAGE is treated differently to all other data types Output of images to serial interface is not possible i e enabling an output object of type PI_IMAGE in mask piMaskRs232O0utput will be ignored Output of images to file will not append the image data to the data file configured in NeuroCheck Instead NeuroCheck will output the images to bitmap files with sequentially numbered names Please refer to the NeuroCheck User Manual for a detailed description of the output capabilities of NeuroCheck Example The following assignments enable the output to file of the first data output object created by the plug in check function and output to both file and serial interfac
82. VT_BOOL Argument Type Description BoardIndex VT_l2 Index of digital I O board counted from 0 OutputNumber VT_l2 Number of the output to be set counted from 0 NewState VT_BOOL State to which the output will be set SetDigitalOutputWord The SetDigitalOutputWord method sets all 16 digital outputs of a digital I O board at once It takes three arguments the first one specifying the digital I O board to be set the second one specifying the bits to be set and the third one holding the values of the bits The method returns TRUE if the outputs could be set or FALSE if an error occurred OLE Automation 115 Syntax object SetDigitalOutputWord BoardIindex BitMask BitStates The object placeholder represents the NCApplication object Return Type VT_VARIANT Argument Type Description BoardIndex V T_ 2 Index of digital I O board counted from 0 BitMask VT_I4 Integer encoding the bit mask specifying the outputs to be set BitStates VT_l4 Integer encoding the states to which the outputs will be set Remarks Each of the 16 bits of the arguments BitMask and BitStates represents one of the 16 digital outputs BitMask is used to specify the outputs to be altered If bit number j is set in BitMask i e if it is 1 then the corresponding output j will be set or reset according to bit number j in BitStates otherwise the current state of the output will not be changed don t care A set bit in BitStates causes the corresponding
83. Values 1 Successful initialization 0 Error in initialization SetupDevice extern C BOOL SetupDevice HWND hwndAppMain Can be used to display a setup dialog for the device The function is not required If the function exists it has to be exported explicitly Parameters hwndAppMain Handle for NeuroCheck application window Return Values 1 Device setup has been changed D11Init will be called 0 Device setup unchanged TestDevice extern C BOOL TestDevice HWND hwndAppMain Can be used to display a test dialog for the device The function is not required If the function exists it has to be exported explicitly Parameters hwndAppMain Handle for NeuroCheck application window Return Values 1 Device is working properly 0 Device is not working Quick Reference 197 TestStart extern C BOOL TestStart void Checks whether start signal has been received Required to be explicitly exported Return Values 1 Start signal has been received 0 No start signal has been received GetTypeld extern C BOOL GetTypeId unsigned short int pTypelId Checks whether check routine selection signal has been received and returns ID Required to be explicitly exported Parameters pTypeld Used to return received check routine ID 0 99999 Return Values 1 Selection signal has been received and returned in pTypeld 0 No selection signal has been received SetCheckResult extern C void SetCheckResult BOO
84. a the XSL rendering can also contain arbitrary texts in XHTML and graphics Every user can create his or her own XSL files We recommend using an existing XSL file as a template saving it under a different name and changing it Included with NeuroCheck you can find a number of XSL files which provide different renderings of check routines You can find the files with the extension xs1 in the subdirectory XSL under the NeuroCheck installation directory You can choose any directory for storing your own XSL files however for clarity s sake we recommend using the same directory XSL adheres to the syntax specification of the XML meta language Please note that most browsers react with an error message to even the smallest mistake in an XSL file s syntax without displaying anything else 182 NeuroCheck Programmer s Reference 8 3 3 Notes on the included XSL files In this section important details of the XSL files will be explained For more information concerning XSL XSLT XPath stylesheets or XHTML please refer to the common literature e Compatibility with Internet Explorer versions To ensure compatibility with the older versions of Microsoft Internet Explorer IE the included XSL files stick to an older version of the XSL syntax The reference to the XSL namespace can be found at the top of each XSL file lt xsl stylesheet xmlns xsl http www w3 org TR WD xsl gt This XSL syntax is recognized by IE versions 5 0 and higher
85. a of the image bytewise Syntax object GetImageData mage ndex The object placeholder represents the SingleCheck object Return Type VT_VARIANT Argument Type Description Imagelndex V1_l2 Number of the image to be returned on the stack Remarks This method is optimized for use with C C See example in section 7 9 9 GetlmageProp The GetImageProp method returns the properties of the image in the internal runtime data stack specified by the magelIndex argument The method returns a safearray containing the properties of the image Syntax object GetImageProp mage ndex The object placeholder represents the SingleCheck object OLE Automation 133 Return Type VT_VARIANT Argument Type Description Imagelndex VT_l2 Index of the image on the stack whose properties are to be returned Remarks This method is optimized for use with C C See example in section 7 9 9 IsCheckEnabled The IsCheckEnabled method returns the current execution state of the check object If the return value is TRUE execution of the check is currently enabled if FALSE it is currently disabled Syntax object lsCheckEnabled The object placeholder represents the SingleCheck object Return Type VT_BOOL Remarks Method IsCheckEnabled is deprecated please use property CheckEnabled instead 7 5 3 Collection Properties and Methods The SingleCheck object provides parts of the functionality of a collection object Therefore one addit
86. ame Application Author Comments Count CurrentCheckResult CurrentResult FileName FullName Heading Name OID Parent PartsCheckedNok PartsCheckedOok Path Saved Visible VT_BSTR ro returns designation of screen layout VT_DISPATCH ro returns the application object VT_BSTR rw reads sets author of the check routine VT_BSTR rw reads sets additional description of the check routine VT_I2 xo returns number of checks in the check routine VT_BOOL ro returns result of most recent execution of the given individual check Takes one argument VT_I2 SCIndex Number of the individual check VT_BOOL ro returns final result of most recent execution of the complete check routine VT_BSTR ro returns filename of the check routine not including path VT_BSTR ro returns full path of check routine file VT_BSTR rw reads sets user defined name of check routine VT_BSTR ro returns filename of the check routine not including path VT_I4 rw reads sets the object s identification number OID VT_DISPATCH ro returns the application object VT_I4 returns total number of parts checked as Part not O K VT_I4 returns total number of parts checked as Part O K VT_BSTR ro returns path specification for the check routine not including filename or filename extension VT_BOOL ro returns TRUE if the check routine has not been changed sinced it was last saved VT_BOOL rw r
87. ameter block 2 The Copy Paste Parameters functions copy a parameter block from one function into the block of another function The unique identification numbers required for plug in check functions ensure that only compatible blocks are copied Plug in check functions can use up to five input data objects of the various NeuroCheck data types image layer of regions histogram measurement list or some plug in data type registered by the function s plug in DLL It can create up to five dynamical output data objects of these types see section Memory Management about conventions for the administration of these data objects Some restrictions apply to the operations on the dynamical input data objects allowed within a plug in check function See chapter Data Types and Objects for details 2 5 2 Initialization Routine The initialization routine of a plug in check function has to be declared as follows excepting the actual name of course BOOL WINAPI InitFunction sPI_CONTEXT_INFO const psContext void const pParameter 28 NeuroCheck Programmer s Reference In psContext NeuroCheck passes information about the current context of the plug in check function This might be useful because plug in check functions may have to behave differently for an other context For instance a function may have different behaviour in automatic and in manual mode The following structure is used by NeuroCheck for context informatio
88. areas Defect suppression parameter for automatic threshold computation to suppress disturbances Description Left X coordinate of top left corner Top Y coordinate of top left corner Right X coordinate of bottom right corner Bottom Y coordinate of bottom right corner Description Classifier name of the classifier attached to this function Screen ROIs Function ID OBF 513 Functionality Parameter values Rotate Image Function ID TROT 507 Functionality Parameter values Template Matching Function ID TMA 546 Functionality Parameter values Check Function Categories Quick Reference 211 Description Parameter values are set and returned in an array of structures holding the following values for each feature Verify if TRUE feature is activated for screening Feature ID identifier of current feature read only Minimum minimum value allowed for the current feature Maximum maximum value allowed for the current feature Description Mode value indicating rotation angle or mirror direction Description Result positions number of objects the function will create at most in first group Minimum quality required degree of correspondence for first group The check function categories are defined in ncauto h Value Symbol and Meaning 0 NC_FCTCAT_GRAYVALUE preprocessing gray level 1 NC_FCTCAT_IMGFILTER preprocessing fi
89. argument pointers The function returns TRUE on success FALSE on error Parameters pdwMajorVersion Will be filled with major verson number e g 5 pdwMinorVersion Will be filled with minor verson number e g 1 pdwBuildVersion Will be filled with main build number e g 1038 pdwSubBuildVersion Will be filled with sub build number e g 0 GetSecurityKeyltem extern C WINAPI int GetSecurityKeyItem int iItemIndex The GetSecurityKeylItem function returns information about the security key of NeuroCheck On error the function returns 1 72 NeuroCheck Programmer s Reference Parameters iItemIndex Index of security key item Can have one of the following values declared as symbolic constants in pi_NcApi h NC_KEY_LICENSE_NUMBER return license number NC_KEY_LICENSE_LEVEL return license level As license level the function returns the same values as for the LicenseLevel property in the OLE automation interface see 7 3 1 Properties of NCApplication Object GetCrCommld extern C WINAPI int GetCrCommId void The Get CrCommId function returns the value of the check routine identification number CRID of the currently loaded check routine If no check routine is loaded or upon error the function returns 1 GetApplolgnoreFlag extern C WINAPI BOOL GetApplIoIgnoreFlag void The GetApplIolIgnoreF lag function returns the value of the ignore cummunication option of NeuroC
90. assification result equals the classification certainty in case of the classifier the correlation coefficient in the case of template matching User Defined Features Plug in check functions can compute additional feature values and store them in free positions of the feature array For this purpose indizes ranging from 60 to 99 have been reserved since a plug in DLL is typically used for implementing functionality specific to a certain inspection problem this range can be used for different purposes in different DLLs so that there should be no shortage of feature indizes By assigning a pointer to a static string in the lpszMeasurementName array of the sPI_LAYER structure a custom designation of the feature can be given which will be used in the NeuroCheck functions working with this feature 3 5 4 Target Types For data output two target types are supported Constant Description PI_TARGET_FILE Output to data file lpszTarget contains the full name of the output file PI_TARGET_RS232 Output to RS232 serial interface lpszTarget contains the name of the COM port 4 NeuroCheck API Functionality The NeuroCheck API application program interface provides a way to call certain functionality of the NeuroCheck main program from the plug in DLL For instance it enables read and write access to the same digital I O and field bus devices used in NeuroCheck Another main feature offers a convenient and simp
91. asurement array all elements should be considered read only sPI_OBJECT typedef struct Ji chosss Read only a int iType AOI contour or region int iWidth enclosing rectangle width int iHeight enclosing rectangle height sPI_CONTOUR psContour contour may be missing sPI_REGION psRegion region may be missing model geometries int iFitType description of model geometry float fFitParameters 10 parameters of model geometry Bet ent lb pee esha ad ae Set au eae a ie sl a a ae ad tl et lt ea eal eee E fp sssse5 Modify Write ey int iNumber index of object for sorting int iGroupNumber group membership BOOL bValid validity for screening int iX enclosing rectangle left edge int iY enclosing rectangle top edge float fMeasurement 300 feature values PR menial Write only poA int iShapeType shape type AOI polyline int iSearchReg size of surrounding area sPI_POINTS psPoints description of new object sPI_OBJECT Used to describe a single region of interest in an sPI_LAYER structure For a new object the write only and modify write elements must be specified Quick Reference 193 Only modify write elements can be altered for input objects by a plug in check function iNumber Changes sorting of regions iGroupNumber Changes groub membership of regions bValid Assigning FALSE lets region be removed ix iY Change
92. at of check routines This chapter describes the XML format of the NeuroCheck check routine data The focus is on the fundamental structure of the format and on hints to particular features The necessary formal definitions e g the IDs and value ranges of the check function parameters can be found in various files in the subdirectory Docs Xm1 of the NeuroCheck installation directory The Readme_xm1 txt found there provides an overview For a deeper understanding of the format some knowledge of XML is required 8 2 1 General description of the structure of XML files The check routine XML format is based on the definition of XML 1 0 according to the recommendation of the World Wide Web Consortium W3C as of October 6 2000 The formal specification can be found on the website http www w3 org TR REC xml Please note that the definition is under constant review by the committee Since this specification is quite formal the most important terms of this meta language will be briefly described in the following e An XML file usually consists of a prolog and a main part e The prolog gives general information concerning the XML file These are e g the XML declaration references to external layout information or document type definitions They can be recognized by the leading character sequence lt or lt Example lt xml version 1 0 gt e The main part of an XML file contains the data structured in elements e Each elem
93. ation 165 check routine in automatic mode and retrieve the final result void OnStartAutomaticMode switch to automatic mode using the OperatingMode property of the application object pINCApplication gt SetOperat ingMode NC_MODE_AUTOMATIC execute active check routine if TRUE pINCApplication gt Execute determine most recent result and statistics BOOL bResult pICheckRoutine gt GetCurrentResult int iOk pICheckRoutine gt GetPartsCheckedOk int iNOk pICheckRoutine gt GetPartsCheckedNoOk TRACES result u total no of Ok d Nok d n unsigned int bResult iOk iNOk eoif else TRACEO error unable to execute check routine n back to manual mode not available for runtime license pINCApplication gt SetOperat ingMode NC_MODE_MANUAL 7 9 5 Display Live Image The following source code sample demonstrates how to switch to live mode and make the server application visible after establishing the server connection and loading a check routine void OnLiveMode Pleg switch to live image mode pINCApplication gt SetOperatingMode NC_MODE_LIVE remark according to the automation interface guidelines the visibility state is a property of the main data ah object NOT of the application object Therefore toggle the visibility state of the data object check routine pICheckRoutine gt SetVisi
94. ation window OLE Automation 109 WindowState The WindowState property returns or sets a value indicating the visual state of the main application window at run time The property returns 1 if it is not accessible Using this property requires a check routine to be loaded Syntax object WindowState value The object placeholder represents the NCApplication object Return Type VT_I2 Possible settings for WindowState are Constant Value Description NC_WINDOW_NORMAL 1 Normal Default NC_WINDOW_MINIMIZED 2 Minimized minimized to an icon NC_WINDOW_MAXIMIZED 3 Maximized enlarged to maximum size Remarks As long as there is no check routine loaded in NeuroCheck WindowState is not accessible and returns 1 Setting the Visible property of the CheckRoutine object to TRUE resets WindowState to its default value i e to NC_WINDOW_NORMAL 7 3 2 Methods This section lists the methods available for the NCApplication object Execute The Execute method starts execution of the active check routine in automatic mode It does not take parameters If the check routine was started successfully the method returns TRUE If an error occurred or if NeuroCheck is not operating in automatic mode it returns FALSE Syntax object Execute The object placeholder represents the NCApplication object 110 NeuroCheck Programmer s Reference Return Type VT_BOOL Remarks Please note that the Execute method will not wo
95. ay happen that the main part of the inspection problem can be solved using the built in standard functions of NeuroCheck whereas a few requirements cannot be met Often these requirements are so specific to the application that the cost and implementation overhead needed to integrate the solution into a standard software package are prohibitively large The plug in interface has been defined to allow such specific functionality to be added to NeuroCheck without changes to the main body of the program This chapter describes how to load and use a fully implemented plug in DLL in NeuroCheck 1 1 Loading a Plug In DLL Vea Loading a plug in DLL is initiated by choosing Options from the System menu On page Plug In of the General Software Settings dialog box clicking the Add button opens a file select dialog for selecting the DLL to be loaded The plug in is loaded dynamically A successfully loaded DLL will be indicated with the plug in icon and a green check box General Software Settings 21x User Interface Safety Version Management User Interface Options Colors Directories Debug Options Plug In Start up Behavior List of Plug In DLLs File name Description Comment SQ C Pro Ncoem V42 V4 0 9 NCOEMDLL ko C Pro Neoem W50 V5 0 2 NCOEMDLL DS Plug In 2 0 sample SHPO Meee YO 0 2 NeuroCheck Unable to completely generate 4 Add Remove Inan J Provide API functionality
96. ber Number of input bit to be read ReadFieldBusOutputBit SetDigitalOutput Reads current state of an output bit of a field bus device Returns Boolean value for state of output bit or VT_EMPTY on error Return type VT_VARIANT Arguments VT_I2 BoardIndex Index of field bus board VT_I2 OutputNumber Number of output bit to be read Sets state of a digital output Returns success or failure of set operation Return type VT_BOOL Arguments VT_I2 BoardIndex Index of digital I O board VT_I2 OutputNumber Number of output to be set VT_BOOL NewState New state value SetDigitalOutputWord Sets state of all 16 digital outputs of one board Returns success or failure of set operation Return type VT_BOOL Arguments VT_I2 BoardIndex Index of digital I O board VT_I4 BitMask Bit mask for outputs to be changed VT_l4 BitStates State values to be set SetFieldBusOutputBit Wrapper class INCApplication Sets state of an output bit of a field bus device Returns success or failure of set operation Return type VT_BOOL Arguments VT_I2 BoardIndex Index of field bus board VT_I2 OutputNumber Number of output bit to be set VT_BOOL NewState New state value public COleDispatchDriver 202 NeuroCheck Programmer s Reference CheckRoutine Object Property ActiveScreenLayout Type Access Description VT_I2 rw reads sets screen layout of automatic screen ActiveScreenLayoutN
97. bers of structure sP T_IMAGE NeuroCheck then will use the pointer directly instead of copying the image data when using VirtualAlloc for allocation Note that the structure of type sPI_IMAGE itself still must be allocated using VirtualAlloc The function returns NULL on etror Parameters uiSize Size of memory block to be reserved NeuroCheck API Functionality 71 ReleaseAdvMemPtr extern C WINAPI BOOL ReleaseAdvMemPtr BYTE pbyData The ReleaseAdvMemPt r function releases memory space allocated with the GetAdvMemPtr function The function returns TRUE on success FALSE on error Parameters pbyData Address of memory block previously reserved with GetAdvMemPtr 4 3 Access to NeuroCheck Settings The API enables the plug in DLL to access certain settings of NeuroCheck For this purpose the API provides the following functions GetNcApiVersion extern C WINAPI int GetNcApiVersion void The GetNcApiVersion function returns the version number of the NeuroCheck API as integer e g 515 It will be increased whenever functionality is added to the DLL GetNcExeVersion extern C WINAPI BOOL GetNcExeVersion DWORD pdwMajorVersion DWORD pdwMinorVersion DWORD pdwBuildVersion DWORD pdwSubBuildVersion The GetNcExeVersion function reads the version numbers of the NeuroCheck main application The version information e g 5 1 1038 0 will be splitted into single parts that are returned by the
98. ble TRUE eof function OnLiveMode 7 9 6 Check Function Parameters The following source code sample demonstrates how to read out the parameters of a check function modify them and store them back to the check function object void ModifyParameters ICheckFunction pICf if FALSE pICf gt HasParameters 166 NeuroCheck Programmer s Reference TRACEO no parameter settings available n return eoif read current parameter settings VARIANT arg piCf gt GetParameters error check data is transfered between server and controller using a safearray if arg vt VT_UI1 VT_ARRAY TRACEO error invalid return value n return eoif switch pICf gt GetFunctionId case NC_FCT_IDT transfer image define in ncauto h sNcIdtParameter psPara declared in ncauto h access data if S_OK SafeArrayAccessData arg parray void amp psPara TRACEO error safe array access n return eoif assign to local vars unsigned int uiLeft psPara gt uiLeft unsigned int uiTop psPara gt uiTop release access SafeArrayUnaccessData arg parray notify system that safearray is no longer needed SafeArrayDestroy arg parray do something with the data launch a dialog for instance and let the user modify the data fill local struct and transfer the data back to the server sNcIdtParameter sPara pa
99. ck Item SingleCheck Count 1 OLE Automation 135 7 5 4 Wrapper The Visual C ClassWizard will create the following wrapper class from the type library class ISingleCheck public COleDispatchDriver 7 6 CheckFunction object 7 6 1 Properties This section lists the properties of the CheckFunction object Activated The Activated property sets or returns a Boolean value indicating whether the check function is activated or deactivated Syntax object Activated value The object placeholder represents the CheckFunction object Return Type VT_BOOL Remarks The Activated property can only be changed for those check functions that allow deactivation Currently only check functions Filter Image and Determine Position can be deactivated For all other check functions the Activated property returns TRUE always Category The Category property returns the category to which the check function belongs The category IDs are defined in ncauto h and listed in the Quick Reference section of this manual Syntax object Category The object placeholder represents the CheckFunction object 136 NeuroCheck Programmer s Reference Return Type VT_I2 CFIndex The CFIndex property returns the index of the check function within the collection of the individual check Syntax object CFindex The object placeholder represents the CheckFunction object Return Type VT_l2 Remarks Use the CF Index property in combinatio
100. ck application window PI_GetHelpFilePath extern C BOOL WINAPI PI_GetHelpFilePath LPSTR lpszPath Informs NeuroCheck about existence and name of a help file for the plug in DLL Required to be explicitly exported from plug in DLL Parameters lpszPath Address of a buffer with size _MAX_PATH for returning the full path name of the help file for the plug in DLL Return Value TRUE A help file has been provided for the DLL and its name returned in lpszPath FALSE No help file has been provided Pl_MenuCommand extern C void WINAPI PI_MenuCommand HWND hwndMain unsigned int uiCmdId Handles calls to plug in menu items in the Tools menu Required to be explicitly exported from plug in DLL Parameters hwndMain Handle of the NeuroCheck application window uiCmdID ID of selected menu item range 0xDO00 0xD099 Pl_GetNumberOfF cts extern C unsigned int WINAPI PI_GetNumberOfFcts void Informs NeuroCheck about the number of check functions in the plug in DLL Required to be 186 NeuroCheck Programmer s Reference explicitly exported from plug in DLL Return Value Returns the number of check functions for which NeuroCheck has to allocated function info blocks PI_GetFctCaps extern C BOOL WINAPI PI_GetFctCaps unsigned short int uilIndex sSPI_FCT_DESC const psFctDesc Informs NeuroCheck about the properties of a check function from the plug in DLL Required to be explicitly exported from plug in DLL
101. ck the API provides a number of functions The main application will be access to digital I O and field bus devices 62 NeuroCheck Programmer s Reference GetDeviceCount extern C WINAPI int GetDeviceCount int iDeviceType The DeviceCount function returns the number of devices of the type specified by iDeviceType configured in NeuroCheck s Device Manager If the input argument is incorrect the function returns 1 For instance the function can be used to retrieve information about the number of I O boards configured in NeuroCheck Parameters iDeviceType Type of device The different device types are identified by symbolic constants defined in pi_NcApi h GetDeviceName extern C WINAPI LPSTR GetDeviceName int iDeviceType int iDeviceIndex The GetDeviceName function returns the name of the specified device as configured in NeuroCheck s Device Manager The string is returned as pointer to a static string This pointer is only valid until the next call to this function so it is recommended to store the string immediately in a CString variable It is not possible to change the contents of the string If one of the input arguments is incorrect the function returns a NULL pointer Parameters iDeviceType Type of device The different device types are identified by symbolic constants defined in pi_NcApi h iDeviceIndex Index of device GetSubDeviceCount extern C WINAPI int GetSubDeviceCount int iDeviceType
102. constant pointer which means that the pointer itself must not be changed In psDat aContainer the address of an allocated data container is passed to the routine for returning the data sequence that NeuroCheck will write to the given output target The following structure is used for the data container typedef struct unsigend int uiCount sPI_DATAOUTPUT_ITEM psDataItem sPI_DATAOUTPUT_INFO The structure elements have the following meaning Element Description uiCount Number of data items i e length of array psDataItem psDataItem Array of data items The array must be allocated by the plug in DLL using VirtualAlloc De allocation will be handled by NeuroCheck Each data item can be either an integer value a floating point value or a string value The following structure is used for the data items typedef struct unsigned int uiType int iData float fData char pszData sPI_DATAOUTPUT_ITEM The structure elements have the following meaning Element Description uiType Type of data item Can have one of three values declared as symbolic constants in pi_types h PI_ITEM_INT item is integer value in iData PI_ITEM FLOAT item is floating point value in fData PI_ITEM_STRING item is string value in pszData iData Integer value of data item 40 2 7 2 1 NeuroCheck Programmer s Reference String value of data item The string must be allocated by the DLL using VirtualAlloc pszData Pl
103. contains the parameters describing the specified model geometry The meaning of the elements of array are listed in following table Model geometry Meaning of elements of FitParameters PI_FIT_CONTOUR If no specific model geometry is calculated array fFitParameters contains the coordinates of the center of gravity of the object contour fFitParameters 0 X coordinate of center point fFitParameters 1 Y coordinate of center point PI_FIT_POINT The description of a point simply consists of its coordinates fFitParameters 0 X coordinate of point fFitParameters 1 Y coordinate of point PI_FIT_LINI Gl The description of a line is given by the coordinates of its center point and the parameters of its mathematical description i e slope parameter m and constant b Furthermore the two points of intersection with the search area are given which represent the start and end point of the line Data Types and Definitions 53 X coordinate of center point Y coordinate of center point Slope parameter m Y axis parameter b X coordinate of start point Y coordinate of start point X coordinate of end point Y coordinate of end point fFitParameters fFitParameters fFitParameters fFitParameters fFitParameters fFitParameters fFitParameters YUYAO OP WBNEF CO fFitParameters PI_FIT_CIRCL Gl The description of a circle is given by the coordinates of its center point and its radius fFitParamete
104. d OLE automation This is of course not the end of it The possibilities are practically without limit as it is the express purpose of OLE automation to enhance each program s capabilities by borrowing functionality from other specialized programs You can for example e Design a specialized user interface for the production line personnel this user interface might feature simplified input of a small subset of parameters relevant during production operation give detailed instructions for certain events or display custom statistics and charts e Use a program written in a standard programming language like Visual Basic to perform communication and control tasks specific to your problem instead of applying a PLC e Hide NeuroCheck during production operation and still use it as a convenient development and test environment for the configuration of your inspection routines e Keep NeuroCheck on the screen to visualize the inspection process but prevent user interaction with NeuroCheck in automatic mode e Connect NeuroCheck to a database e g for setting target values at runtime or storing error statistics e Integrate NeuroCheck into your process control system or communication setup e Implement a teach functionality specific to your inspection tasks e Use NeuroCheck as an intelligent sensor in a closed loop control system realized by evaluating the results in your OLE controller 7 1 4 Capabilities of the NeuroCheck OLE Automation Inte
105. d as child elements single_check of sc_list Element lt single_check gt The single_check element represents individual checks as well as start and end actions Each element is labeled with the attributes name and type The child elements of a check are divided into logical blocks e g into the elements sc_properties and cf_list ete with their respective child elements The check functions of the individual checks can be found in the child elements check_function ofcf_list Element lt check_function gt The check_function element represents a NeuroCheck check function The type of the check function can be recognized by its attributes category id and display see also the corresponding files in the subdirectory Docs Xm1 of the NeuroCheck installation directory All data of the check function is represented by the child elements of this element e g by the element cf _properties with its respective child elements The parameter settings and target values of the check function can be found in the child elements cf_parameter and cf_target_values Elements lt cf_parameter gt and lt cf_target_values gt These two elements contain only child elements of the type parameter All parameters and target values that can be configured in the Parameter and Target Value dialogs of the respective check function are represented here 8 2 10 Element lt parameter gt The parameter element represents the settings of a parameter or target value in
106. d by drawing lines from point one to point two from point two to point three etc The polyline will 54 NeuroCheck Programmer s Reference be a closed polyline if the last point is identical to the first one At least two points are required PI_SHAPE_POLY_REGION Closed polyline for which filling is activated Note that if the polyline is not closed an additional line will automatically be inserted from the first point to the last one At least four points are required the last one identical to the first one T T PI_SHAPE POLY _SEARCHREG Polyline with a surrounding area The size of the surrounding area is given by the value of element iSearchReg Note that the surrounding area must not leave the borders of the applied image PI_SHAPE_POLY_SEARCHREG_REGION Polyline with a surrounding area for which filling is activated The size of the surrounding area is given by the value of element iSearchReg At least two points are required E PI_SHAPE_CIRCLI T Ba Polyline for which circle conversion is activated Circle if the polyline is closed otherwise arc At least three points are required T PI_SHAPE_CIRCLE_REGION Closed polyline for which both circle conversion and filling is activated Note that if the polyline is not closed an additional line will automatically be inserted from the first point to the last one At least four points are requir
107. depends on the language version of NeuroCheck English German e Attribute display This attribute contains a description of the element s content Yes in example 1 EAN 8 in example 2 This description is easier to interpret by a human than the element s content itself 2 in example 2 The content of this attribute depends on the language version of NeuroCheck English German e Attribute disabled Elements containing the attribute disabled 1 are ignored when the check routine is executed In the above example this could be because another parameter the threshold determination method is set to automatic computation and not to manual input 8 2 12 Element lt binary_stream_encapsulation gt binary_stream_encapsulation elements contain complex check routine data that might conflict with the XML syntax specification This affects binary data within PlugIn parameter sections binary image data or certain HTML tags within the description texts of NeuroCheck objects The child elements data and plain contain the data in a format usable by NeuroCheck whereas the element st ream is used to display the data in XSL 8 2 13 Purpose of the individual parts The individual parts of the NeuroCheck check routine XML file have different purposes The element structure and the element contents data are of course the most important parts Some parts of the XML file only serve to enhance clarity and to facilitate visual interpretation of
108. des the one step undo function existing 22 NeuroCheck Programmer s Reference for built in functions The l button will revert the last changes made to the function parameters In the same way NeuroCheck implements the parameter copy functionality Validation of the copied parameter block is again the business of the plug in DLL Executing a Plug In Check Function Whenever NeuroCheck encounters a plug in check function in the course of a check routine it will call the execution routine of the plug in check function The current context information e g about the current operating mode the parameter block and pointers to all required input data objects are passed to the function according to the specifications in the function info structure The execution routine of a plug in check function can create data objects of the types image layer of ROIs histogram and measurement list if the function info structure registered these with NeuroCheck In addition it can create output data objects of same plug in data type registered by its plug in DLL Objects of plug in data types can only be passed to other plug in functions of the same plug in DLL whereas NeuroCheck data objects can be used by any check function The execution routine will receive pointers to adresses of such data objects can allocate memory for the data objects and return the adresses to NeuroCheck Conventions for memory allocation are described below Using the Output Pos
109. dex Index of parent device iSubDeviceType Type of sub device The different sub device types are identified by symbolic constants defined in pi_NcApi h iSubDeviceIndex Index of sub device ReadDigitallnput extern C WINAPI BOOL ReadDigitalInput int iBoardIndex int iInputNumber The ReadDigitallInput function reads the current state of a digital input It takes two arguments which specify the digital I O board and the input to be read The function returns the state of the input i e TRUE or FALSE Parameters iBoardIndex Index of digital I O board iInputNumber Number of input to be read SetDigitalOutput extern C WINAPI BOOL SetDigitalOutput int iBoardIndex int iOutputNumber BOOL bNewState The SetDigitalOutput function sets the state of a digital output It takes three arguments specifying the digital I O board the output to be set and the state the output will be set to The function returns TRUE if the output could be set or FALSE if an error occurred Parameters iBoardIndex Index of digital I O board 64 NeuroCheck Programmer s Reference iOutputNumber Number of output to be set bNewState New state value ReadDigitallnputWord extern C WINAPI BOOL ReadDigitalInputWord int iBoardIndex int pInputWord The ReadDigitalInputWord function reads the current states of all 16 digital inputs of one digital I O board It takes two arguments one which specifies the digital I O
110. e 56 3 5 3 User Defined Features 0 0 ccccecceeseesscesseeneeeeesseeeeeeseeeseesteenseeaes 60 JOA Taret VPeSeincosdveciseecesraceussscesaecavesssmionstianth tees a 60 4 1 4 2 4 3 4 4 5 1 5 2 6 1 6 2 6 3 6 4 T2 Exposed Automation Objects cc ceeeccsssssesseeseeseceeceecesessesseeseeseeeeeeeseneeeeeaes 96 5 Contents NeuroCheck API Functionality c ccccccccsssseeeeesseneeeeseeeeeeseeneeeenees 61 Access to Hardware Devices ccccccssessseesseesecesecseeeseceseenseeeaecnseeseeseenseeaes 61 Bitmap Management 0 ccc ninn n dete N S in 67 Access to NeuroCheck Settings ccccscesseeseessceeeseeeneeeseeeseeeseeeneeseenseenaes 71 Err Or COGS 2 55 ec Sas ssced as vbec E A E E itis ai eed ated nee 74 Implementing a Plug In DLL ccc cceeeeeeeeeeeeneeeeseeneeeeseeneeeeneeeneeeess 77 Overview of the Sample Plug In DLLS ccececceseceeesseeneeeseenseeneeetseeaees IT Project Structuren A Ee a 81 Custom Communication Interface cccceeseeeeeeneeeeeeeeeeeeeenees 83 Using a Custom Communication Interface eccceseeseeseeseeeseeeseeseeeneeesees 83 6 1 1 Loading a Custom Communication DLL eeeeesseeseeteeeeees 83 6 1 2 Transmitting Data via the Custom Communication Interface 84 6 1 3 Using the Custom Communication Interface for Remote Control 86 Administrative Functions cccccecceseeseesceeseeeseeeseceseeseceseensecesecseeeeeseeeseeenes 87 6
111. e 0 given in the function info block the pointer will be NULL Please note that this also applies to all other functions which are passed the parameter memory block The initialization routine is called whenever NeuroCheck creates an instance of the respective plug in check function i e when this plug in check function is appended to or inserted into a check routine or when a check routine is loaded which contains this plug in check function It will typically be used for setting default parameters Interface Description 29 NeuroCheck evaluates the function return value If the function returns FALSE NeuroCheck assumes that the initialization failed The check function will not be added to the check routine or the check routine will not be loaded Hint Since the initialization routine is executed when the check function is first added to a check and also when the check routine is loaded from file it is useful to indicate in the parameter area whether parameters have already been edited for this function A simple method would be to use the first byte of the parameter area as an initialization flag Before the check function is actually added to the check routine the whole parameter block will be filled with zeroes The initialization should set default parameters values only if the first byte is indeed zero and then set the byte to a different value This ensures that altered parameters will not be inadverten
112. e check OK or not OK to the device selected for the Check result signal in the Remote Control dialog box If this device is a custom communication interface or if the option to include the check result in the transmission frame has been activated in the Options for Custom Communication dialog it will call a function declared as extern C void SetCheckResult BOOL bSuccess If the check result is OK a value of 1 will be passed in bSuccess a value of 0 else The function must be explicitly exported from the DLL 6 4 2 Floating Point Value Functions like Measure ROIs or Gauge ROIs compute floating point values If a custom communication interface has been selected as destination device for the results of such a Custom Communication Interface 89 function NeuroCheck will call a function TransferFloat for every value to be transmitted The function is declared as extern C void TransferFloat float fValue In Value NeuroCheck passes the floating point value to be transmitted 6 4 3 Integer Value Functions like Count ROIs or Determine threshold compute integer values If a custom communication interface has been selected as destination device for the results of such a function NeuroCheck will call a function TransferInt for every value to be transmitted The function is declared as extern C void TransferInt int iValue In iValue NeuroCheck passes the integer value to be transmitted 6 4 4 String Functions like
113. e data to file or RS232 serial interface in the same way as the standard NeuroCheck data types with the exception of PI_IMAGE Of course the plug in programmer may also implement a custom output in the data output routine 2 7 2 Data Output Routine The data output routine of a plug in data type has to be declared as follows excepting the actual name of course BOOL WINAPI DataOutput SPI_TARGET_INFO const psTargetInfo void const pData sPI_DATAOUTPUT_INFO psDataContainer InpsTargetInfo NeuroCheck passes information about the output target for which the data output routine is called The following structure is used for the target description typedef struct unsigned int uiType LPSTR lspzName SPI_TARGET_INFO The structure elements have the following meaning Element Description uiType Type of target Can have one of two values declared as symbolic Interface Description 39 constants in pi_types h PI_TARGET_FILE Output to data file PI_TARGET_RS232 Output to RS232 serial interface lspzName Name of target as a zero terminated string For output to data file the string contains the full name of the output file For output to RS232 serial interface the string contains the name of the COM port All elements of the structure have to be considered read only In pData NeuroCheck passes the address of the data object allocated previously inside the execution routine It is passed as
114. e of the output i e TRUE or FALSE if the output was read successfully or VT_EMPTY if an error occurred Syntax object ReadDigitalOutput Boardindex OutputNumber The object placeholder represents the NCApplication object Return Type VT_VARIANT Argument Type Description BoardIndex VT_I2 Index of digital I O board counted from 0 OutputNumber V T_ 2 Number of the output to be read counted from 0 ReadDigitalOutputWord The ReadDigitalOutputWord method reads the current state of all 16 digital outputs of one digital I O board It takes one argument which specifies the digital I O board to be read The method returns an integer value encoding the state of the outputs or VT_EMPTY if an error occurred OLE Automation 113 Syntax object ReadDigitalOutputWord Board ndex The object placeholder represents the NCApplication object Return Type VT_VARIANT Argument Type Description BoardIndex V T_ 2 Index of digital I O board counted from 0 Remarks Please refer to the ReadDigitalInputWord methof for a description of the encoding of the return value ReadFieldBusInputBit The ReadFieldBusInputBit method reads the current state of an input bit of a field bus device It takes two arguments which specify the field bus board and the input bit to be read The method returns the state of the input bit i e TRUE or FALSE if the input was read successfully or VT_EMPTY if an error occurred Syntax
115. e of the second one for the output data object description specified in Example 2 6 3 1 uiDataOutput 1 static int FileOutput TRUE TRUE static int Rs2320utput FALSE TRUE piMaskFileOutput FileOutput piMaskRs2320utput Rs2320utput Descriptive Texts The string area of the function info block contains four pointers to user defined strings used for display in the Select New Check Function dialog box The pointers have to refer to static data elements in the DLL The strings implement the same level of information in the dialog as for built in check functions A recommended maximum size is given although the length of the strings is not limited in principle Element Description lpszFunctionName Name of function used in the Select New Check Function dialog the check routine tree view protocol files etc Recommended string length max 40 chars Interface Description 37 lpszDescription Descriptive text for the function lpszHintPos Hint displayed in the Select New Check Function dialog when the function can be inserted into the check routine at the current position Recommended string length max 80 chars lpszHintNeg Hint displayed in the Select New Check Function dialog when the function cannot be inserted into the check routine at the current position due to lack of required input data objects Recommended string length max 80 chars alpszCustomViewNames List of names for the cus
116. e size NC_ZOOM_100 100 100 of original image size NC_ZOOM_50 50 50 of original image size NC_ZOOM_25 25 25 of original image size NC_ZOOM_10 10 10 of original image size Example The following example demonstrates how to copy the first image on the internal data stack to the clipboard It is copied as a device independent bitmap in normal size with color information If no color information is present in the current image by default the normal grey level image will be taken Clear contents of clipboard Clipboard Clear If SingleCheck CopyImageToClipboard _ 0 NC_CF_COLOR_DIB NC_ZOOM_100 Then Copy image from Clipboard to Picture property of VB form Picture Clipboard GetData End If EnableCheck The EnableCheck method enables or disables execution of the individual check It returns a Boolean value indicating the previous execution state Syntax object EnableCheck bEnable The object placeholder represents the SingleCheck object 132 NeuroCheck Programmer s Reference Return Type VT_BOOL Argument Type Description bEnable VT_BOOL If TRUE execution of the check will be enabled if FALSE it will be disabled Remarks Method EnableCheck is deprecated please use property CheckEnabled instead GetlmageData The GetImageData method returns the gray level data of the image in the internal runtime data stack specified by argument Jmagelndex The method returns a safearray containing the gray level dat
117. e sum is calculated for all objects in the input layer Another example for creating a meas array can be found in PI_DataOutput e Modify MeasArray This plug in check function demonstrates the modification of a measurement array Each measurement value is replaced by its square value Implementing a Plug In DLL 79 PI_DataTypes_Adv This sample demonstrates the use of plug in data types It also gives advanced examples for the use of NeuroCheck data types Less complex examples are given in PI_DataTypes and PI_DataOutput Create Plug In Data Types This plug in check function demonstrates the creation of plug in data types Furthermore it shows the access of class information of objects and of source information of images Modify Plug In Data Type This plug in check function demonstrates the modification of a plug in data type The plug in check function takes as input an object of plug in data type DT_03 It simply changes the CString object encapsulated in the plug in data type Create Color Image This plug in check function demonstrates the creation of a color image It also shows the read access of ROI descripitions i e chain code for the contour and RLC code for the region description A simpler example for creating a PI_IMAGE object can be found in PI_DataOutput Create Layer This plug in check function demonstrates the creation of layer objects and the access of model geometries Objects in the input layer for which no mod
118. eCount DeviceName Type Access Description VT_I2 rw reads sets camera for live view VT_BSTR ro returns camera designation for live view VT_I2 rw reads sets zoom factor for live view VT_DISPATCH ro returns the active check routine object or VT_EMPTY if none VT_DISPATCH ro returns the application object VT_BSTR ro returns the title of the application window VT_I2 xo returns number of devices configured in NeuroCheck or 1 on error Takes one argument VT_I2 DeviceType Type of device VT_BSTR ro returns name of a device configured in NeuroCheck or empty string on error Takes two arguments VT_I2 DeviceType Type of device ExeMajorVersion ExeMinorVersion FullName Height Quick Reference 199 VT_I2 DeviceIndex Index of device VT_I2 xo returns major version number 2 4 VT_I2 xo returns minor version number 2 0 VT_BSTR ro returns the file specification for the application including path VT_I4 rw reads sets height of main application window IgnoreCommunication InterfaceVersion sastHError Left LicenseLevel LicenseNumber Name OperatingMode Parent Path ReadFromBitmap SubDeviceCount SubDeviceName Top Width VT_BOOL rw reads sets ignore communication option of application VT_I2 xo returns version number of automation interface VT_I4 xo returns error number for most recent error VT_I4 rw reads sets left edge of main ap
119. eads sets visibility of the application to the user Method Save SaveAs Collection Property NewEnum Collection Method Item Wrapper class ICheckRoutine SingleCheck object Property CheckEnabled Count CurrentResult Description LastFunction Name NumOf Images OID Quick Reference 203 Description Saves check routine to the file given in Ful 1Name returns success or failure Return type VT_BOOL Arguments None Saves check routine to the specified file returns success or failure Return type VT_BOOL Arguments VT_BSTR FileName name of the new file path optional Type Access Description VT_DISPATCH ro returns an enumerator object that implements TEnumVARIANT Description Returns the given individual check object Return type VT_DISPATCH Arguments VT_VARIANT SCIndex individal check object to be returned public COleDispatchDriver Type Access Description VT_BOOL rw reads sets current activation state of the check VT_I2 xo returns number of check functions in the check VT_BOOL ro returns final result of most recent execution of the single check VT_BSTR rw reads sets description text of the check VT_I2 ro returns index of the last check function of the check which returned O K VT_BSTR rw reads sets the name of the check VT_I2 xo returns number of images on the internal stack VT_I4 rw reads sets the object s identifica
120. ease note that fData Floating point value of data item pszData pszData must be assigned to NULL if iType is not PI_ITEM_STRING Example The following sample code shows how to output the three different types of data Int Float and String assuming that the plug in data object was defined as structure sMY_DATA_TYP Gl typedef struct integer value float value int iData float fData sMY_DATA_TYPE BOOL WINAPI DataOutput SPI_TARGET_INFO const psTargetInfo void const pData SPI_DATAOUTPUT_INFO psDataOutputInfo verify data pointer if pData NULL return FALSE type cast of sMY_DATA_TYPE data pointer psMyData output of 3 elements int float psDataOutputInfo gt uiCount 3 allocate memory for the elements psDataOutputInfo gt psDataItem sP NULL SsMY_DATA_TYPE pData and string using the v heap api _DATAOUTPUT_ITEM VirtualAlloc DWORD psDataOutputInfo gt uiCount MEM COMI sizeof sPI_DATAOUTPUT_ITE IT PAGE_READWRITE inser psDataOu integer element putInfo gt psDataItem 0 uil psDataOutputInfo gt psDataItem 0 iData insert float element psDataOutputInfo gt psDataItem 1 uil psDataOutputInfo gt psDataItem 1 fData get element for string output sPI_DATAOUTPUT_ITEM psItem insert string element psItem gt uiType PI_ITEM_STRING create string for output
121. eck s Device Manager The device is specified by the input arguments DeviceType Devicelndex SubDeviceType and SubDevicelndex If the input arguments are incorrect the property returns an empty string Syntax object SubDeviceName DeviceType Devicelndex SubDeviceType SubDevicelndex The object placeholder represents the NCApplication object Return Type VT_BSTR Argument Type Description DeviceType VT_I2 Type of the parent device DeviceIndex VT_I2 Index of the parent device counted from 0 SubDeviceType V1_l2 Type of the sub device SubDeviceIndex T_l2 Index of the sub device counted from 0 For the possible settings of DeviceType and SubDeviceType please refer to the DeviceCount and SubDeviceCount of the NCApplication object Top The Top property returns or sets the distance between the top edge of the physical screen and 108 NeuroCheck Programmer s Reference the main application window See Figure 17 Syntax object Top value The object placeholder represents the NCApplication object Return Type VT_I4 Width The Width property returns or sets the distance between the left and right edges of the main application window See Figure 17 Syntax object Width value The object placeholder represents the NCApplication object Return Type VT_I4 Remarks The minimum value of the Width property is 620 Figure 17 Properties for controlling size and position of the main applic
122. ect placeholder represents the NCApplication object Return Type VT_BSTR ActiveCameraZoom The ActiveCameraZoom property sets or returns the zoom factor of the live image view It is only available in live mode 98 NeuroCheck Programmer s Reference Syntax object ActiveCameraZoom value The object placeholder represents the NCApplication object Return Type VT_I2 Possible settings for ActiveCameraZoom are Constant Value Description NC_ZOOM_100 100 100 of original image size NC_ZOOM_50 50 50 of original image size NC_ZOOM_25 25 25 of original image size NC_ZOOM_10 10 10 of original image size ActiveCheckRoutine The ActiveCheckRoutine property returns the active check routine object or VT_EMPTY if none is available Syntax object ActiveCheckRoutine The object placeholder represents the NCApplication object Return Type VT_DISPATCH Application The Application property returns the application object Syntax object Application The object placeholder represents the NCApplication object OLE Automation 99 Return Type VT_DISPATCH Caption The Caption property returns the title of the application window Syntax object Caption The object placeholder represents the NCApplication object Return Type VT_BSTR DeviceCount The DeviceCount property returns the number of devices of the type specified by DeviceType configured in NeuroCheck s Device Manager If the input argument is incorrect the pr
123. ect placeholder represents the NCApplication object Return Type VT_I2 ExeMinorVersion The ExeMinorVersion property returns the minor version number of the application s executable file always greater or equal to 0 OLE Automation 101 Syntax object ExeMinorVersion The object placeholder represents the NCApplication object Return Type VT_I2 FullName The FullName property returns the file specification for the application including path Syntax object FullName The object placeholder represents the NCApplication object Return Type VT_BSTR Height The Height property returns or sets the distance between the top and bottom edge of the main application window See Figure 17 Syntax object Height value The object placeholder represents the NCApplication object Return Type VT_I4 Remarks The minimum value of the Height property is 460 IgnoreCommunication The IgnoreCommunication property sets or returns the value of the ignore cummunication option of NeuroCheck If set to TRUE NeuroCheck will ignore all functions requiring signals to be received via digital I O or field bus The default is FALSE 102 NeuroCheck Programmer s Reference Syntax object lgnoreCommunication value The object placeholder represents the NCApplication object Return Type VT_BOOL InterfaceVersion The InterfaceVersion property returns the version number of the OLE automation interface always greater
124. ect placeholder represents the NCApplication object Return Type VT_I2 Possible settings for OperatingMode are Constant Value Description NC_MODE_MANUAL 0 Manual mode not available for runtime version NC_MODE_TEST 1 Test mode read only NC_MODE_LIVE 2 Live mode NC_MODE_AUTOMATIC 3 Automatic mode NC_MODE_AUTOCONFIG 4 Configure automatic screen mode read only Remarks Changing the OperatingMode property requires a check routine to be loaded Changing to Manual Mode requires an installation of Internet Explorer 4 0 or higher Furthermore Manual mode is not accessible for a runtime license of NeuroCheck Both Test mode and Configure automatic screen mode are not accessible through OLE automation at all i e setting the OperatingMode Property to one of the corresponding values will be without effect Parent The Parent property returns NULL Syntax object Parent The object placeholder represents the NCApplication object Return Type VT_DISPATCH Path The Path property returns the path specification for the executable file of the application 106 NeuroCheck Programmer s Reference Syntax object Path The object placeholder represents the NCApplication object Return Type VT_BSTR ReadFromBitmap The ReadFromBitmap property sets or returns the simulate image capture option of NeuroCheck If set to TRUE all Transfer Image functions in the check routine will be switched to bitmap f
125. ed the last one identical to the first one PI_SHAPE_ CIRCLE T EARCHREG Polyline with a surrounding area for which circle conversion is activated The size of the surrounding area is given by the value of element iSearchReg At least three points are required T n PI_SHAPE_CIRCLE ps n EFARCHREG_REGION Polyline with a surrounding area for which circle conversion and filling is activated The size of the surrounding area is given by the value of element iSearchReg At least three points are required Note that the ordering of the points is crutial for any polyline interpretation There should be no crossing of polylines The created region must not pass the edge of the image section it will be applied to An arbitrary object contour can be approximated by a closed polyline by specifying every single point of the contour Data Types and Definitions 55 Example for Creating a Contour The figure shows a dark octogon on a light background and the corresponding description of a closed polyline for approximating its contour The asterisk marks the start of the contour the numbers the point numbers and the arrows the polylines to the next contour point The top left corner X 0 and Y 0 has been chosen as reference point T iShapeType PI_SHAPE_POLY iSearchReg 0 0 3 Elements of psPoints iLength 8 pix DEL 2 3 4 4p 3p 2p Ue 1
126. el geometry has been calculated for simply will be copied to equivalent objects in the output layer if possible For objects a model geometry has been calculated for an output object will be created matching the model geometry A simpler example for creating a PI_LAYER object can be found in PI_DataOutput Pl_DataOutput This sample DLL shows how plug in check functions can participate in NeuroCheck s file output capabilities Output of Color Image This plug in check function demonstrates output of an image It also gives a simple example for the creation of a color image Output of Plug In Data Types This plug in check function demonstrates the creation and data output of plug in data types Output of MeasArray This plug in check function demonstrates the creation and data output of a PI_MEASARRAY data type object 80 NeuroCheck Programmer s Reference Output of Layer This plug in check function demonstrates the creation and data output of a layer object It creates one rectengular AOI and activates some feature values Output of Histogram This plug in check function demonstrates the creation and data output of a PI_HISTO data type object PI_NcApiCalls This sample shows the usage of the NeuroCheck API functionality provided in NcApi DLL A further example is shown in PI_Visualization For this sample the NeuroCheck API is encapsulated in a C class available for re use Please note that for successful execution
127. ened Syntax object PartsCheckedNOk The object placeholder represents the CheckRoutine object Return Type VT_I4 PartsCheckedOk The PartsCheckedOk property returns the total number of parts checked with final result Part O K since the active check routine has been opened 122 NeuroCheck Programmer s Reference Syntax object PartsCheckedOk The object placeholder represents the CheckRoutine object Return Type VT_I4 Path The Path property returns the path specification for the check routine not including the filename or filename extension Syntax object Path The object placeholder represents the CheckRoutine object Return Type VT_ BSTR Saved The Saved property returns a Boolean value indicating whether the check routine has been saved after the most recent change TRUE if the check routine has not been changed since it was last saved FALSE if the check routine has not been saved since the most recent change Syntax object Saved The object placeholder represents the CheckRoutine object Return Type VT_ BOOL Visible The Visible property sets or returns whether the check routine object in effect the NeuroCheck window is visible to the user or hidden The default is FALSE OLE Automation 123 Syntax object Visible value The object placeholder represents the CheckRoutine object Return Type VT_ BOOL Remarks According to the automation interface guidelines the visibility
128. ent is enclosed in a start tag and an end tag The area between the tags is the element content The content can consist of an arbitrary number of arbitrary characters excluding gt and lt and some other reserved characters Usually the content is text i e words and numbers Some examples of elements lt element gt data lt element gt lt element2 gt 1 95583 lt element2 gt lt address gt 552 Northern Avenue IL 60142 5298 lt address gt e Elements can contain attributes that are assigned inside the start tag The value assigned to the attribute must be enclosed in quotation marks Example lt element id 100 type int gt 42 lt element gt e Summary of the nomenclature using an example lt x y zZ gt abc lt x gt With x element name abc element content y attribute name Check routine in XML format 175 z attribute value e Elements can be nested This means that an element can contain one or more other elements The nesting is always hierarchic as with a tree structure Elements must not overlap Example lt main_element gt lt e2 gt data lt e2 gt lt e2 gt other data lt e2 gt lt main_element gt The elements enclosed in another element are called child elements of the enclosing element e Comments i e parts of the XML file that are only intended to aid in the interpretation of the file and do not contain any data are surrounded by the marks lt and gt Example lt Beginning of
129. ent parameter settings VARIANT arg plCf gt GetTargetValues error check data is transfered between server and controller using a safearray if arg vt VT_UI1 VT_ARRAY TRACEO error invalid return value n return eoif switch pICf gt GetFunctionId case NC_FCT_OBC Count ROIs define in ncauto h 168 NeuroCheck Programmer s Reference sNcObcTargetValue psTv declared in ncauto h access data if S_OK SafeArrayAccessData arg parray void amp psTv TRACEO error safe array access n return eoif assign to local vars BOOL bCheckData psTv gt bCheckData unsigned int uiMin psTv gt uiMin unsigned int uiMax psTv gt uiMax release access SafeArrayUnaccessData arg parray notify system that safearray is no longer needed SafeArrayDestroy arg parray L Res ea ae eS ee eee See ae Se sees ee esse see do something with the data launch a dialog for instance and let the user modify the target values fpf SS SS Se SSS SS SS SSS Se Sa fill local struct and transfer the data back to the server sNcObcTargetValue sTv sTv uiMin 17 sTv uiMax 21 SAFEARRAYBOUND rgb sizeof sTv 0 create a 1 dimensional safearray SAFEARRAY psa SafeArrayCreate VT_UI1 1 rgb if psa void pData SafeArrayAccessData psa void amp pData serialize the data into the char array memcpy
130. era 0 0 VT_l4 Identifier index of the camera the image is captured from 7 7 10 Transfer Image Function Transfer Image allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The elements of the parameter structure define the location of the image section to be transferred into memory Parameter Item Type Description Left 0 0 VT_l4 X coordinate of top left corner Top 0 1 VT_l4 Y coordinate of top left corner Right 0 2 VT_l4 X coordinate of bottom right corner Bottom 0 3 VT_l4 Y coordinate of bottom right corner Source 0 4 VT_l4 Identifier of the image source The source IDs are defined in Ncauto h and listed below Camera 0 5 VT_l4 Identifier index of the camera the image is captured from Bitmap 0 6 VT_BSTR Name of bitmap file to be loaded Not available if more than one bitmap file selected in Transfer Image Tray Index 0 7 VT_l4 Index of image tray the image Possible settings for Source are Constant Value Description NC_IDT_SOURCE_CAMERA 0 Image transferred from camera i e frame grabber NC_IDT_SOURCE_BITMAP 1 Image loaded from bitmap file NC_IDT_SOURCE_TRAY 2 Image transferred from image tray 7 7 11 Determine Threshold Function Determine Threshold allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The elements of the parameter structure define whether the threshold is computed
131. eseeeeesseeeseenaeenes 191 Plug In Interface Symbolic Constants ccccescessesseeeseeseeeseeeseeseeessenseenes 194 Custom Communication Interface ccecccesceseeeseeseeeseceseeseeeeeeeeeeeeseeeees 196 OLE Automation Interface 0 ccccccccsccccessscccessseeccesseeecesseeccessseeceesseeeeses 198 Introduction In addition to the extensive functionality contained as built in NeuroCheck provides the experienced user with three programming interfaces for extending the system These interfaces allow you to integrate self developed image processing or communication functions in NeuroCheck In addition you can run NeuroCheck as a software component in the background and provide the operator with an individually developed Windows application as user interface and control instance This Programmer s Reference describes the three programming interfaces which allow NeuroCheck to be enhanced by user defined functionality These interfaces are e The plug in interface for user defined check functions and menu items e The custom communication interface for user defined serial communication protocols e The OLE automation interface for remote control of NeuroCheck through other Win32 applications In addition this document contains a description of the XML format of the NeuroCheck check routine and a Quick Reference for all interfaces presented Plug In Interface NeuroCheck s plug in interface lets you integrate dynamic link l
132. eseeeneeeees 161 7 9 Source Code Samples for C C ccccccccccessesseeseeseeeseceeeeseceeeeseeerenseesaees 162 7 9 1 Contact Server eani aa EEE thaawelaeegusbies E aT 162 79 2 Access Check Rowitin 4 cca e a aie 163 7 9 3 Access Check Functions sssesesseseesesssesssesrrsrrsreseseesesseesessesee 164 7 9 4 Automatic Mode Execution sssseseeseesessssssreserseeseeseesessessesresee 164 795 Display Live Image copen ann Sel E E che eee ees 165 7 9 6 Check Function Parameters ccccccsseeseesseeeeeeseeeseeeseeeseeeseeaes 165 7 9 7 Check Function Target Values c ccceescesseesseeseeeseeeseeseeeeeeaes 167 7 9 8 Check Function Result cccececcccscesseeseceneeeeeeeeeseeseeeseeneenaes 170 TOS Read Image araea aaas aaa eee cach n ae TEETE EEES 171 8 Check Routine in XML Format 0 ccsseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 173 8 1 Antroduct on sosnami ae a E ee ihe RUA es 173 SLI Whatis XML Tenrecinae aine tani See etek Hass 173 8 1 2 Possible applications of XML format c cesceesseeseeeteeteeees 173 8 2 Description of the XML format of check routines esceesesseeteeteeeeees 174 8 2 1 General description of the structure of XML files 174 8 2 2 Overview of the structure of the XML file of a check routine 175 8 2 3 Sample reee heres E EROE TUTA ER 175 8 2 4 Element lt neurocheck_check_routine gt seseseseeseeeesseseeseee 177 8 25 Element lt header nn acsariensn
133. eturn Type VT_BSTR FullName The FullName property returns the fully qualified path of the check routine file 120 NeuroCheck Programmer s Reference Syntax object FullName The object placeholder represents the CheckRoutine object Return Type VT_ BSTR Heading The Heading property returns or sets the user defined name of the check routine root node in the structure tree view See Figure 18 Syntax object Heading value The object placeholder represents the CheckRoutine object Return Type VT_ BSTR Remarks Do not confuse this with the Name property of the check routine Name The Name property returns the filename of the check routine not including path Syntax object Name The object placeholder represents the CheckRoutine object Return Type VT_ BSTR Remarks The Name property is supported for compatibility reasons use the FileName property instead OLE Automation 121 OID The OID property sets or returns the unique object identification number OID Syntax object OID The object placeholder represents the CheckRoutine object Return Type VT_I4 Parent The Parent property returns the application object Syntax object Parent The object placeholder represents the CheckRoutine object Return Type VT_DISPATCH PartsCheckedNOk The PartsCheckedNOK property returns the total number of parts checked with final result Part not O K since the active check routine has been op
134. f principal axis without regard to orientation i e between 0 and 180 PI_BNDAOT_LANGLE_360 Direction of principal axis with regard to orientation i e between PI_BNDAOI_RADMEAN PI_BNDAOI_RADMIN PI_BNDAOI_RADMAX PI_BNDAOI_RANGLE PI_ALL _ AREA PI_BNDAOI_PERI PI_BNDAOI_COMPACT Quick Reference 195 0 and 360 Average radius Mimum radius Maximum radius Angle between minimum and maximum radius Area of region Circumference of region Form factor of region defined as Area 4 m Circumference maximum value 1 for ideal circles else smaller PI_AOI_ANY PI_AOI_UP PI_AOI_DOWN PI_AOI_LEFT PI_AOTI_RIGHT PI_AOT_ HOLES PI_ALL EAN PI_ALL_ MIN PI_ALL_ MAX PI_ALL_ SIGMA PI_ALL_ CONTRAST PI_BNDAOI_FIBRELENGTH Approximate length of a line following the shape of the region holding equal distance to both edges PI_BNDAOI_FIBREWIDTH Sum of distances from the fibre to both edges PI_BNDAOI_ELONGATION Ratio of fibre length to width Region touches any image border Region touches top border of image Region touches bottom border of image Region touches left border of image Region touches right border of image Number of holes enclosed in the region Average gray level inside region Minimum gray level inside region Maximum gray level inside region
135. freed in the deinitialization routine because both routines will be executed only once during the lifetime of the plug in check function but memory allocated inside the execution or parameter dialog routines must be freed inside the same routine because these may be executed arbitrarily often 2 4 The Plug In Menu After loading a plug in DLL NeuroCheck reads the definition of a plug in menu from the resource portion of the DLL Menu items of such a menu are appended to the Tools menu NeuroCheck distinguishes between a menu for manual mode and a menu for automatic mode Refer to the description of the included sample DLL for implementation details 2 4 1 Manual Mode Menu The manual mode menu has a predefined resource ID of 0x6000 Other IDs may interfere with internal functions of NeuroCheck 2 4 2 Automatic Mode Menu The automatic mode menu has a predefined resource ID of 0x6001 Other IDs may interfere with internal functions of NeuroCheck 2 4 3 Menu Items The number of user defined menu items is restricted to 256 The resource IDs of the menu items have to be within a range from 0xD000 to 0xD100 Other IDs may interfere with internal functions of NeuroCheck 2 4 4 Menu Handler When one of the custom menu commands is selected during runtime NeuroCheck calls function extern C void WINAPI PI_MenuCommand HWND hwndMain unsigned int uiCmdId Interface Description 27 In hwndMain the handle of the main application window
136. g in check functions must match the declarations exactly except for the name Initialization Routine BOOL WINAPI InitFunction sPI_CONTEXT_INFO const psContext void const pParameter Performs initialization necessary for a plug in check function when it is first inserted into a check routine or loaded together with a check routine Parameters psContext Pointer to structure containing context information for function pParameter Address of parameter block reserved for the function Return Value TRUE Initialization has been carried out successfully FALS An error occurred during initialization Gl Deinitialization Routine void WINAPI DeInitFunction sPI_CONTEXT_INFO const psContext void const pParameter Peforms necessary cleaning up for a plug in check function when it is removed from the check routine or when the check routine is unloaded Parameters psContext Pointer to structure containing context information for function pParameter Address of parameter block reserved for the function Execution Routine BOOL WINAPI ExecuteFunction sPI_CONTEXT_INFO const psContext void const pParameter Quick Reference 189 void const const ppvDynInput void const ppvDynOutput Performs the actual computation called whenever NeuroCheck encounters the plug in check function object during execution of a check routine Parameters psContext Pointer to structure containing context information for
137. g structures are defined in Ncauto h Target Value Verify Item 0 0 Type VT_BOOL Description If TRUE the function will compare the classes OLE Automation 151 of the ROIs in its input list to the class strings given Rejection 0 1 VT_l4 An ROI will be classified as Not O K if the threshold classification certainty falls below this value even if it corresponds to the respective class in the class list Valid range 0 100 Class strings 0 2 21 VT_BSTR Up to 20 class names to which the identified classes of the ROIs are to be compared The result values are returned in an array consisting of structures holding the following values for each identified ROI Result Value Item Type Description Class string n 0 VT_BSTR Name of the identified class Quality n 1 VT_R4 Classification certainty 7 7 6 Check Allowances Function Check Allowances allows target value setting and result data retrieval through OLE automation The pertaining structures are defined in Ncauto h The target values are transferred using an array of structures holding the following values for each measurement Target Value Item Type Description Verify n 0 VT_BOOL If TRUE the corresponding measurement will be compared to the pertaining target values Description n 1 VT_BSTR Name of the measurement read only Nominal value n 2 VT_R4 Nominal value of the measurement Lower allowance n 3 VT_R4 Allowance added to the nomi
138. gitallnput Boardindex InputNumber The object placeholder represents the NCApplication object Return Type VT_VARIANT Argument Type Description BoardIndex T_ 2 Index of digital I O board counted from 0 InputNumber T_ 2 Number of the input to be read counted from 0 ReadDigitallnputWord The ReadDigitalInputWord method reads the current states of all 16 digital inputs of one digital I O board It takes one argument which specifies the digital I O board to be read The method returns an integer value encoding the states of the inputs or VT_EMPTY if an error occurred Syntax object ReadDigitallnputWord Board ndex The object placeholder represents the NCApplication object 112 NeuroCheck Programmer s Reference Return Type VT_VARIANT Argument Type Description BoardIndex V T_ 2 Index of digital I O board counted from 0 Remarks The return value of method ReadDigitalInputWord is the decimal value of a binary number encoding the current state of the 16 digital inputs Bit j corresponds to input number j A bit value of 1 indicates that the input is set a value of 0 that the input is not set For example a return value of 94ec 0000 0000 0000 1001 in means that only the inputs number 0 and number 3 are set ReadDigitalOutput The ReadDigitalOutput method reads the current state of a digital output It takes two arguments which specify the digital I O board and the output to be read The method returns the stat
139. grammer 18 NeuroCheck Programmer s Reference Hy NeuroCheck C Program Files NCheck PlugIn CHR Tools 0 A z gt oo Bl Ke E8 Define ROIs 3 Plug In Demo B various examples for plug in check functions afameter Target Value Input info neurocheck com Ayo Pl_Simple I5 Transfer Image lug In Menu Cmd Manual 00 c Modify Image Pl_Parameter a SB Figure 6 plug in menu for manual mode in NeuroCheck 2 Interface Description This chapter describes the individual elements of the plug in interface and the operations taking place during initialization use and deinitialization of a plug in DLL and its functions 2 1 Interface Structure To enable NeuroCheck to use the functions contained in a plug in DLL certain conventions have to be adhered to Every plug in DLL has to contain certain administration functions accessible from within NeuroCheck with a specific name This section will first give an overview of the administration frame for the DLL and its functions Subsequent sections will cover the individual administration functions in detail 2 1 1 Managing a Plug In DLL Administration of a plug in DLL in NeuroCheck consists of the following operations k 7 Upon program startup or upon loading the DLL on page Plug In of the General Software Settings dialog box the DLL is loaded into the memory area of the NeuroCheck process and is initialized NeuroCheck calls ro
140. he explanation in section 7 7 1 and an example in section 7 9 6 SetTargetValueltem The SetTargetValueItem method sets an element of the check function s target value matrix The element to be set is specified by the arguments Row and Column its value by argument NewValue The method returns a Boolean value indicating success or failure of the operation Syntax object SetTargetValueltem Row Column NewValue The object placeholder represents the CheckFunction object Return Type VT_ BOOL Argument Type Description Row VT_I2 Row index of element in target value matrix Column VT_l2 Column index of of element in target value matrix NewValue VT_VARIANT New value of specified element Remarks See the explanation in section 7 7 1 SetTargetValues The SetTargetValues method sets the target value information of the check function The target value settings are passed in a safearray structure equivalent to the result value of method GetTargetValues The method returns a value indicating success or failure of the operation OLE Automation 147 Syntax object SetTargetValues TargetSetting The object placeholder represents the CheckFunction object Return Type VT_ BOOL Argument Type Description TargetSetting V1_VARIANT Safearray containing the parameter settings Remarks This method is optimized for use with C C See the explanation in section 7 7 land an example in section 7 9 7 7 6 3 Wrapper The Visual
141. heck If it returns TRUE NeuroCheck currently ignores all functions requiring signals to be received via digital I O or field bus The default is FALSE SetCheckRoutineModifiedFlag extern C WINAPI void SetCheckRoutineModifiedFlag BOOL bState The SetCheckRoutineModifiedFlag function modifies the Dirty flag of the current check routine If this flag is TRUE then upon closing the check routine NeuroCheck will display a message box asking if the user wants to save the check routine or not The flag generally is set to TRUE in NeuroCheck if the check routine has been altered Parameters bState New state of Dirty flag NeuroCheck API Functionality 73 GetParentOID extern C WINAPI int GetParentOID int iOID The GetParentoOID function returns the object identification number OID of the parent object for the object specified by the OID number For a check function the parent object is the single check it belongs to for a single check the check routine If there is no object with the specified OID or if this object is the check routine and thus has no parent then the function returns 1 Parameters iOID Identification number of NeuroCheck object to be investigated GetXMLStringLength extern C WINAPI int GetXMLStringLength int iOID int iExportOptions The Get XMLSt ringLength function returns the length of the XML export string for the NeuroCheck object specified by its object identification number O
142. his check routine contains two SC lt ul gt lt li gt The first single check contains lt li gt lt li gt The second single check contains lt li gt lt ul gt lt span gt lt stream gt lt plain gt lt CDATA This check routine contains two SC lt ul gt lt li gt The first single check contains lt li gt lt li gt The se cond single check contains lt li gt lt ul gt gt lt plain gt lt binary_stream_encapsulation gt lt cr_description_text gt lt cr_description gt lt cr_communication name Communication gt lt cr_communication_id gt 0 lt cr_communication_id gt lt cr_communication gt lt cr_properties gt lt sc_list name List of single checks gt lt Bar code identification gt lt single_check name Single check type 0 index 0 gt lt sc_properties name Single check properties gt lt sc_description name Description of single check gt lt sc_description gt lt sc_properties gt lt cf_list name Check function list gt lt Transfer Image gt lt check_function id 508 display Transfer Image gt lt cf_properties name Check function properties gt lt check_function_description gt lt check_function_description gt lt cf_properties gt lt cf_parameter name List of parameters gt lt parameter id 50801 name Image source Check routine in XML format 177 disp
143. i_types h Since the individual routine has to adhere to the conventions described in section Plug in Check Functions function addresses can be assigned directly Both the data output and the destroy routine have to exist for every plug in data type 3 Data Types and Definitions This chapter describes the data types and definitions for the use of dynamic data objects declared in the included header file pi_types h Please note that in several cases different tules apply for access to an input data objects and for creating an output data object of the same data type 3 1 Image The following structure is used by NeuroCheck for images typedef struct unsigned int uiWidth unsigned int uiHeight BOOL bColor BYTE pbyGrayValue BYTE pbyRedValue BYTE pbyGreenValue BYTE pbyBlueValue int iSource LPCTSTR lpszSourceName sPI_IMAGE The structure elements have the following meaning Element Description uiWidth Width of image in pixels uiHeight Height of image in pixels bColor TRUE for color image FALSE for gray level image pbyGrayValue Pointer to array with gray level values pbyRedValue Pointer to array with values of red channel for color image NULL for gray level image pbyGreenValue Pointer to array with values of green channel for color image NULL for gray level image pbyBlueValue Pointer to array with values of blue channel for color image NULL for gray level image i
144. ibraries DLLs with user defined functions for image processing and communication Each DLL can contain an arbitrary number of self developed check functions These functions have full access to data objects created by NeuroCheck such as images or object features and are seamlessly integrated into the user interface Furthermore the DLL can extend the menu structure of NeuroCheck with customized menu commands NeuroCheck programmers typically use this interface for tasks like e control of special hardware e g xy table e database retrieval of external target values e use of existing specialized image processing know how from self developed libraries or third party products e starting external programs e g for back up purposes or other administrative functions Plug In DLLs for NeuroCheck can be created using common software development tools The typical programming language for this is C or C The documentation of the plug in interface is structured as follows e The first chapter explains how to use a finished plug in DLL in NeuroCheck e The second chapter describes the administration framework for plug in functions provided by NeuroCheck and explains how the plug in interface works and what operations are performed when a plug in function is loaded and executed 10 NeuroCheck Programmer s Reference e The third chapter details the data types and declarations used for accessing internal NeuroCheck data structures and c
145. ication GoTo End_Application End If Server process is running as hidden software component P there is no entry in the system s taskbar as long as the Now read server information At this point we are attached to server NeuroCheck V4 x and higher visibility state of the data object is set to hidden the default OLE Automation 157 If NeuroCheck LicenseLevel NC_VERSION_LITE Then MsgBox You are running a demo version of NeuroCheck amp Execute will not work for the demo version End If 1 Get file name of check routine to be opened Dim strFileName As String If Not GetCheckRoutineName strFileName Then MsgBox Could not get check routine name GoTo End_Application End If 1 Release check routine object before opening new one Set CheckRoutine Nothing Open check routine in server If Not NeuroCheck Open strFileName Then MsgBox Could not open amp strFileName GoTo End_Application End If Get check routine object object veriable on module level Set CheckRoutine NeuroCheck ActiveCheckRoutine If CheckRoutine Is Nothing Then MsgBox Could not access check routine object GoTo End_Application End If Switch to automatic mode using the Operating Mode property only possible after check routine was opened successfully NeuroCheck OperatingMode NC_MODE_AUTOMATIC Switch visibility state to visible only possible after check routine was opened successfully CheckRoutine Visible T
146. ide result values to be accessed by a controller application If TRUE the check function provides result values readable by a controller application if FALSE it does not Syntax object HasCurrentResult The object placeholder represents the CheckFunction object 144 NeuroCheck Programmer s Reference Return Type VT_BOOL Remarks A return value of TRUE does not imply the existence of currently valid result values Use the ErrorCode property to confirm that the result values are current If CheckFunction ErrorCode lt 0 Then MsgBox Check function not executed ElseIf CheckFunction ErrorCode gt 1 Then MsgBox Check function aborted due to failure ElseIf not CheckFunction HasCurrentResult then MsgBox Check function does not provide result values Else Result is valid read result End If HasParameters The HasParameters method returns a Boolean value indicating the existence of parameter values which may be altered by a controller application If TRUE the check function has parameter settings which may be altered by a controller application if FALSE it does not Syntax object HasParameters The object placeholder represents the CheckFunction object Return Type VT_BOOL HasTargetValues The HasTargetValues method indicates the existence of target values which may be altered by a controller application If TRUE the check function has target values which may be altered by a controller applicati
147. ies of individual checks CheckFunction Gives access to the properties of check functions The following figure depicts this object hierarchy NCApplication CheckRoutine SingleCheck 1 CheckFunction 1 CheckFunction 2 SingleCheck 2 SingleCheck n Figure 16 Hierachy of exposed automation objects 7 3 NCApplication Object 7 3 1 Properties This section lists the properties of the NCApplication object All constants are listed in ncauto h ce Note C C programmers must access the properties as follows ptrObj gt GetPropertyName for reading a property ptrObj gt SetPropertyName NewValue for setting a property not available for read only OLE Automation 97 properties The ptrObj placeholder represents a pointer to the NCApplication object PropertyName the name of the property and NewValue the new value the property is set to ActiveCamera The ActiveCamera property sets or returns the index of the camera from which the image is captured in live mode Syntax object ActiveCamera value The object placeholder represents the NCApplication object Return Type VT_l2 Remarks The ActiveCamera property can only be accessed in live mode ActiveCameraName The ActiveCameraName property returns the designation of the camera from which the live image is captured It is only available in live mode Camera designations correspond to those in the Device Manager dialog Syntax object ActiveCameraName The obj
148. ification F Object identification number OID r Contents of transmission frame Include Final result Figure 13 custom communication options For details on these options refer to the online help system of NeuroCheck 6 1 3 Using the Custom Communication Interface for Remote Control Like the standard serial interface protocol the custom communication interface can be used for remote control of NeuroCheck in automatic mode Start Check In order to initiate a check routine run by a signal from the custom communication interface choose Remote Control from the System menu switch to the Input page activate the Start check signal choose Change and select the Custom communication interface indicated by the antenna icon from the Select Signal Source dialog box NeuroCheck will then poll the custom communication interface using function TestStart while it waits for a start signal Select Check Routine In order to switch check routines automatically by a signal from the custom communication interface choose Remote Control from the System menu switch to the Input page activate the Select check routine signal choose Change and select the Custom communication interface indicated by the antenna icon from the Select Signal Source dialog box NeuroCheck will then poll the custom communication interface using function GetTypeId while it waits for a check routine selection signal Transmit Check Result In order to
149. ified Minimum minimum number of ROIs required in first group Maximum maximum number of ROIs allowed in first group Count current number of ROIs in first group Description Verify if TRUE function will verify the classes of ROIs Rejection threshold minimum certainty required for O K Class strings up to 20 class names for verification Results are returned in an array of structures holding the following values for each ROI Class string name of the identified class Quality classification certainty Check Allowances Function ID GCHK 527 Functionality Target values Result values Copy ROls Function ID OCPY 525 Functionality Result values Determine Position Function ID POSC 521 Functionality Result values Capture Image Function ID DIG 517 Functionality Parameter values Quick Reference 209 Description Target values are set or returned in an array of structures holding the following values for each measurement Verify if TRUE measurement will be compared Description name of the measurement read only Nominal value nominal value of the measurement Lower allowance determines lower limit of the measurement Upper allowance determines upper limit of the measurement Result values are returned in an array of structures holding the following values for each measurement Description name of the measurement Current value current value of the meas
150. ile instead of camera images The default is FALSE Syntax object ReadFromBitmap value The object placeholder represents the NCApplication object Return Type VT_BOOL SubDeviceCount The SubDeviceCount property returns the number of sub devices of the type specified by DeviceType DeviceIndex and SubDeviceType configured in NeuroCheck s Device Manager If the input arguments are incorrect the property returns 1 Syntax object SubDeviceCount Device Type Devicelndex SubDevice Type The object placeholder represents the NCApplication object Return Type VT_I2 Argument Type Description DeviceType VT_I2 Type of the parent device Devicelndex VT_I2 Index of the parent device SubDeviceType V _l2 Type of the sub device OLE Automation 107 For the possible settings for DeviceType please refer to the DeviceCount property of the NCApplication object The possible settings for SubDeviceType are Constant Value Description NC_SUBDEVICE_CAMERA 0 Camera NC_SUBDEVICE_DIGINPUT 1 Digital input or field bus input bit NC_SUBDEVICE_DIGOUTPUT 2 Digital output or field bus output bit Remarks Please note that the camera count indicates simply the number of camera channels for the given frame grabber It does not correspond to the number of cameras currently activated in NeuroCheck s Device Manager SubDeviceName The SubDeviceName property returns the name of a sub device configured in NeuroCh
151. in psF ctDesc for every possible index ui Index with the characteristics of the respective plug in data type This section describes the structure of the type description block and the meaning of its members 2 8 1 Type Description Block Declaration The type description block is declared as follows detailed explanations of the individual sections follow below typedef struct version control unsigned int uiStructSize data unsigned int uiTypeld int iIconIndex strings LPSTR lpszTypeDesc function pointer PFNPlugInTypeDataOutput pfnDataOutput 42 NeuroCheck Programmer s Reference PFNPlugInTypeDestroy pfinTypeDestroy sPI_TYPE_DESC 2 8 2 General Information The data area of the type description block contains the following elements Element uiStructSize uiTypeld iIconIndex lpszTypeDesc Description NeuroCheck allocates the block and initializes each element to 0 with the exception of its first element uiSt ruct Size This element contains the size of the type description block as returned by the sizeof function The value of uiStructSize should be considered read only and can be used inside the plug in DLL to verify that NeuroCheck and the plug in DLL use the same declaration of the sPI_TYPE_DESC structure If the value of uiStructSize and the return value of sizeof sPI_TYPE_DESC are not equal there is a version conflict between the plug in interface provided by NeuroCheck
152. in the NeuroCheck documentation Center of Gravity Constant PI_ALL_XCOFG PI_ALL_YCOFG Enclosing Rectangle Constant PI_AOI_XORG PI_AOI_YORG PI_AOI_XDIM PI_AOI_YDIM PI_AOT_RATIO Axes Constant PI_BNDAOI_LAXIS PI_BNDAOI_SAXIS Data Types and Definitions 57 Description X coordinate of the center of gravity of the region Y coordinate of the center of gravity of the region Description X coordinate of top left corner of the enclosing rectangle Y coordinate of top left corner of the enclosing rectangle Width of enclosing rectangle Height of enclosing rectangle Ratio of height to width of enclosing rectangle Description Length of principal axis of the region Length of secondary axis of the region PI_BNDAOI_LANGLE_180 Direction of principal axis without regard to orientation 1 e between 0 and 180 PI_BNDAOI_LANGLE_360 E Radii Direction of principal axis with regard to orientation i e between 0 and 360 In NeuroCheck a radius is defined as the distance from the center of gravity to a point on the border of the region Constant PI_BNDAOI_RADMEAN PI_BNDAOI_RADMIN PI_BNDAOT_RADMAX PI_BNDAOT_RANGL Gl Description Average radius Minimum radius Maximum radius Angle between minimum and maximum radius 58 NeuroCheck Programmer s Reference General Shape Description Constant PI_ALL AREA PI_BNDAOTI_PERI
153. independently of the result of the routine If you de allocate data objects with VirutalF ree already inserted in the NeuroCheck container structure always assign a NULL value to the freed pointer 2 3 2 Output Data Objects of Plug In Data Types In addition to the NeuroCheck data types each plug in DLL can register its own data types Only plug in check functions registered by the same DLL may create output data objects of the plug in data types These output data objects are allocated by the execution routine of the plug in check function The plug in DLL programmer must manage these objects himself which implies that he can choose the way of memory allocation for the data objects The objects can be passed on to other plug in functions which belong to the same DLL For efficient use the user defined data objects are passed as pointers and will only be interpreted inside the plug in functions using them Since NeuroCheck cannot interpret these objects it is not able to delete their dynamically allocated data structure For freeing the allocated memory NeuroCheck calls the destroy routine of the plug in data type passing the pointer to the data structure to be de allocated For de allocation the plug in DLL must use the operator matching the allocation operator previousely used to create the object 2 3 3 Custom Result Views Each plug in check function may create its own result view displayed by NeuroCheck in the Result View pane of the func
154. int iDeviceIndex int iSubDeviceType The Get SubDeviceCount function returns the number of sub devices of the type specified by iDeviceType iDeviceIndex and iSubDeviceType configured in NeuroCheck s Device Manager If the input arguments are incorrect the function returns 1 Parameters iDeviceType Type of parent device The different device types are identified by symbolic constants defined in pi_NcApi h iDeviceIndex Index of parent device iSubDeviceType Type of sub device The different sub device types are identified by symbolic constants defined in pi_NcApi h NeuroCheck API Functionality 63 GetSubDeviceName extern C WINAPI LPSTR GetSubDeviceName int iDeviceType int iDeviceIndex int iSubDeviceType int iSubDevicelIndex The Get SubDeviceName function returns the name of the specified sub device as configured in NeuroCheck s Device Manager The string is returned as pointer to a static string This pointer is only valid until the next call to this function so it is recommended to store the string immediately in a CString variable It is not possible to change the contents of the string If one of the input arguments is incorrect the function returns a NULL pointer For instance the function can be used to read the user defined names of the digital input bits Parameters iDeviceType Type of parent device The different device types are identified by symbolic constants defined in pi_NcApi h iDeviceIn
155. ion TRACEO disconnected n eof function OnAttachServer 7 9 2 Access Check Routine The following source code sample demonstrates how to open a check routine and determine information about its individual checks while the controller is attached to the server void OnOpenCheckRout ine CString szPath do something here to get path information now open check routine in server if pINCApplication gt Open LPCTSTR szPath create check routine object LPDISPATCH lpDis pINCApplication gt GetActiveCheckRoutine ICheckRoutine pICr new ICheckRoutine lpDis determine number of individual checks int iCount pICr gt GetCount loop over all checks and read their description texts ISingleCheck pISc for int i 0 i lt iCount i get individual check object COleVariant var short i VT_I2 LPDISPATCH lpDisCheck pICr gt Item var ASSERT NULL lpDisCheck create dispatch driver object piISc new ISingleCheck lpDisCheck read name CString szName plISc gt GetName TRACE1 name s const char szName if FALSE pISc gt GetCheckEnabled modify execution state of check piISc gt SetCheckEnabled TRUE destroy dispatch driver object delete pISc eofor delete pICr eoif 164 NeuroCheck Programmer s Reference else TRACEO unable to open check routine n eof function OnO
156. ion management in the initialization routine The plug in check function takes a color image as input object and inverts one of its color channel according to the option chosen in its parameter dialog It aborts execution if the input image has no color information In manual mode in this case a message box is displayed to inform the user Pl_DataTypes This sample shows how to access modify and create output objects of different NeuroCheck data types Please refer also to the functions of PI_Parameter e g Modify Histogram Examples for more complicated operations and for the usage of plug in data types are given in PI_DataTypes_Adv e Create Histogram This plug in check function demonstrates the creation ofa PI_HISTO data type object It also shows the access of image and layer data Another example for creating a histogram can be found in PI_DataOutput e Modify Layer This plug in check function demonstrates the modification of an object layer In detail following modifications are shown ordering of objects modification of object number grouping of objects modification of group number activating and calculating feature values fMeasurement array altering position of objects declaration of invalid objects oValid flag e Create MeasArray This plug in check function demonstrates the creation of a PI_LMEASARRAY data type object It also shows the read access of the feature values of a layer object For each activated feature th
157. ional property and one additional method are available _NewEnum Property The _NewEnum property provides an enumerator object that implements TEnumVARIANT It is used by collection handling like the For Each loop in Visual Basic 134 NeuroCheck Programmer s Reference Return Type VT_DISPATCH Example The following example displays the name of each check function of the individual check in a message box Dim CheckFunction As Object For Each CheckFunction In SingleCheck MsgBox CheckFunction Name Next CheckFunction Item Method The Item method returns the given check function object from the collection specified by argument CF Index If no check function object is available for argument SCIndex the Item property returns VT_EMPTY Syntax object ltem CFindex The object placeholder represents the SingleCheck object Return Type VT_DISPATCH Argument Type Description CF Index VT_VARIANT Indicates the check function object to be returned Remarks If CFIndex is an integer value the Item method returns the check function object with position CFIndex in the collection of the SingleCheck object If CFIndex is a string the Item method always returns the first check function in the collection whose name is equal to string CF Index Example The following Visual Basic sample code shows how to access the last check function of the individual check Dim CheckFunction As Object Set CheckFunction SingleChe
158. irst we will show you a sample check routine in XML format For clarity s sake the sample has been reduced to the essentials Some elements were skipped and element attributes were left out The entire check routine can be found as file Nc_Sample chrx in the subdirectory Docs Xm1 of the NeuroCheck installation directory 176 NeuroCheck Programmer s Reference lt neurocheck_check_routine xmlns http www neurocheck com xml gt lt teh HEHEHE Header information Do not change HHHHHE gt lt header name Header information gt lt meaning_of_contents gt NeuroCheck Check Routine lt meaning_of_contents gt lt created_by_name gt NCheck51 exe lt created_by_name gt lt created_by_dir gt C Program Files Ncheck51 lt created_by_dir gt lt created_by_version gt 5 1 1038 4 lt created_by_version gt lt file_version name Version identification gt 0x5111 lt file_version gt lt copyright gt NeuroCheck GmbH D 71686 Remseck Germany lt copyright gt lt header gt lt FFHEHEPEPEEHEHEHEHEHE Check routine data tfttitttttt tt tt tttt gt lt body name Check routine data gt lt cr_properties name Check routine properties gt lt cr_description name Description of check routine gt lt cr_name gt NeuroCheck XML sample lt cr_name gt lt cr_comment gt Sample check routine lt cr_comment gt lt cr_description_text gt lt binary_stream_encapsulation gt lt stream gt lt span xmlns gt T
159. is passed to the function uiCmdId receives the resource ID of the selected menu item 2 5 Structure of a Plug In Check Function This section describes the possible capabilities of plug in check functions and the declarations of the routines making up a plug in check function A plug in check function is implemented through six distinct routines Initialization routine Execution routine Deinitialization routine Parameter dialog routine Custom view create routine Custom view destroy routine The names of these functions are unimportant because NeuroCheck calls them through function pointers in the function info structure The declarations though are fixed Apart from the parameter dialog routine and the two visualization routines all routines have to exist for every plug in check function OY ON NS 2 5 1 Capabilities of Plug In Check Functions Plug in check functions can have a parameter area of in principle unlimited size NeuroCheck manages this as an unstructured memory block i e as a byte array Only the DLL routines themselves can change the values inside this block so that the programmer of a plug in DLL can rely on NeuroCheck never to interfere with the inner workings of the parameter area There are only two ways for NeuroCheck to change the parameter area and both of them make use of values set within the DLL routines 1 The undo function copies the most recent version of the parameter area into the current par
160. itmap function can be used to create a 256 color bitmap It takes five arguments two specifying the dimensions of the image one specifying the scale factor one containing the pixel values of the gray level image and one to enable the drawing of overlays The function returns a handle to the created bitmap or NULL on error Parameters iWidth Width of image 68 NeuroCheck Programmer s Reference iHeight Height of image iZoom Scale factor Can have one of the following values declared as symbolic constants in pi_types h NC_ZOOM_10 10 of original image size NC_ZOOM_25 25 of original image size NC_ZOOM_50 50 of original image size NC_ZOOM_100 100 of original image size NC_ZOOM_200 200 of original image size pbyGrayValues Pointer to image data bOverlayColors If TRUE values in the color palette are reserved for overlay colors This is necessary for drawing on the image using the graphics device interface GDI of Windows Please refer to sample DLL for an example CreateColorBitmap extern C WINAPI HBITMAP CreateColorBitmap int iWidth int iHeight int iZoom BYTE pbyRedData BYTE pbyGreenData BYTE pbyBlueData The CreateColorBitmap function can be used to create a TrueColor bitmap It takes six arguments two specifying the dimensions of the image one specifiying the scale factor three containing the pixel values of each color channel The function returns a handle to the created bitma
161. ized for use with C C See the explanation in section 7 7 1 and the example in section 7 9 8 GetParameterltem The GetParameterItem method returns an element of the check function s parameter matrix The element to be read is specified by the arguments Row and Column The method returns the value of the element or VT_EMPTY on failure Syntax object GetParameterltem Row Column The object placeholder represents the CheckFunction object Return Type VT_ VARIANT Argument Type Description Row VT_I2 Row index of element in parameter matrix Column VT_I2 Column index of element in parameter matrix Remarks See the explanation in section 7 7 1 GetParameters The GetParameters method returns the current parameter settings of the check function The method returns a safearray containing the current parameter settings Syntax object GetParameters The object placeholder represents the CheckFunction object 142 NeuroCheck Programmer s Reference Return Type VT_VARIANT Remarks This method is optimized for use with C C See the explanation in 7 7 land the example in section 7 9 6 GetResultltem The GetResultItem method returns an element of the check function s current result matrix It is only available after at least one execution in automatic mode The element to be read is specified by the arguments Row and Column The method returns the value of the element or VT_EMPTY on failure Syntax object GetRe
162. lay Bitmap file gt 1 lt parameter gt lt parameter id 50804 name Bitmap file name gt C Program Files Ncheck Examples Demo bmp lt parameter gt lt cf_parameter gt lt check_function gt lt Define ROIs gt lt check_function id 512 display Define ROIs gt lt cf_parameter name List of parameters gt lt parameter id 51201 name List of ROIs type list gt lt parameter id 51202 name Region type vector gt lt parameter id 51204 name Group gt 0 lt parameter gt lt parameter id 51208 name UpL X gt 0 lt parameter gt lt parameter id 51209 name UpL Y gt 55 lt parameter gt lt parameter id 51210 name Width gt 200 lt parameter gt lt parameter id 51211 name Height gt 29 lt parameter gt lt parameter gt lt parameter gt lt cf_parameter gt lt check_function gt Klo gt Identify Bar Code gt lt check_function id 536 display Identify Bar Code gt lt cf_parameter name List of parameters gt lt parameter id 53601 name Type display EAN 8 gt 2 lt parameter gt lt parameter id 53602 name L distance gt 5 lt parameter gt lt parameter id 53603 name Smoothing gt 5 lt parameter gt lt cf_parameter gt lt cf_target_values name List of target values gt lt parameter id 53607 name Compare with target value display Yes gt 1 lt parameter gt lt parameter id 53
163. le way to convert pixel arrays into Windows bitmap format which is necessary for displaying images under Windows The NeuroCheck API functionality is encapsulated in a dynamic link library called Ncapi d11 If NeuroCheck can locate this DLL in its installation path on page Plug In of the General Software Settings dialog box appears a check box Provide API functionality and an Info IV Provide API functionality button for displaying a message box with information Info about Ncapi d11 If the check box is activated the NeuroCheck API can be used by any plug in DLL For using the functionality the plug in DLL must connect to DLL Ncapi d11 as explained below The usage of the API functionality is demonstrated in the plug in samples PI_NcApiCalls and PI_Visualization see 5 1 Overview of the Sample Plug In DLLs There you also can find a convenient wrapper class implementation for C By inserting the files PI_NcApi h and PI_NcApi cpp into your project you can access all API functions through methods of the class CNcApi For some API functions the class also provides overloaded methods which simplify their useage with C The functions provided by the API are devided into the following categories e Access to hardware devices i e digital I O and field bus devices e Bitmaps management e Access to NeuroCheck settings e Error Codes 4 1 Access to Hardware Devices For access to the hardware configured in NeuroChe
164. lications of XML format Using XML as the check routine file format offers a number of new possibilities for NeuroCheck users The main application areas are e Documentation An XML file can be viewed in a standard browser such as Microsoft Internet Explorer Together with additional formatting information provided by an XSL file the view of the check routine thus created can be printed and archived for documentation purposes Depending on the content of the XSL file the check routine data can be viewed at various levels of detail For more information on XSL files please refer to chapter 8 3 e Change monitoring Because of the clear structure of the XML file similar check routines can be compared visually using an editor This was not possible in the binary format chr used so far This way you can quickly determine where a target value or parameter in a check function was changed e External modification of check routines Check routines exported from NeuroCheck to XML format can be changed externally This modification can be done manually in a text editor or by using an XML editor Re importing the modified XML file into NeuroCheck renders the changes effective 174 NeuroCheck Programmer s Reference e Automatic creation of check routines In principle it is even possible to create entire check routines automatically outside of NeuroCheck using an XML parser and import this into NeuroCheck 8 2 Description of the XML form
165. lters 2 NC_FCTCAT_IMGGEO preprocessing geometry 3 NC_FCTCAT_COLORANALYSIS color analysis 4 NC_FCTCAT_OBJCREATE image analysis object creation 5 NC_FCTCAT_OBJFEATURES image analysis object features 6 NC_FCTCAT_OBJEVALUATION image analysis object evaluation 7 NC_FCTCAT_TOOLS tools 212 NeuroCheck Programmer s Reference 8 9 10 11 12 Check Function IDs Value 500 501 502 503 504 505 506 507 508 509 oO 10 11 w N Gir e EL Oi Gi EE T EN ol N oO 521 NC_FC NC_FC NC_FC NC_FC NC_FC CAT_IMGACQ image acquisition CAT_POSADJUSTMENT position adjustment CAT_GAUGING gauging CAT_PLUGIN plug in functions CAT_IOCOM IO communication Mnemonic Meaning IN DLE IC TG IL LF ET RM X P Y B UT IL IROT IDT OB IN OBC OB S DAOI OBF SOU RIN DI OC G L OBM OB PO G SC Enhance Image image normalize Delay Execution Copy Image Combine Image Apply Look up Table to Image Filter Image Determine Threshold Rotate Image Transfer Image Image Data Transfer Create Objects by Thresholding binary Count ROIs objects Sort ROIs objects Define Regions Areas of Interest Screen ROIs object filtering Set Digital Output Read Digital Input Capture Image digitize Classify ROIs objects Compute Features object measurements Resample ROIs object on grid
166. ly used After the connection has been established the client can access the automation objects of the server It may read or set properties or call methods of the objects The complete communication is handled by the Automation Manager i e each function call is handled through the operating system Controller NeuroCheck Client Server Commands Results Results Commands Automation Manager Figure 14 OLE Communication for out of process servers stand alone executables OLE Automation 93 The exposed automation objects of NeuroCheck are listed in section 7 2 and described in detail in the subsequent sections In the following we will first have a look at possible applications of using OLE automation with NeuroCheck 7 1 3 Applications of OLE Automation in NeuroCheck As an example an OLE automation client connected to NeuroCheck can open a check routine put NeuroCheck into automatic mode execute the check routine read the results of the inspection run and display them in a special way which is not available in NeuroCheck Note that a controller is not restricted to connect to only a single server It can thus control NeuroCheck and a database management system simultaneously and transfer result data computed by NeuroCheck into the database or control the operation of NeuroCheck based on information from the database The following list is intended to give you an idea of what can be achieved with NeuroCheck an
167. mer s Reference Return Type VT_I2 Example The following sample code shows how to determine the current check result for the given individual check of course the straight forward solution is to use the CurrentResult property of the SingleCheck object If CheckRoutine CurrentCheckResult SingleCheck SCIndex Then MsgBox SingleCheck Name amp was OK End If Methods This section lists the methods of the SingleCheck object CopylmageToClipboard Call the CopyImageToClipboard method to copy a gray level image from the internal runtime data statck to the Clipboard The image to be copied is specified by the ImageIndex argument The method returns a Boolean value indicating success or failure of the copy operation Syntax object CopylmageToClipboard magelndex ImageFormat ImageZoom The object placeholder represents the SingleCheck object Return Type VT_BOOL Argument Type Description ImageIndex V1_l2 Index of the image on the stack to be copied to the Clipboard ImageFormat VT_l2 Format of the image copied to the Clipboard ImageZoom V T 2 Scale factor of the image copied to the Clipboard Possible settings for nageFormat are OLE Automation 131 Constant Value Description NC_CF_DIB 8 monochrome image in device independent bitmap format NC_CF_COLOR_DIB 9 color image in device independent bitmap format Possible settings for JnageZoom are Constant Value Description NC_ZOOM_200 200 200 of original imag
168. meter block This routine is executed whenever NeuroCheck removes an instance of the pertaining plug in check function i e when deleting the function from a check routine deleting the whole check or closing the check routine If the initialization routine performed any activities affecting the whole DLL program or system like allocating dynamic memory or opening communication channels the effects can be reverted here Therefore the function is allowed access to the parameter area in order to be able to react to the current parameter set Changes to the parameter set will have no effect for this function 2 5 5 Parameter Dialog Routine The parameter dialog routine of a plug in check function has to be declared as follows BOOL WINAPI ParameterDialog HWND hwndApp sPI_CONTEXT_INFO const psContext void const pParameter void const const ppvInputData In psContext NeuroCheck passes the function s current context information in pParameter the address of its parameter block In hWndApp NeuroCheck passes a handle for the parent window ppvInputData is an array of the addresses of the required input data objects equivalent to the argument ppvDynInput of the execution routine The function handling the dialog has to cast these addresses to pointers of the correct type for the respective input data object The input objects should be considered read only i e any changes will have no effect See the example DLL for more information This
169. mmunication Interface NeuroCheck allows you to seamlessly integrate your own communication interface DLL It will work exactly as the serial interface DLL included with the setup Implementation Considerations The function declarations described in the following refer to Microsoft 32 bit C C compilers When using a different compiler take care to use compatible data types and parameter passing methods Furthermore it has to be ensured that the DLL exports all function names explicitly A Visual C sample project can be installed or copied from the NeuroCheck CD ROM If installed from CD ROM you will find it in the folder Programming CustComm in the NeuroCheck installation path Please note that it is more a template to base your own implementation on than a ready to use example 6 1 Using a Custom Communication Interface 6 1 1 Loading a Custom Communication DLL Like all device drivers in NeuroCheck a custom communication DLL is loaded using the Hardware Wizard invoked by choosing New in the Device Manager dialog On the first page of the Hardware Wizard select Other communication devices and choose Next Hardware Wizard Page 1 20x This wizard will help you to quickly setup new hardware for use with NeuroCheck Please select the hardware component to be configured Imaging Frame grabber board C EEE1394 FireWire Camera Pi camera Process Communication Digital 1 0 board Field bus card
170. n typedef struct int iSingleCheckIndex int iCheckFunctionIndex int iOID int iMode sPI_CONTEXT_INFO The structure elements have the following meaning Element Description iSingleCheckIndex Current index of single check the plug in check function belongs to For start and end actions a special negative index is given iCheckFunctionIndex Current index of plug in check function within single check iOID Object identification number OID of plug in check function This number is unique within the check routine iMode Current operating mode Can have one of the following values declared as symbolic constants in pi_types h NC_MODE_MANUAL manual mode NC_MODE_TEST test mode NC_MODE_LIVE live mode NC_MODE_AUTOMATIC automatic mode NC_MODE_AUTOCONFIG configure automatic screen mode NC_MODE_INTRO HTML introduction mode All elements of the structure have to be considered read only Please note that this also applies to all other functions which are passed context information In pParameter NeuroCheck passes the address of a memory block reserved for the function parameters according to the size given in the function info block pParameter is passed as constant pointer which means that the pointer itself must not be changed Nevertheless it is well possible to change the contents of the memory block the pointer is pointing to after casting it to the appropriate type If no memory block has been reserved due to siz
171. n with the Parent property and the Item method The following sample code shows how to connect the check function object following the one currently stored in the CheckFunction variable with this object variable If CheckFunction CFIndex lt CheckFunction Parent Count Then Set CheckFunction CheckFunction Parent Item CheckFunction CFIndex 1 End If ColsOfParameterMatrix The ColsOfParameter Matrix property returns the number of columns of the check function s parameter matrix Syntax object ColsOfParameterMatrix The object placeholder represents the CheckFunction object OLE Automation 137 Return Type VT_l2 ColsOfResultMatrix The ColsOfResultMatrix property returns the number of columns of the check function s result matrix Syntax object ColsOfResultMatrix The object placeholder represents the CheckFunction object Return Type VT_l2 ColsOfTargetValueMatrix The ColsOfTargetValueMatrix property returns the number of columns of the check function s target value matrix Syntax object ColsOfTargetValueMatrix The object placeholder represents the CheckFunction object Return Type VT_I2 ErrorCode The ErrorCode property returns a value indicating the status of the check function after its most recent execution in automatic mode Syntax object ErrorCode The object placeholder represents the CheckFunction object 138 NeuroCheck Programmer s Reference Return Type VT_I2 The possible
172. nal value to compute the lower limit of the measurement i e the requirement is current value 2 nominal value lower allowance Upper allowance n 4 VT_R4 Allowance added to the nominal value to compute the upper limit of the measurement i e the requirement is current value lt nominal value upper allowance NOTE to define a tolerance interval extending below the nominal value the lower allowance has to be given with a negative sign The result values of the function are returned in an array of structures holding the following values for each measurement Result Value Item Type Description 152 NeuroCheck Programmer s Reference Description n 0 VT_BSTR Name of the measurement Current value n 1 VT_R4 Current value of the measurement 7 7 7 Copy ROIs Function Copy ROIs allows result data retrieval through OLE automation The pertaining structures are defined in Ncauto h The result values of the function are returned in an array of structures holding the following values for each feature of each ROI Result Value Item Type Description Object Number n 0 vT_l4 Identifier of the ROI counted from zero Feature ID n 1 vT_l4 Identifier of the feature The feature IDs are defined in Ncauto h and listed in the Quick Reference section of this manual Current value n 2 VT_R4 Current value of the feature NOTE Function Copy ROIs is used to access the result data of function Compute Features The reason why the
173. ndex of digital I O board iOutputWord State values to be set ReadFieldBusInputBit extern C WINAPI BOOL ReadFieldBusInputBit int iBoardIndex int iInputNumber The ReadFieldBusInputBit function reads the current state of an input bit of a field bus device It takes two arguments which specify the field bus board and the input bit to be read The function returns the state of the input bit i e TRUE or FALSE Parameters iBoardIndex Index of field bus board iInputNumber Number of input bit to be read SetFieldBusOutputBit extern C WINAPI BOOL SetFieldBusOutputBit int iBoardIndex int iOutputNumber BOOL bNewState The SetFieldBusOutputBit function sets an output bit of a field bus device It takes three arguments specifying the field bus board the output bit to be set and the state the output bit will be set to The function returns TRUE if the output bit was set successfully or FALSE if an error occurred Parameters iBoardIndex Index of field bus board iOutputNumber Number of output bit to be set bNewState New state value ReadFieldBusInputlmage extern C WINAPI BOOL ReadFieldBusInputImage 66 NeuroCheck Programmer s Reference int iBoardIndex int iByteCount BYTE pbyInputImage The ReadFieldBusInput Image function reads the current input image input state of a field bus device It takes three arguments the first one specifiying the field bus board the second one
174. ne aah ei ea 19 2 1 1 Managing a Plug In DLL cececeesceeteceeesseeseeeseeeseenseeaes 19 2 1 2 Managing Plug In Check Functions cccccccessesseeeteeeeeseeeseeeees 20 2 2 Administrative Functions cceceeceeseeseeeseceseeseeeseeeseceeeceeecseeeaeeeseeneeeneeeeees 22 2 2 1 Version Information cccecccesccesceeseesseeseeeseeeseeeseeeneeseeeseeeneensees 22 222 fo Dial prsnem nnar a E E ERN 23 22a eP E r a Seco ed a es E ESS 23 2 2 4 Menu Command Handler cccceceecesessesseeeteeeeesseeseeeseeeseenees 23 2 2 5 Information about Plug In Check Functions cceeseeseeseeeees 24 2 2 6 Information about Plug In Data Types cceceescesseeseeseeeseeeees 24 2 3 Memory Management ceesccsccesseceseceseeceseecesaeeesaeeeeaeeesaeeseaeeesaeeesaeeeas 25 2 3 1 Output Data Objects of NeuroCheck Data Types cececees 25 2 3 2 Output Data Objects of Plug In Data Types cceeeeseeteeetees 25 23 3 Custom Result Vie WSs enssins tunienn ee antes tenes 25 2 3 4 Data Output to File or RS232 Serial Interface eee 26 Did NOL sec AA E A NO 26 2A The Plug In Menus ccascisiescivcceshott turer a e lass 26 2 4 1 Manual Mode Menu cceccecccecccsscsssesseeeseeeeeeseeseeeseeeneeeseeseennes 26 2 4 2 Automatic Mode Menu ccceccceseesseesseeseeeteeeteesseesseeseeeseeneenses 26 243 Mem Items socere a E ee 26 244 Ment Handler ioie ennienni ai e 26 2 5 Structure of a Plug In Check Functi
175. ng the button the functions of all activated plug in DLLs are shown in a tree view The functions are listed as sub nodes of the DLL they belong to The function to be appended or inserted is selected as usual and integrated into the check routine For two plug in DLLs named Ncoem V42 d11 and Ncoem V50 d11 this will appear as in the following figure Using a Plug In DLL in NeuroCheck 17 Select Check Function Fix Acquisition Pl_Simple sb Modify Image Pl_Parameter BB Preprocessing a Objects ka Create New Image z j c Modify Color Image as Analysis Eka Modify Histogram Pl_Visualization c Visualize Images PI_Nc amp piCalls c Read Digital Input Word ts Gauging z3 Position Color b Tha Save Bitmap Bos c Set Digital Output Word lo oO Sta Update Counter Pl_DataTypes_Adv St Create Color Image Se Create Layer S Create Plug In Data Types x Figure 5 property page for plug in check functions in NeuroCheck 1 5 The Plug In Menu In addition to user defined check functions the plug in DLL can define additional menu items separately for manual and automatic mode This allows the user to access special functionality like initializing communication protocols starting external programs etc The menu items are appended to the Tools menu as shown in the following figure for manual mode The names of the individual menu items can of course be defined at will by the DLL pro
176. object ReadFieldBusInputBit Boardindex InputNumber The object placeholder represents the NCApplication object Return Type VT_VARIANT Argument Type Description BoardIndex VT_l2 Index of field bus board counted from 0 InputNumber V T_ 2 Number of the input bit to be read counted from 0 ReadFieldBusOutputBit The ReadFieldBusOutputBit method reads the current state of an output bit of a field bus device It takes two arguments specifying the field bus board and the output bit to be read The method returns the state of the output bit i e TRUE or FALSE if the output was read successfully or VT_EMPTY if an error occurred 114 NeuroCheck Programmer s Reference Syntax object ReadFieldBusOutputBit Boardindex OutputNumber The object placeholder represents the NCApplication object Return Type VT_BOOL or VT_EMPTY Argument Type Description BoardIndex VT_I2 Index of field bus board counted from 0 OutputNumber VT_ 2 Number of the output bit to be read counted from 0 SetDigitalOutput The SetDigitalOutput method sets the state of a digital output It takes three arguments specifying the digital I O board the output to be set and the state the output will be set to The method returns TRUE if the output could be set or FALSE if an error occurred Syntax object SetDigitalOutput Boardindex OutputNumber NewState The object placeholder represents the NCApplication object Return Type
177. occured for a function call to NeuroCheck API A call to Get Last NcApiError resets the internal error state to 1 Return Value Meaning 1 No error 100 No access to NeuroCheck application window 101 102 110 111 120 TZL 130 131 132 140 141 150 151 152 160 161 162 163 165 170 171 172 T73 174 175 180 181 182 183 NeuroCheck API Functionality 75 Invalid parameter Invalid buffer size Error for API function GetDeviceCount Error for API function Get SubDeviceCount Error reading digital input Error setting a digital output Error setting output word for digital IO board Error reading input word for digital IO board Error reading output word for digital IO board Error reading digital input bit for field bus board Error setting a digital output bit for field bus board Error setting output image for field bus board Error reading input image for field bus board Error reading output image for field bus board Error setting modified flag for check routine Error reading ignore communication option of application Error allocating advanced memory pointer Error releasing advanced memory pointer Error or wrong argument in Get SecurityKeylItem Error creating bitmap Invalid bitmap handle Error loading bitmap from file Error creating bitmap file Error writing bitmap to file Invalid bitmap format Could not get version info of NeuroCheck executable Could not get object
178. ol displayed in the status bar will change from yellow to green Details on the NeuroCheck API functionality are listed in chapter NeuroCheck API Functionality 1 4 Using Functions from a Plug In DLL 1 4 1 Administration Frame for Plug In Check Functions Apart from a few restrictions NeuroCheck offers the same administration frame to functions from a plug in DLL that is used for the built in standard functions The restrictions are e Plug in functions cannot have a target value dialog However the parameter dialog can be used instead for target value input e It is not possible to duplicate the Apply button functionality of updating the result display while the parameter dialog is being displayed because the complicated interaction between main program and dialog required for this functionality would increase the administration overhead of the plug in interface prohibitively 16 NeuroCheck Programmer s Reference The user will not notice any other differences between functions from a plug in DLL and built in functions This means for example Plug in functions are added to a check routine like built in functions i e using the commands New Append Check Function resp New Insert Check Function from the Edit menu The functions are selected from their own page in the Select New Check Function dialog box The dialog box displays a function description as well as hints for the usage of the function Help topics describing the f
179. on essesesseesessessessessesersresessessesersersees 27 2 5 1 Capabilities of Plug In Check Functions 27 NeuroCheck Programmer s Reference 2 6 2 7 2 8 3 1 3 2 3 3 3 4 3 5 2 5 2 Initialization Routine 0 0 ceceecceceeseeeseeeseeeeeceeeeseenseenseenseeneeeseens 27 2 5 3 Execution ROUNE annn n O E deine uni ara 29 2 5 4 Deinitialization Routine 2 0 0 0 cecceceesceeeeeececeeeeseeeseeneeeseeeseeeseens 30 2 5 5 Parameter Dialog Routine cccceceseeseeseeeeeeeseeeseeeeeenseeseeeseens 30 2 5 6 Custom Visualization Routines c ccccecceescesceesseesseeteeeeeseeeeens 30 The Function Info Block i s ccicsscecsdevsacsecvscneseensedssteeteeus etcvestevicacdaesteseeccsees 32 2 6 1 Function Info Block Declaration 0 cceeceeceeeseeteeeteeeeeeseeeneees 32 2 6 2 General Information neneosneen ieaanc a 33 2 6 3 Input Output Data Object Description sssssesesssesesesessseseesesee 34 2 6 4 Data Output Description ccc ceeecceseeeceeseeeseseeeeeeeeeeeseeeseenseens 35 2 6 5 Descriptive Texts 20 005 seissceesicaccaeniccestecees acensss eedeceseeeeesnes 36 2 6 6 Function Pointers ccceeceeseesceeseeeeeeeeeneeeeeeseeeseeeeeeseeeseeeeenseens 37 Structure of a Plug In Data Type ccccccecsccsseessceseeeteceseeeseeeeeeseeseseseenneenes 38 2 7 1 Capabilities of Plug In Data Types cccesesseeseeteeeteeeseeseeeseenes 38 242 Data Output Routine 400 225 0es sesseevee
180. on Handle to bitmap allocated in ViewCreate Bitmap passed in hView released successfully Function failed 9 3 Plug In Data Type Declaration This section lists the declarations required for the routines making up a plug in data type The Quick Reference 191 routines of your plug in check functions must match the declarations exactly except for the name Data Output Routine BOOL WINAPI DataOutput SPI_TARGET_INFO const psTargetInfo void const pbyData sPI_DATAOUTPUT_INFO psDataContainer Handles data output of a custom data object in automatic mode if output is activated for the plug in check function using the plug in data type Parameters psTargetInfo Pointer to structure containing information about the output target file serial interface pbyData Address of custom data object allocated previously inside the execution routine psDataContainer Address of data container used for returning a data sequence NeuroCheck will write to the given output target Return Value TRUE Output data passed successfully in psDataContainer FALSI J Destroy Routine void WINAPI TypeDestroy void pbyData No output data available Peforms necessary cleaning up of a custom data object of the plug in data type when it is removed from the data pool of the individual check Parameters pbyData Address of custom data object allocated previously inside the execution routine 9 4 Plug In Data Exchange Str
181. on if FALSE it does not Syntax object HasTargetValues The object placeholder represents the CheckFunction object OLE Automation 145 Return Type VT_BOOL SetParameterltem The SetParameterItem method sets an element of the check function s parameter matrix The element to be set is specified by the arguments Row and Column its value by the argument NewValue The method returns a Boolean value indicating success or failure of operation Syntax object SetParameterltem Row Column NewValue The object placeholder represents the CheckFunction object Return Type VT_ BOOL Argument Type Description Row VT_l2 Row index of element in parameter matrix Column VT_l2 Column index of element in parameter matrix NewValue VT_VARIANT New value of specified element Remarks See the explanation in section 7 7 1 SetParameters The SetParameters method sets the parameter information of the check function The parameter settings are passed in a safearray structure equivalent to the result value of method GetParameters The method returns a value indicating success or failure of the operation Syntax object SetParameters ParaSetting The object placeholder represents the CheckFunction object 146 NeuroCheck Programmer s Reference Return Type VT_ BOOL Argument Type Description ParaSetting VT VARIANT Safearray containing the parameter settings Remarks This method is optimized for use with C C See t
182. on currently unavailable Property method no longer supported Access denied under current security settings Parameters not available for polyline Input value was empty Check function must be initialized in NeuroCheck Unexpected file format Check function cannot be deactivated
183. operty returns 1 Syntax object DeviceCount Device Type The object placeholder represents the NCApplication object Return Type VT_I2 Argument Type Description DeviceType VT_I2 Type of the device Possible settings for DeviceType are Constant Value Description NC_DEVICE_FRAMEGRABBER 0 Frame grabber board NC_DEVICE_DIGITALIO 1 Digital I O board NC_DEVICE_FIELDBUS 2 Field Bus board NC_DEVICE_SERIAL 3 Serial Interface NC_DEVICE_OEMCOM 4 Custom Communication Interface NC_DEVICE_IEEE1394 5 IEEE 1394 camera 100 NeuroCheck Programmer s Reference DeviceName The DeviceName property returns the name of a device configured in NeuroCheck s Device Manager The device is specified by the input arguments DeviceType and Devicelndex If the input arguments are incorrect the property returns an empty string Syntax object DeviceName DeviceType Devicelndex The object placeholder represents the NCApplication object Return Type VT_BSTR Argument Type Description DeviceType V1_l2 Type of the device DeviceIndex VT_l2 Index of the device counted from 0 The possible settings for argument DeviceType correspond to those for the DeviceCount property of the NCApplication object ExeMajorVersion The ExeMajorVersion property returns the major version number of the application s executable file always greater or equal to 4 Syntax object ExeMajorVersion The obj
184. owing source code excerpt demonstrates how to read out the result of a check function after execution in automatic mode Function Identify Bar Code simply returns the identified bar code in element 0 0 of its result matrix Assign object variable CheckFunction Verify check function If CheckFunction FunctionID lt gt NC_FCT_BCI Then Exit Function Verify error code of check function If CheckFunction ErrorCode lt 0 Then check function was not executed labValue Caption GoTo Exit_DisplayValue ElseIf CheckFunction ErrorCode gt 1 Then check function caused error due to internal failure labValue Caption ERROR GoTo Exit_DisplayValue End If Read element 0 0 of result matrix Dim varValue As Variant varValue CheckFunction GetResultItem 0 0 Verify VarType of varValue If VarType varValue lt gt vbString Then VarType should be String for barcode Else Show result string in Label element labValue Caption CStr varValue End If 7 8 5 Check Function Target Values The following source code excerpt demonstrates how to change the target value settings of 160 NeuroCheck Programmer s Reference check function Check Allowances The function sets the nominal value of each measurement to the most recent result of the function i e it may be used to implement a Teach modus Note that this functionality requires to access both the result value matrix and the target value matrix of the check function
185. p or NULL on error Parameters iWidth Width of image iHeight Height of image iZoom Scale factor Can have one of the following values declared as symbolic constants in pi_types h NC_ZOOM_10 10 of original image size NC_ZOOM_25 25 of original image size NC_ZOOM_50 50 of original image size NC_ZOOM_100 100 of original image size NC_ZOOM_200 200 of original image size pbyRedData Pointer to image data red channel pbyGreenData Pointer to image data green channel pbyBlueData Pointer to image data blue channel NeuroCheck API Functionality 69 DeleteBitmap extern C WINAPI BOOL DeleteBitmap HBITMAP hBmp The DeleteBitmap function deletes the bitmap of the given handle The function returns TRUE on success FALSE on error Parameters hBmp Handle of bitmap to be deleted DeleteAllBitmaps extern C WINAPI void DeleteAllBitmaps void The DeleteAl1Bitmaps function deletes all bitmap handles currently kept in the Ncapi d1l1 The function has no parameters and no return value GetBitmapWidth extern C WINAPI int GetBitmapWidth HBITMAP hBmp The Get BitmapWidth function reads the width of the given bitmap The function returns 1 on error Parameters hBmp Handle of bitmap GetBitmapHeight extern C WINAPI int GetBitmapHeight HBITMAP hBmp The Get BitmapHeight function reads the height of the given image The function returns 1 on error Parameters hBmp Handle of
186. pection task The controller program thus can be used to provide an individual user interface for specific applications or to perform complex communication and control tasks Controller programs can be developed using common software development tools for Windows applications like for example Visual Basic Chapter seven contains the complete description of the OLE automation interface of NeuroCheck After an introduction to OLE in general it details and explains the available interface calls for NeuroCheck including source code extracts for both Visual Basic and Visual CH Contents 11 Check Routine in XML Format NeuroCheck check routines can be exported in the human readable XML format This facilitates a custom visualization of your check routine solutions for analysis and documentation purposes Furthermore it allows to monitor changes between check routines and the external manipulation or even automatic creation of check routines Chapter eight explains the XML format used for the check routine data and indicates possible applications In addition it gives hints and instructions for custom visualization using extended style sheets XSL Quick Reference The ninth chapter finally represents a Quick Reference by summarizing syntax and parameters of all functions and data structures relevant for programming user extensions to NeuroCheck 1 Using a Plug In DLL in NeuroCheck When realizing image processing applications it m
187. penCheckRout ine 7 9 3 Access Check Functions The following source code sample demonstrates how to read the list of check functions of an individual check and how to display the help page for a particular check function ID of check function IDT Transfer image NC FCT_IDT declared in ncauto h void ShowCheckDetails ISingleCheck pISc get number of check functions int iCount pISc gt GetCount ICheckFunction pICf loop over check functions for int i 0 i lt iCount i create check function object COleVariant var short i VT_I2 LPDISPATCH lpDis pISc gt Item var ASSERT NULL lpDis create dispatch driver object for check function pICf new ICheckFunction lpDis read name CString szName pICf gt GetName TRACE1 name s const char szName display help page if function is Transfer image if NC_FCT_IDT pICf gt GetFunctionId first retrieve help file path CString szHelpFilePath After retrieving help file path call WinHelp with context information WinHelp hwnd const char szHelpFilePath HELP_CONTEXT DWORD NC_FCT_IDT eoif delete pIcf eofor eof function ShowCheckDetails 7 9 4 Automatic Mode Execution The following source code sample demonstrates how to switch to automatic mode after establishing the connection to the server and loading a check routine how to execute the OLE Autom
188. ple automation controller to illustrate its use For additional information on OLE technology please refer to Microsoft operating system and development documentation especially the documentation on Array Manipulation Functions regarding safearrays Introduction What is OLE The original meaning of the acronym OLE is Object Linking and Embedding denoting a technology for exchanging data objects between applications A typical example can be found in everyday office work a chart from a spreadsheet program can be embedded in a word processor document so that a double click on the chart will automatically activate the spreadsheet program for editing the chart Alternatively the chart can be linked into the document to allow automatic updating of the chart in the document whenever the original chart is updated in the spreadsheet program The original OLE functionality has later been extended into a general standard for the exchange of objects between applications This standard refers to data objects as well as to programmable objects enabling programs to access the functionality of other programs These programmable objects expose certain interfaces to the system allowing other OLE capable applications to control the original programmable object Controlling another application s programmable objects is called OLE automation We will come to that in a moment First though a few remarks on COM and ActiveX just to avoid confusion about all
189. plication window VT_I2 xo returns license level Premium Professional Runtime Demo VT_I4 ro returns the license number from security key VT_BSTR ro returns the name of the application VT_I2 rw reads sets operating mode manual live automatic VT_DISPATCH ro returns Null VT_BSTR xo returns path specification for the application VT_BOOL rw reads sets simulate image capture option of application VT_I2 xo returns number of sub devices configured in NeuroCheck or 1 on error Takes three arguments VT_I2 DeviceType Type of parent device VT_I2 DeviceIndex Index of parent device VT_I2 SubDeviceType Type of sub device VT_BSTR ro returns name of a sub device configured in NeuroCheck or empty string on error Takes four arguments VT_I2 DeviceType Type of parent device VT_I2 DeviceIndex Index of parent device VT_I2 SubDeviceType Type of sub device VT_I2 SubDeviceIndex Index of sub device VT_I4 rw reads sets top edge of main application window VT_I4 rw reads sets width of main application window 200 NeuroCheck Programmer s Reference WindowState Method Execute Open Quit ReadDigitalInput VT_I2 rw reads sets visual state of main application window Description Starts execution of active check routine returns success or failure Return type VT_BOOL Arguments None Opens existing check routine returns success or failure Return type
190. ption gt lt single check s _mame tinzelpriifung gt lt sc_index_inside_check_routine lt sc_in lt se_nane gt Harcodeldentifikation lt se_nane lt oneck function cf id S 8 cf_category lt cieck_fumction_index_imside_single lt eheck fonction manerBil in Speich Export d asx e parameter 103001 name Bi E n lt parameter id St 2 active lt parameter ide Seeas namer Lis lt parameter id 50805 nane parameter id S0806 nane b asio beabeten lt p id S0805 nanes presentation of check routine presentation of check in NeuroCheck chr format routine in XML format pm paee es bme ia T a Cigar A E WRC Mee A me F ee 5 Check routine Bar code identification NEURO SCHECK XSL Cheek routine i T Single check Bal 5 format 4 Single check Bar cede Mentificotion information vere for browser presentation of check routine in browser Figure 19 Utilization of XSL file as rendering filter for XML data The User Manual and the NeuroCheck online help describe how an XSL file can be assigned to a CHRX file when exporting a check routine There are alternatives to using XSL files to render XML data e g using a JavaScript built into a HTML page These methods are not described here Creation of your own XSL files Depending on the content of the XSL file the check routine data can be viewed at various levels of detail In addition to the check routine dat
191. r a user defined data type registered in the plug in DLL containing the plug in check function Both the address of the container and the addresses of the input objects are passed as constant pointers which means that they must not be altered or de allocated However it is possible to alter the value of a member of an input data object inside the execution routine unless this member is read only Similarly ppvDynOut put is a container for the possible output data objects Please note that the addresses of the output object pointers are not constant i e the execution routine creates the required output objects and assignes their addresses to the elements of ppvDynOut put See the example DLL for more information This routine is executed whenever NeuroCheck encounters the respective plug in check function during a check routine run The return value of the function determines the further behavior of NeuroCheck If the function retuns FALSE the current individual check will be 30 NeuroCheck Programmer s Reference terminated with status not O K Every plug in check function can be used as a decision function in this way 2 5 4 Deinitialization Routine The deinitialization routine of a plug in check function has to be declared as follows void WINAPI DeInitFunction sPI_CONTEXT_INFO const psContext void const pParameter In psContext NeuroCheck passes the function s current context information in pParameter the address of its para
192. r setting up the device analogous to the setup dialog of the serial interface DLL included with NeuroCheck The return value of the function indicates the return status of the setup dialog If the function returns TRUE NeuroCheck will call function D11 Init again If the function does not exist NeuroCheck will not react to the Properties button for a custom communication interface 6 2 3 Driver Test The DLL can contain and export a function declared as follows extern C BOOL TestDevice HWND hwndAppMain If this function exists and the user chooses Test in the Device Manager while the custom communication interface is selected NeuroCheck will call this function It receives a handle to the main application window so that the programmer of the communication DLL can display his own dialog for testing the device analogous to the test dialog of the serial interface DLL included with NeuroCheck If the function does not exist NeuroCheck will not react to the Test button for a custom communication interface the same holds for the Test Custom Communication item from the System menu The function should return TRUE if the device is working properly FALSE else 88 NeuroCheck Programmer s Reference 6 3 Remote Control Functions 6 3 1 Test for Start Signal When NeuroCheck is in automatic mode and no check routine is running it polls the device selected for the Start check signal in the Remote Control dialog periodically
193. ra uiLeft 100 para uiTop 200 SAFEARRAYBOUND rgb sizeof sPara 0 create a 1 dimensional safearray SAFEARRAY psa SafeArrayCreate VT_UI1 1 rgb if psa void pData SafeArrayAccessData psa void amp pData serialize the data into the char array OLE Automation 167 memcpy pData amp SPara rgb gt cElements sizeof char release SafeArrayUnaccessData psa now pack the data into the VARIANT VARIANT arg VariantInit amp arg arg vt VT_UI1 VT_ARRAY arg parray psa transmit if FALSE pICf gt SetParameters arg TRACEO error n eoif psa break eof case NC_FCT_IDT case NC_FCT_ITH determine threshold define in ncauto h sNcIthParameter psPara declared in ncauto h corresponding to above case break eof case NC_FCT_ITH default break eof switch eof function ModifyParameters 7 9 7 Check Function Target Values The following source code sample demonstrates how to read out the target value settings of a check function modify them and store them back to the check function object Function Check ROls uses a simple structure for its target values function Check Allowances an array of target value structures void ModifyTargetValues ICheckFunction pICf if FALSE pICf gt HasTargetValues TRACEO no target values available n return eoif read curr
194. ration functions are required PI_xxx cpp Initialization routines do not change PI_xxx h Header file do not change PI_xxx rc Ressource file contains the mandatory info dialog which can be adapted to the desired look and feel or your plug in DLL Parameter dialogs of individual functions can be defined here as well PI_Types h Header file with data types and constants of the NeuroCheck plug in interface Do not change PI_Main cpp Administrative functions This is the base implementation file to be adapted We recommend to modularize your project such that each plug in check function is encapsulated in a single module i e header and implementation file All samples with the exception of the PI_Simple project demonstrate this principle 82 NeuroCheck Programmer s Reference The next two files are only part of projects PI_NcApiCalls and PI_Visualization PI_NcApi h Header file with wrapper class definition data types and constants for the NeuroCheck API interface Do not change PI_NcApi cpp Implementation of wrapper class for conventient usage of the NeuroCheck API interface Do not change NOTE Do not use the MFC as a DLL as this would conflict with NeuroCheck and cause the DLL loading process to fail Instead it is recommended to statically link the MFC This has the additional advantage that it is not necessary to check the version for the installed MFC DLL when using the plug in DLL on a different system 6 Custom Co
195. red explicitly to accept commands from an OLE client This configuration takes place in the Remote Control dialog opened by the Remote Control command from the System menu For NeuroCheck to be controlled via OLE you OLE Automation 95 have to activate the appropriate option in this dialog as shown in the following figure Input Signals Output Signals Options m NeuroCheck automatic operation mode Program processes input signals default setting Source Function of signal Source Start check Manual lt ENTER gt Select check routine Digital inputs Adjust cameras Digital input Options Program is remote controlled by master OLE automation H Abbrechen Figure 15 NeuroCheck must be configured to be controlled via OLE automation using the Remote Control command in the System menu 7 1 7 Programming Language The COM specification is indepent of the programming language This means that an OLE client can be written in any OLE capable programming language e g the various C C environments Visual Basic or Borland Delphi Unless your controller needs to execute very complex algorithms the decisive factor for the speed of execution will be the number of calls to the OLE interface due to the handling of OLE commands through the Automation Manager of the operating system Also important for the speed of your OLE application is the
196. return eoif switch pICf gt GetFunctionId case NC_FCT_BCI Identify Bar Code define in ncauto h sNcBciResult psRes declared in neauto h access data SafeArrayAccessData arg parray void amp psRes TRACE1 barcode s n psRes gt szString release access SafeArrayUnaccessData arg parray notify system that safearray is no longer needed SafeArrayDestroy arg parray break eof case NC_FCT_BCI case NC_FCT_CLE Evaluate Classes define in ncauto h SAFEARRAY psa arg parray unsigned int uiNumOfElements psa gt rgsabound 0 cElements sizeof sNcCleResult TRACE1 Su struct elements n uiNumOfElements if 0 uiNumOfElements return OLE Automation 171 sNcCleResult psRes declared in ncauto h access data SafeArrayAccessData arg parray void amp psRes for unsigned int ui 0 ui lt uiNumOfElements ui output class string and quality TRACE2 Class s f n psRes ui szName psRes ui fQuality eofor release access SafeArrayUnaccessData arg parray notify system that safearray is no longer needed SafeArrayDestroy arg parray break eof case NC_FCT_CLE default break eof switch eof function ReadResult 7 9 9 Read Image The following source code sample demonstrates how to read a gray level image from the image stack of an individual check into the con
197. return values of ErrorCode are Constant Value Description NC_EXE_NOT il Not Executed either because the individual check has not been executed since opening the check routine or because a previous check function returned not O K thus terminating execution of the individual check NC_EXE_OK 0 O K NC_EXE_NOK not O K because of a target value violation e g a measurement did not conform to the tolerances or a bar code contained the wrong string NC_EXE_ERROR 2 not O K because of an internal error such an error occurs for example when an object required for computing a measurement is not present or a bar code is unreadable m Functionld The FunctionId property returns the check function s internal function identification number Refer to the Quick Reference section for a list of identification numbers Syntax object Functionld The object placeholder represents the CheckFunction object Return Type VT_I2 Name The Name property returns or sets the check function s possibly user defined name See Figure 18 Syntax object Name value The object placeholder represents the CheckFunction object OLE Automation 139 Return Type VT_BSTR OID The OID property sets or returns the unique object identification number OID Syntax object OID The object placeholder represents the CheckFunction object Return Type VT_I4 Parent The Parent property retu
198. rface This section will give you an idea of the extent of NeuroCheck s OLE automation interface The exposed automation objects and their properties and methods are detailed in section 7 2 and following You can control the following operations in NeuroCheck through OLE automation e load and save check routines e switch operating modes e execute a check routine and read its result e access image data 94 7 1 5 7 1 6 NeuroCheck Programmer s Reference e transfer complete images to other applications via clipboard obtain information about the hierarchical structure of a check routine and alter designations like names descriptions comments etc activate or deactivate individual checks alter parameters and target values of individual check functions read result and status information for individual checks and check functions read result values of individual check functions obtain information about the currently running server like version number license level license number etc change size position state and visibility of NeuroCheck s main window e get information about devices configured in NeuroCheck s device manager e read input and output states and set output bits of all digital I O boards and field bus devices configured in NeuroCheck s device manager e select layouts for the automatic mode screen e select camera and zoom for live image display e get detailed diagnostic information
199. rface versions e Interface version 400 for compatibility with DLLs developed for NeuroCheck 4 x e Interface version 500 for compatibility with DLLs developed for NeuroCheck 5 0 and 5 1 up to SP4 e Interface version 510 for DLLs developed for NeuroCheck 5 1 SP5 or later according to the interface description in this reference Please note that the differences between 500 and 510 are neglectible Therefore upgrading a DLL from interface version 500 to 510 simply means to re compile with the header file PI_Types h Check routines containing plug in functions created for interface version 500 still can be loaded with the new DLL of interface version 510 The plug in samples included with the NeuroCheck setup will always contain a function returning the correct number for the respective NeuroCheck version 2 2 2 Info Dialog Every plug in DLL has to display an information dialog This function is called from within NeuroCheck by clicking the Info button on page Plug In of the General Software Settings dialog box or by choosing the DLL name from the sub menu of About Plug In DLL from the Help menu Its declaration is extern C void WINAPI DllInfo HWND hwndMain Its single function parameter is the handle for the NeuroCheck main window 2 2 3 Help File A plug in DLL programmer can provide the user of his DLL with a dedicated help file in WinHelp or HtmlHelp format After loading the DLL NeuroCheck calls function extern C BOOL WINAPI
200. rk e for the demo version of NeuroCheck e if no check routine is loaded e if NeuroCheck is not configured for OLE control under System Remote Control e if NeuroCheck is not operating in automatic mode Examine the LastError property to find out the reason for the failure Open The Open method opens an existing check routine It takes the name of the check routine to be opened as argument and returns TRUE if the file was opened successfully or FALSE if the check routine could not be opened Syntax object Open FileName The object placeholder represents the NCApplication object Return Type VT_BOOL Argument Type Description FileName VT_BSTR Name of the check routine to be opened Remarks Remember to release the object variable assigned to a check routine before opening a new check routine as explained for the ActiveCheckRoutine property of the NCApplication object Quit The Quit method closes the open check routine and exits the application OLE Automation 111 Syntax object Quit The object placeholder represents the NCApplication object Return Type None ReadDigitallnput The ReadDigitalInput method reads the current state of a digital input It takes two arguments which specify the digital I O board and the input to be read The method returns the state of the input i e TRUE or FALSE if the input was read successfully or VT_EMPTY if an error occurred Syntax object ReadDi
201. rns the SingleCheck object the current check function belongs to Syntax object Parent The object placeholder represents the CheckFunction object Return Type VT_DISPATCH RowsOfParameterMatrix The RowsOfParameter Matrix property returns the number of rows of the check function s parameter matrix Syntax object RowsOfParameterMatrix The object placeholder represents the CheckFunction object 140 NeuroCheck Programmer s Reference Return Type VT_I2 RowsOfResultMatrix The RowsOfResultMatrix property returns the number of rows of the check function s result matrix Syntax object RowsOfResultMatrix The object placeholder represents the CheckFunction object Return Type VT_l2 RowsOfTargetValueMatrix The RowsOfTargetValueMatrix property returns the number of rows of the check function s target value matrix Syntax object RowsOfTargetValueMatrix The object placeholder represents the CheckFunction object Return Type VT_l2 7 6 2 Methods This section lists the methods of the CheckFunction object GetCurrentResult The GetCurrentResult method returns the result values of the check function It is only available after at least one execution in automatic mode The method returns a safearray containing the current result values OLE Automation 141 Syntax object GetCurrentResult The object placeholder represents the CheckFunction object Return Type VT_VARIANT Remarks This method is optim
202. roy argData parray eoif eof function ReadImageFromStack 8 Check Routine in XML Format This chapter describes the format created when check routines are stored as XML files and possible applications 8 1 Introduction As of NeuroCheck version 5 1 it is possible to store i e to export check routines in XML format This operation is described in the User Manual and the NeuroCheck online help XML check routine files extension chrx contain the same information as check routine files in the binary format chr which is used as the default so far In contrast to the binary format XML format is readable for both humans and for processing programs Chapter 8 2 gives a detailed description of the XML format of the NeuroCheck check routine data 8 1 1 Whatis XML XML stands for eXtensible Markup Language it is a meta language for the definition of document types The language was standardized by the World Wide Web Consortium W3C at www w3c org XML provides a strict separation between document structure contents and visual rendering of the contents The advantage of XML is that it is easily understandable for both people and processing programs parsers Thus XML is ideally suited for exchanging data between different platforms and for medium term or long term storage of important documents Already this technology has established itself as a standard in the IT world for these purposes 8 1 2 Possible app
203. rror Type amp CStr LastErrorNumber 256 _ amp Error Detail amp CStr LastErrorNumber Mod 256 End If Left The Left property returns or sets the distance between the left edge of the physical screen and the main application window See Figure 17 Syntax object Left value The object placeholder represents the NCApplication object Return Type VT_I4 LicenseLevel The LicenseLevel property returns the license level of NeuroCheck encoded in the security key Syntax object LicenseLevel The object placeholder represents the NCApplication object 104 NeuroCheck Programmer s Reference Return Type VT_I2 Possible result values of LicenseLevel are Constant Value Description NC_VERSION_LITE 0 Demo version NC_VERSION_RUNTIME 2 Runtime version NC_VERSION_FULL 4 Premium Edition fully licensed version NC_VERSION_PROFESSIONAL 16 Professional Edition LicenseNumber The LicenseNumber property returns the license number encoded in the security key Syntax object LicenseNumber The object placeholder represents the NCApplication object Return Type VT_I4 Name The Name property returns the name of the application Syntax object Name The object placeholder represents the NCApplication object Return Type VT_BSTR OperatingMode The OperatingMode property returns or sets the operating mode of the application OLE Automation 105 Syntax object OperatingMode value The obj
204. rs 0 X coordinate of center point fFitParameters 1 Y coordinate of center point fFitParameters 2 Radius in pixels A plug in check function must not change any values in fF it Parameters all elements are to be considered read only 3 3 6 Creating a new Region of Interest Creating a new ROI the modify and write only elements of structure sPI_OBJECT must be assigned For simplicity the plug in check function creating the new ROI does not have to calculate the chain code of its contour or the run length code of its region Instead the shape of the new region is specified by a number of points described by the following structure typedef struct int iLength int pix int pix sPI_POINTS The structure elements have the following meaning Element Description iLength Length of arrays i e number of points pix piY Arrays containing the X and Y coordinates of the points Both pointers must be assigned to arrays of length iLength Please note that the coordinates are relative to the reference point given by parameters iX and iY in structure sPI_OBJECT The interpretation of the given points depends on the value of iShapeType It can be assigned one of following values declared as symbolic constants in pi_types h Constant Meaning PI_SHAPE_AOTI Rectangular AOI The enclosing rectangle for the given points is calculated At least two points are required PI_SHAPE_POLY Polyline The polyline is define
205. rue 1 Finally enable Start button cemdStart Enabled True Exit Sub End_Application On error close application NeuroCheck server will be detached upon unloading the form i e in procedure Form Unload Unload Me End Sub Private Sub Form_Unload Cancel As Integer On Error Resume Next upon unload event of form close connection to server If Not NeuroCheck Is Nothing Then Detach NeuroCheck server by quit Note changes to the check routine will NOT be saved NeuroCheck Quit Set NeuroCheck Nothing End If End Sub 158 NeuroCheck Programmer s Reference 7 8 2 Access Single Checks and Check Functions The following source code sample shows how to access individual checks and check functions of the check routine and how to read information The first example shows that the collection property makes it possible to use a for each loop the second example uses a normal for loop Loop over all checks and display name if check is not enabled Dim SingleCheck As Object For Each SingleCheck In CheckRoutine If Not SingleCheck CheckEnabled Then MsgBox SingleCheck Name amp is disabled End If Next SingleCheck Loop over all checks and display check that failed for most recent exeuction of check routine Dim i As Integer For i 0 To CheckRoutine Count 1 If Not CheckRoutine CurrentCheckResult i Then MsgBox CheckRoutine Item i Name amp failed End If Next i Loop over all check functions
206. s position of region fMeasurement i Changes value of feature i sPI_CONTOUR typedef struct int ixStart starting point x coordinate int iYStart starting point y coordinate int iLength number of contour elements BYTE pbyChain chain code array sPI_CONTOUR Used to describe the contour of a single region of interest in an sPI_OBJECT structure All elements are to be considered read only sPI_LREGION typedef struct int iLength length of RLC code int pix X coordinates of start positions int piy Y coordinates of start positions int pixLength lengths of line segment in X direction sPI_REGION Used to describe the region of a single region of interest in an sPT_OBJECT structure All elements are to be considered read only sPI_POINTS typedef struct int iLength array length i e number of points int pix X coordinates of points int ply Y coordinates of points sPI_POINTS Used to describe a newly created object in the sP I_OBJECT structure All elements are to be considered write only sPI_LMEASARRAY typedef struct unsigned int uiCount number of values SPI_MEASVALUE pasMeasValue array with value structures sPI_MEASARRAY Used to exchange geometrical measurement data between NeuroCheck and a plug in check function All elements are to be considered read only 194 NeuroCheck Programmer s Reference sPI_MEASVALUE typedef str
207. ser defined data types IOo Em Create control structure Number of data types al PI_GetDataTypeDesc Retrieve data type properties Store data type description Data type info block in control structure PI_ GetNumberOfFcts e Plug In Function 0 Use plug in check functions e Plug In Function n DLL Deinitialization Remove DLL from process memory upon program exit Figure 7 administration framework for plug in DLLs in NeuroCheck Managing Plug In Check Functions Administration of a plug in check function consists of the following operations 1 Inserting a plug in check function 2 Setting parameters of the check function Interface Description 21 3 Executing the check function 4 Using the output possibilities of the check function 5 Removing the check function from the check routine For every check function the plug in DLL has to provide a dedicated routine for each of these operations These functions are explained in detail in section Structure of Plug In Functions This section will explain only the services provided by the main program for the plug in check functions Inserting a Plug In Check Function When a user defined check function is inserted into or appended to a check routine NeuroCheck retrieves information about the function from its info structure This information comprises e g e Function name e Size of parameter area e Function addresses NeuroCheck
208. sibilities of a Plug In Check Function If registered in the function info structure NeuroCheck will update the plug in check function s graphical output Each function can have several user defined Views Plug in check function also can take part in the standard data output of NeuroCheck i e output of result values to file or serial interface Removing a Plug In Check Function Before removing a plug in check function NeuroCheck calls its deinitialization routine for clean up of any initialized structures e g communication channels 2 2 Administrative Functions To organize communication between NeuroCheck and the plug in DLL certain administrative functions are required Their names declarations and calling conventions are defined within the main program and must not be changed 2 2 1 Version Information Every plug in DLL has to inform NeuroCheck about the interface version for which it has been compiled During DLL loading NeuroCheck calls this function and compares the value returned with the internal interface version information If the value returned by the DLL function does not match any of the plug in interface versions provided by NeuroCheck it will refuse to load the DLL and you will have to recompile it after implementing the necessary changes The function declaration is Interface Description 23 extern C unsigned int WINAPI PI_GetVersion void Please note that NeuroCheck will recognize three plug in inte
209. sseea nk eet eheiv cenit eee 38 243 Destroy Routine secre ike eee ees 41 The Type Description BIOCK ccceccesseesseeseeeseeeneceeeeeeeseeeseeeseeeeeeaeeeneesees 41 2 8 1 Type Description Block Declaration ccesseeseeeteeereeereeteeees 41 2 8 2 General Information ccccecceesceeseeeceeeceeseeeseeeseeeseeeeeeeeeeenseens 42 2 8 3 Function Pointers cceeceeseesceesceeeceeeeseeeseeesecnseeeeeeeeeeeeneeeatens 43 Data Types and Definitions cceeceseseneeeeseeeeeseeeeeeeeeeseneneeeeenens 45 1 Ee oE BG a ods sites cashacis E cceunch ob ed save xve shea nids te etva pha baetta stapes EA 45 Histo Stam resanni Bile Redeedd se Shes Aa A Bd eis RA ae 46 Regions of Interest nnne eiiiai d E Ss 46 3 3 1 Layer of Regions of Interest cccecceesseeseeseeeeeeeeeeeeeseeeseenseenes 47 3 3 2 Single Region of Interest 2 0 0 ceceeseesseeseeeneeeeeeseeeeeeseeeseenseenes 48 3 3 3 gt Object Contours cccccccestesgs cectevsvetes i hed dard aed oeitisaetie 50 3 3 4 Object Regiis ies Gee Ah SUA ese eee RE 51 3 3 5 Model Geometries inisesin i a i ie i ees 52 3 3 6 Creating a new Region of Interest c cc cceesceeseeeseeeeeeeseeteeeseenes 53 MeasStitement Array cscces e a EE a E O E tureiteatess 55 Symbolic Constants isenesest iiy neea EEES EE EERE iias 56 3 5 1 Identification of Data Objects cecceseeseeseeeseeeteeeeeeeseeseeeseenes 56 3 52 gt Feature Valuesiacy asec Setices esa aac chee 8 ees SE es
210. st reach to be created as new region of interest 0 100 7 8 Source Code Samples for Visual Basic The source code in this section was taken mostly verbatim from the official NeuroCheck OLE automation Controller Examples implemented in Visual Basic 6 0 You can find the projects including source code in the folder Programming OLE in the NeuroCheck installation path Attach and Detach Server Open a Check Routine The following source code sample demonstrates how to establish the connection to the automation server upon opening the form of the controller application how to request information open and access a check routine and change the visibility state of the NeuroCheck server Also shown is how to detach the server upon closing of the controller application s main form Option Explicit OLE access objects on module level Dim NeuroCheck As Object NCApplication object Dim CheckRoutine As Object CheckRoutine object Note if the NCheck tlb type library is included to the VB project then the automation objects may also be defined as follows Dim NeuroCheck As NCheck Application Dim CheckRoutine As NCheck CheckRoutine Constants specific to NeuroCheck Constants are defined in NcAuto bas Private Sub Form_Load On Error GoTo End_Application Create OLE server object variable on module level Set NeuroCheck CreateObject NeuroCheck Application If NeuroCheck Is Nothing Then MsgBox Unable to launch server appl
211. sualization Routines Handle the custom visualization of the check function These routines are not required to exist for a plug in check function BOOL WINAPI ViewCreate Parameters psContext psViewInfo hView pParameter ppvinputData ppvOutputData Return Value TRUE FALSI Gl sPI_CONTEXT_INFO const psContext sPI_VIEW_INFO const psViewInfo HANDLE hView void const pParameter void const const ppvInputData void const const ppvOutputData Pointer to structure containing context information for function Pointer to structure containing view information Address to return the bitmap handle for Address of parameter block reserved for the function Address of array with PI_MAXDYNDATA pointers to input data objects Only as many pointers are valid as have been requested in the function info block Address of array with PI_MAXDYNDATA pointers to output data objects Only as many pointers are valid as have been requested in the function info block If the execution of the function returned FALSE the output data will not be valid Bitmap for view created successfully and returnd in hView Creation of view failed hView will be ignored BOOL WINAPI ViewDestroy sPI_VIEW_INFO const psViewInfo HANDLE hView Called to release the view data allocated by ViewCreate Parameters psViewInfo hView Return Value TRUE FALSI Gl Pointer to structure containing view informati
212. sultltem Row Column The object placeholder represents the CheckFunction object Return Type VT_ VARIANT Argument Type Description Row VT_I2 Row index of element in result matrix Column VT_I2 Column index of element in result matrix Remarks See the explanation in section 7 7 1 GetTargetValueltem The GetTargetValueltem method returns an element of the check function s target value matrix The element to be read is specified by the arguments Row and Column The method returns the value of the element or VT_EMPTY on failure Syntax object GetTargetValueltem Row Column The object placeholder represents the CheckFunction object OLE Automation 143 Return Type VT_ VARIANT Argument Type Description Row VT_I2 Row index of element in target value matrix Column VT_I2 Column index of element in target value matrix Remarks See the explanation in section 7 7 1 GetTargetValues The GetTargetValues method returns the current target value settings of the check function The method returns a safearray containing the current target value settings Syntax object GetTargetValues The object placeholder represents the CheckFunction object Return Type VT_VARIANT Remarks This method is optimized for use with C C See the explanation in 7 7 1 and an example in section 7 9 7 HasCurrentResult The HasCurrentResult method returns a Boolean value giving information about the check function s ability to prov
213. t for a color image the gray level array always should be filled with valid values too For color images created by NeuroCheck the gray level array simply contains the same values as the green channel by default 3 2 Histogram The following structure is used by NeuroCheck for gray level histograms with binarization thresholds typedef struct unsigned short int uiThreshold unsigned int auiHistoBuffer 256 sPI_HISTO The structure elements have the following meaning Element Description uiThreshold Binarization threshold auiHistoBuffer Array with number of pixels for each gray level Both for input and output objects the value of ui Threshold and the values of auiHistoBuffer can be modified or assigned 3 3 Regions of Interest In NeuroCheck regions of interest ROIs can be manually defined or dynamically created i e segmented from image objects Regions are organized within layers which can contain both types of objects The description of this complex data structure is subdivided into the following sections Data Types and Definitions 47 Layer of regions of interest Single region Object contour Object region Model geometries Creating a new region OO hon Please note that where not indicated differently for all coordinates the standard NeuroCheck coordinate system applies which starts with its origin 0 0 in the top left corner of the image with its positive X axis pointing to the right and its positi
214. te new image 6 Define ROIs E Determine threshold File Serial interface z4 custom communication device H 8 Measure ROIs Figure 11 global activation of custom communication on output tab page Alternatively you can choose Data Output Custom Communication from the Check Routine menu and activate the Generate custom communication output check box in the Custom Communication Output Settings dialog box Custom Communication Output Settings 24 xi Output Figure 12 global activation of custom communication via menu command This dialog is also invoked by choosing Change Settings from the context menu of the Destination custom comm device box on the Output page of the check routine window Choosing the Options button in this dialog invokes the Options for Custom Communication dialog where you can activate several administrative information items to be included in the transmission This dialog equals the one for serial communication in NeuroCheck NeuroCheck treats the custom communication interface as a serial device because this is the most universal output device as it can be used for remote control as well as for data output 86 NeuroCheck Programmer s Reference Options for custom communication 21x Administrative Information Contents of data packet Include Mig Function index Function type ident
215. th pointers must be assigned to arrays of length iLength piXLength Array containing the length in X direction of each line segment The pointer must be assigned to an array of length iLength A plug in check function must not change any values in this data structure all elements are to be considered read only Example for Region Description The figure shows a dark octogon on a light background and the corresponding region description The description of the enclosing rectangle is given by X 1 Y 1 and both width and heigth equal to 4 The numbers mark the start of each line segment and indicate the ordering For instance the first line segment starts at the relative position X 1 Y 0 absolute position X 2 Y 1 and has a length of 2 pixels 52 NeuroCheck Programmer s Reference iLength 5 1 pix gt 1 0 0 0 3 3 piy gt 0 1 2 3y 3 4 5 piXLength gt 2 4 4 1 1 3 3 5 Model Geometries Each ROI can be assigned a model geometry as calculated by check function Compute Model Geometries The type of the model geometry can be identified by the value of element iFitType It can have one of four values declared as symbolic constants in pi_types h Constant Meaning PI_FIT_CONTOUR No specific model geometry calculated PI_FIT_POINT Model geometry is a single point PI_FIT_LINE Model geometry is a line PI_FIT_CIRCLE Model geometry is a circle Array fF itParameters
216. the 180 NeuroCheck Programmer s Reference data when viewing them in an editor Other parts are helpful for different views in the browser For importing an XML file into NeuroCheck other parts are essential The following table shows which part is used for what Visual interpretation Browser view Import of raw XML data with XSL in editor Element structure X X X Element contents X X X Prolog of XML file X X CDATA sections X Attribute id X Attribute index X Attribute name X X Attribute display X X Attribute disabled X X Attribute type X X Attribute category X Comments in XML file X Line breaking and X indentation in XML file For an XML file created externally for import into NeuroCheck this means for example that many attributes are not required 8 3 Using XSL files as rendering filter for the XML data 8 3 1 Purpose of the XSL files XML provides a strict separation between document structure contents and visual formatting of the contents Therefore an XSL file is necessary for the visualization of XML data in the browser Like XML XSL is a standard by the W3C it stands for eXtensible Style sheet Language An XSL file acts as a filter that determines how the data of the XML file is to be rendered Internally the browser uses the XSL instructions to perform a transformation from XML to a HTML page Check routine in XML format 181 lt check_rowtine_ escri
217. the plug in DLL to verify that NeuroCheck and the plug in DLL use the same declaration of the sPI_FCT_DESC structure If the value of uiStructSize and the return value of sizeof sPI_FCT_DESC are not equal there is a version conflict between the plug in interface provided by NeuroCheck and the one expected by the DLL Unique identification number for the plug in function NeuroCheck uses this number for various purposes among them identifying functions when loading a check routine For this reason plug in check functions inside a single plug in DLLs must not use identical function IDs NOTE function IDs from 0xE0000000 upwards are reserved for use by NeuroCheck GmbH and partners This leaves more than 3 75 10 entries free for customer use ample space even for organizing the most extensive projects The context number NeuroCheck will pass to Winhelp when you choose Info from the Check Function menu or the Help button in the Select New Check Function dialog for a plug in check function Number of expected input data objects A plug in check function can use up to PI_MAXDYNDATA input data objects This symbolic constant is defined in pi_types h witha value of 5 34 NeuroCheck Programmer s Reference uiNumOfOutputData Number of created output data objects A plug in check function can create up to PI_MAXDYNDATA output data objects This symbolic constant is defined in pi_types h witha value of 5 uiSizeOfParameter Si
218. the pointer just like it is done with the check function name and description strings In this case the maximum length of the string must not exceed 80 characters However for readability we recommend a maximum length of 40 characters 3 5 1 Identification of Data Objects There are only three symbolic constants in this section representing the possible values of element iType in the structure sPI_OBJECT describing a region They allow to distinguish between objects with and without a complete contour description Constant PI_OBJEC AOI PI_OBJEC CONTOUR PI_OBJEC R EGION 3 5 2 Feature Values Description Region contains enclosing rectangle only Region also contains contour description Region also contains contour and region description These constants serve to distinguish between the individual feature values possible for a region They are intended to be used as indices for the Measurement array in the region description structure sPI_OBJECT and the bMeasurement and lpszMeasurement Name arrays in the region layer structure sPI_LAYER The constants are listed here in the same order as the features in the NeuroCheck documentation which does not necessarily correspond to the order in pi_types h To ensure compatibility to future versions of the plug in interface programmers should always use the symbolic names never the values directly The features themselves are explained in detail
219. three others to be called in automatic mode The plug in menu commands are appended to the Tools menu in NeuroCheck for the respective mode The sample DLL does not register any plug in check function PI_Parameter This sample shows the usage of a parameter set and the implementation of a parameter dialog for a plug in check function It also shows the usage of help files for plug in check functions For this and all following samples each plug in check function is encapsulated in its own source file e Create New Image This plug in check function demonstrates the use of parameters in a plug in check function and the implementation of a simple parameter dialog It also demonstrates the creation of a new data object The plug in check function takes an input image and creates an output image which is the mirror of the input image If the parameter flag is TRUE the output image additionally will be inverted e Modify Histogram This plug in check function demonstrates the implementation of a parameter dialog which 78 NeuroCheck Programmer s Reference accesses input data of the function An Update button can be used to dynamically update the input data for a new image The plug in check function takes a histogram as input object and modifies the threshold value e Modify Color Image This plug in check function demonstrates the use of a structure as parameter block It gives detailed hints for the setting of default values and vers
220. tion in manual or test mode or in its visualization window in automatic mode For retrieving the current output of a custom view NeuroCheck calls the plug in check function s view create routine This routine returns a handle to a bitmap to be displayed The plug in programmer must manage the bitmap objects himself For convenience he may use the NeuroCheck API functionality provided for bitmap management When the bitmap handle can be released NeuroCheck calls the plug in check function s view destroy routine For de allocation the plug in DLL must use the operator matching the 26 NeuroCheck Programmer s Reference allocation operator previousely used to create the object 2 3 4 Data Output to File or RS232 Serial Interface For output to file or RS232 serial interface a data output routine can be registered for each plug in data type Calling this routine a container is passed for returning a data sequence which NeuroCheck will write to file or serial interface This data sequence must be allocated by the plug in DLL using VirtualAlloc and will be de allocated by NeuroCheck 2 3 5 Note The above applies to output data objects collected in the NeuroCheck data pool only Functions inside the plug in DLL may of course allocate dynamical data for internal use using the new operator and free it using delete Just make sure that all memory allocated inside the DLL is released again Memory allocated inside the initialization routine may be
221. tion number OID 204 NeuroCheck Programmer s Reference Parent SCIndex Method VT_DISPATCH ro returns the check routine object VT_I2 ro returns index of single check in check routine collection Description CopyImageToClipboard EnableCheck GetImageData Get ImageProp IsCheckEnabled Collection Property NewEnum Collection Method Item Copies an image from the data stack to the clipboard Return type VT_BOOL Arguments VT_I2 ImageIndex number of the image on the stack VT_I2 ImageFormat format of image VT_I2 ImageScale scale factor of image Enables or disables execution of the check returns previous state deprecated use CheckEnabled property Return type VT_BOOL Arguments VT_BOOL bEnable if TRUE execution will be enabled Returns safearray containing gray level data of an image Return type VT_VARIANT Arguments VT_I2 ImageIndex number of the image on the stack Returns safearray containing properties of an image Return type VT_VARIANT Arguments VT_I2 ImageIndex number of the image on the stack Returns current activation state of the check deprecated use CheckEnabled property Return type VT_BOOL Arguments None Type Access Description VT_DISPATCH ro returns an enumerator object that implements IEnumVARIANT Description Returns the given check function object Return type VT_DISPATCH Arguments VT_VA
222. tly reset to default values It might also be useful to encode a version information e g in the second byte in case of changes to the structure of the parameter area between two versions of a plug in DLL Please note that this only works if the size of the memory block reserved for the parameter set remains identical between two versions of a plug in check function because NeuroCheck will fail to load a plug in check function from a check routine if it had been saved with a differently sized parameter areas 2 5 3 Execution Routine The execution routine of a plug in check function has to be declared as follows BOOL WINAPI ExecuteFunction sPI_CONTEXT_INFO const psContext void const pParameter void const const ppvDynInput void const ppvDynOutput In psContext NeuroCheck passes the function s current context information in pParameter the address of its parameter block ppvDynInput is a container of the input data objects required in the function info block i e it is an array of the addresses of the objects It has at most five valid members For a function without dynamical input data objects no object will be valid For a function requiring one input data object ppvDynInput 0 will contain the address of this object the other members will not be valid etc The addresses have to be casted inside the function to the respective input data type either a NeuroCheck data type image histogram region layer measurement list o
223. to enclosing rectangle iLength Number of contour points pByChain Chain code of the contour The elements of the chaing code indicate the direction of the contour from the current point to the next point The following figure visualizes the possible values 6 2 A plug in check function must not change any values in this data structure all elements are to be considered read only Example for Contour Description The figure shows a dark octogon on a light background and the corresponding contour description The description of the enclosing rectangle is given by X 1 Y 1 and both width and heigth equal to 4 The asterisk marks the start of the contour the numbers next to each section of the contour encode the direction of the connection between the two contour points Data Types and Definitions 51 iXStart 0 z 7 1 iYStart 1 iLength 8 D 5 pByChain gt 7 0 1 2 3 4 5 6 3 3 4 Object Region ROIs created dynamically by object segmentation usually have an object region described by the following structure typedef struct int iLength int pix int ply int pixXLength sPI_REGION The structure elements have the following meaning Element Description iLength Length of run length code i e number of line segments pix piy Arrays containing the X and Y coordinates of the starting positions for each RLC line segment relative to enclosing rectangle Bo
224. tom result views of the plug in check function which will be displayed in the combo box of the Result View pane of NeuroCheck in manual mode The list must contain uiNumOfViews strings Recommended string length max 40 chars alpsziInputViewNames alpszOutputViewNames List of names for the standard result views for input and output data objects of the plug in check function which will be displayed in the combo box of the Result View pane of NeuroCheck in manual mode The lists must contain uiNumOfInputData resp uiNumOfOutputData strings If not specified predefined names like Gray level image In are used Recommended string length max 40 chars 2 6 6 Function Pointers The function pointer area of the function info block contains the following elements Element Description pfnInitialize Pointer to initialization routine pfnExecute Pointer to execution routine pfnUnInitialize Pointer to deinitialization routine pfnParameterDlg Pointer to parameter dialog routine pfnViewCreate Pointer to view create routine pfnViewDestroy Pointer to view destroy routine The pointers have been defined using function types declared in pi_types h Since the individual routine has to adhere to the conventions described in section Plug in Check Functions function addresses can be assigned directly Apart from the parameter dialog routine and the two visualization routines all routines have to 38 NeuroCheck Programmer s Reference
225. tputData 2 6 4 Data Output Description The pointer area of the function info block contains two more pointers In case of uiDataOutput equal to 1 both pointers must be assigned to static arrays with at least uiNumOfOutputData elements each stating if the respective output data objects can take part in the standard NeuroCheck data output to file or to serial interface respectively NeuroCheck uses only the first elements of the two arrays up to the number of elements stated in uiNumOfOutputData The information in these arrays is used for providing output symbols on the Data Output View in manual mode If data output has been configured for the check routine NeuroCheck will output the indicated data objects during automatic mode For Output of Color Image objects of a user defined data type NeuroCheck will call WF Bitmap File the dump routine of the respective type whereas output of E Output of MeasArray objects of a standard NeuroCheck data type image layer MG File of regions histogram measurement list will be done A F Serial interface automatically Element Description piMaskFileOutput Pointer to be assigned with static array containing flags for the created output data objects for output to file 36 2 6 5 NeuroCheck Programmer s Reference 2 6 4 1 piMaskRs2320utput Pointer to be assigned with static array containing flags for the created output data objects for output to RS232 serial interface
226. troller void ReadImageFromStack ISingleCheck pISc first determine the number of available images int iNumOfImages pISc gt GetNumOfImages if 0 iNumOfImages nothing todo return we have at least one image on the runtime data stack read image at index zero read image properties VARIANT argProp pISc gt GetImageProp 0 error check if argProp vt VT_UI1 VT_ARRAY TRACEO error invalid return data n return eoif sNcImageProp psProp declared in ncauto h access data SafeArrayAccessData argProp parray void amp psProp verify image properties if psProp gt uixSize gt 0 amp amp psProp gt uiYSize gt 0 continue evaluation with verification of image data VARIANT argData pISc gt GetImageData 0 if argData vt VT_UI1 VT_ARRAY 172 NeuroCheck Programmer s Reference TRACEO error invalid return data n SafeArrayUnaccessData argProp parray SafeArrayDestroy argProp parray return eoif transfer grayvalue pixel array char pbyData SafeArrayAccessData argData parray void amp pbyData now work with the image data Ep e g create a DIB and display it release access SafeArrayUnaccessData argData parray SafeArrayUnaccessData argProp parray notify system that safearray is no longer needed SafeArrayDestroy argProp parray SafeArrayDest
227. tructure define the file name of the classifier attached to this function Parameter Item Type Description Classifier 0 0 VT_BSTR File name of classifier possibly including path 7 7 14 Screen ROIs Function Screen ROIs allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The parameter values are transferred using an array of structures holding the following values for each feature currently available in function Screen ROIs Parameter Verify Feature ID Minimum Maximum Item n 0 n 1 1 2 1 3 Type VT_BOOL VT_l4 VT_R4 VT_R4 OLE Automation 155 Description If TRUE the feature is activated for screening else it is ignored Identifier of current feature The feature IDs are defined in Ncauto h and listed in the Quick Reference section of this manual Minimum value allowed for the feature Maximum value allowed for the feature NOTE Group parameter settings of function Screen ROIs cannot be accessed through OLE automation The feature ID is read only i e it cannot be changed When setting the parameters in an array of structures an arbitrary number of structures can be given For instance if four features are activated but only the limits for one of them has to be changed it is sufficient to only transfer the one structure element in the array that matches the feature ID 7 7 15 Rotate Image Function Rotate Image allows parameter se
228. tting through OLE automation The pertaining structure is defined in Ncauto h The element of the parameter structure defines the operating mode of the check function Parameter Mode Possible settings for Mode are Constant Item 0 0 NC_IROT_RO E_O NC_IROT_RO A A A E 90 NC_IROT_RO NC_IROT_RO NC_IROT_MIRRO NC_IROT_MIRRO A 7 7 16 Template Matching Function Template Matching allows parameter setting through OLE automation The pertaining structure is defined in Ncauto h The element of the parameter structure defines the operating mode of the check function The elements of the parameter structure apply ton E_270 HORIZONTAL R_ R VERTICAL Type VT_I4 Description Value indicating either the rotation angle for the rotation or the direction of mirroring Possible settings are defined in Ncauto h and listed below Value Description OP WN EF O Rotation by 0 degrees counterclockwise Rotation by 90 degrees counterclockwise Rotation by 180 degrees counterclockwise Rotation by 270 degrees counterclockwise Mirror image horizontally Mirror image vertically NeuroCheck Programmer s Reference of the first group of ROIs only Parameter Item Type Description Result Positions 0 0 VT_l4 Number of objects the function will create at most inside the available regions Minimum quality 0 1 VT_I4 Required degree of correspondence to the template an object mu
229. uct unsigned int uiNumber identification number float fMeasValue actual value LPSTR lpszName description string may be NULL sPI_MEASVALUE Used to describe a single measurement in a sPI_MEASARRAY structure Element lpszName should be considered read only 9 5 Plug In Interface Symbolic Constants Identification of Data Objects Constant Description PI_OBJECTAOI Region contains enclosing rectangle only PI_OBJECTCONTOUR Region also contains contour description PI_OBJECTREGION Region also contains contour and region description Identification of Model Geometries Constant Description PI_FIT_CONTOUR No specific model geometry calculated PI_FIT_POINT Model geometry is a single point PI_FIT_LINE Model geometry is a line PI_FIT_CIRCLE Model geometry is a circle Feature Values Constant Description PI_ALL_XCOFG X coordinate of the center of gravity of the region PI_ALL_YCOFG Y coordinate of the center of gravity of the region PTI_AOT_XORG X coordinate of top left corner of the enclosing rectangle PI_AOI_YORG Y coordinate of top left corner of the enclosing rectangle PI_AOI_XDIM Width of enclosing rectangle PI_AOI_YDIM Height of enclosing rectangle PI_AOI_RATIO Ratio of height to width of enclosing rectangle PI_BNDAOI_LAXIS Length of principal axis of the region PI_BNDAOI_SAXIS Length of secondary axis of the region PI_BNDAOT_LANGLE_180 Direction o
230. uctures sPI_IMAGE typedef struct unsigned short int uiWidth unsigned short int uiHeight BOOL bColor BYTE pbyGrayValue BYTE pbyRedValue BYTE pbyGreenValue BYTE pbyBlueValue int iSource LPCTSTR lpszSourceName sPI_IMAGE width of image height of image color image gray level values values of red channel values of green channel values of blue channel type of image source name of image source Used to exchange gray level image data between NeuroCheck and a plug in check function 192 NeuroCheck Programmer s Reference All elements are read only A function may only change values within the image data arrays sPI_HISTO typedef struct unsigned short int uiThreshold binarization threshold unsigned int auiHistoBuffer 256 frequencies of gray levels BPI HISTO Used to exchange histogram data between NeuroCheck and a plug in check function All elements may be changed by a plug in check function sPI_LAYER typedef struct unsigned int uiCount number of regions in array BOOL bMeasurement 300 feature validity flags LPSTR lspzMeasurementName 300 feature names unsigned int uiClasses number of available classes LPSTR alpszClasses array of class names sPI_OBJECT pasObject array of pointers to regions SPI_LAYER Used to exchange region of interest data between NeuroCheck and a plug in check function Except for flags in the bMe
231. ug in check function may perform within this structure are setting flags in the bMeasurement array to activate or deactivate features and to specify custom feature names when creating a new output list The number of regions and the addresses of the individual regions must not be changed Thus a plug in check function cannot delete a region but it can declare the object invalid so that a subsequent call to function Screen ROIs removes the region See section Single Region of Interest for details Likewise a plug in check function cannot add regions to a layer but it can create a new layer copy regions to this layer and add additional objects internally 3 3 2 Single Region of Interest NeuroCheck uses the following structure to describe a single region of interest ROD typedef struct GER a a min Read only mf int iType int iWidth int iHeight sPI_CONTOUR psContour sPI_REGION psRegion model geometries int iFitType float fFitParameters 10 A RSEN re ne Yee ree JE S555 Modify Write Ry int iNumber int iGroupNumber BOOL bValid int IX int ays float fMeasurement 300 gh SssSs5s5 Write only af int iShapeType int iSearchReg sPI_POINTS psPoints sPI_OBJECT The structure elements have the following meaning Element Description iType Type of ROI Can have one of three values declared as symbolic constants in pi_types h PI_OBJECTAOT ROI contains
232. unctions can be called by choosing Info from the Check Function menu or by clicking the Help button in the Select New Check Function dialog NeuroCheck automatically redirects the help calls to a help file created by the programmer of the plug in DLL Plug in functions can have a parameter dialog The parameter copy and undo functionality is provided for these parameter dialogs in the same way as for the built in functions Plug in functions access input data in the same way as built in functions The Input Data Configuration dialog operates in the usual manner Plug in functions are stored and loaded together with check routine like built in functions The programmer of the plug in DLL does not need to provide his own file handling functionality The names of the different result representations in the list boxes of the result display pane are customizable If not specified predefined names like Gray level image In are used Plug in functions can have their own graphical result display allowing to visualize overlays like drawing measuring lines into the source image or custom data descriptions Plug in functions can participate on the standard NeuroCheck data output i e output of bitmap files and data output to file or RS232 serial interface 1 4 2 Using a Plug In Check Function in a Check Routine After a plug in DLL has been successfully loaded the Plug In button in the Select New Check Function dialog box is enabled Clicki
233. urement Description Result values are returned in an array of structures holding the following values for each ROI and each feature Object number identifier of ROI Feature ID identifier of feature Current value value of the feature Description X Offset offset in x direction to reference point Y Offset offset in y direction to reference point Rotation rotation angle relative to reference image Pivot X x coordinate of current pivot point Pivot Y y coordinate of current pivot point Description Camera identifier index of camera Transfer Image Function ID IDT 508 Functionality Parameter values Determine Threshold Function ID ITH 506 Functionality Parameter values Define ROIs Function ID DAOI 512 Functionality Parameter values Classify ROIs Function ID OCL 518 Functionality Parameter values NeuroCheck Programmer s Reference Description Left X coordinate of top left corner Top Y coordinate of top left corner Right X coordinate of bottom right corner Bottom Y coordinate of bottom right corner Source identifier of image source Camera identifier index of camera Bitmap name of bitmap file Tray index index of image tray Description Use manual threshold if TRUE manual threshold is used Manual threshold value of the threshold Result image parameter for automatic threshold computation to adjust predominance of light or dark
234. ustomized data structures in plug in functions e The fourth chapter describes the use of the NeuroCheck API functionality in a plug in DLL e The fifth chapter gives an overview of the sample plug in DLLs included in the NeuroCheck installation Custom Communication Interface This interface has been designed for the integration of communication drivers implemented as dynamic link libraries DLL Thus NeuroCheck can be remote controlled by any type of communication hardware and can transmit result data using this hardware A typical example is the support of proprietary serial protocols for connecting to a PLC programmable logic control unit Other examples might be the output of result data to a database or a quality management system the implementation of a proprietary output file format or data transmission via TCP IP Also basic control tasks like a conditional change of a check routine or a loop might be realized with this interface The usage and the implementation of a custom communication DLL is explained in the sixth chapter OLE Automation Interface NeuroCheck supports OLE automation the Windows standard for direct communication between programs Thus NeuroCheck can be run as a server which is remote controlled by a self developed OLE controller program Such an OLE controller program can for instance load and run a complete NeuroCheck check routine It also can access result values or modify parameter settings of the ins
235. utine PI_GetNumberOfFcts This routine is declared within NeuroCheck and has to be provided by every plug in DLL NeuroCheck allocates a control data structure for each of the plug in check functions For each plug in check function NeuroCheck calls routine PI_GetFctCaps which returns a function info structure containing information required by NeuroCheck to handle the plug in check function If exported from the plug in DLL NeuroCheck then calls routine PI_GetNumberOfDataTypes NeuroCheck allocates a control data structure for each of the plug in data types For each data type NeuroCheck calls routine PI_GetDataTypeDesc which returns a type description structure containing information required by NeuroCheck to handle the plug in data type The plug in check functions and data types can then be used like built in functions and data types with the exception that plug in data types can only be used by plug in check functions Every call to a plug in function causes data to be exchanged between NeuroCheck and the DLL Before exiting NeuroCheck removes the plug in DLL from memory The following figure illustrates this administration framework 20 2 1 2 NeuroCheck Programmer s Reference NeuroCheck DLL is loaded during program start up Plug In DLL PI_GetVersion a functions Retrieve function Store function description Function info block ramen ad Retrieve number of l u
236. utine data in the XML file you can use the syntax of the XPath language which again is too complex to be explained in detail here The content of an XML element is evaluated by the XSL element lt xs1 value of gt and can thus be displayed in the browser The assignment of the attribute select tells XSL which XML element or attribute should be evaluated lt xsl template match nc single_check gt lt xsl value of select nc sc_properties nc sc_descript nc sc_name gt sizs tenplates The access to an element is similar to browsing a directory tree by using relative XPath specifications starting from the current XML element In this example the template processing the XML element single_check first accesses its child element Check routine in XML format 183 sc_properties then that one s child element sc_descript and then that one s child element sc_name Please note that you have to use the nc prefix because all elements are defined in the NeuroCheck namespace It is not always only the content of an element that is evaluated For example the attributes name and display often allow for a better rendering of the element and its values For example if the following XML element lt parameter name Barcode type display EAN 8 gt 2 lt parameter gt is evaluated with the following XSL code lt xsl template match nc parameter gt The parameter lt xsl value of select name gt has been set to lt xsl value of gt which means
237. ve Y axis pointing downwards 3 3 1 Layer of Regions of Interest Every function creating regions of interest be it manually or automatically through an object search generates exactly one layer of regions with the following structure typedef struct unsigned int uiCount BOOL bMeasurement 300 LPSTR lpszMeasurementName 300 unsigned int uiClasses LPSTR alpszClasses sPI_OBJECT pasObject SPI_LAYER The structure elements have the following meaning Element Description uiCount Number of objects in layer bMeasurement Array of flags for the activation of individual feature values The various features are identified by symbolic constants defined in pi_types h lpszMeasurementNam Array of string pointers holding the names of the features activated by bMeasurement For an input list these strings are read only Creating a new output list custom feature names can be specified by assigning pointers to static strings uiClasses Number of classes available for the layer if its objects have been classified The class ID assigned to each object is given as feature value Class information is created by check functions Classify ROls Template Matching and Color Matching alpszClasses Array of class names Element i of the array represents the name of class ID i These strings are read only pasObject Pointer to array of region descriptions 48 NeuroCheck Programmer s Reference NOTE the only operations a pl
238. views It also shows further examples for using the NeuroCheck API functionality The NeuroCheck API is encapsulated in a C class available for re use Please note that for successful execution of this sample the check box Provide API functionality on page Plug In of the General Software Settings dialog box must be activated e Visualize Images The plug in check function creates a color image and displays each color channel in a own result view It also displays the input image as gray level image The function also demonstrates the usage of the NeuroCheck API functionality to create bitmaps 5 2 Project Structure A plug in DLL for NeuroCheck is created within a standard Visual C project for DLL programming It will usually be unnecessary to make any changes to the core project files excepting dialog and menu ressources Therefore we recommend to reuse the files from one of the sample projects meeting your requirements First create a new project of type MFC AppWizard dl11 using the Microsoft Foundation Classes as a static library The AppWizard will automatically create several files whose contents should then be replaced by that of the corresponding files from a sample project The file names are derived from the project name For the example project called PI_xxx these are the following files File Description PI_xxx def Definition file exports the required administrative functions Do not change unless additional administ
239. xItem and SetxxxItem methods Row and column index are passed as input arguments to specify the data element to be read or set The meanings of the elements for each check function type are explained in the following sections In general columns always contain the same type of information whereas the number of rows may be dynamic indicated by in the overview table and by row index n in the explanation below This method is more convenient for Visual Basic programmers than using safearrays It leads to optimal performance if only single elements of the data matrix need to be accessed Data Exchange by SafeArray This method always passes the complete set of parameters target values or result values in a safearray structure or an array of safearray structures using the Getyyy and Setyyy Q methods of the CheckFunction object yyy standing for Parameters TargetValues or CurrentResult The pertaining structures for the different check function types are defined in Ncauto h and explained below This method minimizes the number of OLE automation calls and is best suited to pointer languages like C C and to situations where the whole set of data needs to be transferred OLE Automation 149 7 7 2 Identify Bar Code Function Identify Bar Code allows parameter and target value setting and result data retrieval through OLE automation The pertaining structures are defined in Ncauto h Parameter Item Type Description Code type 0 0 V
240. ze of function parameter area NeuroCheck treats the parameter array as an unstructured byte array of this size Please note that changes to the size of the parameter area are crucial NeuroCheck will not be able to load a plug in check function from a check routine saved with a different size of the parameter area than expected while loading If further parameters can be expected in future versions of a plug in check function it is advisable to reserve more than the currently needed memory space giving the chance of maintaining downward compatibility If the size of the parameter area indeed needs to be changed it is recommended also to alter the function identification number uiNumOfViews Number of user defined views of the plug in check function If the element is larger than 0 the plug in check function must provide a view routine and a name for each of the views uiDataOutput Switch indicating whether the plug in intends to take part in the standard NeuroCheck data output processes The element should be 1 when the plug in function provides standard output capabilities it should be 0 if it does not provide any output capability 2 6 3 Input Output Data Object Description The pointer area of the function info block contains two pointers which must be assigned to static arrays with at least uiNumOfInputData resp uiNumOfOutputData elements each stating the types of the expected input and created output data objects respectively Neuro
Download Pdf Manuals
Related Search
Related Contents
FANTASY - FATA SIRENA Tech air 3104v3 Dexford WS 2300 MIKE SINGLETON Adieu à l`anthropologie - Frank`s Hospital Workshop Skyler Clark, Chris Drouin, Matt Fabian Kurzanleitung STP 8000 Handfunkgerät firebird Package Inserts Copyright © All rights reserved.
Failed to retrieve file