Login processing...

Trial ends in Request Full Access Tell Your Colleague About Jove


Using an Automated 3D-tracking System to Record Individual and Shoals of Adult Zebrafish

doi: 10.3791/50681 Published: December 5, 2013


The use of a 3D automatic video system that can track individual and groups of zebrafish is described. As application example we explore the effects of the NMDA-receptor antagonist MK-801 on shoals of zebrafish.


Like many aquatic animals, zebrafish (Danio rerio) moves in a 3D space. It is thus preferable to use a 3D recording system to study its behavior. The presented automatic video tracking system accomplishes this by using a mirror system and a calibration procedure that corrects for the considerable error introduced by the transition of light from water to air. With this system it is possible to record both single and groups of adult zebrafish. Before use, the system has to be calibrated. The system consists of three modules: Recording, Path Reconstruction, and Data Processing. The step-by-step protocols for calibration and using the three modules are presented. Depending on the experimental setup, the system can be used for testing neophobia, white aversion, social cohesion, motor impairments, novel object exploration etc. It is especially promising as a first-step tool to study the effects of drugs or mutations on basic behavioral patterns. The system provides information about vertical and horizontal distribution of the zebrafish, about the xyz-components of kinematic parameters (such as locomotion, velocity, acceleration, and turning angle) and it provides the data necessary to calculate parameters for social cohesions when testing shoals.


Zebrafish has become an important model for biological and pharmacological research1-3. Tracking of movement and spatial distribution patterns of individual zebrafish and of shoals of zebrafish is invaluable. Older studies apply manual quantification based on recorded images4. Now, 2D automatic video tracking systems are commonly used5. However, since zebrafish and many other aquatic and nonaquatic animals move in a three-dimensional space, the interest in 3D systems is growing6. The described 3D system was first published in 20077. For technical details and comparisons with other systems see8. The basic advantage of this system as compared to other systems is that it acquires two (optionally three) synchronous and independent views using a mirroring system and that is uses a two-step calibration protocol. In the first step, the 3D-geometry of the stereo system (formed by the camera and the mirrors) is calibrated. In the second step, the nonlinear errors introduced by light refraction are corrected. When studying aquatic animals, the impact of light refraction can be considerable when left uncorrected. Other so far published systems (even newer developments9) omit the two-step calibration procedure. For technical details about object identification, occlusion with multi-object tracking, jigging noise etc. the reader is referred to the original publications8,9. The system has been validated for the study of anxiety-like behavioral responses10,11, shoaling8,11,12 and, in a preliminary study, for antagonistic behavior in zebrafish13. It has also been tested for other fish species (goldfish8, swordtail, tiger barb) and for mice9.

In the following the protocols for calibration and for using the system are described and the results of an experiment testing the effects of the NMDA-receptor noncompetitive antagonist MK-801 on shoaling zebrafish are presented as a representative example to demonstrate the type of data that can be obtained with the system.

Both in the natural environment and in aquariums, zebrafish usually swims in shoals14. Shoaling preferences seems to depend on several factors, such as rearing, sex, and food availability14,15. Interestingly, the distance between individual zebrafish in a shoal becomes smaller when signals of potential danger are present, such as alarm pheromones16 or novelty11. The shoaling paradigm is therefore also being used to test anxiolytic drugs17. Dominance hierarchies18 and social learning19 are fascinating aspect of zebrafish behavior. Because of its highly developed social behavioral character, zebrafish have also become of interest for autism research20,21.

MK-801 has been reported to alter social behavior in zebrafish5,22,23, which is reminiscent of its effects on mammals24. However, MK-801 has also many other effects on other behaviors (such as swimming behavior, inhibitory avoidance and place preference25-27). Therefore it is crucial, in initial experiments to obtain as much information as possible from basic observations. This will provide the basis for designing more targeted experiments.

Survey of the recording apparatus and software

In its current configuration, the observation container (25 cm x 25 cm x 18 cm, L x W x H), holding the zebrafish, is positioned in the observation chamber (91 cm x 46 cm x 56 cm, L x W x H). The chamber also contains a camera, a mirror which is suspended at approximately >45° angle above the container, and LED-light bars. Figure 1 shows a simplified diagram. The camera records both the front view and the top view (mirror) to construct the 3D trajectories of the zebrafish by determining its x-, y-, and z-coordinates. For orientation purposes, the coordinate vectors are presented on the left-front corner of the observation container (position relative to camera), which corresponds with the vectors presented on the 3D views (e.g. Figure 15) generated by the Path Reconstruction Module (see further below). The sampling rate depends on the camera and the computer. In our experiments it is approximately 40 frames/sec (fps). The spatial resolution of the recorded frames is 640 x 480 pixels (this configuration was chosen as optimal balance between spatial and temporal resolution). Windows XP or higher is required.

Before the first recording, the system has to be calibrated to determine locations of the walls of the container and the water surface, to determine the scaling factor of the recorded frames and to adjust for the sizable error generated by refraction of light when passing from water to air. In principle, calibration has only to be performed during the initial installation and after parts of the setup, such as camera or mirror, are moved or replaced. Nevertheless, it is good practice to check from time to time whether the calibration is still correct and recalibrate, if necessary.

The software consists of three modules. The Recordings Module records the frames (two example frames are shown in Figure 2). The Trajectory Module reconstructs the paths for every zebrafish. The Data Processing Module calculates a range of standard kinematic and spatial parameters. For the purpose of further analysis, the data can be imported into spreadsheet or statistical software.


All experiments were conducted in accordance with the National Institute of Health Guide for Care and Use of Laboratory Animals.

