menu_book

Knowledge Base

Documentation, guides, and resources for Noldus products.

EthoVision XT 19 - Dependent Variables Reference

Last updated: Jul 29, 2026

Variables

Aim

In this topic you find the commands and functions that you can use to extract and process tracking data with JavaScript code.

Get Started

We assume that you have basic knowledge about JavaScript. To get started with JavaScript we recommend this online compiler: https://repl.it/languages/javascript

Many courses on the internet concern JavaScript for web page developers. An excellent course more focused on JavaScript as a data processing tool can be found here: https://www.youtube.com/watch?v=Bv_5Zv5c-Ts

Extract Subject Features

Use the functions below to extract the position and other features of your subjects.

  • GetCenter, GetNose, GetTail
  • GetSubjectCenter, GetSubjectNose, GetSubjectTail
  • GetArea, GetChangedArea
  • GetSubjectArea, GetSubjectChangedArea
  • GetElongation
  • GetSubjectElongation
  • GetViewDirection
  • GetSubjectViewDirection

Extract Other Data

  • GetSampleTime
  • GetPixelChange
  • GetDistanceToZone
  • GetDistanceToPoi
  • GetBehaviorEvent
  • GetCommand
  • GetSignal
  • new Point
  • GetPointPoi

Query Data

Use the functions below to ask simple questions, like Is the subject in the central zone? The software gives a boolean answer (true/false).

  • IsInZone (discontinued)
  • IsSubjectCenterInZone, IsSubjectNoseInZone, IsSubjectTailInZone
  • IsPointInZone
  • Point.Equals
  • IsSubjectActor

Calculate

  • Distance
  • Point.Distance
  • TurnAngle
  • Heading
  • SetOutput
  • SetOutputMissing

GetCenter, GetNose, GetTail

Returns the x,y coordinates of the center-point, nose-point or tail-base point of the subjects in a single-subject trial, respectively. Use this function in a single-subject experiment, or in a multi-subject experiment to extract the body points of the focal subject.

  • Syntax
    GetCenter()
    GetNose()
    GetTail()
  • Example

    In the following example, the code verifies if the center point of the subject, when found, is in the zone named Zone 1.

    const g_Zone = "Zone 1";
    (...)
    function Process()
    {
        var ptC = GetCenter();
        if (ptC)
        {
            g_bInZone = IsInZone(g_Zone, ptC);
        }
    }
  • Example

    In the following example, we calculate the average x coordinate of the center point and the nose point.

    var ptC = GetCenter();
    var ptN = GetNose();
    var x_avg = ptC.x + ptN.x;

GetSubjectCenter, GetSubjectNose, GetSubjectTail

Returns the x, y coordinates of a body point of a specific subject in a multi-subject experiment. You can use this function to compare the position of different subjects in the same JavaScript variable.

See also the sample experiment Subject Counter with JavaScript code XT160, which you can find on my.noldus.com, under Downloads > EthoVision XT > Drivers and tools.

  • Syntax
    GetSubjectCenter(Subject name)
    GetSubjectNose(Subject name)
    GetSubjectTail(Subject name)
  • Arguments

    Subject name: the name of one of the subjects as defined in the Experiment Settings.

  • Example

    In the following loop (not shown entirely), the center point of each subject is loaded in the variable pt.

    const g_aSubjects = ["Subject 1", "Subject 2", "Subject 3", ... ]
    (...)
    for (i = 0; i < g_aSubjects.length; ++i)
    {
        var pt = GetSubjectCenter(g_aSubjects[i]);
        (...)
    }

    Note that g_aSubject.length function gets the length of the array variable g_aSubjects which contains the names of the subjects. The variable g_aSubjects is defined at the top of the script.

GetArea, GetChangedArea

Returns the current value of the subject's area (in practice, the yellow blob that you see during tracking), and the area that has changed from the previous sample, respectively. Use these functions for:

  • The subject in a single-subject experiment.
  • The focal subject in a multi-subject experiment. Here "focal" refers to the subject for which the statistics are calculated.

Areas are expressed in internal units (mm), independent of the units selected in the Experiment Settings. For information on the Changed area, see Rotation.

  • Syntax
    GetArea()
    GetChangedArea()
  • Example
    var a = GetArea();
    var ca = GetChangedArea();
  • Notes

    GetArea and GetChangedArea are not available when using Deep learning with two subjects per arena, because this method does not record the subjects' body contour.

GetSubjectArea, GetSubjectChangedArea

GetSubjectArea returns the current value of the area of a specified subject in a multi-subject experiment.

GetSubjectChangedArea returns the area of the subject in a multi-subject experiment that has changed from the previous sample. For information on the Changed area, see Rotation.

The subject's area is the area of the yellow blob that you see during tracking. It is expressed in internal units (mm), independent of the units selected in the Experiment Settings.

  • Syntax
    GetSubjectArea("subject name")
    GetChangedArea("subject name")

    where Subject name is the name of the subject specified in the Experiment Settings.

  • Example
    var a = GetSubjectArea("Subject 1");
  • Example
    // This for loop extracts the area for a number of subjects
    for (i = 0; i < g_aSubjects.length; ++i)
    {
        var AreaSubj = GetSubjectArea(g_aSubjects[i]);
        ...
    }
  • Notes

    GetSubjectArea and GetSubjectChangedArea are not available when using Deep learning with two subjects per arena, because this method does not record the subjects' body contour.

GetElongation

GetElongation returns the current value of Body elongation for:

  • The subject in a single-subject experiment.
  • The focal subject in a multi-subject experiment. Here "focal" refers to the subject for which the statistics are calculated.

It is expressed as a number between 0 and 1. To obtain the same as the dependent variable Body elongation, multiply it by 100.

  • Syntax
    GetElongation()
  • Example
    var y = GetElongation();
    if (y != null)
    {
        SetOutput(y*100);
    }
    else
    {
        SetOutputMissing();
    }
  • Notes

    GetElongation is not available when using Deep learning with two subjects per arena, because this method does not record the subjects' body contour.

GetSubjectElongation

Returns the current value of Body elongation for a specified subject in a multi-subject experiment. It is expressed as a number between 0 and 1. To obtain the same as the dependent variable Body elongation, multiply it by 100.

  • Syntax
    GetSubjectElongation("Subject name")

    where Subject name is the name of the subject specified in the Experiment Settings.

  • Example
    // This for loop extracts the body elongation for a number of subjects
    for (i = 0; i < g_aSubjects.length; ++i)
    {
        var EloSubj = GetSubjectElongation(g_aSubjects[i]);
        ...
    }
  • Notes

    GetSubjectElongation is not available when using Deep learning with two subjects per arena, because this method does not record the subjects' body contour.

Source: EthoVision XT 19 Help, Noldus Information Technology

Need a grant proposal quote?

We provide detailed quotations formatted for grant applications. Request yours today.

Noldus is here to assist you throughout the whole process.

shopping_bag
check_circle

Thank you!

We'll get back to you shortly.

error

Please correct the following errors:

error

error

error

error

By clicking Submit, you consent to Noldus processing your data as described in our privacy policy.