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

Setting Thresholds

I have the following code snip to set thresholds, but it always draws a graphic outline of the area inside the thresholds. I don't want this outline, how can I switch it off? I tried setting the colour to 'transparent' but it didn't do it.

        ' SET THRESHOLDS
        With measure.ThresholdToolCommands.Thresholds(Nothing)
            .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(){LowerThreshold,UpperThreshold}))
            .Run(ThisApplication.ActiveDocument)
        End With

Best Answer

  • Answer ✓
    Paul,

    BTW, why do you want to make segmentation outlines invisible? They are specifically shown, so the user can have visual indication of what have been measured. If you don't want to show it, you can just delete all segmented objects in the end of the macro . (or do all the processing and measurements on hidden images).

    Yuri

Answers

  • Paul,

    If I understand correctly you just want to set threshold for the Count operation without showing the threshold overlay, is it right?

    If yes, there is a way to do that. Threshold overlay is shown only when Threshold Tool panel is visible. Just make sure that the threshold tool panel is not visible: either don't show it or, to be sure, hide it before applying the threshold:

            With Measure.ThresholdTool.Gadgets.Histogram(Nothing)
                .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
                .Run()
            End With
    
    Let me know if that's what you need.

    Yuri

  • 2017-03-10-103321

    Paul  --

    There is another PREMIER FEATURE that may help you MANUALLY or through CODE.

    The SHOW THRESHOLD OVERLAY OPTION may control the display in the manner you desire.

    Below is a GRAPHIC that shows the CONTROL and its effect on an image.

    Below that is CODE that shows how to access this CONTROL from CODE.

    I hope this information is helpful.

    -- Matt

    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-



    Imports MediaCy.Addins.ThresholdTool
    Public Module Module1
    
    
        Public Function DemoShowOverlayOn()
            Dim image1
    
            With Application.DocumentCommands.ActiveImage(Nothing)
                .Run(image1)
            End With
    
            With Measure.ThresholdToolCommands.Options(Nothing)
                .ShowOverlay = True
                .Run(image1)
            End With
    
        End Function
    
        Public Function DemoShowOverlayOff()
            Dim image1
    
            With Application.DocumentCommands.ActiveImage(Nothing)
                .Run(image1)
            End With
    
            With Measure.ThresholdToolCommands.Options(Nothing)
                .ShowOverlay = False
                .Run(image1)
            End With
    
        End Function
    
    End Module
    
  • Thanks for your help - Yuri, yes this is what I want to do.I have attached a image which shows a threshold outline in red. If I add your code then the Threshold tool dialog does close but the outline is still there. 

    In the image you can also see the tools on my Threshold tool toolbar. I don't see the 'show' button that Matt shows.
  • Sorry I think the red outline was missing from the previous image. See attached
  • edited March 2017
    Hi Paul,

    The red line doesn't look like threshold overlay, but rather it's an object outline, which is shown after the Count. Is it correct?

    If yes, then you can change the thickness of the line in the Measurement Options panel (Outlines group, Width). You can also change it to Filled and set transparency.

    Let me know if we are talking about the same thing.

    Yuri

  • Yes, we are talking about the same thing. I have tried various settings in the measurement options but I can't remove the line.
  • Paul,

    You can set the style to Filled and set Opacity to 0:



    Another way is to switch off Measurements overlay:



    Yuri
  • The first option works - how can I set this as the default behavior?
  • It's persisted, so once changed it will stay (until you change or reset the options). It's also a part of IQO file, so you can save it and use in your macro.

    Yuri

  • There are several segmentation steps and the outlines get confusing for the operator. We are aiming for 'click' then get result without interaction. Saving the transparency settings in the IQO files worked. Thanks for your help.
Sign In or Register to comment.