1. Calibration

  1. Place an empty observation container in the chamber so that the feet of the container are inserted into the holes provided for correct alignment. Orient the container such that the semi-transparent walls (the purpose of their structure is to reduce reflections) face the far side and to the right of the camera.
  2. Open the Record Module, select 'Camera control' and adjust 'gain' and 'shutter' (after deselecting them, boxes on the right) so that the image is clear. Place the side mirror in an approximately 45° angle at the left side of the observation container so that the side view of the container on the computer monitor is fully visible. Furthermore, the mirror has to be aligned such that the front wall of the container is seen as one line (as indicated by the arrow in Figure 3).
  3. Connect the calibration panel to the parallel port (of the camera card) and press 'LED panel on/off' button in Record Module to switch the LEDs on.
  4. Place the calibration panel in the empty observation container such that the 5 LEDs can be seen in the front, top and side views on the computer monitor as in Figure 3 (sometimes the cable blocks the view, in this case move it). Make also sure that the LEDs are below the marks for the water level (these marks are engraved in the observation containers at 135 mm from the inside bottom of the tank) and that the position of the panel is stable (so that it does not move when filling the container with water in step 1.9).
  5. Switch off the lights in the observation chamber and shut the curtain (be careful not to touch the cable of the calibration panel or the side mirror).
  6. Push the 'Data location' button and make or select a folder for the calibration files. These files will be used for all subsequent recordings (or experiments) until recalibration becomes necessary. Thus, ideally make the calibration data part of the name of the calibration folder.
  7. Adjust the three red boxes on the computer screen such that each just encompasses the 5 LEDs in any of the three views (Figure 4, left panel). Again use 'gain' and 'shutter' under 'Camera control' to obtain clear images of the LEDs, without images of other light points (which are due to noise, reflections or water droplets on the wall of the container), as in Figure 4, right panel.
  8. Switch the LEDs off and push the 'Collect calibration w/o water' button. On the computer screen 5 tags ('x') numbered from 0-4 appear. Switch the panel on. The locations of the tags should coincide with the LEDs. If not, repeat step 1.7 (see Figure 4 for illustration of incorrect tag assignment on left panel and correct tag assignment on right panel).
  9. Fill the observation chamber with water up to the mark. The LEDs should be beneath water level (as was explained in step 1.4). If they are above water level, empty the container and go back to step 1.4. When filling the water into the container, be careful that the LED panel does not move. However, should this happen, then empty the container and go back to the step 1.4. This is important, because calibration is based on determining the differences between the recorded LEDs positions without and with water.
  10. Push the 'Collect calibration w. water' button. Again, like in step 1.8, five tags will appear on the screen, which in most cases will be slightly offset from those obtained during calibration without water. In this step, gain and shutter might have to be readjusted. Repeat until the tags are placed correctly on top of the LEDs (as in Figure 4, right panel).
  11. Switch lights on in the observation chamber, adjust gain and shutter (under 'Camera Control') so that the image is not overly bright.
  12. Figure 5 shows the six points that have to be selected sequentially by right-click the mouse. Be sure that the points are on the designated lines: 1. front view water level, 2. left top ridge of container in top view, 3. vertical line that outlines the front wall in side view. The length of the line is not essential. Between clicking positions 1 and 2, 3 and 4, and 5 and 6, straight lines will appear (the numbers will actual not appear on the screen). Press 'Collect container information' to save this information.
  13. Remove both side mirror and LED panel and fill the water exactly up to the mark. Select 'Start Recording'. A new window asks for the duration in minutes. For the current purpose 1 min is enough. Press OK.
  14. After recording, exit Record Module, open Trajectory Module, select the calibration folder (made in step 1.6) with 'Data Location' (loading of the file might take some time). This folder contains the calibration files and the files of the just recorded data (step 1.13).
  15. Press the 'Acquire Background' button. A new window opens, without changing anything press OK. Wait until a (upside-down) image of the observation tank appears on the monitor. Then press 'Load Background'. The background picture will be corrected. A new window opens that asks for adjusting the boxes. Simply press OK.
  16. Push sequentially third through seventh button: 'Load Correspondence w/o water', 'Calibrate virtual camera(s)', 'Load refracted correspondence', 'Collect container geometries', 'Retrieve animal container info'. This latter step can take several minutes. It is completed when three white lines appear on the screen (which are the lines that were drawn in step 1.12). Press "Save container info" button.
  17. Push the 'Collect volume' button. Now, as shown in Figure 6, consecutively mark the 8 corners of the water body, which is a cuboid. For every point first click it in the front view and then in the top view.
  18. Select '3D' on the left corner of the window. Now a new window opens showing the outline of a box with a white bottom (as in Figure 15, but without the trajectory). Right click the mouse to select rotations and translations of the box view. If no image appears or if the image is not that of a cuboid (i.e. in step 1.17 the corners were right-clicked in the wrong order), do the following: while leaving, but not closing the Trajectory Module, using Windows go to the calibration folder (made in step 1.6), select subfolder 'Animal container data' and delete the file named TankVertices and repeat step 1.17.
  19. Congratulation, the calibration is completed. Ideally, a test run with a dummy fish should be performed to check if everything works well. The good news is that recalibration has only to be performed if the positions of mirror or camera were (even only slightly) altered or if there are problems with tracking (see section 3).

2. Recording

  1. Place the observation container filled up to the marks with water into the observation chamber such that the feet of the container are inserted into the holes provided for correct alignment. Orient the container such that the semi-transparent walls (or white walls in our example - see Discussion) face the far side and to the right as seen from the camera.
  2. Switch on the lights in the compartment, put the (experimental or dummy) fish into the container and close the curtains. Note: the system can record multiple fish (see the Representative Results section); however, it is advisable to gain some experience with the system by recording single fish first.
  3. Open the Record Module. On the screen appears the image of the front and top (mirror) view of the container. The image might not be ideal (e.g. overexposed, e.g. Figure 7) and might have to be adjusted (next three steps) to obtain good contrast between fish and background (e.g. Figure 8).
  4. Select 'Camera control' and, in the 'General Settings' window that opens, adjust 'Shutter' and 'Gain' (after deselecting the corresponding boxes to the right, see Figure 9) in such a way that the image is not overexposed and there is good contrast between fish and background.
  5. On the left side of the 'Camera control' window select 'White Balance/Color' and in the new window deselect the 'Auto' box and adjust the Red and Blue values (see Figure 10) to obtain best color contrast in both front and top view.
  6. It might be necessary to switch a few times between adjusting color (under 'White Balance/Color') and adjusting gain and shutter (under 'General Settings') to obtain the best camera setting. Be aware that even if you were to be satisfied without any adjustment, it is crucial to deselect the 'Shutter', 'Gain' and 'Auto' boxes (as explained in steps 2.4 and 2.5), otherwise the background will fluctuate over the course of the recording which makes it impossible to extract the trajectories. Do not change any of the other settings. When done close the 'Camera Control' window.
  7. From the main menu of the Record Module select 'Data location' to make or to open an earlier made folder. Note that every recording (e.g. fish or shoal) gets its own folder which should ideally be a subfolder of the experiment folder.
  8. Press 'Start recording'. A window opens that asks for the duration of the recording in minutes (only enter whole numbers). Press 'OK', which starts the actual recording session.
  9. If the recording is completed, exit the program. Before recording the next fish it is recommended to restart the computer. Use the Restart option in Windows to preserve the camera settings (from steps 2.4 and 2.5). The necessity to restart the computer between recordings is due to some problems with the camera card.
  10. Before going to the Trajectory Module for path reconstruction, copy and paste the 'Animal container data' and the 'Correspondence data' subfolders from the calibration folder (made in section one of this protocol) to every folder that was created during recording. In these latter folders two other subfolders are present, namely 'Raw data' and 'Time stamps'. The former contains all recorded frames in JPEG format; the latter contains information about the total number of frames and the intervals between the frames (in msec).

