Skip to content

API Reference

Information on the classes in the acquire module along with the attributes and methods associated with them.

acquire.AvailableData

The AvailableData class represents the collection of frames that have been captured since the last call to runtime.get_available_data().

AvailableData objects should be set to have a short lifetime, since these objects reserve space on the video queue and will eventually block camera acquisition to ensure no data is overwritten before it can be processed.

frames() -> Iterator[VideoFrame]

Returns an iterator over the video frames in the available data.

Returns:

Type Description
Iterator[VideoFrame]

An iterator over the video frames in the available data.

get_frame_count() -> int

Returns the total number of video frames in the available data.

Call get_frame_count() to query the number of frames in a AvailableData object.

Returns:

Type Description
int

The total number of video frames in the AvailableData object.

acquire.AvailableDataContext

The AvailableDataContext class is the context manager for available data for the given VideoStream ID.

acquire.Camera

The Camera class is used to describe cameras or other video sources.

Attributes:

Name Type Description
identifier Optional[DeviceIdentifier]

An optional attribute which contains an instance of the DeviceIdentifier class. DeviceIdentifier has id and kind attributes assigned by acquire if the device is natively supported. Otherwise, it is of type None.

settings CameraProperties

An instance of the CameraProperties class which contains the settings for the camera.

acquire.CameraCapabilities

The CameraCapabilities class is used to describe the camera's supported properties.

Attributes:

Name Type Description
exposure_time_us Property

An instance of the Property class that captures the range and type of supported values in microseconds for the camera's exposure time, which is how long in microseconds the camera collects light from the sample for a single frame.

line_interval_us Property

An instance of the Property class that captures the range and type of supported values in microseconds for a rolling shutter camera to scan one line.

readout_direction Property

An instance of the Property class that specifies whether the data is read out of the camera forwards or backwards and if that direction can be chosen by the user.

binning Property

An instance of the Property class that captures the range and type of support values for binning, which is combining adjacent pixels by averaging in each direction, and whether the binning factor can be chosen by the user.

offset OffsetCapabilities

An instance of the OffsetShapeCapabilities class that represents the horizontal and vertical offset for the region of interest on the camera chip.

shape ShapeCapabilities

An instance of the OffsetShapeCapabilities class that represents the width and height of the region of interest on the camera chip.

supported_pixel_types List[SampleType]

A list containing instances of the SampleType class representing each of the supported pixel types, such as 8-bit unsigned integer (uint8).

digital_lines DigitalLineCapabilities

An instance of the DigitalLineCapabilities class which indicates the number and names of the available lines. Up to 8 lines are supported with the last line typically being the camera software trigger.

triggers TriggerCapabilities

An instance of the TriggerCapabilities class which indicate what kinds of triggers (start acquisition, start exposure, or start a frame) are supported.

acquire.CameraProperties

The CameraProperties class is used to set the desired camera properties for acquisition.

Attributes:

Name Type Description
exposure_time_us float

How long in microseconds your camera should collect light from the sample. However, for simulated cameras, this is just a waiting period before generating the next frame.

line_interval_us float

The time to scan one line in microseconds in a rolling shutter camera.

binning float

How many adjacent pixels in each direction to combine by averaging. For example, if binning is set to 2, a 2x2 square of pixels will be combined by averaging. If binning is set to 1, no pixels will be combined.

pixel_type SampleType

An instance of the SampleType class which specifies the numerical data type, for example Uint16, a 16-bit unsigned integer type.

readout_direction Direction

An instance of the Direction class which specifies whether the data is readout forwards or backwards.

offset Tuple[int, int]

A tuple of two integers representing the (x, y) offset in pixels of the image region of interest on the camera.

shape Tuple[int, int]

A tuple of two integers representing the (x, y)size in pixels of the image region of interest on the camera.

input_triggers InputTriggers

An instance of the InputTriggers class, which describes the trigger signals for starting acquisition, camera exposure, and acquiring a frame.

output_triggers OutputTriggers

An instance of the OutputTriggers class, which describes the trigger signals for the camera exposure, acquiring a frame, as well as any wait times for sending the trigger signal.

acquire.Capabilities

The Capabilities class contains representations of each of the 2 supported VideoStream objects.

Attributes:

Name Type Description
video Tuple[VideoStreamCapabilities, VideoStreamCapabilities]

A tuple containing two VideoStreamCapabilities instances since acquire supports simultaneous streaming from 2 video sources.

acquire.DeviceIdentifier

Represents an identifier for a supported device, including its unique id and type, such as a camera or storage.

Attributes:

Name Type Description
id Tuple[int, int]

