Loading Smart Segementation in macros
Is it possible to load a smart segmentation option before an image is opened? I'm trying to have a macro that sets everything up so the user only has to load an image and analyse it without having to load each setting individually.
0
Best Answer
-
Hi David,The recorded from UI command loads recipe only to existing image, but it's possible to load file directly to "Global Recipe". Here is the macro, which you can use in "Run before" batch processing:
Public Function LoadRecipeToGlobal() As SimpleScript LoadRecipeToGlobal = New SimpleScript With Automate.ScriptingCommands.CodeCommand(LoadRecipeToGlobal) If .Run() Then ' load recipe to Global Dim globalRecipe As MediaCy.Addins.LearningSegmentation.SegmRecipe=MediaCy.Addins.LearningSegmentation.Globals.m_SegmRecipe Dim FileName As String=ThisApplication.Path(mcPathType.mcptConfigurationFiles) & "Dark.isg" globalRecipe.Load(FileName,MediaCy.Addins.LearningSegmentation.McLearningSegmentation.ThisAddin.LS.Options) End If End With End Function
Note, that you have to ally global recipe processing every image (in "Loop on" batch macro).The following macro applies global recipe to active image:Public Function ApplyGlobalRecipe() As SimpleScript ApplyGlobalRecipe = New SimpleScript Dim doc1 With Application.DocumentCommands.Active(ApplyGlobalRecipe) .Run(doc1) End With With Measure.SmartSegmentation.RecipeCommands.ApplyGlobal(ApplyGlobalRecipe) .FilterInput = True .Run(doc1) End With End Function
Regards,Yuri0