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

Problem with SMART THRESHOLD . . .

2017-04-30-153857

All --

The FUNCTION below was recorded with PREMIER 9.2 for a customer with multiple copies of PREMIER and with an IT DEPT that has not cleared 9.3 yet.

During the RECORDING, I :

** Selected BRIGHT SEGMENTATION, then closed the dialog box
** Selected DARK SEGMENTATION, then closed the dialog box
** Selected MANUAL SEGMENTATION, then closed the dialog box
** Selected SMART SEGMENTATION, then closed the dialog box

In BRIGHT, DARK, and MANUAL sections there is a CODE like

        With Measure.MeasurementsCommands.Options(NewMacro)
            .Segmentation.AutoFindPhase = MediaCy.IQL.Features.mcFindPhase.mcfpBrightest
            .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstThresholdSegmentation
            .Run(doc1)
        End With
that seems to configure PREMIER for that type of SEGMENTATION.

CODE like this is not recorded in the SMART section of CODE.

There is no
    mcFindPhase
method or property that seems to apply.

What is the equivalent CODE that will put PREMIER into the SMART SEGEMENTATION MODE so that recalling a SMART SEGMENTATION RECIPE with a
        With Measure.SmartSegmentation.RecipeCommands.Open(Nothing)
and then triggering a COUNT with a

        With Measure.MeasurementsCommands.ExecuteCount(Nothing)
will identify FEATURES based on the SMART THRESHOLD RECIPE?

I am doing this to resolve a problem with an APP that works properly every time except the first time it is run after PREMIER 9.2 is restarted.

I think the issue is related to making sure that PREMIER is in the SMART SEGMENTATION MODE.

I think something is being reset by the RESTART that is some getting set properly by the code I have written if it is run twice or more but not the first time through.

Thanks.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
    Public Function NewMacro() As SimpleScript
        NewMacro = New SimpleScript
        Dim doc1

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run()
        End With

        With Application.DocumentCommands.Active(NewMacro)
            .Run(doc1)
        End With

        With Measure.MeasurementsCommands.Options(NewMacro)
            .Segmentation.AutoFindPhase = MediaCy.IQL.Features.mcFindPhase.mcfpBrightest
            .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstThresholdSegmentation
            .Run(doc1)
        End With

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run()
        End With

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run()
        End With

        With Measure.MeasurementsCommands.Options(NewMacro)
            .Segmentation.AutoFindPhase = MediaCy.IQL.Features.mcFindPhase.mcfpDarkest
            .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstThresholdSegmentation
            .Run(doc1)
        End With

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run()
        End With

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run()
        End With

        With Measure.MeasurementsCommands.Options(NewMacro)
            .Segmentation.AutoFindPhase = MediaCy.IQL.Features.mcFindPhase.mcfpManual
            .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstThresholdSegmentation
            .Run(doc1)
        End With

        With Measure.ThresholdTool.Gadgets.Histogram(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run()
        End With

        With Measure.SmartSegmentationCommands.Gadget(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run()
        End With

        With Measure.SmartSegmentationCommands.Gadget(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run()
        End With

    End Function

Best Answer

  • Answer ✓
    Hi Matt,

    Thanks for reporting that. Macro recording of this option was missing, it will be fixed in the next version.
    You can use the following code to activate Smart segmentation mode:
            With Measure.MeasurementsCommands.Options(NewMacro)
                .Segmentation.SegmentationType = McMMOptions.mcmmSegmentationType.mcmmstLearningSegmentation
                .Run(doc1)
            End With
    

    Your workaround with options file will also work, and it's even better, because the complete smart segmentation recipe is included in the IQO file.

    Yuri

Answers

  • 2017-04-30-160630

    All --

    I was able to "work around" this issue by creating an using an IQO FILE that has SMART SEGMENTATION configured within it.

    I would rather do this with the appropriate command if possible but I'm not a FISH OUT OF WATER anymore.

    I hope there is a more elegant solution.

    Thanks.

    -- Matt
  • 2017-05-01-102633

    Yuri --

    Thank you for your assistance and your advice.

    The next time I "raise the hood" on this APP, I'll see whether the existing IQO FILE or the code to activate the Smart segmentation mode.

    I lean toward the second because so much can happen when an IQO FILE is LOADED.

    Thanks again.

    -- Matt

Sign In or Register to comment.