Click or drag to resize

IMcPointsSelected Property

A BOOLEAN property of each Feature setting and reflecting the Selected status.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Default Property Selected ( 
	<OptionalAttribute> Selector As Object
) As Object
	Get
	Set

Parameters

Selector (Optional)
Type: SystemObject
An empty variant, a single negative value, a single index value, or an array of zero or more index values (negative index values are legal but will be ignored). If the Selector argument is a non-negative scalar value, then Selected status of the indicated feature from the collection is exposed as a scalar True/False value. If the Selector argument is a scalar value of negative one (-1), then the overall Selected status of all features from the collection are exposed or set as a scalar True/False value. The property will be True only if any feature in the collection is Selected. It will also be True if the feature is in the "reset" state (IsReset is true). If the Selector argument is missing or any negative scalar value other than -1, then the Selected property is exposed or set as an array of Long values. The number of elements in the array will be equal to the Count property. Selected features will be noted by a non-negative index value, while deselected features will be noted by a negative value (minus the feature index plus one); this array may be subsequently used as a Selector argument for any other property to extract information about only the selected features. If Selector is an array, then zero or positive values are treated as indices into the features collection, negative values are legal but ignored. In this case, the Selected status will be exposed as an array of Long values (encoded as above) equal to the length of the number of non-negative elements in the Selector array. Index values greater or equal to the Count property are illegal. If the argument is a McFeatures (i.e., McPoints, McLines or McRegions) or a McBitMask, then features that intersersect the selector's bit mask are selected as if an array of index values were supplied. If the OptionFlags mcofFullCoverageIntersectionTest bit is set, then the test is more stringent and a feature must be fully covered by the selector's bit mask in order to be included in the selection.

Property Value

Type: Object

Implements

IMcFeaturesSelectedObject
Remarks
A new feature is all selected by default. Depending on the Selector argument, the property may be a single, scalar True/False Boolean value or it may be an array of such values. The property is exposed as an array if the Selector argument is an array or if it is a negative scalar value other than minus 1. A new McFeatures collection is all selected by default. On assignment, you may assign either a scalar Boolean True/False Selected value or an array of such Boolean values. The Selector arguement determines which features are set to the assigned Selected state. Each element in the assigning array is used and then reused as necessary to set all of the selected features; thus, when the assigning value is a scalar, all selected features are assigned the same True or False value. On assignment with True, all three of the mcfsfDeselected, mcfsfOutOfRange and mcfsfCancelled FeatureStatusFlags are cleared. On assignment with False, the mcfsfDeselected FeatureStatusFlag is set, while the mcfsfOutOfRange and mcfsfCancelled FeatureStatusFlags are cleared.
Examples
VB
'This is McMeasure_Filter_Examples.bas
Option Explicit

'**** Utilitiy Sub's
'Note: the BoneBig.jpg example image is a good one for these examples
Private Function uLoadExampleImage(Optional strImage As String = "BoneBig.jpg") As Boolean
    If MsgBox("Open example image?", vbYesNo) = vbYes Then
        Images.Open Path + "Images\" + strImage
    End If 'user wants to open an example image
    'Else leave the ActiveImage alone
    If ActiveImage Is Nothing Then
        MsgBox "There is no ActiveImage, so the example cannot run."
    End If
    uLoadExampleImage = ActiveImage Is Nothing
End Function 'uLoadExampleImage

'**** Runnable Examples Start Here *****

Public Sub ShowRgnAreaOutliersInYellow()
    If uLoadExampleImage Then Exit Sub
    ActiveImage.LineFeatures.Reset 'get rid of dangling lines
    'Filter on region area, eliminate very small regions, and then show
    'first and last quintile outliers in yellow
    With ActiveImage.RegionFeatures
        .Threshold.Execute 'get some region features
        .CleanUpBordersAndNoise , mcrbNoBorder, 10 'eliminate very small regions
        .Selected = True 'ensure that all features start selected
        With .mRgnArea
            Dim varRanks As Variant
            varRanks = McRankedValues(.value, 5) 'quintiles
            .RangeMin = varRanks(mcrvfiFirstNtileIndex + 0) 'First 20%
            .RangeMax = varRanks(mcrvfiFirstNtileIndex + 3) 'Last 20%
            .Filter 'de-select areas that are out of range
        End With
            'show small and big areas in yellow
        .DisplayedObjects(McOpNOT(.Selected)).SetColors &HFFFF&
    End With 'ActiveImage.RegionFeatures
End Sub 'ShowRgnAreaOutliersInYellow


