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

CREATE MASK in SMART SEGMENTATION TOOL and THRESHOLD TOOL produce different images . . .

All --

The SMART SEGMENTATION TOOL seems to be doing the following

1)  The MASK image generated by the SMART SEGMENTATION CREATE MASK BUTTON is UNCALIBRATED
2)  The MASK image generated by the SMART SEGMENTATION CREATE MASK BUTTON is named "SmartMask"
3)  The pixels in the SELECTED OBJECTS portion of the MASK have intensities of 1 and are pseudocolored (in a manner that I don't seem to be able to turn off)
4)  The SEGMENTATION OVERLAY remains on the ORIGINAL IMAGE even when the SMART SEGMENTATION TOOL is closed.

#1 is the same as BRIGHT, DARK, and MANUAL SEGMENTATION but it has been said that this will be resolved in IPP91

#2 is different from BRIGHT, DARK, and MANUAL SEGMENTATION in that the MASKS generated by these tools are named "Mask of " plus the name of the original image

#3 is different from BRIGHT, DARK, and MANUAL SEGMENTATION in that the MASKS generated by these tools contain SELECTED OBJECTS PIXELS with intensities of 255 (max value for 8 bit image) and they are not pseudocolored

#4 is different from BRIGHT, DARK, and MANUAL SEGMENTATION in that the SEGMENTATION OVERLAY disappears from the ORIGINAL IMAGE when the THRESHOLD TOOL is closed.

I'm working on an APP that contains the option for the user of BRIGHT, DARK, and MANUAL SEGMENTATION.  I would like to add SMART SEGMENTATION as an option.  Initially I thought that the APP could just

-- Open SMART SEGMENTATION
-- Load an ISG file
-- CREATE MASK
-- Close SMART SEGMENTATION

like it currently does the

-- Open THRESHOLD TOOL
-- Load an RGE file
-- CREATE MASK
-- Close THRESHOLD TOOL

for a MANUAL SEGMENTATION (supported by a previously user created RGE file).

- - - - - - - - - - - -

Will the SMART SEGMENTATION change in the near future to be more consistent with BRIGHT, DARK, and MANUAL SEGMENTATION or will code developed to handle its current characteristics last for a while?

Thanks.

-- Matt

Best Answers

  • edited August 2013 Accepted Answer
    Hi Matt,

    Thank you for analysing the differences between smart and threshold masks and indeed the behaviour is different. Smart segmentation pseudo-color mask is designed to show multi-class segmentation, where pixel intensity corresponds to object class. Creation of Binary mask in smart segmentation will be available in 9.1.
    Other issues you mentioned will be also fixed:
    1) The mask will be calibrated.
    3) Pseudo-color will be possible to switch off using Pseudo-color button on the Adjust tab.(new Binary mask will not have pseudo-color)
    4) Segmentation mask is shown on active image when the image has a valid recipe, that's the current behavior. The output mask doesn't have any recipe by default, so the overlay is not shown there. Closing the smart segmentation panel will remove the mask overlay.

    Below is the code, which you can use now to create a binary smart segmentation mask:
        Public Function CreateSmartMask() As SimpleScript
            CreateSmartMask = New SimpleScript
            Dim doc1, image1
    
            With Application.DocumentCommands.Active(CreateSmartMask)
                .Run(doc1)
            End With
    
            With Measure.SmartSegmentationCommands.CreateMask(CreateSmartMask)
                .Run(doc1, image1)
            End With
    
            With Automate.ScriptingCommands.CodeCommand(CreateSmartMask)
                If .Run() Then
                    'make binary, transfer calibration'
                    image1.Op.Mult(255)
                    image1.SpatialCalibration=doc1.Data.SpatialCalibration
                End If
            End With
        End Function
    

    Regards,

    Yuri


  • Accepted Answer
    Hi Matt,

    Thanks for reporting this. It will be fixed in 9.1.

    Yuri

Answers

  • Yuri --

    Thank you for looking into this.

    I also appreciate your providing code that will help me to integrate include SMART with BRIGHT, DARK, and MANUAL SEGMENTATION in the APP.

    Nick is working to make time during the upcoming DEALER WEBINAR for me to present this APP.  It will be nice to be able to say the APP includes all the SEGMENTATION methods.  I'd love it if you (and Pierre) would attend and see what you and Pierre (and NikitaRG) have contributed to here. 

    Thanks again.

    -- Matt
  • Yuri --

    While working with SMART SEGMENTATION this AM, I noticed another variation from the way SMART SEGMENATION works and the way BRIGHT, DARK, and MANUAL SEGMENTATION works.

    If a SMART SEGMENTATION is defined with the SMART SEGMENTATION TOOL and a COUNT done, FEATURES are found and all is well.

    The issue appears if the SMART SEGMENTATION TOOL is closed (MANUALLY or by the COUNT on the COUNT/SIZE RIBBON) and the ROI moved.

    If the ROI is changed and another SMART SEGMENTATION COUNT is done with the SMART SEGMENTATION TOOL CLOSED, the FEATURES that are found are from the OLD ROI and are shifted depending upon the location of the NEW ROI.

    The method I found to resolve this is to OPEN then CLOSE the SMART SEGMENTATION TOOL then do the COUNT.

    BRIGHT, DARK, and MANUAL SEGMENTATION can handle a move of the ROI with the TOOL hidden.

    I hope this information is helpful.

    -- Matt
Sign In or Register to comment.