Home Image-Pro General Discussions

Split Objects

Hello All

I'm writing a script that requires me to split close dapi labelled nuclei. I want to do this using Boundary Shape with a ridge value of 1000. When I record the macro no mention is made of my Boundary Shape or the 1000 ridge value. I have a network license so its likely that the automation will be used on several different computers all with different initial settings for how counts are made. How do I get these options included in the code. The recorded code is below

Public Function Splitnuclei()
        Dim doc1

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

        With Measure.Measurements.SplitCommands.All(Nothing)
            .UseLines = False
            .SelectedOnly = False
            .Run(doc1)
        End With

        With Measure.Measurements.Gadgets.Options(Nothing)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run()
        End With

        With Measure.MeasurementsCommands.Options(Nothing)
            .Segmentation.CleanBorders = MediaCy.IQL.Features.mcRegionBorders.mcrbAllBorders
            .Run(doc1)
        End With

        With Measure.MeasurementsCommands.ExecuteCount(Nothing)
            .Run(doc1)
        End With

        With Measure.Measurements.SplitCommands.All(Nothing)
            .UseLines = False
            .SelectedOnly = False
            .Run(doc1)
        End With

    End Function

Regards

David 

Best Answer

  • Answer ✓
    Hi David,

    Only parameters that get changed during macro recording are added to the macro. 
    Here is the code that defines the ridge size and auto-separation method:

            With Measure.MeasurementsCommands.Options(CountWithSplit)
                .AutoSeparationUnlimited = False
                .AutoSeparationMaxSize = 100
                .AutoSeparation = True
                .AutoSeparationMethod = McMMOptions.mcmmSeparationMethod.ConcaveBoundary
                .Run(doc1)
            End With
    
    You can also add these parameters after recording using macro designer. I've added a screenshot that shows that.

    Regards,

    Yuri

Answers

Sign In or Register to comment.