IMcLineProfilesProfileValues Property |
![]() |
Namespace: MediaCy.IQL.Features
ReadOnly Default Property ProfileValues ( <OptionalAttribute> Selector As Object, Optional channel As Integer = -1 ) As Object Get
'A sub to allow you to draw Polyline LineFeatures Sub StartPolylineTool() Dim myMGO As McGraphOverlay Set myMGO = ThisApplication.ActiveImage.LineFeatures.DisplayOverlays.MasterGraphOverlay myMGO.SelectTool "", "McGraphObjPoly", mcgtStandardAutoDisplay End Sub 'StartPolylineTool 'A sub to allow you to draw simple line LineFeatures Sub StartSimpleLineTool() Dim myMGO As McGraphOverlay Set myMGO = ThisApplication.ActiveImage.LineFeatures.DisplayOverlays.MasterGraphOverlay myMGO.SelectTool "", "McGraphObjLine", mcgtStandardAutoDisplay End Sub 'StartSimpleLineTool 'A sub to allow you to edit or delete LineFeatures Sub StartSelectTool() Dim myMGO As McGraphOverlay Set myMGO = ThisApplication.ActiveImage.LineFeatures.DisplayOverlays.MasterGraphOverlay myMGO.SelectTool "McGraphToolSelect" End Sub 'StartSelectTool 'Show the distance from start of each line to the max intensity Sub FindBrightestPointOnEachLine() If ThisApplication.ActiveImage Is Nothing Then Exit Sub If ThisApplication.ActiveImage.LineFeatures.Count < 1 Then MsgBox "Draw one or more lines on the ThisApplication.ActiveImage." StartPolylineTool 'start the polyline tool Exit Sub End If 'don't have any lines yet With ThisApplication.ActiveImage.LineFeatures.Profiles 'Capture profiles from all lines .Interpretation = mciMonochrome 'intensity only .SampleMode = mclpsmFixedSampleLength .LengthPerSampleDesired = 1# 'one pixel per sample 'Find the brightest point on each line Dim lP As Long For lP = 0 To .CountOfProfiles-1 Dim vThisProfile As Variant vThisProfile = .ProfileValues(lP) 'profile from this line feature 'Get 1st profile index where Max value appears Dim lMaxIndex As Long lMaxIndex = McSqueezeSelector(McOpEQ(vThisProfile, McMax(vThisProfile)))(0) 'Since sampling is at 1 pixel spacing lMaxIndex is the distance Debug.Print "Line feature " & lP & " had peak intensity at " _ & lMaxIndex & " pixels from start of line." Next lP End With End Sub 'FindBrightestPointOnEachLine 'Show the percentage distance of each line to the "greenest" spot Sub FindGreenestPointOnEachLine() If ThisApplication.ActiveImage Is Nothing Then Exit Sub If ThisApplication.ActiveImage.Type.Interpretation <> mciRGB Then MsgBox "The ThisApplication.ActiveImage must be RGB for this test." Exit Sub End If 'not RGB If ThisApplication.ActiveImage.LineFeatures.Count < 1 Then MsgBox "Draw one or more lines on the ThisApplication.ActiveImage." StartSimpleLineTool 'start the simple line tool Exit Sub End If 'don't have any lines yet With ThisApplication.ActiveImage.LineFeatures.Profiles 'Capture profiles from all lines .Interpretation = mciRGB 'we want color .SampleMode = mclpsmFixedNumberOfSamples .NumberOfSamplesDesired = 101 'one hundred percent 'Find the "Greenest" point on each line Dim lP As Long For lP = 0 To .CountOfProfiles - 1 Dim vRed As Variant, vGreen As Variant, vBlue As Variant vRed = .ProfileValues(lP, 0) vGreen = .ProfileValues(lP, 1) vBlue = .ProfileValues(lP, 2) 'We define "Greenest" as Green-(Red+Blue) Dim vGreenest As Variant vGreenest = McOpSub(vGreen, McOpAdd(vRed, vBlue)) 'Get 1st profile index where Max value appears Dim lMaxIndex As Long lMaxIndex = McSqueezeSelector(McOpEQ(vGreenest, McMax(vGreenest)))(0) 'Since sampling is at 1/101 spacing, that is the percent, too Debug.Print "Line feature " & lP & " had peak green at " _ & lMaxIndex & " percent from start of line." Next lP End With End Sub 'FindGreenestPointOnEachLine