Manipulating and Querying the PASTE OVERLAY using SOFTWARE . . .
All --
I have a customer who has a STEREOLOGY CHALLENGE.
They have a SAMPLING PATTERN that needs to be applied over their EXPERIMENTAL IMAGE.
I have written an APP with all of the FEATURES and FUNCTIONS required to apply the PATTERN.
When the customer reviewed the APP, they requested that I add the FUNCTIONS to be able to SHIFT the PATTERN in X and Y and ROTATE the PATTERN before applying it to the image. This will allow them to match their new APP BASED procedure to their old PROJECTOR BASED procedure.
When I do a COPY on the PATTERN IMAGE, and a PASTE into the EXPERIMENTAL IMAGE, I can manually SHIFT the PATTERN in X and Y before the PASTE is made permanent. Doing this does not seem to allow me to do a ROTATION though an angle THETA.
Questions . . .
** Is there a way to ROTATE the PASTE OVERLAY using the MOUSE
** Is there a way to ROTATE the PASTE OVERLAY using an APP
** Is there a way for an APP to QUERY the PASTE OVERLAY to find out how much it was SHIFTED (and maybe ROTATED) before it was APPLIED?
These questions are important because the APPLICATION of the (MODIFIED) PATTERN is not really a PASTE but an ARITHMETIC OP (AND the MODIFIED PATTERN IMAGE with the EXPERIMENT IMAGE).
I would like to do APPLY the PATTERN (using the ARITHMETIC OPS) after learning the appropriate amount of SHIFT and ROTATE from the PASTE OPERATION as a PREVIEW.
I know I can SHIFT and ROTATE the PATTERN IMAGE with an APP before doing the APPLY via an ARITHMETIC OP but I'm concerned that the time for each nudge of SHIFT or ROTATE would take lots of time (and screen flashes) via the mechanisms I am aware of.
Any suggestions on how to make this smooth and efficient would be appreciated.
Thanks.
-- Matt
I have a customer who has a STEREOLOGY CHALLENGE.
They have a SAMPLING PATTERN that needs to be applied over their EXPERIMENTAL IMAGE.
I have written an APP with all of the FEATURES and FUNCTIONS required to apply the PATTERN.
When the customer reviewed the APP, they requested that I add the FUNCTIONS to be able to SHIFT the PATTERN in X and Y and ROTATE the PATTERN before applying it to the image. This will allow them to match their new APP BASED procedure to their old PROJECTOR BASED procedure.
When I do a COPY on the PATTERN IMAGE, and a PASTE into the EXPERIMENTAL IMAGE, I can manually SHIFT the PATTERN in X and Y before the PASTE is made permanent. Doing this does not seem to allow me to do a ROTATION though an angle THETA.
Questions . . .
** Is there a way to ROTATE the PASTE OVERLAY using the MOUSE
** Is there a way to ROTATE the PASTE OVERLAY using an APP
** Is there a way for an APP to QUERY the PASTE OVERLAY to find out how much it was SHIFTED (and maybe ROTATED) before it was APPLIED?
These questions are important because the APPLICATION of the (MODIFIED) PATTERN is not really a PASTE but an ARITHMETIC OP (AND the MODIFIED PATTERN IMAGE with the EXPERIMENT IMAGE).
I would like to do APPLY the PATTERN (using the ARITHMETIC OPS) after learning the appropriate amount of SHIFT and ROTATE from the PASTE OPERATION as a PREVIEW.
I know I can SHIFT and ROTATE the PATTERN IMAGE with an APP before doing the APPLY via an ARITHMETIC OP but I'm concerned that the time for each nudge of SHIFT or ROTATE would take lots of time (and screen flashes) via the mechanisms I am aware of.
Any suggestions on how to make this smooth and efficient would be appreciated.
Thanks.
-- Matt
0
Best Answers
-
Matt, this how you can get all information about images in the Image Compare view (Image Compare view should be active view):
Public Function Get_Image_Compare_Info() As SimpleScript Get_Image_Compare_Info = New SimpleScript Dim doc1 With Application.DocumentCommands.Active(Get_Image_Compare_Info) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Get_Image_Compare_Info) If .Run() Then ' User Code Here Dim ic As MediaCy.Addins.ImageCompare.McImageCompareDocument ic = TryCast(doc1, MediaCy.Addins.ImageCompare.McImageCompareDocument) If ic IsNot Nothing Then For Each info As MediaCy.Addins.ImageCompare.McInfo In ic.Info .Application.Output.PrintMessage(String.Format("{0} Image:{1} Size:{2} Center:{3} Angle:{4}", Now, info.Image.DisplayName, info.Position.Size, info.Position.Center, info.Angle)) Next End If End If End With End Function
Thanks,
Nikita.0 -
Matt,
The advantage of keeping the SimpleScript syntax is that your macro remains compatible with the designer and you can edit it graphically.
Of course it is more verbose and you may prefer dealing with shorter code, in which case you can also get rid of the CodeCommand which is only there to allow user code in designer compatible macros. See below.
PierrePublic Sub Get_Image_Compare_Info2() Dim doc1 With Application.DocumentCommands.Active(Nothing) .Run(doc1) End With Dim ic As MediaCy.Addins.ImageCompare.McImageCompareDocument ic = TryCast(doc1, MediaCy.Addins.ImageCompare.McImageCompareDocument) If ic IsNot Nothing Then For Each info As MediaCy.Addins.ImageCompare.McInfo In ic.Info .Application.Output.PrintMessage(String.Format("{0} Image:{1} Size:{2} Center:{3} Angle:{4}", Now, info.Image.DisplayName, info.Position.Size, info.Position.Center, info.Angle)) Next End If End Sub
0
Answers
It looks like what you need to do is to group all the overlay objects together before doing the paste, this will allow you to rotate the overlay after pasting, as well as tell you the amount of rotation using the McGraphObjGroup object.
Pierre
Take a look on Image Compare view. In this view you can align images, rotate and scale. Also, Preview may be useful for your task. Let me know, if this view works for you and I'll give you some ex how to get angle/position/size of the images in the view.
Thanks,
Nikita,
If I understand your suggestion, you are thinking that the PATTERN is something like ANNOTATION OBJECTS or MEASUREMENT OBJECTS.
The PATTERN is not OBJECTS but it is another image.
The PATTERN IMAGE has a WHITE BACKGROUND with BLACK PATTERN.
When the PATTERN IMAGE is ANDED with the EXPERIMENTAL IMAGE via
'AND the PATTERN IMAGE into the ORIGINAL IMAGE With Process.ProcessCommands.Operations(Nothing) .Operation = eOperation.AND .NumberValue = 0R .ResultType = eResultType.Apply .Run(doc2, doc1, image1) End With
the BLACK PATTERN appears on the EXPERIMENTAL IMAGE. This matches the CUSTOMERS current PROCEDURE.
Nikita --
I have worked with IMAGE COMPARE a bit and it seems that after I add the PATTERN IMAGE and the EXPERIMENTAL IMAGE to the IMAGE COMPARE IMAGE, that every modification via the ALIGN TOOLS or the IMAGE PARAMETER TOOLS applies to BOTH the IMAGES.
Is there an option that I'm overlooking that will LOCK one of the images to keep it from being modified by the ALIGN TOOLS or IMAGE PARAMETER TOOLS or that will only apply the TOOLS to a SELECTED IMAGE?
Thanks.
-- Matt
Once you have these 2 images in position like you need, you can create "result" image.
Nikita.
I was mistakenly thinking that the TOOL would manipulate the LAST IMAGE that was ADDED but based on your comment I see now that I need to SELECT an image with the MOUSE before using a TOOL.
I have recorded the some of the functions triggered by the IMAGE COMPARE and I believe that if I drive the IMAGE COMPARE from my APP then this feature will work for what I need. The core commands for this seem to be
With Process.CompareCommands.SetPosition(NewMacro3) .Center = New System.Drawing.PointF(1075.508F,825.6236F) .Size = New System.Drawing.SizeF(1936F,1456F) .Run(doc1, image1) End With With Process.CompareCommands.SetAngle(NewMacro3) .Angle = 6R .Run(doc1, Nothing) End With
I'll work with this and see if I can get my APP to control IMAGE COMPARE in the way I need so that I can gather the SHIFT VALUES and ROTATE VALUE needed to MODIFY the PATTERN IMAGE before it is ANDED with the EXPERIMENTAL IMAGE.
If I drive the IMAGE COMPARE from the MOUSE and the TOOL BAR, is there a way to query the IMAGE COMPARE for the SHIFT and ROTATE that are set by the use? This would allow:
** the USER to take advantage of the MOUSE INTERFACE with the PATTERN IMAGE
** the APP to create a MODIFIED PATTERN IMAGE to AND with the EXPERIMENT IMAGE
This would be the best answer to give the CUSTOMER the EXPERIMENTAL IMAGE with the BLACK PATTERN APPLIED
Thanks.
-- Matt
The example code that you provided as
Get_Image_Compare_Info()
is SUPER.
I think it demonstrates very nicely how to interact with an important PREMIER FEATURE.
I think I now have everything I need to add the FEATURES this CUSTOMER needs in their APP to score PREMIER and the APP an
A++
If you are going to be at the GATHERING in NOV, I would very much like to review with you how you located the DATA TYPES, METHODS, and PROPERTIES that you integrated into your example.
Many thanks.
-- Matt
One additional question . . .
How come your
Get_Image_Compare_Info
(below)
works but my
Get_Image_Compare_Info2
(below)
does not work?
The only difference is that I changed the SIMPLESCRIPT stuff as I've done often before.
Is there an easy modification to
Get_Image_Compare_Info2
or can you explain the advantage of leaving the SIMPLESCRIPT stuff in there.
That will make it work?
Thanks.
-- Matt
Thank you for your response.
I did not understand until now that the major advantage of the
SimpleScript
was compatibility with the graphical program editor.
Thanks for that information.
I assume from your message and the content of the commands that were removed that the
CodeCommand
is some sort of ERROR TRAP to keep the macro from running on an empty PREMIER.
Since it looks like
does the same thing it looks like all of the bases are covered.
It will be late this (TUE) PM before I can weave this into the APP but it looks like I can modify NIKITA'S CODE (with the SIMPLESCRIPT) or your code (without SIMPLESCRIPT).
Thank you for explaining and giving me the option.
-- Matt