Home Image-Pro Automation (Macros, Apps, Reports)

Prompting user for thresholding or white level setting

I would like the user to interactively set threshold levels or adjust lighting on playback of macro...how do i do this? In very old versions of imagpro this was done by simply leaving one of the parameters out in the function call. I am unsure of how to do this in the vb.net version. There is a property *.prompt but i am unsure of how to use it?

Best Answers

  • Answer ✓
    Premier has different, easier and more flexible tools to provide interactivity.
    Any command in macro can be made interactive, you should just select this command in the Project Workbench, designer view and select "Prompt user in imaging workspace" from the context menu over the properties window (as shown in the attached screenshot). Activating this option sets Interactive property to True.

    Optionally you can define Prompt and Text of the interaction popup.

    Here is the macro:

        Public Function SetThreshold() As SimpleScript
            SetThreshold = New SimpleScript
            Dim doc1
    
            With Measure.ThresholdTool.Gadgets.Histogram(SetThreshold)
                .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
                .Run()
            End With
    
            With Application.DocumentCommands.Active(SetThreshold)
                .Run(doc1)
            End With
    
            With Measure.MeasurementsCommands.Options(SetThreshold)
                .Segmentation.AutoFindPhase = MediaCy.IQL.Features.mcFindPhase.mcfpManual
                .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstThresholdSegmentation
                .Run(doc1)
            End With
    
            With Measure.ThresholdToolCommands.Thresholds(SetThreshold)
                .AllowOverlap = False
                .Interpretation = eInterpretation.Mono
                .Classes = New System.Collections.Generic.List(Of SegmentationClass)
                .Classes.Add(New SegmentationClass("Class 1",System.Drawing.Color.Blue,New Double(){0R,20R}))
                .Prompt = "Please adjust threshold."
                .Interactive = True
                .Run(doc1)
            End With
    
            With Measure.ThresholdTool.Gadgets.Histogram(SetThreshold)
                .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
                .Run()
            End With
    
        End Function
    
    Regards,
     
    Yuri

  • Answer ✓
    Information box is already interactive, so you should not make this command Interactive second time (Remove Inteactive=True). You can show prompt for user input for any command property, just right mouse click over the property in the designer and activate "Prompt user for this property" as on the attached screenshot.

    Yuri

Answers

  • great..thx

  • I am still having issues with certain functions. I am able to work interactively with the thresholding and contract enhancement functions but for the information box the code runs twice and for the  'extract channel' the user is not allowed to choose from the drop-down box but has to insert the value for which image they want (0 =red;1=green;2 = blue). 
Sign In or Register to comment.