Experimental paradigms are implemented as separate classes that define the data that
should be extracted from the images, what should be written to file and which stimuli
should be generated. All experimental classes are required to implement the
following interface so that the main program can properly interact with them:
The most important item is the ProcessNext method which gets called for every individual
frame by the main program. This method receives the current frame index and associated
camera frame. It should return true while the experiment is still running. Returning false
will terminate the current experiment. An image coordinate passed back via the poi
parameter will center the details image of the user interface around those coordinates.
SuggestedBufferSeconds can be used to suggest a camera buffer size to the program. In
general camera buffers can be large for open-loop experiments (to ensure no frames are
dropped) but should small for closed-loop experiments (to avoid reacting to stale frames
in the buffer).
Support classes
Each user experiment should inherit from ExperimentBase. This class provides convenient
support for common tasks:
Storage of general experiment related information such as frame-rate, experiment length,
etc.
Easy generation of of files with common base-name to store various experiment related data.
Writing general experiment information, such as name fish type and date of birth or start
and end times into an info file wich can be further customized by sub-classes.
Experiments that need fish tracking can derive from TrackingExperiment which provides a
method for conveniently creating a fitting tracker object based on general experiment
conditions such as a given frame rate and image resolution.
These support classes make it very easy to quickly write an experimental class that writes
fish position and heading to a file for every camera frame: