Software for analyzing the behavioural test “Morris Water Maze”

. The Morris Water Maze Behavioural Test is a universal method for testing cognitive functions in experimental rodents, and it is especially effective in detecting deviations in memory functions and learning, which makes it indispensable in the study of neurodegenerative diseases, effect of therapeutic drugs, rodent stroke and aging models etc. However, despite the wide range of possible applications, data analysis makes the use of this test difficult. Currently, automated tracking and analysis programs of rodent moving are becoming to be popular. Thus, our goal was to develop and create an available quality product, which will allow the scientist to carry out research as efficiently as possible doing various options of the “Morris water maze” using latest modern parameters. In this article, we analyze different types of the Morris water maze methodology and the current scientific parameters of this test to understand the necessary and optimal capabilities of the future program, then to overcome the limitations of the systems currently available we have combined detection and tracking techniques into one standalone tool. The result of the work is a software product that allows to quickly and accurately detect the trajectory of animal moving in the water, and also provides parameters for evaluating the cognitive functions of memory and learning.


Introduction
The Morris Water Maze has become the gold standard for the study of spatial memory and learning processes, is a must-have test for phenotyping mutant and transgenic mice [1], and is often used as a general analysis of cognitive function [2], for example, to test the effects of various disorders of the nervous system, such as animal models of stroke [3], aging [4], neurodegenerative diseases [5][6][7][8][9] or the potential impact of new therapeutic agents [10]. The basic idea behind this behavioral test is simple -animals, usually rats or mice, are placed in a large circular pool of water and need to get out of the water onto a hidden platform.
The numerous protocols for this test are so sensitive to changes in normal function in various areas of the brain, not just the hippocampus, that they can be used as an "indicator" of normal cognitive functioning.
The basic protocol, which aims to diagnose the spatial reference memory, consists of a daily series of tests in which an experimental rodent swims in opaque water looking for a hidden platform [11][12][13]. In this case, the simplest and most revealing parameter is the platform search latency time. The latency is calculated from the period between the beginning of the rodent movement and the time point when it found the location of the platform [14]. The second revealing parameter is the percentage of time the rodent spent in one of the four imaginary quadrants the platform is in [14]. In this modification of the protocol, the last single test is an obligatory step, when the platform is completely removed from the pool, and the rodent swims for a certain amount of time in opaque water, where there is no platform. To evaluate this step, the parameter of the percentage of time spent by the rodent in the quadrant where the platform was being is used, as well as another parameter -the number of intersections of the rodent's path and the area of interest (ROI), highlighted in the place where the platform was previously.
Another MWM protocol is used to test working memory, for this, a condition of delayed matching to place is created [2,15,16]. The main difference with based protocol is daily random change of the hidden platform location and just two tests per day, thus there is a daily change of the ROI. Also, the reverse learning protocol is associated with the constant change of the platform position [17].
Recognition learning procedure was developed to study the process of spatial and nonspatial recognition [18]. This configuration use two hidden platforms, one of which is standard "right" and the other is unstable floating "wrong". Sometimes the location of the right platform additionally changes daily. Thus in this case, there are two areas of interest simultaneously, one of which may change daily. Other options for conducting the Morris Water Maze include changes such as limiting the trajectory of a swimming animal to minimize navigation requirements (for example, a circular water maze [19]), reducing the number of available external signals between learning trials [16], the use of floating or folding platforms and other manipulations.
In addition to the parameters already mentioned, more and more complex metrics are gaining popularity. For example, learning index, cumulative search error, Whishaw error, angular deviation error and experimental animal search strategies. The Learning Index (or Gallagher's proximity) [20] is a mean measure of proximity calculated from the distance between the ROI (hidden platform or where the platform was previously) and the current position of the rodent in the pool. In the original 1993 paper, the proximity was calculated ten times per second, and the average was taken every second. Summation second mean measures of proximity up gives the cumulative search error for each trials [21]. The distance between the rodent's starting point of swimming and the platform location is sometimes subtracted from the cumulative search error to normalize the parameter to different starting locations. Another interesting and indicative parameter for assessing the behavior of an animal in the "Morris water maze" is Whishaw's error [22,23]. To calculate this parameter, an imaginary corridor with an arbitrary width is constructed, which is determined by the researcher, the central line of this corridor is a straight line connecting the initial position of the test animal with the location of the platform. The percentage of time spent by the animal in an imaginary corridor is calculated. The heading angle error is an effective but rarely used parameter [24]. It is defined as the value of the deviation of the angle between the orientation of the animal at a certain point of its swimming in the pool and the direct path of the beginning of the movement of the animal towards the platform. Sometimes, instead of the initial position of the animal, the change in the angle of orientation of the animal in space relative to the platform is compared between every first and second seconds of the test [24]. Classification methods of search strategies provide additional insight into various types of animal behavior [25]. It is considered more E3S Web of Conferences 203, 01029 (2020) EBWFF-2020 https://doi.org/10.1051/e3sconf/202020301029 objective to classify not entire trajectories, but individual segments of it [26], which makes it possible to identify animals with mixed behavior.
Therefore, the availability of high-quality software capable of measuring parameters more complex than the latency time of the search is an urgent problem of modern neurobiological research.

Related Work
During the Morris Water Maze the behavior of animals is commonly recorded in either a manual or a semiautomatic way. Traditionally, a researcher observes the animal; if the researcher considers that a certain behavior pattern is displayed, the researcher writes down the behavior, either by hand or by entering the data into an event-recording program [27]. Manual recording of behavior can be implemented with a relatively low investment, and, for some behaviors, it may be the only way to detect and record their occurrence. However, automated observation can provide significant advantages. Behaviors are recorded more reliably because computer algorithm works in the same way, and the system does not suffer from observer fatigue or drift. For instance, in contrast to manual observation, video tracking carries out pattern analysis on a video image of the observed animals to extract quantitative measurements of the animals' behavior. Automated observation using video tracking is particularly suitable for measuring locomotor behavior, expressed as spatial measurements (distance, speed, turning etc.) that the human observer is unable to accurately estimate [28].
Nowadays the behavioral test "Morris Water Maze" is practically not used without automated analysis of the received data, as the only parameter that can be manually registered is the latent time of finding the platform. For a scientist there are a lot of commercial and well tested automated programs for the analysis of behavior in rodents have been developed. The main drawback of these programs is their cost. Most of them are sold as both hardware and software packages, such approach makes these programs unavailable for many laboratories. Another drawback of these tools is a small amount of set of output parameters which are usually limited by latent time, percentage time in quadrant and the zone of interest, and sometime a Whishou error. Examples of such automated programs for analysis of rodent behavior are EthoVision [27], Smart Video Tracking Software [29], VideoTrack [30] and AnyMaze [31]. Most of them are sold as a hardware and software package, making these options unaffordable for many laboratories.
However, there is another approach -open-source software developed by another scientists. The advantages of such programm are absolutely simple and inexpensive way to purchase. But there are also possible drawbacks as low quality of analysis, complicated interface, selective specialization and low approbation. Also, some of the publicly available software options need a MATLAB license [32], which results in an increased cost, take much longer to run or are limited to the operating systems. There is an open-source Mouse Behavioral Analysis Toolbox (MouBeAT) [28] which is based on the image analysis software ImageJ. Another one open-source solution is ToxTrac, which was developed by a group of Swedish scientists in 2017 [33]. This solution did not suit us, as during analysis of video files the trajectory was not determined correctly.
After research it was decided to develop such software ourselves. In this article we present a self-contained tool for Morris Water Maze test automatization. As it is written on C++ and Rust programming languages and is self-contained, this program is easy to install. It does not require additional software to be installed.

Experimental Setup
The test setup is a polypropylene water pool mounted on a steel base with adjustable supports (Open Science, TS1004-M2). Pool diameter 1.5 m, wall height 60 cm. The pool package includes a height-adjustable white acrylic platform with a metal weighting in the base, 10 cm in diameter. The unit is additionally equipped with a digital video system VS 1304-1 with a portable telescopic tripod. The video system consists of a highly sensitive digital video camera GigE Vision (DMK23GV024) and a Fujinon lens (YV5x2.7R4B-2). Video recording during the experiment is controlled from a stationary computer using a free Gigabit Ethernet interface.

Preprocessing
Videos were acquired in DVVIDEO codec at 30 frames per second (fps) and for further work with them, they have to be reencoded. Our tool provides two functions to reencode DVVIDEO to H.265 codec, either individually or in batch. These functions are described in library files written on Rust programming language. For its correct work the open source software FFmpeg is required to be available on the user's computer. This software could be selected to install with the tool. For mouse detection there are several preprocessing steps. First is pool detection to reduce area of movement. The second is background subtraction to remove uninteresting movements. The third is reducing uninteresting details with blur usage.

Pool detection
For pool detection on the image modification of the Hough transform was used. The Hough transform is a feature extraction technique used in image analysis, computer vision, and digital image processing [34]. The purpose of the technique is to find imperfect instances of objects within a certain class of shapes by a voting procedure. This voting procedure is carried out in a parameter space, from which object candidates are obtained as local maxima in a so-called accumulator space that is explicitly constructed by the algorithm for computing the Hough transform.

Background subtraction
Background subtraction is a major preprocessing step in many vision-based applications. In our case the mouse has to be extracted from the static pool. Technically, the moving foreground has to be extracted from static background. • If there is an image of background alone, without any objects, it is not so hard to extract an object. It is enough to subtract the new image from the background. In most of the cases, there is no such an image, so the background has to be extracted from images. It becomes more complicated when there are some shadows of the object. Since shadows also move, simple subtraction will mark that also as foreground.
•In this work a Background/Foreground Segmentation Algorithm BackgroundSubtractorMOG2 was used. This is an efficient adaptive algorithm that uses Gaussian mixture probability density. Recursive equations are used to constantly update the parameters and but also to simultaneously select the appropriate number of components for each pixel [35], [36].

Details reducing
For reducing of details that are not interested for us Gaussian Blur filter was used. The Gaussian Blur is a type of image-blurring filter that uses a Gaussian function (eq. 1) for calculating the transformation to apply to each pixel in the image. (1) • -the distance from the origin in the horizontal axis; • -the distance from the origin in the vertical axis; • -the standard deviation of the Gaussian distribution.
The pixels of the filter footprint are weighted using the values got from the Gaussian function thus providing a blur effect. The spacial representation of the Gaussian filter, sometimes referred to as the "bell surface", demonstrates how much the individual pixels of the footprint contribute to the final pixel color.

Detection and Tracking
After all preprocessing steps detection of a mice is only a contours search. To retrieve contours from an image algorithm proposed by Suzuki was used [37]. There are two border following algorithms. The first one determines the surroundness relations among the borders of a binary image. Since the outer borders and the hole borders have a one-to-one correspondence to the connected components of 1-pixels and to the holes, respectively, the proposed algorithm yields a representation of a binary image, from which one can extract some sort of features without reconstructing the image. The second algorithm, which is a modified version of the first, follows only the outermost borders (i.e., the outer borders which are not surrounded by holes).
•Despite of small amount of objects, there was a lot of detected ones. To reduce amount of useless detected objects, were selected only objects which contour are is larger than 200 and less than 5000 pixels and only that objects which are inside the previously detected pool.
For mice tracking Kalman Filtering was used. The Kalman filter for tracking moving objects estimates a state vector comprising the parameters of the target, such as position and velocity, based on a dynamic/measurement model. To use the Kalman filter for the tracking of moving objects, it is necessary to design a dynamic model of target motion. The most common dynamic model is a constant velocity (CV) model, which assumes that the velocity is constant during a sampling interval. This model has been used in many applications because of its versatility, effectiveness, and simplicity [38]. This algorithm allows not only to track mice detection and draw its path, but also to choose mice from all detected objects. It is assumed that the longest tracked path belongs to the observed mice. When mice could not be detected on some frames in case of occlusion, used tracking algorithm assumes its placement and continues to track for a small amount of frames.

Results
Current state of the project is WIP (work in progress) and for now only results of detection and tracking could be presented. For testing proposed tool, were used videos of different mice. Output of our tool are three files: xVideo file with whole test process ( fig. 1 (a); fig. 1 (b)); E3S Web of Conferences 203, 01029 (2020) EBWFF-2020 https://doi.org/10.1051/e3sconf/202020301029 xImage file with mouse's path ( fig. 1 (c)). xFile with values of computed metrics: xTime spent for the platform search; xTime spent in all sectors; xTime spent in a sector with the platform ( fig. 1 (d));  As was mentioned previously, current state is WIP. In the next phase of our project different metrics will be measured. Some of them are: •Gallagher's proximity -the average distance of the subject from the platform, corrected for start point using the average swim speed for the trial and removing the time required to swim at that speed to the platform position, from the beginning of the trial data, so as to exclude that part of the trial from the measure [39]; •How many times the mouse crosses the platform; •Whishaw's index -measure of how straight the path of the mouse is from the starting point to the platform.
•Platform search strategy. The swimming path of animals is first divided into segments, and then the segments are classified into behavioral strategies. Thus, it is possible to track changes in the behavior of animals with each trial, and the way of swimming of animals in general is divided into more than one strategy, revealing how their behavior changes.

Conclusion
In this article, to automate MWM testing, we considered various methods that were combined into one tool, in contrast to existing commercial and non-commercial tools, open and standalone, and created a unique program for tracing rodents and processing the obtained data. With its help, we obtained correct data on the trajectory of the mouse movement during the procedure for conducting the behavioral test, and this is one of the most difficult stages of the automated analysis of the movement of an object in the aquatic environment. Unlike "dry" behavioral tests, the water maze is a more difficult task for computer tracing, since the dynamic surface of the water creates many unnecessary moving factors, from glare of bright light to the complete disappearance of the experimental rodent from the field of view (if the mouse is completely immersed in water). At the moment, our software is at the stage of active development, but it can already produce standard parameters that are difficult to calculate manually. The software we offer is self-sufficient, it does not require any massive third-party programs for its work, and will be effective for any modification of the "Morris water maze". In the future, after final revision, the created program will become a better analogue of inaccessible commercial programs.
The program to increase the competitiveness of leading Russian universities among leading scientificeducational centers (Project 5-100-2020).