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

Differences between FUNCTIONS presenting RECTANGULAR ROI TOOL and POLYGON ROI TOOL in IPP 9.1.4

All --

I have two FUNCTIONS that are intended to give the USER the RECTANGULAR ROI TOOL or the POLYGON ROI TOOL.

The FUNCTION for the RECTANGULAR ROI TOOL works just fine

The FUNCTION for the POLYGON ROI TOOL does not work.

No errors are presented but the second FUNCTION does not engage the POLYGON ROI TOOL.

Can someone point out what I'm doing wrong please?

Thanks.

-- Matt

    Public Function SelectRoiRectangle()

        'Connect with the active document
        With Application.DocumentCommands.Active(Nothing)
            .Run(ThisApplication.Activedocument)
        End With

        'Deactivate the MULTIPLE ROIS OPTION
        With Select.RoiCommands.MultipleROIs(Nothing)
            .Text = "Multiple ROIs"
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run(ThisApplication.ActiveImage)
        End With

        'Turn on the RECTANGULAR ROI TOOL
        With Select.Roi.ToolsCommands.Rectangle(Nothing)
            .Image = .GetImage("Select.Roi.Tools.Rectangle")
            .Overlay = Overlays.OverlayType.ROIOverlay
            .Tool = Overlays.OverlayToolType.McGraphObjRect
            .Run(ThisApplication.ActiveImage)
        End With

        'Display an INTERACTION BALLOON
        With Automate.ScriptingCommands.Interaction(Nothing)
            .Text = "Select RECTANGULAR ROI"
            .Image = .GetImage("Select.Roi.Tools.Rectangle")
            .Prompt = "Please create a RECTANGULAR ROI around the SAMPLE AREA then press OK!"
            .Interactive = True
            .Run(ThisApplication.ActiveImage, Nothing)
        End With

        'Activate the IMAGE SELECTION TOOL for the user
        With [Select].Roi.ToolsCommands.Select(Nothing)
            .overlay = overlays.OverlayType.ImageToolsOverlay
            .Run(ThisApplication.ActiveImage)
        End With

    End Function


    Public Function SelectRoiPolygon()

        'Connect with the active document
        With Application.DocumentCommands.Active(Nothing)
            .Run(ThisApplication.Activedocument)
        End With

        'Deactivate the MULTIPLE ROIS OPTION
        With Select.RoiCommands.MultipleROIs(Nothing)
            .Text = "Multiple ROIs"
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run(ThisApplication.ActiveImage)
        End With

        'Turn on the POLYGON ROI TOOL
        With Select.Roi.ToolsCommands.Polygon(Nothing)
            .Image = .GetImage("Select.Roi.Tools.Polygon")
            .Overlay = Overlays.OverlayType.ROIOverlay
            .Tool = Overlays.OverlayToolType.McGraphObjPoly
            .Run(ThisApplication.ActiveImage)
        End With

        'Display an INTERACTION BALLOON
        With Automate.ScriptingCommands.Interaction(Nothing)
            .Text = "Select POLYGON ROI"
            .Image = .GetImage("Select.Roi.Tools.Polygon")
            .Prompt = "Please create a POLYGON ROI around the SAMPLE AREA then press OK!"
            .Interactive = True
            .Run(ThisApplication.ActiveImage, Nothing)
        End With

        'Activate the IMAGE SELECTION TOOL for the user
        With [Select].Roi.ToolsCommands.Select(Nothing)
            .overlay = overlays.OverlayType.ImageToolsOverlay
            .Run(ThisApplication.ActiveImage)
        End With

    End Function



Best Answer

  • Accepted Answer
    Hi Matt,

    You are missing ".Closed = True" in the polygon command:

            'Turn on the POLYGON ROI TOOL
            With Select.Roi.ToolsCommands.Polygon(Nothing)
                .Image = .GetImage("Select.Roi.Tools.Polygon")
                .Overlay = Overlays.OverlayType.ROIOverlay
                .Tool = Overlays.OverlayToolType.McGraphObjPoly
                .Closed = True
                .Run(ThisApplication.ActiveImage)
            End With
    

    Nikita

Answers

  • Nikita --

    Thank you for your response on 25-MAY to my question posted 24-MAY.

    I had to step away from this section of the project for a bit but I have used the CODE you provided and all works well.

    Thank you very much for your assistance on this matter.

    -- Matt


Sign In or Register to comment.