During 2p imaging the behavior cameras are triggered at the beginning of a frame (TTL OUT 1x f.r.) or at the beginning and middle of a frame (TTL OUT 2x f.r.), thus leading to acquisition at twice the frame rate.
During epi/intrinsic imaging the port camera should be configured to provide a signal that is active during the exposure of each frame. Use the manufacturer’s application to do this. In the case of the PCO sCMOS cameras, you should use Camware64 to set the TTL/IO configuration to look as follows, which sets OUT1 and OUT1 to the exposure signal and IN2 to Acquire Enable:
The output from the camera should be connected to the DIN1 (DIGITAL input #1) connector. During imaging the firmware automatically routes this signal to the TTL OUT 1x and 2x fr outputs, thus providing a synchronization signal to the behavior cameras. All cameras will collect the same number of frames. Finally, if you have a signal that needs to be time stamped during the data collection you can use the DIN2 connector. The rising edge of this signal will be time stamped with the frame number at which it occurred. In addition, DOUT0 must be connected to the Acquisition Enable line of your camera. In the PCO series this would be Input 2. Unfortunately, this connection was left out of the diagram below.
The format of the data are the same as before, so you can use sbx_get_ttlevents() and sbx_get_camport_frames() to read those data. The behavior cameras write their data into *_eye.mat and *_ball.mat files, which are standard Matlab files which can be loaded into the workspace.
To image simultaneously via the port and behavior cameras proceed as follows:
Enable the camera path in Scanbox and bring up Camera Properties. Use the fields in the camera properties to select the desired frame rate and/or exposure time for your camera. Each camera vendor uses different names, so you have to look at the manual for your camera to find out which parameters to change. Scanbox sets the default rate of the port camera to 15 fps.
After adjusting the frame rate and exposure time you can focus and choose the desired illumination level. Next go to the Cameras panel, enable the cameras you want to collect data from and select a region of interest. You can use Preview to adjust focus and illumination for these cameras as well.
Finally, go to the intrinsic/epi imaging panel and set an ROI for the port camera (or leave undefined if you want to acquire the full frame). You can now hit the Grab button to acquire data, or you can issue a network command to start sampling. When receiving a command to start sampling Scanbox checks if the camera port is active. If so, it collects images via the port and behavior cameras. Otherwise, it performs two-photon imaging and also acquires data from the behavior cameras.
Scanbox does not currently check the maximum frame rates the behavior cameras can support based on their ROIs selections. The user must make sure that the behavior cameras can run as fast as the port camera. So, if you set the port camera to run at 60 fps, and the behavior cameras cannot keep up with that rate, then you will be dropping frames.