3. Path Reconstruction

  1. Open the Trajectory Module, press 'Data location' to select the folder that was created with the Record Module and then press the 'System Setup' button to open the 'Parameters' (see Figure 11).
  2. Select a Top and Bottom View Color Thresholds. A good starting value is 1,000. If this value is low, the software is more likely to record noise. However, if the value is too high, the fish might be below detection range. Later (steps 3.11 and 3.12) it might become necessary to readjust the color thresholds. Also note that the top and bottom color thresholds have not to be the same.
  3. Select Top and Bottom View Size Thresholds. A good starting value for a midsized zebrafish is 10, for a very big one 20, and for a very small one 5. The higher the size threshold, the less likely it is to pick up noise. However, if it is too high, the software might not be able to detect the fish either. Again, in step 3.11 and 3.12 it might become necessary to readjust the size thresholds. Also note that the top and bottom size thresholds have not to be the same.
  4. For 'Upper Size Threshold' a value of 3,000 is usually good and for 'Specific Length' leave it at 220 (already preset). The 'Number of fish' refers to the number of fish in the observation tank. 'Max num of Points' refers to the total number of frames. Remember (or write down) this number or a slightly lower one (e.g. 45,703 might be memorized as 45,000). Press OK.
  5. Sequentially press the buttons 'Load correspondence w/o water', 'Calibrate virtual camera(s)' and 'Load animal container info'. An error message will be generated if the calibration-subfolders 'Animal container data' and 'Corresponding data' were not copied to the current experimental folder (see step 2.10). If so, copy and paste those subfolders now and press the buttons again.
  6. Press the button 'Acquire background'. A new window will ask to fill in 'from' and 'to' with the default values 0 and 100, respectively. Change the 100 into the maximal number of frames (in the example given in step 3.4 this might be simplified as 45,000). Press OK.
  7. Wait until a (distorted) image appears. Then press 'Load background' which will result in establishing the correct background image. The fish should not be visible in this background image. If the fish is visible, try to acquire a better background from other recording segments (e.g. try 0-1,000, 1,000-2,000 etc. in step 3.6).
  8. If the fish did not move at all during the recording session, the only way to acquire a background is to remove the fish and make a new short recording without the fish, but with the same 'Camera Controls' settings (this is important). Acquire the background and copy the 'Background data' subfolder to the current experimental folder. Now press 'Load background', do not press 'Acquire background'. Note that opening and closing the curtain often results in somewhat changed background, thus it might become necessary to adjust the thresholds in steps 3.2 and 3.3 to reduce noise. Step 3.11 shows how to check for noise.
  9. After loading the background, adjust the three red boxes (with the help of the mouse) as depicted in Figure 12. The boxes mark the areas in which the software is looking for the fish. Close the box on the left (i.e. reduce it to a line or a point) because the side view is only used for calibration (as was explained in step 1.7).
  10. Press 'Start generating trajectories' button. A window opens asking for the starting frame number. Go with the default '0'. After pressing 'OK', the 'Tag assignments' window opens (see Figure 13). Press 'Step forward' until the tag ('X0') appears on the screen. If the tag is not placed on the image of the fish, press 'No' until it is placed correctly. Then press 'Go'. If it is never assigned correctly (or at all) press 'Go' anyway and look for the problem (next step).
  11. Path reconstruction starts. Ideally, the tag should always (or at least most of the time) be placed on the image of the fish. If it is often placed wrongly, open the 'Info' window (second choice above the video screen). Figure 14A shows the ideal case, where only the outlines of the fish are seen. Figure 14B shows a case of excessive noise which prevents the correct tag assignment. If you see a clear image of the fish without noise (as in Figure 14A), but the tag will never or only seldom be assigned correctly, then the most likely reason is that the calibration is off. Recalibrate and redo the path reconstruction. If during calibration, mirror and cameras are not moved, the new calibration data can be used for the previously performed recordings.
  12. In case of excessive noise (as in Figure 14B), press 'Stop' in main menu and choose new color and size thresholds (steps 3.2 and 3.3). Also check if the red boxes (step 3.9) can be reduced a little bit (for instance to exclude the noise generated by water movements at the top). Note that sometimes the program is 'stuck' (if no tag could be allocated at all): in this case restart the program.
  13. Watch the trajectory on the 3D-screen (third choice above the screen). Figure 15. represents an example of a trajectory. By right-clicking the mouse select between rotation and translations of the 3D-configuration.
  14. When the trajectory is completed, sequentially press the buttons 'Save' (not 'Stop', which deletes the trajectory!), 'Trajectory clean-up' and 'Trajectory smoothing'. A new window opens showing the filter-parameters for smoothing (Figure 16). Do not alter the default values before having gathered more experience with the system. Press 'OK'.
  15. By now it should be clear why choosing a good camera setting (with good contrast between fish and background) before recording (see steps 2.4-2.6) was so important. Proceed to Data Processing.

