Image Processing Reference
borders of the patch are defined manually, using the ImageJ software ellipse tool [ 8 ], and are
calculated as length of the radius from centroid of the patch. All flies outside this radius are
considered “of patch.” Lighting was ambient room lighting. Videos were recorded for 1 h in-
tervals, and a subset were scored for joining and leaving by hand, to evaluate accuracy.
To facilitate tracking and individual-fly (sex and genotype) identification, we painted a
small color-coded dot on each fly (either blue or yellow). For color detection problems there
are drawbacks to the RGB color space. First, there is a high correlation between red, green, and
blue channels; moreover, they are not robust to lighting conditions. In many situations, one
and nonlinear color spaces that achieve beter color constancy, efective bandwidth reduction,
in 3D HSV space, which were most effective for distinguishing blob colors. Each pixel within
the ly silhouete was assigned to a color based on h , s , and v , and values, and pixels which
were not within these thresholds were disregarded. The paint color was inferred by the major-
ity of pixels.
Blobs are identified for each frame, or time T . The number of blobs, and blob statistics for
each T , were output. Blob statistics include the blob X and Y centroids ( B X and B Y ); ited-el-
lipse major and minor axes ( B A , B B ); and blob area (in pixels, B P ). Blobs with centroids outside
the perimeter of the patch are excluded. Every blob is assigned a unique identifier within a
frame ( B i ). Each blob is subsequently assigned an inferred fly number ( B n , below).
Flies are taken to be nonfissible blob units. We infer the number and identity of flies within
blobs by tracking fusion and fission events. We construct tracks by making three simplifying
assumptions (based on observation). First, that flies do not often move a greater distance than
their body length between frames. Second, that the noise in blob area estimation is not large
between consecutive frames (i.e., less than half the actual fly area). Third, (on the scale of 30
frames a second) that flies do not join and leave patches often, that is, we conservatively as-
sume fly number does not change, unless there is no other explanation for the data. TABU is
Trajectories are constructed by initializing the first frame assuming each blob is a single fly
Subsequently, we implement the following algorithm at each frame:
1. Identify Neighborhoods : For each pair of frames T t and T t + 1 , we construct a graph by drawing
edges between blobs that (a) are in different frames and (b) overlap. We define overlapping
as having centroids within the distance of the major axis B A of the blob ellipse. We define
two degrees of overlapping: mutual and unidirectional. A mutual overlap occurs when the
B A of both blobs is longer than the distance between their centroids. If only one B A is this
long, the overlap is unidirectional. A “neighborhood” is defined as group of blobs linked
by mutual edges.
2. Check “ Joins ” and “ Leaves ”: We test for probable joining and leaving events by examining
blobs that are not in a neighborhood with other blobs, using the more-relaxed unidirec-
tional overlap. Flies in blobs in T t with no unidirectional matches in T t + 1 are assumed to
have left, and flies in blobs in T t + 1 with no unidirectional matches in T t are assumed to have
joined. Otherwise, the unmatched blobs are assigned to their nearest unidirectional match.
3. Assign flies to blobs : In the simplest case, a neighborhood is comprised of a single blob in T t
and T t + 1 . If so, all flies in the blob at T t are assigned to the blob at T t + 1 . In more complex
cases, we assign flies between blobs to minimize the difference between summed ly-area
and their respective B P . Every fly inherits the blob-specific statistics of its assigned blob.