Detect the position of flies placed into individual cages from a stack of time-lapse images collected from a webcam (names are incremented and stamped with date and time). Read a large number of frames (1 / min over 7 days for ex) without the need of loading all of them into memory. This plugin is adapted from Fabrice de Chaumont “Single Mouse Track”. Results (t, x, y, cage) are exported into an Excel file. (ATTENTION: Java 8 is needed)
The purpose of Drosotrack is to collect the positions of flies placed into individual containers across time, and to evaluate when they stop moving (aka when they are dead). The idea is to be able to monitor this by collecting a time lapse series of images snapped each minute over 3-7 days, using a webcam. Drosotrack will analyze the stack of images (whatever its size) and export an excel file with the x,y coordinates of each fly across time.
Drosotrack reads either avi files or a stack of files (jpg) stored in a directory (with names incremented). Once the stack is opened by the dialog box (click to set/change video source) (make sure the correct option is selected: AVI or stack), you can display the images normally.
The first step to the analysis is to define “cages”, by drawing a polygonROI around each area to which each individual is confined. In our setup, we have a row of 8 rectangular cages. This array of polygonROIs can be stored onto the disk as an xml file.
The second step of the analysis is to adjust the analysis parameters:
- start and end frame : number of the first image and of the last image. By default, this is set from 0 to the end.
- analyze step: in order to shorten the analysis, one may want to skip images, for example by reading the positions only once per hour (if so, set step = 60 if the sampling rate is 1 image per min.). Default: 1.
- fly detect threshold: an integer that defines a threshold used to detect flies against the background. Default: 25.
- jitter (to count fly as dead): due to the camera noise, even dead flies show some “movement”. This threshold defines how much movement is acceptable to count a fly as immobile. Default: 5.
- track on a dark background: click this if your flies are white on a dark background.
Once these parameters are adjusted, start the analysis by hitting the button “start computation”. Each image will be loaded in memory and the position of each fly will be marked with a green rectangle (no panic, it occurs with a delay and often the next image is already displayed while the rectangles are not all displayed). With images of 1280 x 720 pixels, detecting flies in 8 rectangles of approximately 255 x 75 pixels, takes about 3000 s for 9900 images.
At the end of the analysis, an excel file is created with a fixed name (todo: check if exists, do not overwrite) with the x,y position of each fly across time. If the analysis was made on a stack of jpg files, an additional column list the file names (which is quite useful if the names include the date and the time).
The detected positions are also stored in Icy as ROIs, so that you can then go image by image and modify by hand the position of the incorrect ROIs (…!). These rois positions can be exported from within Icy to another excel file.