Description

Called to get measurement attributes

Return Type

A Variant value.  

Syntax

object.UserAttributes (MeasurementObject, AttributeId)

The UserAttributes Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McUserMeasure.
MeasurementObjectRequired. A McMeasure object.

The McMeasure object for which the measurement is to be computed, or Nothing if the McUserMeasure class is being asked its for default value.

AttributeIdRequired. A mcMeasurementAttributeID enumeration, as described in settings.

ID of the Attribute being requested. Only the following mcMeasurementAttributeID values will ever be seen.

mcmaidDependencies --- Default is mcmdfAssumedDependencies (mcmdfImageLuminance Or mcmdfFeatureData Or mcmdfIntensityCalib Or mcmdfSpatialCalib Or mcmdfAoi Or mcmdfUserData). If you return dependencies with the mcmdfOther flag OR'ed into the flags, then the UserIsValueStale method will be called on every McMeasure.Value access to allow you to determine if the measurement is currently stale.

The UserAttributes(mcmaidDependencies) call is made once only for each McMeasure object being serviced by an McUserMeasure instance. This call occurrs immediately after a new McMeasure is connected with the McUserMeasure object. This is the place to do any per-McMeasure intialization or event handling.

mcmaidDisconnectMeasure --- The UserAttributes(mcmaidDisconnectMeasure) call is made only once when an McMeasure instance is disconnecting from its McUserMeasure object. You should do any cleanup and free per-McMeasure memory storage or object references at this time. You do return anything.

mcmaidCanBeEnabled --- Default is True. You should return this as False if the measurement cannot be made for any reason (e.g., some required property has not yet been asssigned to; see for example, the CUserMeasureSortedIndices.cls sample file).

mcmaidAllowedParent --- Default is mcmpDescendentOfFeatures.

mcmaidCategories --- Default is mcmcfUserDefined. No matter what other category flags you return, mcmcfUserDefined is also OR'ed into the result.

mcmaidPerFeatureMeasurement --- Default is True for numeric measurements. If True (or the default), then the slowest moving dimension of the Variant filled by the ComputeValue method must be equal to the ancestor McFeatures.Count property.

mcmaidNofDimensions --- Default is 1. The number of dimensions of the array in the Variant returned by the ComputeValue method must agree with this number.

mcmaidShape --- Default is all dimensions variable. This implies that if the number of dimensions is greater than 1, that the results will be an array of Variants. The shape of the Variant returned by the ComputeValue method must be compatible with the array of dimension sizes returned by this call.

mcmaidResultMcObjectType --- Default is mcobjTypeREAL (64-bit IEEE real) for numeric results. This is always mcobjTypeUNKNOWN for non-numeric results, since the McMeasure.ValueMcObject is always Nothing for those measurements.

mcmaidResultType --- Default is mcmrtNumeric, but if you supply mcmrtMcPoints, mcmrtMcLines or mcmrtMcRegions, the ComputeValue must return an object of the corresponding type as the result of the measurement.

mcmaidIllustration --- Default is Nothing. If you supply this attribute it should be an 80 by 60 pixel illustration suitable for accompanying the UserDisplayName and UserDescription. The attribute is returned as a Picture object holding the illustration.

mcmaidDefaultRangeMin --- Default is minus some huge number. If you supply this number, return a Double value for the lowest value your measurement can take.

mcmaidDefaultRangeMax --- Default is some huge positive number. If you supply this number, return a Double value for the highest value your measurement can take.

Settings

The settings for AttributeId are:

ConstantValueDescription
 mcmaidID0

As Long. For built-in measurements, the TagNumber (DISPID) of the measurment. Zero for all custom measurements.

 mcmaidName1

As String. Parseable name of the measurement.

 mcmaidAllowedParent2

As mcMeasurementParent. The allowed parent of the measurement.

 mcmaidParent3

As mcMeasurementParent. The actual parent of the measurement instance.

 mcmaidCategories4

As mcMeasurementCategoryFlags. The categories that the measurement is part of. Category flags are Or'ed together.

 mcmaidPerFeatureMeasurement5

As Boolean. True (the usual case) if the measurement is computed on a per-feature basis of the ancestor McFeatures (e.g., the Area of each region). False if only one measurement is computed for all features (e.g., a count of the number of regions that overlap other regions), or if the measurements do not correspond one-to-one to the associated feature index. Note that non-numeric measurements, where Attributes(mcmaidResultType) is something other than mcmrtNumeric, can also have this Attribute True if the measurement Value McFeatures has features that correspond one-to-one to the ancestor McFeatures (e.g., mpRgnCentroidAsPoint); this is the usual case for non-numeric measurements.

 mcmaidNofDimensions6

As Long. Number of dimensions for the measurment Value property. Zero indicates that the Value is a scalar. One indicates that the measurement result is a 1-dimensional array (which under some circumstances might be a length-1 or even length-0 array). Two indicates that the Value is a two-dimensional array and so on. The “shape” of array results is given by the mcmaidShape AttributeID. The measurement Value is one result per-feature if mcmaidPerFeatureMeasurement AttributeID is True, so in this case, the number of dimensions will always be 1 or more. The number of dimensions will always be 4 or less.

 mcmaidShape7

Array As Long. The “shape” (e.g., size of each dimension) of the entire measurement Value. Sizes of all dimensions are returned encoded in a a 1-D array with a length given by mcmaidNofDimensions, with element zero representing Dim1 (the slowest moving). Sizes of fixed dimensions are returned as positive numbers, while sizes of variable dimensions are returned as zero. Variable dimensions beyond the first will be represented in the Value property as an array of Variant, with each Variant itself holding an array. Note that if the Value property is a scalar [i.e., Attributes(mcmaidNofDimensions) equal to 0], this array will be zero-length.

