How to draw Line Profile on invisible image?
Hi guys,
I create an invisible image and I want to draw Line Profile on it .
But it pop up an error message about
'Unable to cast COM object of type 'MediaCy.IQL.Engine.McImageClass' to interface type 'MediaCy.IQL.Application.IMcDocument'.
[code]
Can I draw Line Profile on invisible image?
Please help me to solve this annoying problem, thanks!
I create an invisible image and I want to draw Line Profile on it .
But it pop up an error message about
'Unable to cast COM object of type 'MediaCy.IQL.Engine.McImageClass' to interface type 'MediaCy.IQL.Application.IMcDocument'.
[code]
Dim im As McImage = ThisApplication.ActiveImage Dim invisible_im As McImage = im.Duplicate(mcImageCreateFlags.mcicfNotVisible) 'Create invisible image With Measure.LineProfile.ProfileCommands.Add(Nothing) .ProfileType = LineProfile.ProfileTypes.Line .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(New System.Drawing.PointF(1689, 1116)) .Points.Add(New System.Drawing.PointF(1952, 1116)) .Angle = 0R .CreateEngine = true .Run(invisible_im) 'Draw Line Profile on invisible image
End With
Can I draw Line Profile on invisible image?
Please help me to solve this annoying problem, thanks!
0
Answers
Line Profile commands works with IMcDocument (visible image or image set) and will not work with invisible image. As workaround you can create McLines instance attached to invisible image (Ex: Dim lines As McLines = McApplication.ThisApplication.CreateOperator("McLines", MyInvisibleImage, "MYLines")) and use lines.Profiles to analyze edges.
Thanks,
Nikita.
With small modifications in the macro you can create invisible document and use it with the line profile commands:
Key modifications:
1) create invisible document from the invisible image
2) force to create line profile engine (.CreateEngine = True should be set on the first line profile command)
Remember to close invisible document to free up the memory.
Nikita.
This is of great help to me!