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

How to filter Data Collector results?

Hello, 

I am wondering how to filter results from the Data Collector app (either via the Expression section in the Data Collector app or via code in the project module). I would like to place a threshold on values for the "mTrVelocity_Mean" column I am collecting data with. So any track with a mean velocity value BELOW 15.000 would be deleted from the Data Collector table as well as the tracking table. Is this possible at all? If not, I can manually delete the tracks still, it would just save time to be able to impose a filter on the results. 

Here are the measurements I am using the Data Collector for:



Here is my code for the macro I created to both find all tracks in the image sequence and the mean velocity value (in the Data Collector)
Public Function Auto_All() As SimpleScript
        Auto_All = New SimpleScript
        Auto_All.Shortcut = MediaCy.IQL.Application.mcScriptShortcut.CtrlA
        Dim trdoc1

        With Application.RibbonCommands.SelectRibbonTab(Auto_All)
            .TabName = "TrackingTab"
            .Run()
        End With

        With Application.DocumentCommands.Active(Auto_All)
            .Run(trdoc1)
        End With

        With Measure.TrackingCommands.FindTracksAuto(Auto_All)
            .Interactive = True
            .Run(trdoc1)
        End With

        With Application.RibbonCommands.SelectRibbonTab(Auto_All)
            .TabName = "Share"
            .Run()
        End With

        Measure.Data.CollectorCommands.Clear(Auto_All).Run()

        With Measure.Data.CollectorCommands.Collect(Auto_All)
            .Run(New List({trdoc1}))
        End With

    End Function

Best Answers

  • Answer ✓
    You can also select tracks with low velocity in the Tracking histogram:

    These tracks will get selected and you can delete them clicking the Delete Selected button.

    Yuri
  • Hi Equamme, 

    You can add custom expressions to the data collector which can be very helpful. 

    Click on the help link in the 'Add new Measurement' dialog for more details. 




    Here I've added a custom measurement to the Motion Track Objects Stats table that only records a value if the track velocity is >3.  If this is not true, the value is recorded as 0. 



    Here I've added another measurement, that is set to 1 for tracks with a mean velocity > 3, and 0 for tracks where this is not true. 




    I've then added measurements to the Image table that collects the sum of the high velocity track velocity, and the total number of high velocity tracks. 



    I can then divide the total velocity of the high velocity tracks by the number of high velocity tracks to get the mean of only the high velocity tracks:



    If you'd like to try this approach, my data collector types are attached. 
    Andrew

Answers

  • 2021-09-15-134740

    equamme --

    Will you please provide a more information about how you would like to filter the TRACKING RESULTS?

    How many TRACKS are in your RESULTS?

    What TRACKING MEASUREMENTS do you want to FILTER on?

    Are you looking for the LONGEST TRACK or the FASTEST OBJECT or what?

    I hope these questions help.

    -- Matt





  • Matt-

    The number of tracks changes with the image/ROI, as we are processing multiple ROI per sequence. Typically we see between 6-20 tracks. I have my actual tracking table (which does not show avg velocity, the measurement we need) and I have the data collector table, which shows the average velocity of each track over the sequence (120 frames). This is so I know the avg velocity of each track, as the velocity per track per frame (which is what shows on the tracking table) is not helpful for our experiment. I am trying to figure out how to get the program to delete all tracks (in both the data collector and the tracking table) with an average velocity of <= 15.000, but I'm not sure how I would do that. 
  • edited September 2021
    Hi equamme,

    You can identify short tracks in Data Collector and mark them, but it is not possible to delete them.

    If your goal is to get rid of short tracks on the image, then you can delete them automatically defining "Minimum total track length" in the Tracking options dialog:

    All tracks shorter than this length will be ignored and not collected ("Total track length" is directly proportional to mTrVelocity_Mean for the sequences of the same lngth).

    Let me know if it solves your problem.

    Yuri

  • Yuri-

    Unfortunately no, we have already done that (as we have a stated minimum track length).

    I am looking for a way to filter the tracks by avg velocity, but it seems that is not possible? This is the setup, with the actual tracks and the tracking table on the bottom left, and the Data Collector table on the right.



    I have highlighted a track with a mean velocity of <15.000, which I would like to have filtered out in some way. I have been simply deleting them myself, so if there is no way to filter the collected data like that, I can continue doing so. 
  • Thank you!
  • Andrew-

    Thanks so much!
Sign In or Register to comment.