Issues with ajustement setting not applying.
Hi,
I recorder this macro to switch from composite view, apply some adjustment to each channel and redisplay the composite view.
When I do It manually, the composite picture is displayed properly, but when I run the macro, the adjustment are applied to each channel in the non composite view but they are applied only to channel 3 in the composite display.
I tried to work directly on the composite view, but I have issues with referring the channels in the composite view.
Thanks
Public Function NewMacro() As SimpleScript
NewMacro = New SimpleScript
Dim doc1, image1, window1
With Application.RibbonCommands.SelectRibbonTab(NewMacro)
.TabName = "Process"
.Run()
End With
With Application.DocumentCommands.Active(NewMacro)
.Run(doc1)
End With
With Process.Filter.EnhancementCommands.Gauss(NewMacro)
.Passes = 1
.KernelSize = Filters.mcKernelSize2.mcks3x3
.Strength = 100
.Run(doc1, image1)
End With
With Application.WindowCommands.Define(NewMacro)
.Run(doc1, window1)
End With
With View.ImageSetViewCommands.Options(NewMacro)
.ColorCompositeView = False
.Run(window1)
End With
With Application.RibbonCommands.SelectRibbonTab(NewMacro)
.TabName = "Adjust"
.Run()
End With
With Adjust.LookupTableCommands.WhiteLevel(NewMacro)
.WhiteLevel = 1000R
.LUT = -1
.Run(doc1)
End With
With View.ImageSetViewCommands.Options(NewMacro)
.ViewLocation = New McImageSetLocations
.ViewLocation.Add(mcImageSetDimensions.mcisdChannel, 1)
.Run(window1)
End With
With Adjust.LookupTableCommands.WhiteLevel(NewMacro)
.WhiteLevel = 1000R
.LUT = -1
.Run(doc1)
End With
With View.ImageSetViewCommands.Options(NewMacro)
.ViewLocation = New McImageSetLocations
.ViewLocation.Add(mcImageSetDimensions.mcisdChannel, 2)
.Run(window1)
End With
With Adjust.LookupTableCommands.WhiteLevel(NewMacro)
.WhiteLevel = 1000R
.LUT = -1
.Run(doc1)
End With
With View.ImageSetViewCommands.Options(NewMacro)
.ColorCompositeView = True
.Run(window1)
End With
With Application.RibbonCommands.SelectRibbonTab(NewMacro)
.TabName = "Share"
.Run()
End With
With View.ImageViewCommands.Options(NewMacro)
.View.AutoZoomMode = MediaCy.IQL.Display.Viewer.mcAutoZoomMode.mazmNone
.Run(window1)
End With
With Application.WindowCommands.ExportToPowerPoint(NewMacro)
.Export = Window.ExportToPowerPoint.ExportOptions.DocumentView
.Run(New List({window1}))
End With
End Function
0
Answers
Adding some delay before exporting the view fixes the problem.
I've added CodeCommand with DoEvents function. Here is the complete macro:
Public Function NewMacro() As SimpleScript NewMacro = New SimpleScript Dim doc1, image1, window1,image2,window2,doc2 With Application.RibbonCommands.SelectRibbonTab(NewMacro) .TabName = "Process" .Run() End With With Application.DocumentCommands.Active(NewMacro) .Run(doc1) End With With Process.Filter.EnhancementCommands.Gauss(NewMacro) .Passes = 1 .KernelSize = Filters.mcKernelSize2.mcks3x3 .Strength = 100 .Run(doc1, image1) End With With Application.WindowCommands.Define(NewMacro) .Run(doc1, window1) End With With View.ImageSetViewCommands.Options(NewMacro) .ColorCompositeView = False .Run(window1) End With With Application.RibbonCommands.SelectRibbonTab(NewMacro) .TabName = "Adjust" .Run() End With With Adjust.LookupTableCommands.WhiteLevel(NewMacro) .WhiteLevel = 1000R .LUT = -1 .Run(doc1) End With With View.ImageSetViewCommands.Options(NewMacro) .ViewLocation = New McImageSetLocations .ViewLocation.Add(mcImageSetDimensions.mcisdChannel, 1) .Run(window1) End With With Adjust.LookupTableCommands.WhiteLevel(NewMacro) .WhiteLevel = 1000R .LUT = -1 .Run(doc1) End With With View.ImageSetViewCommands.Options(NewMacro) .ViewLocation = New McImageSetLocations .ViewLocation.Add(mcImageSetDimensions.mcisdChannel, 2) .Run(window1) End With With Adjust.LookupTableCommands.WhiteLevel(NewMacro) .WhiteLevel = 1000R .LUT = -1 .Run(doc1) End With With View.ImageSetViewCommands.Options(NewMacro) .ColorCompositeView = True .Run(window1) End With With Automate.ScriptingCommands.CodeCommand(NewMacro) If .Run() Then 'wait until the composite view is updated System.Windows.Forms.Application.DoEvents End If End With With View.ImageViewCommands.Options(NewMacro) .View.AutoZoomMode = MediaCy.IQL.Display.Viewer.mcAutoZoomMode.mazmNone .Run(window1) End With With Application.WindowCommands.ExportToPowerPoint(NewMacro) .Export = Window.ExportToPowerPoint.ExportOptions.DocumentView .Run(New List({window1})) End With End Function
Yuri
If it still doesn't work, try to reproduce the problem on one of the demo images (e.g. the one from Colocalization folder) and attach the complete macro project (packaged as IPX) to the post.
Yuri
Hi,
I tested the File in the colocalization folder and it's a hit and miss. Sometime it works sometime it does not. I wanted to upload the IPP file but I get the "File Format is no allowed" message
Yuri
you can call this macro instead of System.Windows.Forms.Application.DoEvents , like this:
With Automate.ScriptingCommands.CodeCommand(NewMacro) If .Run() Then 'wait until the composite view is updated 'System.Windows.Forms.Application.DoEvents ApplyToCC End If End With
Please test it and let us know if it fixes your problem.
Yuri