Top  Previous  Next

watershed ( integer Input, integer Output [, integer Preflood =0, integer Invert =0 ] )

Use this function to find the ridges of intensity in an image or selection. The function works by treating the image as a topographic surface, finding the local minima in it and then "flooding" the surface. The lines at which the neighboring pools join as the water rise are extracted as watershed ridges. You can pre-flood the surface with a selected "rain" level to disregard lower ridges. The procedure can be inverted to locate "valleys" on the intensity surface.


An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
An integer specifying the initial depth of "water basins" on the intensity surface. Increasing this parameter will submerge the smaller ridges and they will not appear in the output image.  
Default value: 0  
A boolean integer specifying whether the input image should be inverted before the operation is applied. Must be one of the following values:  
FALSE=0 – no inversion is performed.  
TRUE=1 – inverts the input image before applying the watershed algorithm. The valleys in the image intensity will be extracted instead of the ridges.  
Default value: FALSE  
Error flags
The flag set if successful.  
The flag set if failed.  


This set of statements extracts the fiber structure from a sample image using the watershed operator:  
setCurDir ("samples")  
loadIm (1,"sample3.iwd")