PVCAM  3.9.x
Programmable Virtual Camera Access Method library
Exposure Modes

During sequences, the exposure mode (also referred to as 'Trigger Mode') determines how and when each exposure begins and ends.

PVCAM supports several exposure modes:

The modes above are considered legacy modes and are mostly used for CCD cameras only. For sCMOS cameras, new extended modes were introduced:

Please refer to PL_EXPOSURE_MODES in PVCAM header for a complete list of exposure modes and always use the PARAM_EXPOSURE_MODE to discover the list of the camera-supported modes.

In general, the settings in pl_exp_setup_seq apply to each exposure within a sequence. They also apply to every sequence until the setup is reset with the two exceptions being VARIABLE_TIMED_MODE and BULB_MODE. These two modes ignore the exposure_time parameter in setup, and rely on a function or a trigger to determine the exposure time.

Every sequence has alternating periods of exposure and non-exposure time. During the time the sensor is not exposing, the camera could be in several states, such as waiting for pl_exp_start_seq, reading out, or performing clearing. In the diagrams that follow, each exposure mode shows the exposure time in white and the time between exposures in gray.

Legacy Exposure Modes

Timed Mode

In TIMED_MODE, all settings are read from the setup parameters, making the duration of each exposure time constant and the interval times between exposures constant as well. In this mode, every sequence has the same settings.

The diagram below represents a sequence in TIMED_MODE.

TimedMode.png

Trigger-First Mode

Use TRIGGER_FIRST_MODE when an external trigger signal is used to start the the sequence.

TriggerFirst.png

In TRIGGER_FIRST_MODE, pl_exp_start_seq starts the acquisition. The camera enters the clear mode while it waits for a trigger signal. The black line in the diagram illustrates a trigger signal coming from an external trigger source. If none of the CLEAR_PRE_EXPOSURE modes is used, the sensor will become trigger-ready immediately after pl_exp_start_seq is called.

Once an external event triggers the camera to start exposing, the acquisition follows an internal script generated in pl_exp_setup_seq. Note that all exposure times are equal, and the time intervals between exposures are equal, too.

An external trigger signal must be connected to the camera for TRIGGER_FIRST_MODE to function. If the equipment fails to send a trigger signal, the sequence can be stopped by calling pl_exp_abort.

Strobed Mode

Use STROBED_MODE when an external trigger signal is used to start each exposure in the sequence.

Strobed.png

In STROBED_MODE, pl_exp_start_seq starts the acquisition. The camera enters clear mode while it waits for the first trigger signal to start the first exposure. As shown in the diagram above, each new exposure waits for an external trigger signal. Notice that the intervals between exposures can vary greatly, but the exposure times are constant. If none of the CLEAR_PRE_EXPOSURE modes is used, the sensor will become trigger-ready immediately after pl_exp_start_seq is called.

An external trigger signal must be connected to the camera for this mode to function. If the equipment fails to send a trigger signal, the acquisition can be stopped by calling pl_exp_abort.

Bulb Mode

Use BULB_MODE, when an external trigger signal is used to control the beginning and end of each exposure.

Bulb.png

In BULB_MODE, pl_exp_start_seq starts the acquisition. The camera enters clear mode while it waits for a true external trigger signal to start each exposure. The sensor continues to expose until a false trigger signal ends the exposure. In the diagram above, the trigger signal line moves up to represent a true trigger and down to represent a false trigger. If none of the CLEAR_PRE_EXPOSURE modes is used, the sensor will become trigger-ready immediately after pl_exp_start_seq is called.

Notice that the exposure times and the intervals between exposures vary greatly. Since the true and false signals determine exposure time, the exposure_time set in pl_exp_setup_seq is ignored.

An external trigger signal must be connected to the camera for BULB_MODE to function. If the equipment fails to send a trigger signal, the sequence can be stopped by calling pl_exp_abort.

Variable-Timed Mode

Use VARIABLE_TIMED_MODE when exposure_time needs to be changed between sequences.

In VARIABLE_TIMED_MODE, all the settings except exposure_time are read from the setup parameters. The exposure_time must be set with parameter ID PARAM_EXP_TIME. If PARAM_EXP_TIME is not called before the first sequence, a random time will be assigned. The camera will not read the first exposure time from the exposure_time in setup, because this mode ignores the exposure_time parameter.

VTM.png

The first sequence shows a case where exposure time of each acquisition is equal. In the second sequence, the exposure time varies between acquisitions.

Extended Exposure Modes