Public Sub KeepOnlyBigElongatedRegions()
    If uLoadExampleImage Then Exit Sub
    ActiveImage.LineFeatures.Reset 'get rid of dangling lines
   'Filter on region aspect ratio and area, keeping only big elongated regions
    With ActiveImage.RegionFeatures
        .Threshold.Execute 'get some region features
        .Selected = True 'ensure that all features start selected
            'Select elongated region features
        .mRgnAspect.RangeMin = 1.5   'minimum aspect ratio
        .mRgnAspect.RangeMax = 10000 'big maximum aspect ratio
        .mRgnAspect.Filter True 'de-select features that are round
            'Select largest 25% of region features
        Dim varRanks As Variant
        varRanks = McRankedValues(.mRgnArea, 4) 'quartiles
        .mRgnArea.RangeMin = varRanks(mcrvfiFirstNtileIndex + 2) 'Top 25%
        .mRgnArea.RangeMax = 1000000# 'big maximum size
        .mRgnArea.Filter True 'de-select features that are small
            'remove all small or round region features
        .RemoveFeature 'remove not-Selected features
        'Same as above  .RemoveFeature McOpNOT(.Selected)
    End With 'ActiveImage.RegionFeatures
End Sub 'KeepOnlyBigElongatedRegions

'This example illustrates the use of the Filter method's AllInRangeElseAnyInRange
'argument to OR two filterings and then AND one to the result of those.
Public Sub KeepOnlyLongVerticalLines()
    If uLoadExampleImage Then Exit Sub
    ActiveImage.RegionFeatures.Reset 'get rid of dangling regions
    'Filter on line angle and length, keeping only longer than average vertical lines
    With ActiveImage.LineFeatures
        .SetFromMaskMethod = mcsfmmLinesLongestStraight
        .Threshold.Execute 'get some region features
        .CleanUpBordersAndNoise , mcrbAllBorders, 5 'get rid of very short or border lines
        .Selected = False 'Important: insure that all features start deselected
            'get ones going up
        .mLnAngle.RangeMin = 60
        .mLnAngle.RangeMax = 130
        .mLnAngle.Filter False 'select only those going up
            'or ones going down
        .mLnAngle.RangeMin = 240
        .mLnAngle.RangeMax = 300
        .mLnAngle.Filter False 'OR select those going down
            'From those, select only longer than average vertical lines
        .mLnLength.RangeMin = .mLnLength.Mean 'longest of vertical lines
            'note that the Mean is only of Selected line features, so
            'it is the Mean of only lines that have passed the angle tests.
        .mLnLength.RangeMax = 1000000# 'big maximum length
        .mLnLength.Filter True 'AND de-select features that are short
            'remove all non-vertical, short line features
        .RemoveFeature 'remove not-Selected features
        'Same as above  .RemoveFeature McOpNOT(.Selected)
    End With 'ActiveImage.RegionFeatures
End Sub 'KeepOnlyLongVerticalLines

'**** McMeasures.Filter examples ******

Public Sub ShowBigOrElongatedRegions()
    If uLoadExampleImage Then Exit Sub
    ActiveImage.LineFeatures.Reset 'get rid of dangling lines
    'Filter on region area and roundness, showing regions that
    'are either big or are particularly non-round in Cyan, and
    'showing regions that are both big and non-round in Magenta
    With ActiveImage.RegionFeatures
        .Threshold.Execute 'get some region features
        .Measures.Unselect 'all Enabled=False
            'Set Enable=True for the measurements we will need
        .Measures.Select Array("mRgnArea", "mRgnRoundness"), True
            'the below does the same as the above using ID instead of name
        '.Measures.Select Array(.mRgnArea.Attributes(mcmaidID), .mRgnRoundness.Attributes(mcmaidID)), True
        'The two assignments below do the same as the above Select calls
        '.mRgnArea.Enabled = True
        '.mRgnRoundness.Enabled = True
            'Set the ranges we want to select on
        Dim varRanks As Variant 'Select largest 10% of region features
        varRanks = McRankedValues(.mRgnArea, 10) 'deciles
        .mRgnArea.RangeMin = varRanks(mcrvfiFirstNtileIndex + 8) 'Top 10% area
        .mRgnArea.RangeMax = 1000000# 'big maximum area
        varRanks = McRankedValues(.mRgnRoundness, 10) 'deciles
        .mRgnRoundness.RangeMin = varRanks(mcrvfiFirstNtileIndex + 7) 'Top 20% round
        .mRgnRoundness.RangeMax = 10000 'big maximum roundness

        .Measures.Filter False 'select either big regions OR elongated ones
            'show big or elongated region features in cyan
        .DisplayedObjects(.Selected).SetColors &HFFFF00

        .Measures.Filter True 'select big regions AND elongated ones
            'show big and elongated region features in magenta
        .DisplayedObjects(.Selected).SetColors &HFF00FF
    End With 'ActiveImage.RegionFeatures
End Sub 'ShowBigOrElongatedRegions
See Also