Click or drag to resize

IMcProfileEdgesRawProfiles Property

For global objects only, the raw profile upon which edges are detected.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Property RawProfiles ( 
	Optional bClosedProfiles As Boolean = false,
	<OptionalAttribute> RangeMinMax As Object
) As Object
	Get
	Set

Parameters

bClosedProfiles (Optional)
Type: SystemBoolean
If given and True on assignment, the assigned profiles are assumed to be closed, so that edge detection may "wrap" from beginning to end. If missing or False, no wrapping is performed. This parameter determines the WeightingFlags mcpewfWrapAtEnds bit. This parameter is ignored on access.
RangeMinMax (Optional)
Type: SystemObject
If given on assignment, a length 2 array or a DOUBLERANGE value giving the absolute minimum and maximum values allowed for the assigned profiles. This information is critical in computing the AbsoluteMaxWeightValue, which in turn is critical if you set the mcpeofAbsoluteThresholding OptionFlags bit. If only a single value is assigned, then only the minimum is being specified. For limits not given, the assigned profiles are scanned for their maximum and minimum values, and the maximum ranges are set to these values +/- 1. This parameter is ignored on access.

Property Value

Type: Object
Remarks
Usually, McProfileEdges operators are descendents of a McLineProfiles operator, which is a descendent of a McLines or a McRegions operator, which in turn are descendents of a McImage. McProfileEdges is used in this way to detect luminance patterns along lines or region boundaries (as captured by the ProfilesAncestor McLineProfiles operator). However, it is also legal to create global instances of McProfileEdges operators (i.e., ones where the CreateOperator call has Nothing for the Parent parameter). When used this way, you must supply the raw "luminance" profiles upon which the edges will be detected. That is the role of the RawProfiles property. After assigning one or more arrays of values to RawProfiles, you may use FindEdges to detect patterns of value variation (e.g., peaks or valleys) using all of the tools supplied by McProfileEdges. A few McProfileEdges properties depend on having an ancestor McLines or MRegions and make no sense for global McProfileEdges operators. These properties are: ChannelOfInterest, EdgesAsMcPoints and EdgeTicMarksAsMcLines. An attempt to access or assign any of these properties will result in an error. The ProfilesAncestor property can always be accessed, but it will return Nothing for global McProfileEdges operators. It is illegal to access or assign to the RawProfiles property unless the McProfileEdges instance is a global operator. On access, the RawProfiles property is exposed as an array of Variants, each one of which will hold a 1-dimensional array of Double values defining the profile samples. The property is always exposed as an array, even if there is only one (or no) profile; thus, the number of profiles can be determined with the UBound VB function. On assignment, you may assign a one or two-dimensional array of numbers, or you may assign an array of Variants, each of which contains a one or two dimensional array of numbers (each Variant supplies one profile for each "row"). If a 2-dimensional array is supplied, then the the slowest-moving dimension (leftmost in C/C++, rightmost in VB) determines the number of profiles being supplied, while the fastest moving dimension is the number of samples per profile (e.g., this is the way that the McHistogram.Value property is organized for multichannel image histograms). If a 1-dimensional array is supplied, then it represents one profile of the given number of samples. The distance between each profile sample is assumed to be 1 unit.
Examples
VB
'This is GlobalMcProfileEdgesSamples.bas
'It has samples of using a global McProfileEdges operator instance
'(one without a parent operator) to detect "edges" on arbitrary profiles.
'
Option Explicit

'This method creates a global McProfileEdges instance named "GlobalEdges"
Public Sub CreateGlobalMcProfileEdges()
    CreateOperator "McProfileEdges", , "GlobalEdges"
End Sub 'CreateGlobalMcProfileEdges

'This method finds local peaks in a monochrome image histogram
Public Sub FindMonochromeImagePeaks()
    Output.Show "Output"
    Output.Clear
        'Open a grayscal image
    Images.Open Path + "Images\" + "MusBrain.tif"
    If ActiveImage Is Nothing Then Exit Sub

        'Create an unnamed global McProfileEdges instance
    Dim globalEdges As McProfileEdges
    Set globalEdges = CreateOperator("McProfileEdges", Empty)

        'Get a luminance histogram of the image
    ActiveImage.Histogram.Interpretation = mciMonochrome 'just to be sure we get only 1 channel

    With globalEdges
            'Assign the histogram as the single profile
        .RawProfiles(False, 0) = ActiveImage.Histogram.Values
            'Average 31 adjacent bins when looking for peak patterns
        .EdgeFindingMethod = mcpefmMatchPattern
        .Pattern = Array(0#, 0.5, 1#, 0.5, 0#)
        .MatchLength = 31

        .ThresholdForEdge = 20
            'Find a max of 5 peaks
        .MaxEdgesPerProfile = 5
        .FindEdges
        Dim strReport As String
        strReport = Str(.EdgeCounts(0)) & " peaks were found in the luminance histogram."
        If .EdgeCounts(0) <> 0 Then
            strReport = strReport & vbCrLf & "Peaks were found at: " & McToText(.EdgeDistances(0))
        End If 'any peaks found
    End With 'globalEdges

    Output.PrintMessage strReport

    ActiveWindow.Close
End Sub 'FindMonochromeImagePeaks

'This method finds peaks in a monochrome image histogram based on log of bin counts
Public Sub FindColorImagePeaks()
    Output.Show "Output"
    Output.Clear
        'Open a color image
    Images.Open Path + "Images\" + "FlTriple.tif"
    If ActiveImage Is Nothing Then Exit Sub

        'Create an unnamed global McProfileEdges instance
    Dim globalEdges As McProfileEdges
    Set globalEdges = CreateOperator("McProfileEdges", Empty)

        'Get an RGB histogram of the image
    ActiveImage.Histogram.Interpretation = mciRGB 'just to be sure we get only 1 channel

    With globalEdges
            'use Log histogram bin counts for peak detection
        Dim mcobjCounts As McObject
        Set mcobjCounts = McObjectTemp(ActiveImage.Histogram.Values)
            'set all zero counts to 1 (log of zero is illegal)
        Dim selZeroCounts As McObject
        Set selZeroCounts = McOpEQ(mcobjCounts, 0)
        mcobjCounts.SelectedValues(selZeroCounts) = 1
            'set the raw profile to find "edges" on to Log(Histogram.Values)
        .RawProfiles(False, 0) = McLog(mcobjCounts)
            'Get count of profiles
        Dim lRawProfilesCount As Long
        lRawProfilesCount = UBound(.RawProfiles) + 1
            'Find highest peaks in each color band
        .EdgeFindingMethod = mcpefmPeaks
        .Weights = Array(0.25, 1#, 1#, 1#, 0.25)
        .MatchLength = 5

        .ThresholdForEdge = 50
            'Find a max of 5 peaks
        .MaxEdgesPerProfile = 5
        .FindEdges
        Dim strReport As String, iChannel As Long
            strReport = "Peaks in an RGB histogram."
        For iChannel = 0 To 2
            strReport = strReport & vbCrLf & Str(.EdgeCounts(iChannel)) & " peaks were found in the channel " & Str(iChannel) & " histogram."
            If .EdgeCounts(iChannel) <> 0 Then
                strReport = strReport & vbCrLf & "Peaks were found at: " & McToText(.EdgeDistances(iChannel))
            End If 'any peaks found
        Next iChannel
    End With 'globalEdges

    Output.PrintMessage strReport

    ActiveWindow.Close
End Sub 'FindColorImagePeaks
See Also