User-defined parameters
Top  Previous  Next


ImageWarp scripting language can be used to define custom measurements in form of user-defined parameters. The following functions provide support for custom parameters: measObjects, measFields, measBlobs,measContours, measCurves,

User-defined parameters are submitted to measurement functions via the optional last argument in the argument list. This argument must be a string that contains the code defining a procedure for calculating custom parameters and written in ImageWarp language standard. An escape sequence \n must be used to indicate line breaks in the code. Before being used in a measurement function, the user-defined parameters should be activated with
selectParam with one of the following arguments: "User1", "User2", "User3", "User4", "User5". As an alternative, you can assign your own name for a user-defined parameter by calling renameParam and use the new name for selecting and defining the parameter.

The following example shows how to define custom parameters and use them in measurements.

Example

grabIm(1)  
'assign custom name for user-defined parameter User1  
renameParam("User1","Elongation")  
'defining a formula:  
'SetParamValue(GetParamValue(FeretMax)/GetParamValue(FeretAvrg))  
strUser="SetParamValue(\"Elongation\",(GetParamValue(\"FeretMax\")/GetParamValue(\"FeretAvrg\")),0)"  
'set the scope of interactive functions to global parameter list  
setParamScope(PAR_GLOBAL)  
'select parameters for measurements including the newly defined one  
SelectParam("Area","Perim","FeretMax","FeretAvrg","Elongation")  
'Submit definition string as a last argument for measurement function  
MeasContours(1,TRUE,3,0,strUser)