setSpaceCal
Top  Previous  Next

setSpaceCal ( integer Image, string Unit, floating Xscale, floating Yscale [, integer Ox =0,
integer Oy =0, integer Invert =0 ] )  

Use this function to define a spatial calibration scale and apply it to an image. Spatial calibration supplies a scale for establishing a size relationship for objects in an image and affects the results of measurements.
.
Parameters
 
Image  
 
An integer between 1 and 116 specifying the frame number of the image to which the spatial calibration will be applied. Values in the range of 100-116 correspond to hidden frames.  
 
Unit  
 
A string specifying the name for the spatial calibration unit. If this parameter is zero, ImageWarp will automatically use pixels as the calibration units for the spatial scale being defined.  
 
Xscale, Yscale  
 
Floating variables or constants specifying the number of spatial calibration units per pixel in the horizontal and vertical direction respectively.  
 
Ox, Oy  
 
Optional integers specifying the position of the origin of the image coordinate system relative to the top left corner of the image, in pixels. Both positive and negative values are allowed. A negative Ox value will move the origin to the left of the left edge of the image, while the negative Oy value will move the origin up above the top line of the image.  
Default values: 0  
 
Invert  
 
Optional boolean integer specifying the direction of the vertical axis. Must be one of the following values:  
 
FALSE=0 – keeps the Windows default downward direction for the Y-axis.  
TRUE=1 – assigns the inverted upward direction for the Y-axis.  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example
 
This set of statements assigns a calibration scale with selected parameters to a sample image:  
 
unit="cm"  
xscale=12  
yscale=11  
setCurDir ("samples")  
loadIm (1,"sample8.iwd")  
setSpaceCal(1,unit,xscale,yscale)