A tuple of (driver_id, device_id) containing two Uint8 integers that serve to identify each driver and device uniquely for a given run.

kind DeviceKind

An instance of the DeviceKind class that represents the type or kind of the device.

name str

A string representing the name or label of the device.

none() -> DeviceIdentifier

Returns a "None" type DeviceIdentifier.

Useful when a DeviceIdentifier is not needed.

acquire.DeviceKind

This class represents the types of devices in a given system.

Attributes:

Name Type Description
Camera DeviceKind

Enum-type class variable of DeviceKind that specifies a device is a camera.

NONE DeviceKind

Enum-type class variable of DeviceKind for if a device's kind is unavailable.

Signals DeviceKind

Enum-type class variable of DeviceKind that specifies a device is a signal.

StageAxis DeviceKind

Enum-type class variable of DeviceKind that specifies a device is a stage.

Storage DeviceKind

Enum-type class variable of DeviceKind that specifies a device is for storage.

acquire.DeviceManager

The DeviceManager class manages selection of available devices in the system.

Regular expressions are accepted for the name argument.

devices() -> List[DeviceIdentifier]

Returns a list of all available device identifiers.

select(kind: DeviceKind, name: Optional[str] = None) -> Optional[DeviceIdentifier]

Selects a specified device.

Call this method to choose the first available device of a given type or to select a specific device by name.

Parameters:

Name Type Description Default
kind DeviceKind

The type of device to select.

required
name Optional[str]

The name of the device to select. Regular expressions supported.

None

Returns:

Type Description
Optional[DeviceIdentifier]

The selected device identifier, or None if the specified device is

Optional[DeviceIdentifier]

not available.

select_one_of(kind: DeviceKind, names: List[str]) -> Optional[DeviceIdentifier]

Selects the first device in the list of devices that is of one of the specified kinds.

Parameters:

Name Type Description Default
kind DeviceKind

The type of device to select.

required
names List[str]

A list of device names to choose from. Regular expressions supported.

required

Returns:

Type Description
Optional[DeviceIdentifier]

Optional[DeviceIdentifier]: The selected device identifier, or None

Optional[DeviceIdentifier]

if none of the specified devices are available.

acquire.DeviceState

The DeviceState class represents the acquisition status of a device.

Attributes:

Name Type Description
Closed DeviceState

Enum-type class variable of DeviceState that specifies when a device is not ready for configuration.

AwaitingConfiguration DeviceState

Enum-type class variable of DeviceState that specifies when a device is ready for configuration.

Armed DeviceState

Enum-type class variable of DeviceState that specifies when a device is ready to stream data.

Running DeviceState

Enum-type class variable of DeviceState that specifies when a device is streaming data.

acquire.DigitalLineCapabilities

The DigitalLineCapabilities class represents the digital lines supported by the device.

Attributes:

Name Type Description
line_count int

Integer number representing the number of digital lines supported.

names Tuple[str, ...]

Tuple of strings to name each of the digital lines, typically the last one is the camera software trigger.

acquire.DimensionType

Used to specify the physical meaning of a dimension, such as space or time dimension.

When downsampling, Space and Time dimensions are downsampled by the same factor. Channel and Other dimensions are not downsampled.

This value is also reflected in the dimension metadata of an OME-Zarr dataset.

Attributes:

Name Type Description
Space DimensionType

Enum-type class variable of DimensionType that indicates a spatial dimension.

Channel DimensionType

Enum-type class variable of DimensionType that indicates a color channel dimension.

Time DimensionType

Enum-type class variable of DimensionType that indicates a time dimension.

Other DimensionType

Enum-type class variable of DimensionType that indicates the dimension is not a space, channel, or time.

acquire.Direction

The direction that data is read for streaming.

Attributes:

Name Type Description
Backward Direction

Enum-type class variable of Direction that specifies when data is streamed backward.

Forward Direction

Enum-type class variable of Direction that specifies when data is streamed forward.

acquire.InputTriggers

The InputTriggers class represents input triggers for a camera device.

Attributes:

Name Type Description
acquisition_start Trigger

An instance of the Trigger class representing the trigger for starting acquisition.

exposure Trigger

An instance of the Trigger class representing the trigger for exposure.

frame_start Trigger

An instance of the Trigger class representing the trigger for starting a frame.

acquire.OffsetCapabilities

acquire.OutputTriggers

The OutputTriggers class represents output triggers for a camera device.

Attributes:

Name Type Description
exposure Trigger

An instance of the Trigger class representing the trigger for exposure.

frame_start Trigger

An instance of the Trigger class representing the trigger for starting a frame.

trigger_wait Trigger

An instance of the Trigger class representing the trigger for waiting before continuing acquisition.

