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

Ipp 11 macro scripts update fgggf

    Public Function SegmentationOptions_Save(ByVal SetFilename As String) As Boolean
        If (ThisApplication.Documents.Count < 1) Then Return False
            With Measure.ThresholdToolCommands.Save(Nothing)
                .FileName = SetFilename
                .FilterIndex = 1
                .Run(ThisApplication.ActiveDocument)
            End With
        Return True
    End Function
    Public Function SegmentationOptions_Load(ByVal SetFilename As String) As Boolean
        If (ThisApplication.Documents.Count < 1) Then Return False
            With Measure.ThresholdToolCommands.Open(Nothing)
                .FileName = SetFilename
                .FilterIndex = 1
                .Run(ThisApplication.ActiveDocument)
            End With
        Return True
    End Function

Answers

  • I check/update all my macro scripts from Ipp 9/10 to new vesrion 11.
    I have an issue in threshold segmantation Open command (thershold settings from file).
    Although the function "Save" works correct, the function "Load" returns a system error.
    Checking Automation help the "ThresholdToolCommand Class" has not changed for this commands.
    Any idea what is wrong?
  • 2023-03-08-140749

    Stelios Gietos --

    I do not have any direct information to offer you but . . .

    If this was my challenge, I would determine what happens in IP 11 if I manually attempt to load the THRESHOLD SEGMENTATION FILE that was working properly in IP 10.

    If that works MANUALLY, I would say that there is an issue in the IP 11 PROJECT WORKBENCH.

    If that does not work MANUALLY, I would say that there is an issue in the IP 10 THRESHOLD SEGMENTATION FILE.

    I hope this information is helpful.

    -- Matt


  • Hello Stelios Gietos,

    Thank you for your report. We are investigating this issue and will contact you with a solution.

    Thank you,
    Nikita.
  • Stelios Gietos, we have identified the problem and will fix it in the next point release of Image-Pro version 11 (the initial release has already been frozen).  In Image-Pro v11, the Save and Load Threshold operations are no longer exposed in the user interface.  Instead these settings are saved and loaded along with all of the other measurement options. Below is a modification of your macros that saves and loads threshold settings as part of a measurement options .IQO file.
        Private Function MeasurementOptions_Save(ByVal SetFilename As String) As Boolean
            If (ThisApplication.Documents.Count < 1) Then Return False
            With Measure.Measurements.OptionsCommands.Save(Nothing)
                .FileName = SetFilename
                .FilterIndex = 1
                .Run(ThisApplication.ActiveDocument)
            End With
            Return True
        End Function
        Private Function MeasurementOptions_Load(ByVal SetFilename As String) As Boolean
            If (ThisApplication.Documents.Count < 1) Then Return False
                With Measure.Measurements.OptionsCommands.Open(Nothing)
                    .FileName = SetFilename
                    .FilterIndex = 1
                    .Run(ThisApplication.ActiveDocument)
                End With
            Return True
        End Function
    
        Public Sub SaveAndLoadMeasurementOptionsTest()
            Dim strFileName As String = ThisApplication.Path(mcPathType.mcptConfigurationFiles) + "MeasurementOptionsTest.iqo"
            If MeasurementOptions_Save( strFileName) Then
                MeasurementOptions_Load(strFileName)
            Else
                MsgBox("We need an active image")
            End If
        End Sub 'SaveAndLoadMeasurementOptionsTest
    
    I hope this approach will allow you to get past this problem.
    Craig.
  • Dear Graig,

    Thank you very much for your information.

    The funny thing is that I use (exactly) these functions to load parameter settings for detection/counting objects, but there is a significant delay to load all the parameters from file, to apply them and count again.

    <>
    Imagine that you have a cancer image with several multi color cells and it is not accurate to separate/detect cells automatic, doing a "multi" color threshold segmentation (even smart one) for all.
    So you can save for any class type its segmantation separatelly and calling them one by one for counting which as method it was much faster.
    As concern the open file "delay", imagine that you measure at least 20 images from a single specimen and get their class stats!
    <>

    I hope to consider my note above in a future release (for macros at least).

    Have a nice weekend,
    Stelios
  • Hi Stelios,

    Regarding delay: do you see it loading options with Smart segmentations? If yes, then that's the time to generate segmentation images for all channels in the recipe. If you haven't optimized your recipe , all 20 default channels are used (which may cause delays). You may optimize the recipe to use only top 1-3 channels, then click Filter. Recipient with few channels will load much faster.

    Yuri

  • Hi Yuri,

    Thank you for this cells segmentation approach.
    I'll do my tests and I'll let you know.

    Have a nice week,
    Stelios
Sign In or Register to comment.