4. Data Processing

  1. First, take a look at the folder that was used for recording the fish (Figure 17). It contains 'Animal container data' and 'Correspondence data' subfolders which were copied from the calibration folder (step 2.10), the 'Time stamps' and 'Raw data' subfolders which were created during recording of the fish and the 'Background data' and 'Trajectories' subfolders which were created during path reconstruction.
  2. Figure 17 also shows that the 'Trajectories' subfolder contains three files. The point.smoothed-file is the file that will be used for further data processing. In case of multiple fish recording (e.g. shoaling experiment), for every fish a separate point.smoothed-file will be generated.
  3. Figure 18 shows the top part of an example point.smoothed-file. The first line gives the total number of samples or frames, the second line the duration of the recording (in minutes) and the third line the coordinates (sequence: x, z, y) of the center of the water body relative to the camera. This is followed by one line for every frame giving the x-, y-, z-coordinates (in mm) for the fish and the duration of that sample (in seconds).
  4. There are two ways to process the data provided in the point.smoothed-files: use the Data Processing Module or use other software, such as Excel or MATLAB to do calculations which are not (yet) incorporated in the Data Processing Module.
  5. Open Data Processing Module, select 'Project' on the toolbar, then from the pull-down menu select 'New' and then fill in a name for the experiment. Select 'Edit Project' on toolbar, select 'Add to Project' from the pull-down menu, followed by 'New group' and fill in a name for the group (e.g. 'Controls'). Note, at this moment the project and group names are not really used, but the names have to be filled. The created folders could be used to store the output files (see step 4.10).
  6. Select a group (e.g. 'Controls') in the right window (see Figure 19). The tool bar will change. Select 'Edit group', then 'Add to group' from the pull-down menu, then 'New measurements'. This will open a browser. Open the folder made during recording (step 2.7), select the subfolder 'trajectories' and then the point.smoothed-file. In the example presented in Figure 19, for Group-A six files were loaded, for Group-B four files. (Note that in the illustrated example the smoothed files have the extensions 0 and 1, because in that experiment two goldfish were tested simultaneously).
  7. For analysis, select the point-smoothed-file in the right window, select 'Data Processing', select 'Single Endpoints' from the pull-down menu and by way of example select 'Duration freezing' (Figure 20). A window opens to specify freezing in terms of speed threshold and duration threshold. In the example the fish spends 25.86 % of the observation time on freezing.
  8. To familiarize yourself within the program, try other examples, such as Travel distance, Depth Distribution (which allows you to determine the number of depth levels) and Burst frequency.
  9. There are more advanced calculations, such as spectral analysis of for instance the z-component of acceleration. In this case, select 'Time-series features', then 'TD freq domain analysis', 'Spectral analysis' and 'Z accele spectrum'. Fourier analysis will be performed on the indicated parameter (for explanation7). Not all options displayed on the menu are yet fully implemented. For instance, 'Path tortuosity' was only added experimentally.
  10. When selecting the option 'Batch processing using default threshold', about 200 endpoints will be calculated. In this context, 'default' means that delimiters have been set. For example, currently depth distribution is calculated for three depth levels, angular distribution is calculated for four sections (i.e. quadrants) etc. After generating the parameters a new window opens that asks for the location and name of the file to be created. Those will be saved in CSV-format and can be imported into other software, such as Excel, for further processing.
  11. In contrast to the Recording Module and Trajectory Module, the Data Processing Module is an evolving module that will be further adapted to the requirements of the researchers.

Representative Results

Six-month old female zebrafish (Danio rerio) of an unspecified ('short-fin') wild-type strain, were purchased from Aquatica Tropicals, Inc. In total 120 zebrafish were used. They were acclimated to the laboratory conditions for approximately 8 weeks in 38 L aquariums before starting the experiments. Water temperature was equal to room temperature (~23° C). Light regimen: 14 hr lights on (6:00-20:00), 10 hr lights off. Zebrafish were fed three times a day: 8:00 Tetra tropical flakes; 12:00 live brine shrimp larvae; 15:00 Tetra tropical flakes. On the days of the experiments, the zebrafish were fed flakes only at 8:00. Immediately after the second recording, the zebrafish were euthanized with 300 mg/L tricaine methanesulfate (MS-222).

For the control group 14 quadruplets (i.e. groups of four zebrafish) were used (n =14), for the MK-801 group 16 quadruplets (n = 16). After 1 hr exposure to 10 µM MK-801 (beginning at 9:30) in 1 L containers, the quadruplets were transferred to the observation containers. Recording was started immediately (at 10:30) and lasted 20 min. Subsequently, the zebrafish were left in the containers for 3.5 hr. During this period, aeration was provided via a tube connected to an air pump. At 14:00 a second 20 min recording was made. The goal of the two recordings was to study the effects of habituation and/or diminishing effects of the drugs (the half-life of MK-801 in rats is about 2 hr28). We analyzed (1) average social distances (also called inter-individual distances11,29) as measure for social cohesion, (2) vertical distribution over ten depth levels, (3) horizontal distribution over four radial zones (see Figure 24A, inset for locations of zones) and over quadrants (see Figure 24B, inset for locations of quadrants), and (4) the three components (x,y,z) of travel distance. The data were averaged per shoal. After Shapiro-Wilkins tests demonstrated that not all variables were normally distributed, Mann-Whitney U-tests were applied for all variables to compare means of control and MK-801 groups. These comparisons were performed separately for the morning and the afternoon sessions. We took α = 0.05/4 = 0.0125, because four (groups of) variables were used (see above).

Figure 2A shows a typical example frame for control zebrafish and Figure 2B shows a typical example frame for zebrafish treated with MK-801, both recorded during the morning session. Notice that the control zebrafish were close to the bottom, close to the front wall (i.e. the side closest to the camera) and stayed closely together (i.e. social cohesion was high). In contrast, the zebrafish treated with MK-801 were close to the top, they did not show any preference in the horizontal plane and they swam at considerable distance from one another (i.e. social cohesion was low). Figure 21 shows representative trajectories. The control zebrafish had a clear tendency to remain at the front side of the observation container. Moreover, they stayed close to the bottom most of the time. Zebrafish treated with MK801, on the other hand, swam anywhere on the horizontal plane. However, they had a clear preference for the upper depth levels at 10:30. At 14:00, their vertical distributions became more homogenous.

