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

Getting COUNT, SHAPE, and AREA for ROI(s) ...

All --

I am working on an APPLICATION where the user is normally working with a SINGLE RECTANGULAR ROI.

After the user is given the opportunity to FINE TUNE the ROI, I would like the APP to be able to

-- Determine the number of active ROIS
-- Determine the SHAPE of the active ROIS
-- Determine the AREA of the active ROIS

I see some information within the FORUM entry for

Resize ROI

Is there a more efficient way to do this or is

Resize ROI

the best guide on how to do this?


-- Matt

Best Answer

  • edited January 2015 Accepted Answer

    You can use IQL functions to get ROI parameters. ROIs are McRegions exposed as ActiveImage.Aoi. Here is the example:

    Imports MediaCy.IQL.Features
        Public Sub GetROIArea
            Dim roi As McRegions=ThisApplication.ActiveImage.Aoi
            If roi.Count>0 Then
                'print area of the first ROI
                Debug.Print roi.mRgnArea.value(0)
            End If
        End Sub
    The project must have a reference to MediaCy.IQL.Features.dll.



  • Matt,

    Why do you use ROIs? If you need these parameters you can just use manual measurements, all these parameters, including intensity, will be reported in the data table.
    Resizing of measurements can be done easily using Grow/Shrink functions. 

    Also, measurements and ROIs can be converted one to another using Features manager.

  • Yuri --

    Thank you for your prompt response.

    The customer has a sample handler (imaging RECTANGULAR PETRI DISH).

    They are measuring a SINGLE SPECIMEN within the boundary of the PETRI DISH but the SPECIMEN can move around because there are multiple images.

    They want to be able to set a RECTANGULAR ROI in the first (n) image that is big enough for the SPECIMEN but not as large as the PETRI DISH and to move (but not change the size of the ROI) should the SPECIMEN move beyond the ROI in the second (n+1) image.

    They want the AREA of the ROI to be documented along with the SPECIMEN MEASUREMENTS.

    I can get the AREA of the ROI using a variety of mechanisms but if I can query the ADMINISTRATION level of PREMIER rather than the MEASUREMENT level it would be super.

    Thanks again.

    -- Matt
  • Yuri --

    Thank you again for your prompt response.

    This looks perfect.

    I'll wire it in ASAP and I'll let you know how it goes.


    -- Matt
  • Yuri --

    The code above works like a champ.


    -- Matt

Sign In or Register to comment.