How can a PREMIER PROJECT access the MARKER DISTANCES within the LINE PROFILE TOOL?
All --
I have a project that needs to use the LINE PROFILE TOOL.
I have created a routine (SAA_CaliperTool -- please see below) that activates the appropriate PREMIER FEATURES to create the LINE PROFILE LINE and the LINE PROFILE MARKERS.
Unfortunately there are two problems. They are:
1) I cannot determine how to access the data within the LINE PROFILE TOOL
2) I cannot determine how to DELETE a LINE PROFILE MARKER.
I have looked in the AUTOMATION HELP to solve #1 and the closest I come is:
MediaCy.Automation.Measure.LineProfile Namespace
I have looked in the PREMIER HELP to solve #2 and the closes I come is:
mk:@MSITStore:C:\PROGRA~1\MEDIAC~1\IMAGE-~1.1\Help\IMAGE-~2.CHM::/Line_Profile_Edges.htm
Can someone please point me the right direction?
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
I have a project that needs to use the LINE PROFILE TOOL.
I have created a routine (SAA_CaliperTool -- please see below) that activates the appropriate PREMIER FEATURES to create the LINE PROFILE LINE and the LINE PROFILE MARKERS.
Unfortunately there are two problems. They are:
1) I cannot determine how to access the data within the LINE PROFILE TOOL
2) I cannot determine how to DELETE a LINE PROFILE MARKER.
I have looked in the AUTOMATION HELP to solve #1 and the closest I come is:
MediaCy.Automation.Measure.LineProfile Namespace
Automation
Reference ► MediaCy.Automation.Measure.LineProfile
I have looked in the PREMIER HELP to solve #2 and the closes I come is:
mk:@MSITStore:C:\PROGRA~1\MEDIAC~1\IMAGE-~1.1\Help\IMAGE-~2.CHM::/Line_Profile_Edges.htm
Can someone please point me the right direction?
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Public Function SAA_CaliperTool() 'Activate the LINE PROFILE FEATURE With Measure.LineProfileCommands.LineProfile(Nothing) .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked .Run() End With 'Remove any preexisting LINE PROFILES from the image With Measure.LineProfile.ProfileCommands.RemoveAll(Nothing) .Run(ThisApplication.ActiveDocument) End With '-- Create the XY COORDINATES for the LINE PROFILE LINE Dim MyX1, MyY1 As Double MyX1 = ThisApplication.ActiveImage.Width / 2. MyY1 = ThisApplication.ActiveImage.Height / 2. Dim MyX2, MyY2 As Double MyX2 = ThisApplication.ActiveImage.Width / 2. MyY2 = ThisApplication.ActiveImage.Height * 0. 'Create a LINE PROFILE LINE With Measure.LineProfile.ProfileCommands.Add(Nothing) .CreateEngine = True .ProfileType = LineProfile.ProfileTypes.Line .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(New System.Drawing.PointF(MyX1,MyY1)) .Points.Add(New System.Drawing.PointF(MyX2,MyY2)) .Angle = 0R .Run(ThisApplication.ActiveDocument) End With 'Activate the MANUAL EDGE EDITING TOOL in the INTERACTIVE MODE with PROMPT With measure.LineProfile.ToolsCommands.Select(Nothing) .Tool = LineProfile.mcOverlayTool.mcotManualPatternA .Interactive = True .Prompt = "Please place LINE PROFILE MARKERS in the appropriate locations and then press OK." .Run(ThisApplication.ActiveDocument) End With 'Deactivate all tools by selecting the NO TOOL With Measure.Measurements.ToolsCommands.Select(Nothing) .tool = eMMTool.NoTool .Run(ThisApplication.ActiveDocument) End With 'AAA? 'Connect with the LINE PROFILE MEASUREMENT DATA 'BBB? 'Learn the LINE PROFILE MARKER COUNT 'CCC? 'Learn the LINE PROFILE MARKER DISTANCES ' 'Deactivate LINE PROFILE FEATURE ' With Measure.LineProfileCommands.LineProfile(Nothing) ' .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked ' .Run() ' End With End Function
0
Best Answer
-
Matt, please, select correct tool and auto detection method (the macro coded for Peaks):
Nikita.
0
Answers
-
Hi Matt,
Search forum for McLineProfileEngine, basically you need access to Line Profile Engine, this line:Dim lpe As LineProfile.McLineProfileEngine = LineProfile.AddIn.LineProfileEngine(doc1,True)
Thanks,
Nikita.0 -
Nikita --
Thank you for your guidance.
I have done the FORUM SEARCH that you recommended and I have looked at the code in your POST (on the face and within gx2pqitnsdlr.ipx.
I can get to the DISTANCES generated by the PEAK DETECTION withDebug.Print "d" Debug.Print d
using in the code below.
Unfortunately I cannot seem to get to the DISTANCES generated by MANUAL EDGE EDITING.
Also, what is the procedure from the PREMIER USER INTERFACE to SELECT and DELETE a MANUAL EDGE?
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Public Function Convert_Peaks_To_Measurements() As SimpleScript Convert_Peaks_To_Measurements = New SimpleScript Dim doc1 With Application.DocumentCommands.Active(Convert_Peaks_To_Measurements) .Run(doc1) End With With Measure.MeasurementsCommands.DeleteAll(Convert_Peaks_To_Measurements) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Convert_Peaks_To_Measurements) If .Run() Then Dim lpe As LineProfile.McLineProfileEngine Dim pd As LineProfile.McProfileData, dis As Double() Dim index As Integer, p As System.Drawing.PointF lpe = LineProfile.AddIn.LineProfileEngine(doc1, True) If lpe IsNot Nothing AndAlso lpe.FeaturesCount > 0 Then For profileIndex As Integer = 0 To lpe.FeaturesCount - 1 'all profiles pd = lpe.ProfileData(profileIndex) dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPeaks).Distances ' all Peak's distances For Each d As Double In dis index = CInt(d / lpe.LengthPerSampleDesired) 'calibrated distance to index Debug.Print "d" Debug.Print d If 0 <= index AndAlso index < pd.Points.Length Then p = New System.Drawing.PointF(pd.Points(index).x, pd.Points(index).y) AddMeasurementPoint(doc1, p) End If Next Next End If End If End With End Function Private Sub AddMeasurementPoint(doc As Object, p As System.Drawing.PointF) Dim meas As Object With Measure.MeasurementsCommands.Add(Nothing) .MeasurementType = McMeasurements.enumMMSTypes.mmtsManualTag .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(p) .SnapFeature = False .Run(doc, meas) End With End Sub
0 -
Matt, manual peaks work as well. Using your macro (In the Bold - manual Peaks):d20.565822156321d49d74d113.675661358466d146d172d193.536862006051
Hold "Shift" then manual Peak tool is selected to remove.
Thanks,
Nikita.0 -
Nikita --
Thank you for the additional information.
D doesn't generate anything for me when there are only MANUAL PEAKS. Can you please try it that way? Also, I'm using 9.1.4.
I createdConvert_Peaks_To_Measurements2
with a couple of other DEBUG.PRINTS and when I runConvert_Peaks_To_Measurements2
it seems to skip the MANUAL PEAKS. This is shown in the SCREEN CAPTURE below.
I was able to DELETE MANUAL PEAKS with the SHIFT + MANUAL EDGE EDITING.
I don't see this information in the HELP FILE.
Thanks for your assistance.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Public Function Convert_Peaks_To_Measurements2() As SimpleScript Convert_Peaks_To_Measurements2 = New SimpleScript Dim doc1 Debug.Clear Debug.Print "ThisApplication.ActiveImage.DisplayName" Debug.Print ThisApplication.ActiveImage.DisplayName With Application.DocumentCommands.Active(Convert_Peaks_To_Measurements2) .Run(doc1) End With With Measure.MeasurementsCommands.DeleteAll(Convert_Peaks_To_Measurements2) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Convert_Peaks_To_Measurements2) If .Run() Then Dim lpe As LineProfile.McLineProfileEngine Dim pd As LineProfile.McProfileData, dis As Double() Dim index As Integer, p As System.Drawing.PointF lpe = LineProfile.AddIn.LineProfileEngine(doc1, True) Debug.Print "lpe.featurescount" Debug.Print lpe.featurescount If lpe IsNot Nothing AndAlso lpe.FeaturesCount > 0 Then For profileIndex As Integer = 0 To lpe.FeaturesCount - 1 'all profiles pd = lpe.ProfileData(profileIndex) dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPeaks).Distances ' all Peak's distances Debug.Print "UBound(dis)" Debug.Print UBound(dis) For Each d As Double In dis index = CInt(d / lpe.LengthPerSampleDesired) 'calibrated distance to index Debug.Print "d" Debug.Print d If 0 <= index AndAlso index < pd.Points.Length Then p = New System.Drawing.PointF(pd.Points(index).x, pd.Points(index).y) AddMeasurementPoint(doc1, p) End If Next Next End If End If End With End Function
0 -
Hi Matt,
Works for me on 9.1.4 fine even with just the manual peaks.
On your screenshot, the distances have many significant digits - they are manual peaks!
Nikita.0 -
Nikita --
I'm sorry to be such a headache but something is working differently on my PREMIER 9.1.4 and yours.
I created a LINE PROFILE with 5 MANUAL EDGES and then ran Convert_Peaks_To_Measurements2. The routine did not see any EDGES.
I made the LINE PROFILE identify several AUTOMATIC EDGE and then ran Convert_Peaks_To_Measurements2. The routine did not see any EDGES.
I created a 2nd LINE PROFILE with several AUTOMATIC EDGES and several MANUAL EDGES and then ran Convert_Peaks_To_Measurements2. The routine did not see any EDGES.
SCREEN CAPTURES are attached.
Thank you for your assistance.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Single LINE PROFILE with only MANUAL EDGES
Single LINE PROFILE with MANUAL EDGES and AUTO EDGES
Double LINE PROFILE (one toward TOP of IMAGE, one toward BOTTOM of IMAGE) with MANUAL and AUTO EDGES
0 -
Nikita --
Thank you for pointing that out to me.
I have made the following change to the CODE:'dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPeaks).Distances ' all Peak's distances dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPatternA).Distances ' all PatternA distances
When I search the AUTOMATION HELP FILES, I don't see any helpful information when I search formcetPeaks
but in
mcEdgeTypes
LineProfile
EdgeTypes EnumerationAutomation Reference ► MediaCy.Commands.LineProfile ► EdgeTypes
I see
Peaks
Valleys
Rising
Falling
PatternA
PatternB
Reference
so I took a shot at using
mcetPatternA
and now everything is working.
Here is a SCREEN CAPTURE to show this.
The revised version of Convert_Peaks_To_Measurements2 is below.
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Public Function Convert_Peaks_To_Measurements2() As SimpleScript Convert_Peaks_To_Measurements2 = New SimpleScript Dim doc1 Debug.Clear Debug.Print "ThisApplication.ActiveImage.DisplayName" Debug.Print ThisApplication.ActiveImage.DisplayName With Application.DocumentCommands.Active(Convert_Peaks_To_Measurements2) .Run(doc1) End With With Measure.MeasurementsCommands.DeleteAll(Convert_Peaks_To_Measurements2) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Convert_Peaks_To_Measurements2) If .Run() Then Dim lpe As LineProfile.McLineProfileEngine Dim pd As LineProfile.McProfileData, dis As Double() Dim index As Integer, p As System.Drawing.PointF lpe = LineProfile.AddIn.LineProfileEngine(doc1, True) Debug.Print "lpe.featurescount" Debug.Print lpe.featurescount If lpe IsNot Nothing AndAlso lpe.FeaturesCount > 0 Then For profileIndex As Integer = 0 To lpe.FeaturesCount - 1 'all profiles pd = lpe.ProfileData(profileIndex) 'dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPeaks).Distances ' all Peak's distances dis = pd.EdgesData(LineProfile.mcEdgeTypes.mcetPatternA).Distances ' all Pattern A distances Debug.Print "UBound(dis)" Debug.Print UBound(dis) For Each d As Double In dis index = CInt(d / lpe.LengthPerSampleDesired) 'calibrated distance to index Debug.Print "d" Debug.Print d If 0 <= index AndAlso index < pd.Points.Length Then p = New System.Drawing.PointF(pd.Points(index).x, pd.Points(index).y) AddMeasurementPoint(doc1, p) End If Next Next End If End If End With End Function
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions