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

Feature Manager & measurements

Hi Yuri,
In my macro I have used thid code to get measurements info.
    Dim data As McMMData
    Dim stats(8) As Double
    '----------------------------------------------------------------------
    With measure.MeasurementsCommands.GetData (Nothing)
        '----------------------------------------------------------------------
        .Run(ImDab,data)
        '----------------------------------------------------------------------
    End With
    Dim meas As New MeasEntry
    meas.Measurement = eMeasures.RgnArea
    '----------------------------------------------------------------------
    data.CalcStatistics (meas,stats)
    dAreaNucleiPositivi = stats(5)        ' somma
    lNumNucleiPositivi = data.LastCountInRange

It works fine when the objecct are counted directly on the image.
I want to move, using the Feature Manager, measurements gathered from the main channel on a secondary one.
Measurements are correctly overlapped on the 2nd image but data.LastCountInRange reports always 0 meanwhile
the dAreaNucleiPositivi (Area sum) is correctly shown.

from the attached snapshot  you can note that In Range object number and the statistic both report the correctnumber of objects.
Only the Total Object number is always 0.
Is there any way to get the correct In Range object number by macro using an alternative function?
grazie
Maurizio

Answers

  • Options
    Hi Maurizio,

    That ribbon bar shows the "Last Count Results" on that image. Copying data from Features manager is not considered as Count. Features manager contains only objects and has no information how many objects was on the image before applying filters. If you want to get "Total" from the count on other image, you should get right after you do the Count.

    Public Sub PrintTotal
            Dim md As McMMData=ThisApplication.ActiveImage.MeasurementsData
            Debug.Print md.LastCountTotal
        End Sub

    Yuri 
  • Options
    Hi Yuri,
    I also tried lNumNucleiPositivi = data.LastCountTotal but it returns always 0 (i'll retry tomorrow)
    what I am doing is count objects on the main image then move them (by FM) on a 2°image, apply a filter (Intensity mean) to select only the darkest objects and count how many they are.
    I cannot do the count again on the second image.
    ciao Maurizio

  • Options
    In that case you have full control.

    1. Copy features to 2nd image then get the number of objects (ThisApplication.ActiveImage.MeasurementsData.Rows), it will be your TotalCount.
    2. Apply filters and get the number of objects that are left (ThisApplication.ActiveImage.MeasurementsData.Rows) it will be your ObjectsInRange.

    Yuri
Sign In or Register to comment.