Click or drag to resize

RegionsOperatorsmaRgnRadii Method

Array of NumAngles radii.

Namespace:  MediaCy.IQL.Operators
Assembly:  MediaCy.IQL.Operators (in MediaCy.IQL.Operators.dll) Version: 3.1.0.0
Syntax
VB
<ExtensionAttribute>
Public Shared Function maRgnRadii ( 
	regions As McRegions
) As McMeasureAngles

Parameters

regions
Type: MediaCy.IQL.FeaturesMcRegions

Return Value

Type: McMeasureAngles

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type McRegions. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This measurement's McMeasure.Value property is exposed as a 2 dimensional array, with the "row" for each region feature holding an array of McMeasureAngles.NumAngles values. All measurements derived from McMeasureAngles share the same NumAngles property, so assigning to one sets the property for all others as well. This measurement is based on the centers of border pixels under the region feature's outline. Thus, the result is not affected by the OptionFlags mcofOutlinePixelTiles bit or any other sub-pixel placement of feature outline vertices. The origin of the measured radius is the pixel centroid (see mRgnPixelCentroidX and mRgnPixelCentroidY), which is sensitive to holes in the blob for features of Type mcftScanList.
Examples
VB
'This is ArrayMeasurementsSamples.bas

Option Explicit

Public Sub Access2DMeasurements()
        'The example image below with the given thresholding yields 3 region features
    Images.Open Path & "Images\BoneBig.jpg"
    ActiveImage.Aoi.SetBox -1, 10, 10, 100, 100

    With ActiveImage.RegionFeatures
        .Threshold.IntensityRange = Array(128, 255)           ' set some Threshold
        .Threshold.Execute                                 ' find some regions and rid small ones
        Dim lMinPixelArea As Long
        lMinPixelArea = 200
        .CleanUpBordersAndNoise ActiveImage.Aoi, mcrbNoBorder, lMinPixelArea

        Dim nRows As Long, nValues As Integer
        nRows = .Count                                     ' number of rows = number of regions detected
        If nRows = 0 Then
           MsgBox "You didn't find any regions."
           Exit Sub
        End If
        .maRgnDiameters.NumAngles = 8  ' 32 values by Default, but we want fewer for this example
        nValues = .maRgnDiameters.NumAngles 'This many diameters are extracted per row

        ' the "ma" results are described to be a 2-D array of nRows x nValues
        ' .maRgnDiameters.Compute 'Calling Compute is not necessary, since it is done automatically

        'Below are 4 ways to access this measurement result

        Output.Show "Output"
        Output.Clear

           'Here's one way of accessing the Value property with a feature selector (using straight VB)
        Output.PrintMessage "Example 1. Straight VB, accessing maRgnDiameters.Value using a selector"
        Dim iRegion As Long, iVal As Long, strT As String
        For iRegion = 0 To nRows - 1
            ReDim oneFeatureArray(0 To nValues - 1) As Double
            oneFeatureArray = .maRgnDiameters.value(iRegion)
            strT = "Row" & Str(iRegion) & " diameters:"
            For iVal = 0 To nValues - 1
                strT = strT & Str(oneFeatureArray(iVal))
            Next iVal
            Output.PrintMessage strT
        Next iRegion

           'Here's another way of accessing the Value property as a 2-D array (using straight VB)
        Output.PrintMessage vbCrLf & "Example 2. Straight VB, accessing maRgnDiameters.Value whole, as a 2-D array"
            'Note that VB 2-D array declarations and indexing are backwards from C/C++
        ReDim allFeature2DArray(0 To nValues - 1, 0 To nRows - 1) As Double
        allFeature2DArray = .maRgnDiameters.value
        For iRegion = 0 To nRows - 1
            strT = "Row" & Str(iRegion) & " diameters:"
            For iVal = 0 To nValues - 1
                    'Note that VB 2-D array indexing is backwards from C/C++
                strT = strT & Str(allFeature2DArray(iVal, iRegion))
            Next iVal
            Output.PrintMessage strT
        Next iRegion

           'Here's an easier way (using McToText for the print-out and a Value property selector)
        Output.PrintMessage vbCrLf & "Example 3.  McToText, accessing maRgnDiameters.Value using a selector"
        For iRegion = 0 To nRows - 1
           ReDim oneFeatureArray(0 To nValues - 1) As Double
           oneFeatureArray = .maRgnDiameters.value(iRegion)
           Output.PrintMessage "Row" & Str(iRegion) & " diameters: " & McToText(oneFeatureArray)
        Next iRegion

           'Here's an even easier way (using McOMGlobal vector operations to select one "Row" of values at a time)
        Output.PrintMessage vbCrLf & "Example 4.  Using McOMGlobal, accessing maRgnDiameters.ValueMcObject"
        Dim mcobjValue As McObject
        Set mcobjValue = .maRgnDiameters.ValueMcObject
        For iRegion = 0 To nRows - 1
           Output.PrintMessage "Row" & Str(iRegion) & " diameters: " & McToText(mcobjValue.SelectedMcObject(iRegion))
        Next iRegion

'        In general, .maRgnDiameters.value(iRegion) returns a Variant holding an array of length
'        .maRgnDiameters.NumAngles for the iRegion'th region, while .maRgnDiameters.value returns
'        a Variant holding a 2-D array with .Count "Rows" each holding .maRgnDiameters.NumAngles
'        elements (of type Double).  The .maRgnDiameters.ValueMcObject is just a McObject (of
'        type mcobjTypeREAL) holding this 2-D array.

    End With 'ActiveImage.RegionFeatures
    ActiveWindow.Close
End Sub 'Access2DMeasurements
See Also