IMcProfileEdgesPattern Property |
![]() |
Namespace: MediaCy.IQL.Features
'Set the Pattern from a supplied McLines SetPatternFromUserMcLines( ByRef ProfileLine As McLines, ByRef UsersLine As McLines) 'If the supplied McLines has no line feature, then start the line tool If UsersLine.Count = 0 Then MsgBox "Draw a line across the desired patter." 'Make sure that auto-display of the UsersLine features is on UsersLine.DisplayOverlays.AutoDisplayTemplateID = mcgtStandardAutoDisplay 'Turn on the simple line tool UsersLine.DisplayOverlays.MasterGraphOverlay.SelectTool "", "McGraphObjLine", mcgtStandardAutoDisplay Exit Sub 'and quit until there is a line End If UsersLine.Profiles.Interpretation = mciMonochrome 'intensity only UsersLine.Profiles.SampleMode = mclpsmFixedSampleLength UsersLine.Profiles.LengthPerSampleDesired = 1# 'one pixel per sample 'Now set the Pattern for our ProfileLine ProfileLine.Profiles.ProfileEdges.Pattern = UsersLine.Profiles.ProfileValues(0) End Sub 'Call the below twice. The first time it will tell you to draw a line 'over the desired pattern. The next time it will assign the pattern 'and find the "edges" Sub DoOneSetPattern() 'Capture the pattern sample as the entry state of ThisApplication.ActiveImage.LineFeatures Dim PatternSampleLine As McLines Set PatternSampleLine = ThisApplication.ActiveImage.LineFeatures.Duplicate ThisApplication.ActiveImage.LineFeatures.Reset 'Clear ThisApplication.ActiveImage.LineFeatures SetPatternFromUserMcLines ThisApplication.ActiveImage.LineFeatures, PatternSampleLine If PatternSampleLine.Count = 0 Then Exit Sub 'must wait for user to create pattern line 'Else we are done withe the pattern line. Remove it. Set PatternSampleLine = Nothing 'Create diagonal line ThisApplication.ActiveImage.LineFeatures.SetFeaturePoints 0, Array(0&,0&,ActiveImage.Height-1,ActiveImage.Width-1) With ThisApplication.ActiveImage.LineFeatures.Profiles .Interpretation = mciMonochrome 'intensity only .SampleMode = mclpsmFixedSampleLength .LengthPerSampleDesired = 1# 'one pixel per sample .ProfileEdges.EdgeFindingMethod = mcpefmMatchPattern .ProfileEdges.FindEdges 'get them edges 'Show the edge tic marks .ProfileEdges.EdgeTicMarksAsMcLines.DisplayOverlays.AutoDisplayTemplateID(True) = mcgtStandardAutoDisplay End Sub 'DoOneSetPattern