Click or drag to resize

IMcLineProfilesProfileValues Property

The sampled line intensity profiles from the ancestor McLines or McRegions features.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
ReadOnly Default Property ProfileValues ( 
	<OptionalAttribute> Selector As Object,
	Optional channel As Integer = -1
) As Object
	Get

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 the intensity profile array of the ancestor feature from the profiles is exposed a 1 or 2 dimensional array of double values, as described in Remarks. If the Selector argument is Empty, Error or Null, or any negative value, then the ProfileValues property is exposed as an array of Variant, one for each ancestor feature. The number of elements in the array will be equal to the CountOfProfiles property. Each Variant will hold one profile array, as described in Remarks. If Selector is an array, then zero or positive values are treated as indices into the ancestor features collection, negative values are legal but ignored. In this case, the the ProfileValues property is exposed as an array of Variant, one for each Selector index value. Each Variant will hold one profile array, as described in Remarks. Index values greater or equal to the CountOfProfiles property are illegal.
channel (Optional)
Type: SystemInt32

Property Value

Type: Object
Remarks
When this property is accessed it is automatically computed from the current ancestor features and ancestor image data. This recomputation will be required only if the IsStale property is True; after accessing ProfileValues, IsStale will be False. One line profile is computed for for each of the ancestor McLines or McRegions features. For ancestor McRegions, the profile follows the closed boundary polygon. Each profile consists of NumberOfSamples luminance samples, with each sample consisting of NumberOfChannels luminance values. Each channel's luminance value may be an average of interpolated sub-sample values both along and perpendicular to the line, depending on the SampleMode, SampleNumbersOrLengths and VirtualWidth properties. The luminance values will be intensity calibrated if the CalibratedIntensity property is True and if the ancestor McImage.IntensityCalibration property has been set. Each profile from one ancestor McFeatures feature is exposed as a 1D (if NumberOfChannels equals 1 or the Channel argument is non-negative) or 2D array (if NumberOfChannels greater than 1 and the Channel argument is its default of mcwcAllChannels, -1). The length of this array for each channel is the number of samples and will be given by the corresponding element in the NumberOfSamples property. Formally, if NumberOfChannels is 1 or the Channel argument is non-negative, then for feature index nFeature the profile array is dimensioned as a Double array of length NumberOfSamples(nFeature) (i.e., "Dim OneProfile(0 to NumberOfSamples(nFeature)-1) As Double" in VB, or "double OneProfile[NumberOfSamples(nFeature)];" in C/C++). If NumberOfChannels is greater then one and the Channel argument is mcwcAllChannels (-1), then for feature index nFeature the profile array is dimensioned as a 2D Double array of length NumberOfChannels with NumberOfSamples(nFeature) sample values per channel, (i.e., "Dim OneProfile(0 to NumberOfSamples(nFeature)-1, 0 to NumberOfChannels-1) As Double" in VB, or "double OneProfile[NumberOfChannels,NumberOfSamples(nFeature)];" in C/C++). These results are organized in the same way as the McHistogram.RawValues and McHistogram.Values results are when more than one channel's histogram is requested; that is, the channel dimension is the slowest moving one. By default the ProfileValues property exposes the profile from each ancestor feature as an array of Variant, each Variant holding one profile array, as described above. However, if the Selector argument is supplied as a single scalar index value, then only that one profile array is exposed. If the Selector argument is an array of indices, then those feature's profiles are exposed as an array of Variant, each holding one profile array.
Examples
VB
'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
See Also