Home Image-Pro General Discussions

Orientation plot limits

Hi again!  Is it possible to adjust the minimum and maximum axis values for the Orientation plot created by motion tracking?  We would like to be able to compare results between samples, but keep the same relative X and Y coordinates between samples (to demonstrate that one set of cells is moving far more slowly than another set, and so the tracks are much closer to the origin).

It would be nice if we could force the below to go from -200 to 200 on both axes.


Best Answer

  • Answer ✓
    The orientation plot is auto-scaled to the extends of the existing tracks, so it's not possible to define the axis ranges.
    As a workaround, you can add a track that would define the max extends of the displacement.

    Here is the macro that will add a new "Ref" track to auto-scale the orientation plot to -200...200 range for X and Y axes:

        Public Function AddMaxTrack() As SimpleScript
            AddMaxTrack = New SimpleScript
            Dim trdoc1, obj1
            'define the range of the max displacement
            Dim r As Double=200
    
            With Application.DocumentCommands.Active(AddMaxTrack)
                .Run(trdoc1)
            End With
    
            With Measure.TrackingCommands.AddManualTrack(AddMaxTrack)
                .Points = New System.Collections.Generic.List(Of System.Drawing.PointF)
                .Points.Add(New System.Drawing.PointF(0,0))
                .Points.Add(New System.Drawing.PointF(-r,0))
                .Points.Add(New System.Drawing.PointF(-r,-r))
                .Points.Add(New System.Drawing.PointF(r,-r))
                .Points.Add(New System.Drawing.PointF(r,r))
                .Points.Add(New System.Drawing.PointF(-r,r))
                .StartFrame = 0
                .TrackName = "Ref"
                .Run(trdoc1, obj1)
            End With
    
        End Function
    
    


    Yuri

Answers

  • Thanks, clever solution.  I will give that a try.
  • Ah, so that worked 99%, but for presentation purposes, there is now a random color around the border of each plot.  Is there a command make sure the newly created track is Black or White?  I cannot seem to find any sort of color or transparency options per track.
  • Oh, never mind, you can change the color through the data table!
  • Yes, it's possible to set track color. Here is the modified macro that adds White reference track:

        Public Function AddMaxTrack() As SimpleScript
            AddMaxTrack = New SimpleScript
            Dim trdoc1, obj1
            'define the range of the max displacement
            Dim r As Double=200
    
            With Application.DocumentCommands.Active(AddMaxTrack)
                .Run(trdoc1)
            End With
    
            With Measure.TrackingCommands.AddManualTrack(AddMaxTrack)
                .Points = New System.Collections.Generic.List(Of System.Drawing.PointF)
                .Points.Add(New System.Drawing.PointF(0,0))
                .Points.Add(New System.Drawing.PointF(-r,0))
                .Points.Add(New System.Drawing.PointF(-r,-r))
                .Points.Add(New System.Drawing.PointF(r,-r))
                .Points.Add(New System.Drawing.PointF(r,r))
                .Points.Add(New System.Drawing.PointF(-r,r))
                .StartFrame = 0
                .TrackName = "Ref"
                .Run(trdoc1, obj1)
            End With
    
            With Automate.ScriptingCommands.CodeCommand(AddMaxTrack)
                If .Run() Then
                    'set track color
                    obj1.Color=System.Drawing.Color.White
                End If
            End With
    
    
        End Function
    

    Yuri
Sign In or Register to comment.