Computational protocol: Open Source Tracking and Analysis of Adult Drosophila Locomotion in Buridan's Paradigm with and without Visual Targets

Similar protocols

Protocol publication

[…] The movement of flies was visualized via a standard commercial video camera (web cam). Any camera with a resolution of 640×480 or better will work (we used a Logitech Quickcam Pro 9000). The position of the fly is determined and recorded online (capture rate is determined by the speed of the computer). We obtained a mean resolution of one pixel for 0.35 mm (with a range of 0.31 to 0.4 mm). The user can observe the quality of the tracking via on-screen crosshairs placed on the image of the fly (). An alert is sounded and the recording stopped when the specified experiment duration is reached. The tracker was written in C++ using OpenCV (Willowgarage, and Qt (Nokia, libraries and operates as follows. Contrast and luminosity are set by the experimenter such that the fly appears as a dark spot on a homogenously bright background. Color information is discarded and a black-and-white image is generated using a user-adjustable threshold. The image is then inverted and a Gaussian blur is applied. The brightest dots are then determined (above a given threshold) and the brightest point in each dot is taken as the putative position of the fly. The parameters of the Gaussian and the threshold are adjusted in the interface (different parameters should be used for different spot sizes). If multiple points are located, the one closest to the position of the fly in the previous frame is taken (for the first frame, the brightest spot is taken). The coordinates of this point, which approximates to the centroid of the fly, is then saved along with the time stamp and the so-called burst number. The burst number is incremented and the tracking stops whenever the position of the fly is outside the platform limits or cannot be detected at all. In these instances, the recording is interrupted and an acoustic alert is played. Once the experimenter puts the fly back on the platform using a brush (or changes the camera settings) the recording can be resumed. The trajectory data is saved in an ASCII text file with four rows, separated by tabs: time (in ms), the two coordinates (X, Y in pixels), and the burst number ().The user can modify thresholds and is asked to enter information about the experiment before it starts. In particular, the position of the platform is semi-automatically determined, by simply clicking on three points on the platform edge, spaced as far apart as possible. Any tilt of the camera can be visually detected and must be avoided during this step (the round platform has to fit the circle drawn by the software). This makes tilt correction unnecessary. The information entered by the user (fly label, data file name, duration of experiment, stripes width and position, platform size and position, date and time at the start of the experiment and resolution of the camera capture) is saved in a separate text file (, encoded using the Extended Markup Language, XML). In order to sort individual experiments into experimental groups, the user lists the XML file name together with a group label in a separate text file. [...] CeTrAn, the analysis software, is written in the open source statistics package R ( and can be used without computing knowledge thanks to a user-friendly interface written in RGG (R Graphical user interface Generator, This interface allows the user to set different variables and to browse the disk to find the location of the three relevant entries: the folder containing the data, the group text file and an output folder into which the package will write its outputs (). In practice, data files are often dispatched in different folders; one then sets the “folder containing the data” to the parent folder, and adds the subfolder into the XML file name (for example: “experiment_1/fly_1.xml”). CeTrAn then imports and analyzes the data before drawing output graphs. […]

Pipeline specifications

Software tools OpenCV, RGG
Applications Miscellaneous, Microscopic phenotype analysis
Organisms Drosophila melanogaster