Description

Returns a distance map of the image AOI.

Return Type

A McImage object.  

A new 16-bit monochrom McImage holding the distance map

Syntax

object.DistanceMap ([Threshold], [StraightDist], [DiagDist], [KnightDist], [MaxDist], [Flags], [vSourceImg])

The DistanceMap Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McMorpho.
ThresholdOptional. A Double value.

double: Defines the separation between background (below) and objects (equal to or above) as a percentage of the full luminance range. Note that the Threshold property is ignored by this method, this argument is always used. The default is 50.

StraightDistOptional. A Long value.

Weight given to straight distance. The default is 17 which, with defaults for the DiagDist and KnightDist arguments, provides a good approximation to a Euclidian distance map. For a checker board or diagonal distance map, this argument should be 1.

DiagDistOptional. A Long value.

Weight given to diagonal distance. The default is 24 which, with defaults for the StraightDist and KnightDist arguments, provides a good approximation to a Euclidian distance map. For a checker board distance map this arguement should be zero. For a diagonal distance map, this argument should be 1.

KnightDistOptional. A Long value.

Weight given to the 'Knights move' distance, two pixels in one direction and one pixel at 90 degrees. The default is 38 which, with defaults for the StraightDist and DiagDist arguments, provides a good approximation to a Euclidian distance map. For a checker board or diagonal distance map, this argument should be 0.

MaxDistOptional. A Long value.

If positive, the highest value to appear in the distance map; if negative, the limit will be 65535. Note that all distances in the map will be at least equal to the StraightDist argument.

FlagsOptional. A mcImageCreateFlags enumeration, as described in settings.

A combination of mcImageCreateFlags used in creation of the output image. The mcImportPropertiesFlags may also be OR'ed into this argument. Unless the mcipfLookupTables argument is OR'ed in, the result image's McImage.LookupTable McLookupTable.WhiteLevel is set to display the largest distance in any frame as fully white. The default for this argument will create a visible image that is part of the collection.

vSourceImgOptional. A Variant value.

Optional input IMcImage. If not given, the McMorpho operator's parent image is used.

Settings

The settings for Flags are:

ConstantValueDescription
 mcicfDefault0
 mcicfContiguous1

If set, frames are allocated contiguously, and you cannot add to the FrameCount at a later time.

 mcicfNoInit2

Default is to initialize to 0 (black), this flag suppresses initialization.

 mcicfNoAddToCollection4

If set, the image is created, but not added to the collection (see Notes).

 mcicfNotVisible8

If set, the image is created, possibly added to collection (see above), but not made visible.

 mcipfNoImportProperties8388608

Suppress ImportProperties for functions creating an image from another.

Remarks

This method uses the value of the Threshold property to binarize the image AOI, and always creates a new 16-bit grayscale image to store its results.

No distance will exceed 65535. All foreground blob border pixels will have a distance of StraightDist from the background (they are all on horizontal pixel distance from a background pixel). Thus all distances in the map will be at least equal to StraightDist.

The distance map is based on reflected pixel values at AOI boundaries. This often results in peak distances being detected at the AOI boundary for foreground blobs that intersect those boundaries.

Exceptions

The exception mceINVALIDARG (E_INVALIDARG) will be thrown if one of the parameters is invalid.