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,GetTailGetSubjectCenter,GetSubjectNose,GetSubjectTailGetArea,GetChangedAreaGetSubjectArea,GetSubjectChangedAreaGetElongationGetSubjectElongationGetViewDirectionGetSubjectViewDirection
Extract Other Data
GetSampleTimeGetPixelChangeGetDistanceToZoneGetDistanceToPoiGetBehaviorEventGetCommandGetSignalnew PointGetPointPoi
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,IsSubjectTailInZoneIsPointInZonePoint.EqualsIsSubjectActor
Calculate
DistancePoint.DistanceTurnAngleHeadingSetOutputSetOutputMissing
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.lengthfunction gets the length of the array variableg_aSubjectswhich contains the names of the subjects. The variableg_aSubjectsis 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
GetAreaandGetChangedAreaare 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
GetSubjectAreaandGetSubjectChangedAreaare 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
GetElongationis 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
GetSubjectElongationis 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