Since PVCAM 3.0.1 the newly added Exposure Modes can be retrieved from the camera directly and cross-correlated with values in the PVCAM header files so that applications can narrow down which modes they would like to operate with. Application developers are encouraged not to hard-code the exposure modes in the source code but to read the supported modes from the camera dynamically. This change was introduced together with the addition of the Expose Out Modes.

Teledyne Photometrics cameras based on sCMOS sensors support multiple exposure (trigger) modes and several expose out behaviors. The available triggering modes and expose out behaviors can be discovered by reading the PARAM_EXPOSURE_MODE and PARAM_EXPOSE_OUT_MODE parameters. These cameras also support the "extended" trigger modes that need to be combined ("logically OR-ed") with the selected expose out mode.

Internal Trigger

Internal mode is the default triggering mode for sCMOS cameras. This means the software/application initiates the start of the acquisition. Once initiated, each frame captured in the sequence is controlled by the internal timing generators in the camera. Camera settings, expose out behavior and sequence size are set in the software application prior to acquiring the sequence. Internal trigger mode is used when synchronization with other devices is either not required or is controlled independently through the software.

See also
EXT_TRIG_INTERNAL

Trigger-First

Similar to Internal Trigger Mode, but a hardware trigger from the I/O connector is required. Hardware triggering allows higher precision of acquisition timing than the software triggers. Rising edge of an external trigger initiates the start of a sequence of acquisitions. Once initiated, each frame capture in the sequence is controlled by the internal timing generators of the camera. Camera settings, expose out behavior and sequence size are set in the software application prior to acquiring the sequence.

See also
EXT_TRIG_TRIG_FIRST

Edge Trigger

Similarly to Trigger-First Mode, Edge Mode requires a hardware trigger, but in this case a trigger is needed for every frame. The rising edge of the external trigger initiates capture of a single frame. Each frame requires an external trigger from the I/O connector. Camera settings, expose out behavior and sequence size are set in the software application prior to acquiring the sequence.

See also
EXT_TRIG_EDGE_RISING

Level Trigger

This mode behaves identically to the legacy Bulb mode. See description in section Bulb Mode.

Software Trigger Edge

This mode combines the low trigger-to-exposure-start latency of external trigger modes with the simplicity of Internal trigger mode where a software command starts the exposure. Instead of physical trigger signal on the I/O connector, an API function pl_exp_trigger is used to signalize the acquisition start. At the same time, the latency between the API call and exposure start is significantly reduced compared to the Internal trigger mode. In Software Trigger Edge mode, the pl_exp_trigger function has to be called to start each exposure. Camera settings, expose out behavior and sequence size are set in the software application prior to acquiring the sequence.

See also
EXT_TRIG_SOFTWARE_EDGE

Software Trigger First

This mode combines the low trigger-to-exposure-start latency of external trigger modes with the simplicity of Internal trigger mode where a software command starts the exposure. Instead of physical trigger signal on the I/O connector, an API function pl_exp_trigger is used to signalize the acquisition start. At the same time, the latency between the API call and exposure start is significantly reduced compared to the Internal trigger mode. In Software Trigger First mode, the pl_exp_trigger function has to be called once to start the first exposure with subsequent exposures being controlled by the camera internal trigger. Camera settings, expose out behavior and sequence size are set in the software application prior to acquiring the sequence.

See also
EXT_TRIG_SOFTWARE_FIRST

Expose Out Modes

Since PVCAM 3.0.1, the new enumerable parameter PARAM_EXPOSE_OUT_MODE can be retrieved dynamically from the currently connected camera and cross-correlated with the PVCAM header so that applications can decide which modes they prefer to operate in without user intervention. Please, refer to the Best Practice Example section below or to the Extended Enumerations code sample.

The settable Expose Out behaviors provide flexibility in different experimental scenarios.

Note
All timing diagrams below are shown with Edge triggering mode.

First Row

The "Expose Out" I/O signal leaving the camera is high only when the first row of a single frame is being exposed. The length of the signal is equal to the exposure time for the first row. Exposure time is equal to the time set in the software application.

Although "First Row" behavior provides the maximum camera frame rates, it does not avoid the overlap due to rolling shutter. This mode is not recommended if trying to alternate between excitation wavelengths.

FirstRow.png
See also
EXPOSE_OUT_FIRST_ROW

Any Row

The "Expose Out" I/O signal leaving the camera is high when any row in a single frame is exposing. The length of the Expose Out signal is equal to the time between the start of the first row exposure and the end of the last row exposure. Each line exposes for the same amount of time which is equal to the value set in the software application. Maximum camera frame rates are not possible in this mode but this does avoid frame overlap.

AnyRow.png
See also
EXPOSE_OUT_ANY_ROW

All Rows