Quantitative analysis of the data confirmed our description. Figure 22A shows that the average social distance (i.e. the average inter-individual distances between the four zebrafish of the quadruplets) was for MK-801 zebrafish more than three times as large as for control zebrafish during the morning (at 10:30), with U = 0 and p<0.00001. After 3.5 hr habituation (at 14:00), the social distance in control zebrafish increased, whereas it remained more or less unchanged in MK-801 zebrafish. However, it remained significantly different for both groups (U = 19, p<0.0005) Figure 22B shows the timelines of social distance for the two experimental groups for both 10:30 and 14:00.

The vertical distribution was also very different for both groups. Figure 23 shows that both in the morning (10:30) and in the afternoon (14:00), control zebrafish spent most of the time at the two to three lowest depth levels (i.e. the levels closest to the bottom of the observation container). The MK-801 zebrafish, on the other hand, swam most of the time close to the surface of the water at 10:30 (Figure 23A). After 3.5 hr habituation, at 14:00 they were more or less equally distributed over all depth levels.

The horizontal distribution was also very different for both experimental groups. In Figure 24A we see that MK-801 zebrafish spent less time in the outer zone and more time in the middle and the central zones than control zebrafish did. The differences between groups in regard to the quadrants were even more obvious (Figure 24B). Control zebrafish had a very strong preference for the two front quadrants (1 and 4), i.e. the side of the container closest to the camera. MK-801 zebrafish, on the other hand, were more or less equally distributed over the four quadrants.

As far as kinematic parameters are concerned, we limit the discussion here to travel distance (Figure 25). The MK-801 zebrafish moved more than control zebrafish. Interestingly, this difference was especially significant for the y-component of travel distance. This is the direction of the camera (see Figure 1). Indeed, control zebrafish stayed most of the time close to the front wall in quadrants 1 and 4 (as can be seen in Figures 24A and 24B). MK-801 zebrafish, on the other hand, moved back and forth between front and back halves of the container.

Here, we have presented only a sample of the possible ways to analyze the data provided by the experiment. At this point we restrain from attaching any specific biological interpretation to the results. However, it is worth mentioning that MK-801 has been found to induce social withdrawal30 and reduce social investigative behaviors in rats31 and has been studied as model for negative sumptomes of schizophrenia30. It also caused hyperactivity31, circling behavior32, sensory impairment33, and reduced prepulse inhibition34 in mammals. Although we did not specifically test for those impairments, our findings seem to be consistent with them. More specific experimental setups are required to determine whether the described effects of MK-801 in zebrafish are comparable to those described in mammals. Further analyses and experiments would also be necessary to decide whether anxiety, respiration problems, spatial disorientation, attention deficit, stereotypy etc. played significant roles in the altered behaviors induced by MK-801 in the zebrafish.

Figure 1
Figure 1. Schematic diagram of apparatus. The camera captures frames (i.e. still images) showing both the front view and the top view of the observation tank. The frames are stored in the computer for further processing. Note the locations of the xyz-dimensions, which are important for describing the 3D characteristics of the movements and locations of the zebrafish. The two shaded walls in the figure (and the bottom of the tank) were in our experiment (see Representative Results) painted white, whereas the two other walls were transparent. Click here to view larger image.

Figure 2
Figure 2. Example frames. Note that the front or top views alone are characterized by loss of information. This is especially clearly visible in panel B where the three zebrafish on the left seem to be in close proximity to one another when looking at the front view, whereas the top view shows that this is not true. On the other hand, the top view does not give any indication of the distance from bottom. A) Control zebrafish. B) Zebrafish treated with 10 µM MK-801. Note that the color (blue) of the background was generated by the recording software and was chosen to obtain good contrast. The real color of the walls in the back and on the right and of the bottom was white. Click here to view larger image.

Figure 3
Figure 3. Alignment of side mirror. The white arrow on the left indicates the front wall (closest to the camera) in the side mirror. If two lines are visible, correct the position of the side mirror until only one line is visible (step 1.2). The 5 LEDs of the calibration panel are clearly visible on all three views. Note that because the lights in the chamber are switched on, many other reflections are seen on the LED panel (step 1.4). Click here to view larger image.

Figure 4
Figure 4. Tagging the LEDs. The left panel shows that the five tags (as numbered from 0-4) identified by the calibration procedure do not coincide with the actual LEDs. Besides the LEDs other light spots (in fact reflections) can be seen. On the right panel, gain and shutter were reduced such that only the LEDs are visible. Now the five tags are assigned correctly (as described in steps 1.7-1.10). Click here to view larger image.

Figure 5
Figure 5. Collect container info. The sequence of the six points to be selected (by right-clicking the mouse) is presented. The lines will be drawn automatically. Note that the here indicated numbers do not appear on the screen. When done, press 'Collect container info' (as described in step 1.12). Click here to view larger image.

Figure 6
Figure 6. Collect volume. Right-click the mouse on the indicated locations marking the corners of the water body: first mark the corner in the front view and then in the top view. Then go to the next corner (from 1-8). Note that the eight points mark the outline of the water body, not of the tank. Also note that when right-clicking the mouse only 'x0' appears, which will disappear again when clicking on the next spot (thus the numbers 1-8 do not actually appear on the screen). The procedure is described in step 1.17. Click here to view larger image.

Figure 7
Figure 7. Uncorrected contrast. The image is overexposed and the contrast between fish and background (especially in the front view) is low. Click here to view larger image.

Figure 8

Figure 8. Corrected contrast. The contrast is now improved as compared to Figure 7. Note that the colors on the screen are false colors. Click here to view larger image.

Figure 9
Figure 9. General Settings. After selecting 'Camera control' in the main menu, the 'General Settings' window opens. Deselect 'Shutter' and 'Gain' boxes and use the sliders to find the best contrast between fish and background. Click here to view larger image.