For example, in the usual case of a single value per-feature measurement, mcmaidNofDimensions will be 1, while mcmaidShape will return a length-1 array with 0 (a variable size) as the value.

 mcmaidResultMcObjectType8

As mcobjTypeEnum. The Type of the ValueMcObject property. The VARTYPE of the McMeasure.ValueMcObject property can be determined by getting the McObject.ValueType property. Use McMeasure.Attributes(mcmaidResultValueType) to get the result McMeasure.Value property's type.

 mcmaidDependencies9

As mcMeasurementDependencyFlags. Determines under what conditions the measurement becomes “stale” (i.e., the McMeasure.IsValueStale property goes True). The McMeasure.Value property and statistics are only recomputed when accessed if some dependency of the measurement has changed since the last access.

 mcmaidCanBeEnabled10

As Boolean. True if the measurement can be Enabled for computation. This will usually be True, but an McMeasure instance without an ancestor McImage cannot perform any luminance-related measurements (ones with a mcmdfImageLuminance dependency) and some measurements require multi-channel or 3-channel color images. Some measurements may require other properties to be set before a measurement can be made. For example, most measurements for McRefFeatures objects require that the McRefFeatures.ReferenceFeature property be assigned before the measurement's Value property can be accessed..

 mcmaidResultType11

As mcMeasurementResultType. The overall type of the measurement Value. Most measurement results are numeric (mcmrtNumeric), but some results are an McFeatures-derived object (McPoints, McLines or McRegions). Use McMeasure.Attributes(mcmaidResultValueType) to get the result McMeasure.Value property's type. Use McMeasure.Attributes(mcmaidResultMcObjectType) to get the result McMeasure.ValueMcObject type; note that only mcmrtNumeric results expose a McMeasure.ValueMcObject property.

 mcmaidIllustration12

As a Picture object. If not Nothing, an 80 by 60 pixel illustration suitable for accompanying the DisplayName and Description. The program must handle the case where Nothing is returned; that is, where there is no illustration for the measurement.

 mcmaidOneDimPerFeature13

As Boolean. True (the usual case) if Attributes(mcmaidPerFeatureMeasurement) is True, Attributes(mcmaidResultType)=mcmrtNumeric and Attributes(mcmaidNofDimensions) equals 1. Only for measurements where Attributes(mcmaidOneDimPerFeature) is True will the Filter method or any of the statistical methods succeed.

 mcmaidCanFilter14

As Boolean. True (the usual case) if the McMeasure.Filter method can be called. This will usually be the same as Attributes(mcmaidOneDimPerFeature).

 mcmaidCanGetStatistics15

As Boolean. True (the usual case) if the McMeasure.Count, McMeasure.Min, McMeasure.Max, McMeasure.Mean, and so on statistical properties can be accessed. This will usually be the same as Attributes(mcmaidOneDimPerFeature).

 mcmaidResultValueType16

As VARTYPE (unsigned short interger). The Vartype of the McMeasure.Value property variant. For standard numeric results this will be vbDouble.

 mcmaidDefaultRangeMin17

As Double. The default for the McMeasure.RangeMin property. This property is only useful if Attributes(mcmaidCanFilter) returns True.

 mcmaidDefaultRangeMax18

As Double. The default for the McMeasure.RangeMax property. This property is only useful if Attributes(mcmaidCanFilter) returns True.

 mcmaidDisconnectMeasure100

Remarks

This method does not have to do anything if all attributes of the measurement match the assumed defaults.

The default McMeasure.Attributes assumed for a user measurement are that the measurement will be made on some ancestor McFeatures (an McPoints, McLines or McRegions) and that one numeric value per feature will be computed and packaged into the McMeasure.Value as a one-dimensional array (of length equal to the ancestor McFeatures.Count property).

By default, the value is assumed to depend on data from ancestor McImage luminance, ancestor McFeatures features, the current spatial and intensity calibrations, the ancestor McImage.Aoi and the McMeasure.UserData. These data sources are the measurement's “dependencies”. When one of a measurement's dependencies change, then the McMeasure.IsValueStale property goes True and on the next McMeasure.Value or statistical property access the value will be recomputed. If your measurement does not depend on all of these sources or has other standard dependencies, then you should return the appropriate mcMeasurementDependencyFlags in response to a UserAttributes(mcmaidDependencies) call. If the mcmdfOther flag is OR'ed into the flags returned from this call, then the UserIsValueStale method will be called on every McMeasure.Value access to allow you to determine if the measurement is currently stale.

The UserAttributes(mcmaidDependencies) call is made once only for each McMeasure object being serviced by an McUserMeasure instance. This call occurrs immediately after a new McMeasure is connected with the McUserMeasure object. This is the place to do any per-McMeasure intialization or event handling.

For most simple per-feature measurements the default attributes will be acceptable, if not optimal. However for measurements that are to be fully integrated into the measurement model, you should service the mcmaidAllowedParent to identify the expected type of parent object, mcmaidCategories to list the measurement category or categories, mcmaidDependencies to specify the measurement's data dependencies, mcmaidIllustration to provide an illustration for the measurement, and mcmaidDefaultRangeMin and mcmaidDefaultRangeMax to establish the initial McMeasure.RangeMin and McMeasure.RangeMax. For non-numeric measurements or measurements with unusual results shape, you might need to service all of the mcMeasurementAttributeID values supplied as the AttributeId argument. McUserMeasurements objects that supply all of these attributes along with a UserDisplayName and UserDescription can expose new measurements that are essentially indistinguishable from built in ones. The samples illustrate most of the cases that you might need to deal with.