The "Expose Out" I/O signal leaving the camera is high only when all rows within a single frame are exposing simultaneously. The length of the Expose Out signal is equal to the time between the start of the last row exposure and the end of the first row exposure, which is also equal to the exposure time set in the software application. Each row exposes for the duration as defined by the software application plus the time required for each row to start exposing.

AllRows.png

All Rows provides an effective global shutter with the speed and low noise benefits of rolling shutter, while eliminating rolling shutter motion artifacts. This mode is recommended for synchronizing the camera with high speed light sources that alternate excitation wavelengths for high speed multi-channel fluorescence and that only illuminate the sample when all rows are exposing.

See also
EXPOSE_OUT_ALL_ROWS

Rolling Shutter

The Rolling Shutter Expose Out Mode is similar to the First Row Mode, except that the Expose Out signal is high only when all the rows are exposing.

When Exposure time is shorter than readout time:

RollSHTRexpLessRead.png

When Exposure time is longer than readout time:

RollSHTRexpMoreRead.png

Below is a comparison of the different Expose Out behaviors with different exposure durations:

ExpOutBehaviorComparison.png

From this comparison the following conditions can be defined for each expose out behavior:

ExpOutBehaviorConditions.png
See also
EXPOSE_OUT_ROLLING_SHUTTER, EXPOSE_OUT_GLOBAL_SHUTTER

Line Trigger

In Programmable Line Trigger mode the camera sends a short pulse for every line readout. This allows accurate synchronization with external devices in Programmable Scan Mode.

See also
EXPOSE_OUT_LINE_TRIGGER

Best Practice Example

The following example shows how to use the Extended Exposure Modes together with Expose Out Modes and still keep the backward compatibility with older cameras.

Note
Please, refer to the Extended Enumerations code sample to obtain more information on how to use Extended Exposure Modes.

Define a helper function to retrieve available parameter values:

// A helper function that enumerates a given parameter from the camera
void EnumerateParameter(int16 hcam, uns32 paramID, std::vector<int32>& values,
std::vector<std::string>& names)
{
rs_bool bAvail = FALSE;
uns32 count = 0;
values.clear();
names.clear();
// Check the availability of the parameter
if (pl_get_param(hcam, paramID, ATTR_AVAIL, &bAvail) != PV_OK || bAvail == FALSE)
return;
// Get the number of expose out modes
if (pl_get_param(hcam, paramID, ATTR_COUNT, &count) != PV_OK)
return;
// Get the mode values and names
for (uns32 i = 0; i < count; ++i)
{
uns32 enumStrLen;
if (pl_enum_str_length(hcam, paramID, i, &enumStrLen) == PV_OK)
{
char* enumStr = new char[enumStrLen]; // Allocate a string buffer
int32 enumVal;
if (pl_get_enum_param(hcam, paramID, i, &enumVal, enumStr, enumStrLen) == PV_OK)
{
values.push_back(enumVal);
names.push_back(std::string(enumStr));
}
delete[] enumStr;
}
}
}

Setup the acquisition:

void SetupAcquisition(int16 hcam)
{
rs_bool bAvail;
std::vector<int32> trigModeVals;
std::vector<std::string> trigModeStrs;
int16 selectedTrigMode = 0;
std::vector<int32> expOutModeVals;
std::vector<std::string> expOutModeStrs;
int16 selectedExpOutMode = 0;
|| bAvail == FALSE)
{
selectedTrigMode = TIMED_MODE;
}
else
{
// The enumeration should be done upon opening the camera when an UI element
// can be populated with available exposure modes
EnumerateParameter(hcam, PARAM_EXPOSURE_MODE, trigModeVals, trigModeStrs);
selectedTrigMode = (int16)trigModeVals[0]; // Or any other mode selected by user
}
|| bAvail == FALSE)
{
selectedExpOutMode = 0; // This will have no effect when doing bitwise OR
}
else
{
EnumerateParameter(hcam, PARAM_EXPOSE_OUT_MODE, expOutModeVals, expOutModeStrs);
selectedExpOutMode = (int16)expOutModeVals[0]; // Or any other selected by user
}
const int16 finalExpMode = selectedTrigMode | selectedExpOutMode;
const rgn_type roi = { 0, m_SerSz-1, 1, 0, m_ParSz-1, 1 }; // Acquire full frame
uns32 bufferSize;
// Setup the acquisition, 1 frame, 1 roi, 10ms exposure
if (pl_exp_setup_seq(hcam, 1, 1, &roi, finalExpMode, 10, &bufferSize) != PV_OK)
return false;
// Next: Allocate the buffer and call pl_exp_start_seq()
}