Figure 10
Figure 10. Color settings. In the 'White Balance/Color' window deselect the 'Auto' box and use the 'Red' and 'Blue' sliders to find the best combination for good contrast between fish and background. Parameters. After opening the Trajectory Module, select the experimental file with 'Data location' and then open the 'Parameters' window with 'System Setup'. Good starting values are here assigned to the parameters. Click here to view larger image.

Figure 11
Figure 11. Parameters. After opening the Trajectory Module, select the experimental file with ‘Data location’ and then open the ‘Parameters’ window with ‘System Setup’. Good starting values are here assigned to the parameters. .Click here to view larger image.

Figure 12
Figure 12. Box alignment. Note how the red boxes for the top and the front view define the areas in which the fish might be found. The box to the left is reduced to a line to exclude this area from the search. Click here to view larger image.

Figure 13

Figure 13. Tag assignments. After pressing the 'Start generating trajectories' button and choosing the starting frame (normally frame #0), the 'Tag assignments' window opens. Press 'Step forward' until the tag ('X0') appears on the screen. If the tag is not placed on the image of the fish, press 'No' until it is placed correctly. Then press 'Go'. Click here to view larger image.

Figure 14
Figure 14. Info screen. Panel (A) shows the correct tag assignment. The tag ('X0') is placed on the image of the fish in both views. Usually a line passes through the tag. Panel (B) shows excessive noise and the absence of tag assignment. The frames were acquired from the same recording by changing the color and size thresholds (in step 2.2) from 1,000-50 and 10-5, respectively. Click here to view larger image.

Figure 15
Figure 15. Three-D representation of the reconstructed path. The origin of the arrows is located at the left-front corner of the tank for orientation purposes (see also Figure 1). Thus in this example the fish stays close to the left wall (relative to the camera). Click here to view larger image.

Figure 16
Figure 16. Trajectory smoothing. This window opens after pressing the 'Trajectory smoothing' button. For the time being accept the default value by pressing 'OK'. Click here to view larger image.

Figure 17
Figure 17. Subfolders. The folder generated during recording is shown above. After path reconstruction it contains the six indicated subfolders. Click here to view larger image.

Figure 18
Figure 18. Smoothed file. Top part of an example point.smoothed-file is shown, indicating number of frames, duration of recording (in min), coordinates of center of water body relative to camera, and for every frame the coordinates and the duration. Click here to view larger image.

Figure 19
Figure 19. Data processing. Selecting the files to be analyzed (right window). Click here to view larger image.

Figure 20
Figure 20. Example analysis. The endpoints of interest can be calculated by selecting them from the menu. In this example 'Duration Freezing' was selected. The program asks to provide speed and duration thresholds that define freezing. The result is expressed in percentage of the total duration of the recording. Click here to view larger image.

Figure 21
Figure 21. Representative trajectories. Two representative trajectories for control zebrafish and two representative trajectories for zebrafish treated with 10 µM MK-801 are presented for the morning session starting at 10:30 (upper row) and for the afternoon session starting at 14:00 (lower row). The trajectories for the individual zebrafish of every quadruplet are presented by a different color. However, note that tag swapping might have taken place. Manual correction is required if it is crucial to follow the individual lines. The left front side (origin of the insert arrows) of the depicted container is the side that is closest to the camera (see Figure 1 for positioning of tank). Click here to view larger image.

Figure 22
Figure 22. Average social distance between fish. A) Average social distances for control zebrafish and zebrafish treated with 10 µM MK-801 are presented for the morning and the afternoon sessions. Mean and S.E.M. are presented. ***, p<0.001. B) The timelines of the average inter-individual are presented for both groups. Click here to view larger image.

Figure 23
Figure 23. Depth distribution. A) Distribution of the zebrafish over ten equal depth levels (with level 1 being the level closest to the bottom) for the morning session. B) Distribution of the zebrafish for the afternoon session. Mean and S.E.M. are presented. *, p<0.0125; **, p<0.005; ***, p<0.001. Click here to view larger image.

Figure 24
Figure 24. Horizontal distributions. (A) Temporal distribution over the four radial zones of the experimental groups is presented. The inset shows the locations of the zones from center to periphery: center, middle, outer and combined-corner zones. (B) Temporal distribution over the four quadrants of the experimental groups is presented. The inset shows the location of the quadrants. The walls indicated by double lines represent white walls, those presented by single lines present transparent walls. The camera is located left of the inset, i.e. closest to quadrants 1 and 4 (see also Figure 1). Mean and S.E.M. are presented. Black asterisks denote comparisons between the groups for the morning session and grey asterisks those for the afternoon sessions: *, p<0.0125; **, p<0.005; ***, p<0.001. Click here to view larger image.

Figure 25
Figure 25. Travel distance. The xyz-components of travel distance for the zebrafish during the morning and the afternoon sessions are shown. Mean and S.E.M. are presented. Black asterisks denote comparisons between the groups for the morning session and grey asterisks those for the afternoon sessions: *, p<0.0125; ***, p<0.001. Click here to view larger image.


The experimental procedure shown here allows recording individual zebrafish, pairs of zebrafish (e.g. to study mating or aggression) and shoals of zebrafish (as shown in the representative example). The system is especially suited for simultaneously obtaining information about 3D (vertical and horizontal) distribution, kinematic characteristics (e.g. velocity, acceleration, turning angle) and social parameters (e.g. social cohesion). In the following, we list a few important issues to consider when planning experiments.

Depending on the experimental procedure, different behavioral systems can be studied. For instance, to explore neophobia (i.e. fear for new environments) the recording should be started immediately after introducing the zebrafish to the observation tank (after waiting just for a few seconds for the water to settle down to diminish noise), without prior habituation11,17,37. On the other hand, some research topics might require the zebrafish to be well habituated, for instance when studying the effects of alarm pheromones16. When studying groups of zebrafish, the experimenter should be aware that although the software minimizes switching of tags, it is at this moment not possible to follow individual zebrafish throughout. This is also not important for shoaling studies where the emphasis is on social cohesion, but would be crucial when exploring aggression or mating. Manual reassignment of tags is an option, but can be very time-consuming.

