Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{alias:SI3.8_Triggering|parent=Aliases}
{excerpt}
{composition-setup}

ScanImage utilizes various data acquisitions _subsystems_ (each bank of Analog Input and Output channels per board comprises a subsystem) during its operation. The start time(s) of the data streams on each of these subsystems must be synchronized for each acquisition. This requires that each of the subsystems 'listen' for a common _Start Trigger_ signal (i.e. a digital rising/falling edge) which initiates the acquisition/generation. 

To accomplish this, ScanImage identifies a [National Instruments|http://www.ni.com] 'programmable function interface' (PFI) terminal (e.g. PFI0, PFI1, etc) which can serve as a 'listener' for a _Start Trigger_ input signal. 
(i) Note that all _subsystems_ on each board use the same physical PFI terminal as their trigger input source. 
(i) Note that all _boards_ used by ScanImage must use the same PFI terminal number value for a particular acquisition (i.e., if PFI0 is used, it must be used/connected on all boards).

h3. Start Triggering Modes
Every ScanImage acquisition requires a _Start Trigger_ -- this can be either _Internal_ or _External_.

{panel:borderStyle=none|bgColor=#FFFFFF}
h5. Internal Start Triggering (REQUIRED)
The 'Internal' start triggering mode is the default. In this mode, ScanImage itself generates a single _Start Trigger_ signal that serves as the trigger source for acquisitions. 

* This rising-edge _Start Trigger_ output signal is generated by ScanImage on the digital output line specified by the {vi-statevar:state.init.triggerBoardIndex} and {vi-statevar:state.init.triggerLineIndex} values in the [INI file|SI_INIFile].
(i) Port 0 is assumed, i.e. line *X* implies the digital output *P0.X*

* The {vi-statevar:state.init.triggerInputTerminal} *INI* value specifies the input PFI terminal on which to receive the 'Internal' Start Trigger, typically PFI0. This input terminal, on all boards, *must* be connected to the _Start Trigger_ output generated by ScanImage. 

* The 'Internal' trigger mode is used by default for all ScanImage [acquisition modes|SI3.8_AcqModes] and is *always* used for:
** [FOCUS|SI3.8_AcqModes] acquisitions
** [Snapshot|SI3.8_AcqModes] acquisitions
** [Image Stack|SI3.8_ImageStacks] acquisitions

{vi-indent:2}
(/) [Typical Wiring Diagrams|Wiring Your System (r3.8)#TypWiring] illustrates the connection of these signals with the default INI values.
(/) Note the _Start Trigger_ output signal can be used to synchronize ScanImage acquisitions with external software, e.g. physiology or sensory stimulus software, provided the external software can accept an external trigger input, i.e. can 'slave' to ScanImage.
{vi-indent}

h5. External Start Triggering (OPTIONAL)
ScanImage also allows an external trigger source to be used, allowing ScanImage to be 'slaved' to external software, such as that for electrophysiology, sensory stimulation, or behavioral control/monitoring.

* The {blue:EXT} toggle control on the [*Main Controls*|Main Controls (r3.8)] is used to specify that ScanImage should 'listen' for an external, rather than the default 'internal' trigger source. 
(i) The {blue:EXT} setting only applies for [GRAB and LOOP|SI3.8_AcqModes] acquisitions - excluding [Image Stack|SI3.8_ImageStack] acquisitions. Otherwise, it is ignored and 'internal' triggering is used.

* The  {blue:Start Trigger Source} value specified on the [*Triggers*|Triggers (r3.8)] panel specifies the input PFI terminal number on which to receive the 'Internal' Start Trigger. This input PFI terminal, on all boards, *must* be connected to the _Start Trigger_ output generated by ScanImage. 

{vi-indent:2}
(/) [Typical Wiring Diagrams|Wiring Your System (r3.8)#TypWiring] illustrates the connection of an external trigger signal to the default (PFI1) external start trigger input terminal
{vi-indent}
{panel}

{excerpt}

h3. Trigger Time Logging

The time at which the _Start Trigger_ arrives, initiating an acquisition, is stored as part of the [image file header|Image File Storage & Format (r3.8)#FileHeader], to aid with analysis, e.g. for aligning image data to separately obtained physiology/stimulus/behavior data. The following header fields are stored:

* {vi-statevar:internal.triggerTime}: Represents the trigger time of the saved [*GRAB* acquisition or *LOOP* _Repeat_|SI3.8_AcqModes] as accurately as possible in [Matlab date string|http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/brqy1ep-1.html#brqy1ep-4] format. 

* {vi-statevar:internal.softTriggerTime}: Represents the trigger time of the saved [*GRAB* acquisition or *LOOP* _Repeat_|SI3.8_AcqModes]  in less-accurate manner, for backward-compatibility, as a [Matlab date string|http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/brqy1ep-1.html#brqy1ep-4] format. 

{vi-indent:2}
(/) For [Image Stack|SI3.8_ImageStacks] acquisitions, both variables represent the trigger time of *first* _Slice_ in the stack.
(/) It is highly recommended that users employ the {vi-statevar:internal.triggerTime} value
{vi-indent}