acquire.PID

The PID class represents proportional-integral-derivative (PID) values.

Attributes:

Name Type Description
derivative float

The derivative value for the PID.

integral float

The integral value for the PID.

proportional float

The proportional value for the PID.

acquire.Properties

The Properties class represents properties related to video streams.

Attributes:

Name Type Description
video Tuple[VideoStream, VideoStream]

A tuple containing two VideoStream instances since acquire supports simultaneous streaming from 2 video sources. VideoStream objects have 2 attributes camera and storage to set the source and sink for the stream.

acquire.Property

Indicates the type of and whether the property can be overwritten.

For numerical values, it also captures the accepted range of values.

Attributes:

Name Type Description
writable bool

A boolean indicating whether the property can be written.

low float

Floating point number for the lower bound of the property, if applicable.

high float

Floating point number for the upper bound of the property, if applicable.

kind PropertyType

An instance of the PropertyType class which indicates the type of the property (fixed precision, floating-point, enum, or string).

acquire.PropertyType

The PropertyType class indicates the type of the property (fixed precision, floating-point, enum, or string).

Attributes:

Name Type Description
FixedPrecision PropertyType

Enum-type class variable of PropertyType that indicates fixed precision or integer values.

FloatingPrecision PropertyType

Enum-type class variable of PropertyType that indicates floating point precision values.

Enum PropertyType

Enum-type class variable of PropertyType that indicates enum-type values.

String PropertyType

Enum-type class variable of PropertyType that indicates string values.

acquire.Runtime

Coordinates runtime.

The Runtime class coordinates the devices with the storage disc including selecting the devices, setting their properties, and starting and stopping acquisition.

abort() -> None

Aborts the runtime, terminating it immediately.

Call abort() to immediately end data acqusition. All objects are deleted to free up disk space upon shutdown of Runtime.

device_manager() -> DeviceManager

Returns the DeviceManager instance associated with this Runtime.

Call device_manager() to return the DeviceManager object associated with this Runtime instance.

execute_trigger(stream_id: int) -> None

Executes a trigger for the given stream ID.

Call execute_trigger with a specific stream_id, 0 or 1, to execute a trigger for that video source.

get_available_data(stream_id: int) -> AvailableDataContext

Returns the AvailableDataContext instance for the given stream ID.

Call get_available_data with a specific stream_id, 0 or 1, to return the context manager, AvailableDataContext, associated with the 1st or 2nd video source, respectively.

Parameters:

Name Type Description Default
stream_id int

The ID of the stream for which available data is requested.

required

Returns:

Name Type Description
AvailableDataContext AvailableDataContext

Context manager for available data for the given VideoStream ID.

get_capabilities() -> Capabilities

Returns the current capabilites of the runtime as an instance of Capabilities.

Call get_capabilities() to return the Capabilities object associated with this Runtime instance.

get_configuration() -> Properties

Returns the current configuration properties of the runtime.

Call get_configuration() to return the Properties object associated with this Runtime instance.

get_state() -> DeviceState

Returns the current state of the device.

Call get_state() to return the DeviceState object associated with this Runtime instance.

set_configuration(properties: Properties) -> Properties

Applies the provided configuration properties to the runtime.

Call set_configuration with a Properties object to change the properties of this Runtime instance.

Parameters:

Name Type Description Default
properties Properties

The properties to be set.

required

Returns:

Type Description
Properties

The updated configuration properties.

start() -> None

Starts the runtime, allowing it to collect data.

Call start() to begin data acquisition.

stop() -> None

Stops the runtime, ending data collection after the max number of frames is collected.

Call stop() to end data acquisition once the max number of frames specified in acquire.VideoStream.max_frame_count is collected. All objects are deleted to free up disk space upon shutdown of Runtime.

acquire.SampleRateHz

The SampleRateHz class represents the sampling rate in hertz.

Attributes:

Name Type Description
numerator int

The numerator part of the sampling rate fraction.

denominator int

The denominator part of the sampling rate fraction.

acquire.SampleType

The SampleType class defines the type of the values in the streamed data.

Attributes:

Name Type Description
F32 SampleType

Enum-type class variable of SampleType that specifies values of 32-bit floating point type.

I16 SampleType

Enum-type class variable of SampleType that specifies values of 16-bit signed integer type.

I8 SampleType

Enum-type class variable of SampleType that specifies values of 8-bit signed integer type.

U16 SampleType

Enum-type class variable of SampleType that specifies values of 16-bit unsigned integer type.

U8 SampleType

Enum-type class variable of SampleType that specifies values of 8-bit unsigned integer type.

U10 SampleType