The color of the walls of the observation container and of the observation chamber can have great influence on the behavior of the zebrafish. For instance, white walls have been described to induce aversion responses36, 37. When trying different colors, keep two things in mind: 1) it is important that the front wall (i.e. the wall closest to the camera) remains transparent and that a lid (if one is used) also has to be transparent; 2) when selecting a color never used before, first determine whether the contrast between zebrafish and background is appropriate for recording. Do a test run. Changing the camera settings for recording (Gain, Shutter, Red and Blue, as explained in steps 2.5 and 2.6) and the settings for trajectory reconstruction (e.g. color and size thresholds, as explained in steps 3.3, 3.5, 3.11, and 3.12) can make a big difference. Again, experience with the system will go a long way to decide what is possible.

Depending on the purpose of the experiment, a light source with different characteristics (e.g. spectrum, intensity) might be desirable. The LED bars can easily be replaced. Make sure that the light reaches every part of the container.

If the experiment requires that the zebrafish remains in the observation container for several hours, make sure to provide aeration. An air tube can be attached to the back right corner by using a clip. Check on the computer screen that the clip does not interfere with the recording, i.e. that the zebrafish is at no time hidden from view. In Figures 2A and 2B the black clip can be seen in the top view. Ideally, aeration should be provided before or between recordings, but not during recording as to prevent noise. Also note that switching strong aeration on or off might startle the zebrafish.

If the experiment requires keeping the zebrafish in the container overnight, it is useful to cover the observation chamber with a transparent lid to prevent the zebrafish from leaping out (which is a very common occurrence). If the cover is not removed before recording (as not to disturb the zebrafish), consider the following two points: 1) make sure that the mirror images of the light sources do not obstruct the recording (e.g. by shifting the light sources or by choosing a lid that does reflect light only minimally); 2) consider that the lid might become foggy when used overnight, especially since in this case aeration has also to be provided; one way to reduce this is to choose a lid with small holes in it.

For some experiments it might be essential to determine the baseline behavior of the zebrafish before administering a drug. In this case, the drug can be added between sessions by way of a tube (similar to the aeration tube discussed above).

Although the focus here was on recording zebrafish (Danio rerio), other fish species can, of course, also be recorded with the system. It has been used to study behaviors in (juvenile) goldfish (Carassius auratus), tiger barb (Barbus tetrazona), and green swordtail (Xiphophorus helleri).

Finally it should be noted that other dimensions of the observation tanks are principally possible. However, it would require reconfiguring the system and finding a good balance between spatial and temporal resolution when using much larger observation containers. Furthermore, the shape of the container has to be cuboid. The number of zebrafish or other experimental subjects is theoretically unlimited; however tag swapping increases with number of subjects.


Hans Maaswinkel, Liqun Zhu and Wei Weng are employees of xyZfish, Ronkonkoma NY, that produces the tracking system used in this article.


The authors have no acknowledgements.


