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

CODE to determine whether a MEASUREMENT OBJECT is completely (or partially) within an ROI?


All --

Lets say there are two RECTANGULAR ROIs within an IMAGE and 10 CIRCULAR MEASUREMENT OBJECTS in the SAME IMAGE.  The MEASUREMENT OBJECTS were not generated with a COUNT and are not necessarily inside or outside of the ROIS.

Is there a way for CODE to SELECT the MEASUREMENT OBJECTS that are completely (or maybe partially) within one of the ROIs or perhaps completely (or maybe partially outside all of the ROIS?

I can do this with MASKS but it will be a multi-step process and it will be clunky.  I am hoping there is some kind of comparison function that will do this efficiently.

Thanks in advance.

-- Matt

Best Answers

  • edited March 2019 Accepted Answer
    Hi Matt,

    Yes, it can be done, but you should use measurement objects, not ROIs.
    Here are the steps:
    1. Create your RECTANGULAR objects as measurements of Class 1 (you can convert them from ROIs using Features Manager).
    2. Activate Class 2
    4. Use "Parent" measure to get parents of circles. The circle, which CENTER is within a rectangle will have Parent, circles outside - no parent.

  • Accepted Answer

    Image-Pro has other ways to filter out existing measurement objects. For example, you can set and Apply Filter in  Data Histogram.



  • 2019-03-28-090819

    Yuri --

    Thank you for your guidance on this. 

    I created an EXAMPLE IMAGE similar to yours and asked IP to extract all the CLASS and PARENTAL INFO and everything went well.

    From this I gather that the PARENT / CHILD RELATIONSHIP is based on where the CENTER of the possible CHILD OBJECT lies.

    It also looks like combining PARENT and NESTING DEPTH can be used to determine whether an object is COMPLETE CHILD or a PARTIAL CHILD

    I did notice something though . . .

    When I opened the EDIT RANGE TOOL to play with FILTERING OUT the ORPHANS, all of the OBJECTS disappeared.

    Closing the EDIT RANGE TOOL brings the objects back but I see this.

    that may be related

    I can CODE something that will eliminate ORPHAN OBJECTS but I think this is an issue within IP.  It seems that the only time the FILTER RANGE can be used from the USER INTERFACE is when the OBJECTS are generated by a COUNT.  When OBJECTS are generated MANUALLY, via the FEATURE MANGER, or via the MEASUREMENT TABLE, it seems they cannot be FILTERED.

    Thanks again for your guidance on this.

    -- Matt
  • Hi Matt,

    Regarding Edit Range: when you open it it tries to apply current segmentation method to the image. If you created all your objects manually, it may have unpredictable results. In short: Filter Range is used only for automatically segmented objects, and it cannot not be used with manually drawn features, as you have also pointed out.

  • 2019-03-28-105946

    Yuri --

    Thank you for the info on EDIT RANGE.

    I would think that the value of the EDIT RANGE would be increased if would work on MANUALLY CREATED OBJECTS or OBJECTS generated by the FEATURE MANAGER or IQM FILES.

    Thanks again.

    -- Matt
  • 2019-03-29-094810

    Yuri --

    Thanks for the reminder about that tool.

    I'll look into applying it to this situation.

    Thanks again.

    -- Matt

Sign In or Register to comment.