Enum-type class variable of SampleType that specifies values of 10-bit unsigned integer type.

U12 SampleType

Enum-type class variable of SampleType that specifies values of 12-bit unsigned integer type.

U14 SampleType

Enum-type class variable of SampleType that specifies values of 14-bit unsigned integer type.

acquire.ShapeCapabilities

Represents the size of the offset or the shape of the region of interest on the camera.

The sum of the offset and shape is the size of the full camera chip.

Attributes:

Name Type Description
x Property

An instance of the Property class which represents the width of the region of interest on the camera or the horizontal offset of the region of interest on the camera chip.

y Property

An instance of the Property class which represents the height of the region of interest on the camera or the vertical offset of the region of interest on the camera chip.

acquire.SignalIOKind

The SignalIOKind class defines the signal type, input or output, for a trigger.

Attributes:

Name Type Description
Input SignalIOKind

Enum-type class variable of SignalIOKind that specifies signal coming in to the device.

Output SignalIOKind

Enum-type class variable of SignalIOKind that specifies signal sent out of the device.

acquire.SignalType

The SignalType class specifies whether a signal is analog or digital.

Attributes:

Name Type Description
Analog SignalType

Enum-type class variable of SignalType that specifies a signal is analog.

Digital SignalType

Enum-type class variable of SignalType that specifies a signal is digital.

acquire.Storage

The Storage class represents storage devices and their settings.

Attributes:

Name Type Description
identifier Optional[DeviceIdentifier]

An optional attribute which contains an instance of the DeviceIdentifier class that describes the storage device if that device is natively supported. Otherwise, it is of type None.

settings StorageProperties

An instance of the StorageProperties class which contains the settings for the data storage.

acquire.StorageCapabilities

The StorageCapabilities class represents what types of data handling is supported by the storage device.

Attributes:

Name Type Description
chunking_is_supported bool

A boolean indicating whether chunking is supported for this storage device.

sharding_is_supported bool

A boolean indicating whether sharding is supported for this storage device.

multiscale_is_supported bool

A boolean indicating whether multiscale storage is supported.

acquire.StorageDimension

Represents the type and size of the dimension for storage.

Attributes:

Name Type Description
name str

A string representing the name or label of the storage dimension.

kind DimensionType

An instance of the DimensionType specifying if the storage dimension is space, channel, time, or a different physical dimension

array_size_px int

The size of the output array along this dimension, in pixels. The final (i.e., append) dimension must have size 0.

chunk_size_px int

The size of a chunk along this dimension, in pixels.

shard_size_chunks int

Integer number of chunks per shard. Shards enable aggregating multiple chunks into a single file. This value is ignored if sharding is not supported by the storage device.

acquire.StorageProperties

The StorageProperties class represents properties for data storage.

Attributes:

Name Type Description
uri Optional[str]

The URI where the image data will be stored.

external_metadata_json Optional[str]

Optional JSON-formatted metadata for the acquisition.

s3_access_key_id Optional[str]

The access key ID for the S3 bucket. This value is only applicable for Zarr storage devices and S3 URIs.

s3_secret_access_key Optional[str]

The secret access key for the S3 bucket. This value is only applicable for Zarr storage devices and S3 URIs.

first_frame_id int

The ID of the first frame.

pixel_scale_um Tuple[float, float]

A tuple of two floats representing the pixel size of the camera in micrometers.

acquisition_dimensions List[StorageDimension]

A list of instances of the StorageDimension class, one for each acquisition dimension. The fastest changing dimension should be first in the list and the append dimension should be last. This value is only applicable for Zarr storage devices.

enable_multiscale bool

A boolean indicating whether multiscale storage is enabled.

acquire.Trigger

The Trigger class represents a trigger signal.

Attributes:

Name Type Description
edge TriggerEdge

An instance of the TriggerEdge class specifying if the trigger is on the rising or falling edge trigger signal.

enable bool

A boolean indicating whether the trigger is enabled.

line int

An integer representing the max value of the trigger signal.

kind SignalIOKind

An instance of the SignalIOKind class specifying if the signal is input or output.

acquire.TriggerCapabilities

Specifies what types of events the trigger can initiate.

Attributes:

Name Type Description
acquisition_start TriggerInputOutputCapabilities

An instance of the TriggerInputOutputCapabilities class indicating which lines, either input or output, are supported for starting acquisition.

exposure TriggerInputOutputCapabilities

An instance of the TriggerInputOutputCapabilities class indicating which lines, either input or output, are supported for starting exposure.

frame_start TriggerInputOutputCapabilities

An instance of the TriggerInputOutputCapabilities class indicating which lines, either input or output, are supported for starting a frame.