Name Company Catalog Number Comments
AABT-3D Tracking Hardware xyZfish AABT II Includes camera, video card, observation compartment with mirror and lighting
AABT-3D Calibration equipment xyZfish calib Contains calibration panel and side mirror
AABT-3D Observation containers xyZfish cubes  
AABT-3D Tracking software xyZfish v.1.0  
Computer optional N/A Windows XP or higher
(+)-MK-801 hydrogen maleate Sigma M107  
Air pump Fusion 500  
Air line tubing 3/16” Lee’s Aquarium and Pet Products 14508  
Medium Binder Clips OfficeDepot 561339 To attach airline to observation container



  1. Brennan, C. H. Zebrafish behavioural assays of translational relevance for the study of psychiatric disease. Rev. Neurosci. 22, 37-48 (2011).
  2. Kabashi, E., Brustein, E., Champagne, N., Drapeau, P. Zebrafish models for the functional genomics of neurogenetic disorders. Biochim. Biophys. Acta. 1812, 335-345 (2011).
  3. McCollum, C. W., Ducharme, N. A., Bondesson, M., Gustafsson, J. A. Developmental toxicity screening in zebrafish. Birth. Defects. Res. C. Embryo Today. 93, 67-114 (2011).
  4. Kurta, A., Palestis, B. Effects of ethanol on the shoaling behavior of zebrafish (Danio rerio). Dose-Response. 8, 527-533 (2010).
  5. Sison, M., Gerlai, R. Behavioral performance altering effects of MK-801 in zebrafish (Danio rerio). Behav. Brain Res. 220, 331-337 (2011).
  6. Delcourt, J., Denoël, M., Ylieff, M., Poncin, P. Video multitracking of fish behaviour: a synthesis and future perspectives. Fish Fish. 14, 186-204 (2013).
  7. Zhu, L., Weng, W. Catadioptric stereo-vision system for the real-time monitoring of 3D behavior in aquatic animals. Physiol. Behav. 91, 106-119 (2007).
  8. System for 3D monitoring and analysis of motion behavior of targets. US patent. Zhu, L., Wang, J., Su, R., Weng, W. 8306260 (2012).
  9. Cachat, J., et al. Three-dimensional neurophenotyping of adult zebrafish behavior. PLoS ONE. 6, e17597 (2011).
  10. Maaswinkel, H., Zhu, L., Weng, W. The immediate and the delayed effects of buspirone on zebrafish (Danio rerio) in an open field test: a 3-D approach. Behav. Brain Res. 234, 365-374 (2012).
  11. Maaswinkel, H., Le, X., He, L., Zhu, L., Weng, W. Dissociating the effects of habituation, black walls, buspirone and ethanol on anxiety-like behavioral responses in shoaling zebrafish. A 3D approach to social behavior. Pharmacol. Biochem. Behav. 108, 16-27 (2013).
  12. Maaswinkel, H., Zhu, L., Weng, W. The advantages of a 3D-automatic recording system for the study of shoaling behavior in zebrafish. 10th International Conference Zebrafish Development and Genetics, Madison, (2012).
  13. Maaswinkel, H., Zhu, L., Weng, W. An automatic recording system to quantify antagonistic interactions between zebrafish. Abstract. 10th International Conference Zebrafish Development and Genetics, Madison, (2012).
  14. Spence, R., Gerlach, G., Lawrence, C., Smith, C. The behaviour and ecology of the zebrafish, Danio rerio. Biol. Rev. Camb. Phil. Soc. 83, 13-34 (2008).
  15. Krause, J., Hartmann, N., Pritchard, V. L. The influence of nutritional state on shoal choice in zebrafish, Danio rerio. Anim. Behav. 57, 771-775 (1999).
  16. Speedie, N., Gerlai, R. Alarm substance induced behavioral responses in zebrafish (Danio rerio). Behav. Brain Res. 188, 168-177 (2008).
  17. Gebauer, D. L., Pagnussat, N., Piato, A. L., Schaeffer, I. C., Bonan, C. D., Lara, D. R. Effects of anxiolytics in zebrafish: similarities and differences between benzodiazepines, buspirone and. 99, 480-486 (2011).
  18. Paull, G. C., Filby, A. L., Giddins, H. G., Coe, T. S., Hamilton, P. B., Tyler, C. R. Dominance hierarchies in zebrafish (Danio rerio) and their relationship with reproductive success. Zebrafish. 7, 109-117 (2010).
  19. Engeszer, R. E., Ryan, M. J., Parichy, D. M. Learned social preference in zebrafish. Curr. Biol. 14, 881-884 (2004).
  20. Mathur, P., Guo, S. Use of zebrafish as a model to understand mechanisms of addiction and complex neurobehavioral phenotypes. Neurobiol. Dis. 40, 66-72 (2010).
  21. Tropepe, V., Sive, H. L. Can zebrafish be used as a model to study the neurodevelopmental causes of autism. Genes Brain Behav. 2, 268-281 (2003).
  22. Echevarria, D. J., Hammack, C. M., Pratt, D. W., Hosemann, J. D. A novel behavioral test battery to assess global drug effects using zebrafish. Int. J. Comp. Psychol. 21, 19-34 (2008).
  23. Seibt, K. J., Piato, A. L., Luz Oliveira, da, Capiotti, R., Vianna, K. M., R, M., Bonan, C. D. Antipsychotic drugs reverse MK-801 induced cognitive and social interaction deficits in zebrafish (Danio rerio). Behav. Brain. Res. 224, 135-139 (2011).
  24. Zou, H., et al. Low dose MK-801 reduces social investigation in mice. Pharmacol. Biochem. Behav. 90, 753-757 (2008).
  25. Ng, M. C., Hsu, C. P., Wu, Y. J., Wu, S. Y., Yang, Y. L., Lu, K. T. Effect of MK-801-induced impairment of inhibitory avoidance learning in zebrafish via inactivation of extracellular signal-regulated kinase (ERK) in telencephalon. Fish Physiol. Biochem. 38, 1099-1106 (2012).
  26. Sison, M., Gerlai, R. Associative learning performance is impaired in zebrafish (Danio rerio) by the NMDA-R antagonist MK-801. Neurobiol. Learn. Mem. 96, 230-237 (2011).
  27. Swain, H. A., Sigstad, C., Scalzo, F. M. Effects of dizocilpine (MK-801) on circling behavior, swimming activity, and place preference in zebrafish (Danio rerio). Neurotox. Teratol. 26, 725-729 (2004).
  28. Vezzani, A., et al. Kinetics of MK-801 and its effect on quinolinic acid-induced seizures and neurotoxicity in rats. J. Pharmacol. Exp. Ther. 249, 278-283 (1989).
  29. Green, J., et al. Automated high-throughput neurophenotyping of zebrafish social behavior. J. Neurosci. Methods. 210, 266-271 (2012).
  30. Rung, J. P., Carlsson, A., Rydén Markinhuhta, K., Carlsson, M. L. (+)-MK-801 induced social withdrawal in rats; a model for negative symptoms of schizophrenia. Prog. Neuro-psychopharmacol. Biol. Psych. 29, 827-832 (2005).
  31. Gururajan, A., Taylor, D. A., Malone, D. T. Cannabidiol and clozapine reverse MK-801-induced deficits in social interaction and hyperactivity in Sprague-Dawley rats. J. Psychopharmacol. 226, 1317-1332 (2012).
  32. Burket, J. A., Cannon, W. R., Jacome, L. F., Deutsch, S. I. MK-801, a noncompetitive NMDA receptor antagonist, elicits circling behavior in the genetically inbred Balb/c mouse strain. Brain Res. Bull. 83, 337-339 (2010).
  33. Saunders, J. A., Gandal, M. J., Roberts, T. P., Siegel, S. J. NMDA antagonist MK801 recreates auditory electrophysiology disruption present in autism and other neurodevelopmental disorders. Behav. Brain Res. 234, 233-237 (2012).
  34. Brosda, J., et al. Pharmacological and parametrical investigation of prepulse inhibition of startle and prepulse elicited reactions in Wistar rats. Pharmacol. Biochem. Behav. 99, 22-28 (2011).
  35. Wong, K., et al. Analyzing habituation responses to novelty in zebrafish (Danio rerio). Behav. Brain Res. 208, 450-457 (2010).
  36. Maximino, C., et al. Parametric analyses of anxiety in zebrafish scototaxis. Behav. Brain Res. 210, 1-7 (2010).
  37. Blaser, R. E., Rosemberg, D. B. Measures of anxiety in zebrafish (Danio rerio): dissociation of black/white preference and novel tank test. PloS One. 7, e36931 (2012).
Using an Automated 3D-tracking System to Record Individual and Shoals of Adult Zebrafish
Play Video

Cite this Article

Maaswinkel, H., Zhu, L., Weng, W. Using an Automated 3D-tracking System to Record Individual and Shoals of Adult Zebrafish. J. Vis. Exp. (82), e50681, doi:10.3791/50681 (2013).More

Maaswinkel, H., Zhu, L., Weng, W. Using an Automated 3D-tracking System to Record Individual and Shoals of Adult Zebrafish. J. Vis. Exp. (82), e50681, doi:10.3791/50681 (2013).

Copy Citation Download Citation Reprints and Permissions
View Video

Get cutting-edge science videos from JoVE sent straight to your inbox every month.

Waiting X
Simple Hit Counter