entry_exit_mouse_box.measures module
- class entry_exit_mouse_box.measures.MiceVisibilityProcessor(mask_path, areas, ma, start, duration)[source]
Bases:
object
Calculates an array indicating for each box (designated by the labels in ‘areas’) if a mouse is inside or not. The process is realized on several threads. The input video was saved as a mask (0=BG, 255=FG) but it requires thresholding anyway due to compression. The areas are a grayscale image with one value per box (0=BG). To process the presence of a mouse, we use the length of the ellipse fitted to the mouse’s label. It requires the input image to be calibrated. The process doesn’t start from the frame 0 but from the frame ‘start’. We don’t need a control structure to write in the buffer as the threads are not writing in the same place.
- process_sessions()[source]
We call ‘session’ the span of time during which the mouse is hidden or visible. For each box, a video is a succession of sessions, alternating between hidden and visible. During a session, the mouse is either hidden or visible. A session is defined by a duration (in seconds) and a distance (in pixels).