acquire.TriggerEdge

The TriggerEdge class represents what edge of the trigger function initiates the trigger.

Attributes:

Name Type Description
Falling TriggerEdge

Enum-type class variable of TriggerEdge that defines the falling edge of the trigger.

NotApplicable TriggerEdge

Enum-type class variable of TriggerEdge that defines if a trigger does not have a rising or falling edge.

Rising TriggerEdge

Enum-type class variable of TriggerEdge that defines the rising edge of the trigger.

AnyEdge TriggerEdge

Enum-type class variable of TriggerEdge that defines any edge of the trigger.

LevelLow TriggerEdge

Enum-type class variable of TriggerEdge that defines the low level of the trigger.

LevelHigh TriggerEdge

Enum-type class variable of TriggerEdge that defines the high level of the trigger.

acquire.TriggerInputOutputCapabilities

Specifies which of the up to 8 supported digital lines can be used for either input or output triggering.

The 2 attributes, input and output, each are read-only values and 8-bit integers from the conversion of the 8 binary digit representation of the digital lines to a decimal integer.

Attributes:

Name Type Description
input int

8-bit integer representing which digital lines can be used for input triggering. For example, if lines 0 and 2 were available for input triggers, the 8 binary digit representation of the lines is 00000101, which is 5 in the decimal system.

output int

8-bit integer representing which digital lines can be used for output triggering. For example, if lines 3 and 5 were available for output triggers, the 8 binary digit representation of the lines is 00101000, which is 40 in the decimal system.

Examples:

If lines 0 and 2 were available for input triggers, the 8 binary digit representation would be 0b00000101, since the 8 available lines are zero indexed. 00000101 binary is 5 in the decimal system, so the input attribute would have a value of 5.

acquire.VideoFrame

The VideoFrame class represents data from acquisition of a frame.

data() -> NDArray[Any]

Returns the data of the video frame as an NDArray.

Call data() to create an NDArray of the VideoFrame data.

metadata() -> VideoFrameMetadata

Returns the metadata associated with the video frame.

Call metadata() to create a VideoFrameMetadata object containing the metadata of VideoFrame.

acquire.VideoFrameMetadata

The VideoFrameMetadata class represents metadata related to a video frame.

Attributes:

Name Type Description
frame_id int

An integer representing the ID of the video frame.

timestamps VideoFrameTimestamps

An instance of the VideoFrameTimestamps class specifying the video timestamps based on the hardware clock and the acquisition clock.

acquire.VideoFrameTimestamps

The VideoFrameTimestamps class represents timestamps related to a video frame.

Attributes:

Name Type Description
hardware int

An integer representing hardware timestamps.

acq_thread int

An integer representing timestamps from the acquisition thread.

acquire.VideoStream

The VideoStream class represents a video stream.

Attributes:

Name Type Description
camera Camera

An instance of the Camera class representing the camera device for the video stream.

storage Storage

An instance of the Storage class representing the storage device for the video stream.

max_frame_count int

An integer representing the maximum number of frames to acquire.

frame_average_count int

An integer representing the number of frames to average, if any, before streaming. The default value is 0, which disables this feature. Setting this to 1 will also prevent averaging.

acquire.VideoStreamCapabilities

The VideoStreamCapabilities class captures the capabilities for a video stream.

Attributes:

Name Type Description
camera CameraCapabilities

An instance of the CameraCapabilities class which represents the capabilities for the camera in this video stream.

storage StorageCapabilities

An instance of the StorageCapabilities class which represents the capabilities for the storage device in this video stream.

max_frame_count Property

An instance of the Property class.

frame_average_count Property

An instance of the Property class.

acquire.VoltageRange

The VoltageRange class represents a range of voltage values.

Attributes:

Name Type Description
mn float

A float representing the minimum voltage value.

mx float

A float representing the maximum voltage value.

acquire._get_runtime() -> Runtime

Potentially create and get the global acquire runtime.

acquire.core_api_version() -> str

Returns the version string for the core API.

acquire.gui(viewer: napari.Viewer, frame_count: int = 100, stream_count: int = 2) -> None

Napari dock-widget plugin entry-point

This instances a magicgui dock widget that streams video to a layer.

acquire.setup(runtime: Runtime, camera: Union[str, List[str]] = 'simulated: radial sin', storage: Union[str, List[str]] = 'Tiff', output_filename: Optional[str] = 'out.tif') -> Properties

Set up the runtime with a camera and storage device.

acquire.setup_one_streams(runtime: Runtime, frame_count: int) -> Properties

acquire.setup_two_streams(runtime: Runtime, frame_count: int) -> Properties