Cameras

A camera is a subtype of Camera. Exposure time and region of interest live in the camera's exposure_time and roi::CameraROI fields. Where a driver defines them, the setters (setexposuretime!, setroi!, settriggermode!) push those fields to the hardware, and the generic setter throws elsewhere. DCAM4Camera and AndorSDK3Camera have all three; ThorcamDCXCamera has setexposuretime! and setroi!; ThorCamCSCCamera has only setexposuretime!(camera, value), which takes the value (it crops its ROI in Julia); SimCamera has none. Every frame is a (height, width) array indexed [y, x], and a sequence is (height, width, frames) (see Image layout).

The acquisition calls are capture (one frame), live (a continuous view read with getlastframe), sequence (a fixed number of frames read with getdata) and abort. Their blocking behavior, timeouts and return values differ between drivers. Each driver's type docstring below says how its own differ, including what its methods do not check.

Camera interface

MicroscopeControl.HardwareInterfaces.CameraInterface.CameraFormat — Type
CameraFormat

A mutable struct that represents the format of a camera.

Fields

  • x_pixels::Int: The number of pixels in the x dimension.
  • y_pixels::Int: The number of pixels in the y dimension.
  • pixelsize::Float64: The size of a pixel in microns.
  • gain::Float64: The gain of the camera.
  • sensortype: The type of sensor used in the camera.
source
MicroscopeControl.HardwareInterfaces.CameraInterface.CameraROI — Type
CameraROI

A mutable struct that represents the region of interest of a camera. Offsets are driver-specific: DCAM4Camera sends 0-based offsets to DCAM; ThorCamCSCCamera uses 1-based offsets when cropping the full sensor in Julia. No origin conversion is performed. Their export_state attributes include roi_origin (0 or 1).

Fields

  • x_start::Int: The x coordinate of the start of the ROI.
  • y_start::Int: The y coordinate of the start of the ROI.
  • width::Int: The width of the ROI.
  • height::Int: The height of the ROI.
source
MicroscopeControl.HardwareInterfaces.CameraInterface.capture — Method
capture(camera::Camera)

Acquire one frame.

Arguments

  • camera::Camera: The camera object

Returns

  • The frame, (height, width) indexed [y, x], on DCAM4Camera, ThorCamCSCCamera and ThorcamDCXCamera (lab decision 0040; see docs/src/conventions.md). When the frame does not arrive, DCAM4Camera returns nothing or throws (its docstring says when), ThorCamCSCCamera throws, and ThorcamDCXCamera logs an error and returns nothing.
  • [limitation] SimCamera's capture only switches the camera to single-frame mode and returns no frame; read the simulated frame with getdata or getlastframe.
source
MicroscopeControl.HardwareInterfaces.CameraInterface.getdata — Method
getdata(camera::Camera)

Get the last image frame from the camera

Arguments

  • camera::Camera: The camera object

Returns

  • image: The image frame, (height, width), or a sequence's stack, (height, width, N), indexed [y, x] with [1, 1] at the top left

Image layout: lab decision 0040; see docs/src/conventions.md. A driver converts its SDK's row-major buffer once, with rowmajor_to_yx, and returns the result as it is.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getlastframe — Method
getlastframe(camera::Camera)

Get the last image frame from the camera

Arguments

  • camera::Camera: The camera object

Returns

  • image: The image frame, (height, width) indexed [y, x], [1, 1] at the top left, or nothing when no frame arrives (for example a CSC poll timeout or failed read). Check for nothing before indexing or displaying; drivers must not fabricate a frame. CSC capture and sequence getdata throw on a missing frame.

Image layout: lab decision 0040; see docs/src/conventions.md. A driver converts its SDK's row-major buffer once, with rowmajor_to_yx, and returns the result as it is.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.start_live — Method
start_live(camera::Camera; on_close=nothing) -> Task

Open a GLMakie window that shows the camera's live view. Calls live(camera), then reads frames with getlastframe while camera.is_running == 1 and shows each one scaled to its maximum, with [min max] in the corner (a nothing frame is skipped). Closing the window stops the reader, calls abort(camera) and then on_close() if one is given. Returns the task that updates the display. Needs a display (under xvfb-run on a headless machine).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.start_sequence — Method
start_sequence(camera::Camera) -> nothing

Open a GLMakie window, start sequence(camera), and show frames read with getlastframe while camera.is_running == 1, as start_live does. The window is for watching a sequence, not for keeping it: it does not collect the stack, and closing it calls abort(camera), which on DCAM4Camera and ThorcamDCXCamera releases the sequence buffers and on ThorCamCSCCamera shuts the camera down. [limitation] Do not read the stack with getdata around this window: on ThorcamDCXCamera getdata frees the same buffers the window's abort frees again, and on ThorCamCSCCamera the window and getdata take frames from the same queue. To keep a stack, call sequence and getdata without the window; on ThorcamDCXCamera, a sequence that starts returns the Task that polls the frame count, so wait it before getdata (see that type's docstring). [limitation] On ThorcamDCXCamera, closing the window frees the buffers while the window's reader may still be copying from one. SimCamera's getdata returns new random frames of the right shape at any time; it keeps nothing.

source
MicroscopeControl.export_state — Method
export_state(camera::Camera)

Return the camera's (attributes, data, children) tuple for save_h5. A driver that puts frames in data (the bundled drivers put none) follows the image layout: (height, width[, N]) indexed [y, x], unpermuted, which save_h5 writes as it is and tags with dimension_order (lab decision 0040; see docs/src/conventions.md).

source

Simulated camera

MicroscopeControl.HardwareImplementations.SimulatedCamera.SimCamera — Type
SimCamera(; unique_id="SimCamera", exposure_time=0.1, roi=CameraROI(1, 1, 1024, 1024),
          sequence_length=10, kwargs...)

A simulated camera that returns random UInt16 frames, for tests, examples and system code run without hardware. Every frame is (roi.height, roi.width) indexed [y, x], and a sequence's stack is (roi.height, roi.width, sequence_length) (see docs/src/conventions.md); the values are noise.

Keywords

  • unique_id::String = "SimCamera"
  • camera_format::CameraFormat = CameraFormat(1024, 1024, 6, 2, "SCMOS"): reported by export_state only.
  • exposure_time::Float64 = 0.1: seconds. getlastframe sleeps this long, and a sequence runs sequence_length * exposure_time.
  • roi = CameraROI(1, 1, 1024, 1024): width and height set the frame size. Not checked against camera_format.
  • sequence_length = 10: frames per sequence.
  • capture_mode::CaptureMode = LIVE: set by capture, live and sequence; it picks what getdata returns.
  • is_running::Bool = false: set by live and sequence, cleared by abort and at the end of a sequence; start_live reads frames while it is set.
  • trigger_mode::TriggerMode = AUTO, frame_rate, last_error, camerastate: stored and exported (the panel offers capture_mode and trigger_mode in menus); no simulated behavior depends on them. camera_handle is stored only.

Behavior

  • initialize and shutdown do nothing.
  • live and sequence set is_running; a sequence clears it after sequence_length * exposure_time on an @async task, and abort clears it at once.
  • getdata returns at once, without waiting for a running sequence: a stack in SEQUENCE mode, one frame otherwise.
  • [limitation] capture only switches to SINGLE_FRAME mode and returns no frame, unlike the hardware drivers; read the frame with getdata.
  • [limitation] setexposuretime! and setroi! are not implemented; set the exposure_time and roi fields directly.
source
MicroscopeControl.export_state — Method
export_state(camera::SimCamera)

Settings only: data is nothing, so the state holds no image. A driver that puts frames there follows the image layout, (height, width[, N]) indexed [y, x], unpermuted (lab decision 0040; see docs/src/conventions.md).

source

Hamamatsu cameras (DCAM-API)

MicroscopeControl.HardwareImplementations.DCAM4.DCAM4Camera — Type
DCAM4Camera(dev_id::Int = 0; unique_id="DCAM4Camera", roi=CameraROI(0, 0, 1024, 1024),
            trigger_mode=DCAMPROP_TRIGGER_MODE__NORMAL, sequence_length=10, kwargs...)

A Hamamatsu camera driven through the DCAM-API (libdcam, resolved at load time; set MICROSCOPECONTROL_LIBDCAM to override the library path).

The constructor opens the camera. It takes a count of the DCAM API (initializing it if no other DCAM4Camera in the process holds it), opens device dev_id, reads the image size the camera reports (IMAGE_WIDTH, IMAGE_HEIGHT) into camera_format and the camera's exposure into exposure_time; the camera_format and exposure_time keywords are therefore replaced. It throws if the API cannot be initialized or the device cannot be opened, which usually means another process holds the DCAM SDK or the camera. initialize does nothing. shutdown stops any capture, closes the device and gives back the API count; the last holder uninitializes the API, so several cameras can share one process.

Fields a caller sets

  • exposure_time::Float64: seconds. Push it to the camera with setexposuretime!(camera), or call setexposuretime!(camera, t); the camera's read-back value is stored.
  • roi::CameraROI: 0-based x_start/y_start in sensor pixels, as DCAM takes them. Push it with setroi!(camera) or setroi!(camera, roi).
  • trigger_mode::DCAM4.TriggerMode (one of the DCAM4.DCAMPROP_TRIGGER_MODE__* values, not exported; the exported TriggerMode is the Triggerscope's): push it with settriggermode!.
  • sequence_length: frames per sequence.

last_error holds the DCAMERR of most failed calls, not all: a failed readout-time read falls back with a warning, and shutdown's device close is logged only. capture, live, sequence, getlastframe, getdata and abort document their waits, timeouts and return values in their own docstrings.

Concurrency

One lock per camera, acquisition_lock, serializes every start (live, sequence, capture) with every stop (abort, shutdown), so getlastframe can run on another thread during a live view. A frame wait runs with the lock released and is registered with the camera; a stop aborts the registered waits and waits for them to end before it releases the buffer. A frame wait's DCAM wait is bounded by its timeout; after it, the reader may still copy a frame and close its wait handle before it unregisters, and a stop waits for that too. [limitation] A property call (setvalue, setexposuretime!, setroi! and the others) holds the lock across its DCAM call, which has no timeout, so a hung property call delays a stop or shutdown until it returns. The comments on the struct's fields state the invariant in full.

source
MicroscopeControl.HardwareImplementations.DCAM4.dcamapi_uninit — Method
dcamapi_uninit() -> DCAMERR

Call the DCAM-API's dcamapi_uninit through the library named by Libraries.libdcam, and return its DCAMERR. On failure an error is logged and the code is still returned, not thrown. It tears down the process-wide DCAM-API state; uninitializing while a device is still open or while another part of the process still uses the API is the caller's problem (the camera shutdown calls it when the last holder gives back its count of the API).

source
MicroscopeControl.HardwareImplementations.DCAM4.dcamprop_getvalue — Method
dcamprop_getvalue(hdcam::Ptr{Cvoid}, iProp::Int32) -> (err::DCAMERR, value::Float64)
dcamprop_getvalue(hdcam::Ptr{Cvoid}, idprop::DCAM_IDPROP) -> (err::DCAMERR, value::Float64)

Read the current value of DCAM property iProp (a property ID such as DCAM_IDPROP_INTERNALFRAMERATE, given as an Int32 or a DCAM_IDPROP member) from the open camera hdcam with dcamprop_getvalue of the DCAM-API. Every property value comes back as a Float64, in the property's own unit (seconds, 1/second, a mode number). The returned err is the DCAMERR of the call; on failure an error is logged (nothing is thrown) and value is whatever the library left, 0.0 if it wrote nothing, so test err with is_failed before using it. hdcam is the handle of an opened device, not a DCAM4Camera.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.capture — Method
CameraInterface.capture(camera::DCAM4Camera)

capture refuses (throws) while a live view or sequence is running (is_running) and after shutdown; otherwise it first stops and releases any leftover from an earlier call. It waits at most capture_timeout_ms(exposure, readout) (2 x (exposure + readout) + 1 s, with the readout read from the camera). A timeout or a failed wait logs, sets last_error and throws, after the capture is stopped and the buffer released. A failed buffer allocation or start returns nothing with last_error set, as before. A frame that cannot be copied returns nothing with last_error set. It waits, with the lock released, for any stop in progress to finish before it starts, so a loop of captures cannot keep a stop from ending. Another task's abort, live, sequence, capture or shutdown during the frame wait aborts the wait (see DCAM4Camera). capture then returns nothing after one warning, reads no frame, leaves last_error as it was, and stops and releases nothing: the camera is the other task's now, and the stopper owns the capture. If that stop failed, the capture stays as a leftover (last_error says so) that the next capture, start or abort stops and releases, as after any failed capture.

Image layout: a frame is (height, width), indexed [y, x] with [1, 1] at the top left, and a stack is (height, width, N). dcambuf_readframe converts the SDK's row-major buffer once, dropping any row padding, with CameraInterface.rowmajor_to_yx; see docs/src/conventions.md (lab decision 0040).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getdata — Method
CameraInterface.getdata(camera::DCAM4Camera)

In SEQUENCE mode it polls the capture status until the sequence ends, for at most capture_timeout_ms(N * exposure, N * readout), and reads the N frames. In SINGLEFRAME mode it reads the newest frame at once. In LIVE mode it returns the newest frame at once and leaves the live view running (no stop, no release, `isrunningunchanged). A timeout, a failed status read or a frame that cannot be read logs, setslasterrorand returnsnothing; so does a sequence that transferred fewer frames than requested, withlasterrorset toDCAMERRLOSTFRAME. Outside LIVE mode every exit then stops the capture and releases the buffer, except when a newer capture (abort,live,sequenceorcapture, from another task) has replaced the one it reads: it then logs one warning and returnsnothing, reading no frame, leavinglasterroras it was and the newer capture's buffer alone. The replacement check, the reads and the cleanup hold the camera's acquisition lock, and so does each status read of the poll; the sleep between reads does not. Aftershutdownit returnsnothingwithlasterrorset toDCAMERRINVALIDHANDLE. The cleanup first aborts and joins any frame wait in progress (agetlastframeon another thread; seestopandrelease!`), and is skipped if the capture was replaced meanwhile.

Image layout: a frame is (height, width), indexed [y, x] with [1, 1] at the top left, and a stack is (height, width, N). dcambuf_readframe converts the SDK's row-major buffer once, dropping any row padding, with CameraInterface.rowmajor_to_yx; see docs/src/conventions.md (lab decision 0040).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getlastframe — Method
CameraInterface.getlastframe(camera::DCAM4Camera)

Wait for the next frame for at most capture_timeout_ms(exposure, readout), with the readout cached by readout_time (refreshed by live, sequence and capture), and return it. On a timeout or a failed wait it logs, sets last_error and returns nothing. A frame that cannot be copied returns nothing with last_error set.

It is safe to call from a thread while another task calls abort, live, sequence, capture or shutdown. The wait is registered with the camera (see DCAM4Camera), and a stop aborts it and waits for it to end before the buffer is released or the device closed. When the capture it waited on has been stopped or replaced meanwhile it returns nothing, reads no frame and leaves last_error as it was, with one warning per session. While a stop is under way, or after shutdown, it returns nothing at once with the same warning, makes no DCAM call and opens no wait.

Image layout: a frame is (height, width), indexed [y, x] with [1, 1] at the top left, and a stack is (height, width, N). dcambuf_readframe converts the SDK's row-major buffer once, dropping any row padding, with CameraInterface.rowmajor_to_yx; see docs/src/conventions.md (lab decision 0040).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.live — Method
CameraInterface.live(camera::DCAM4Camera; nframes=10)

Keyword Arguments

  • nframes::Int = 10: The number of frames to capture

Frames are read with getlastframe or getdata; their layout is (height, width) indexed [y, x] (lab decision 0040; see docs/src/conventions.md).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.sequence — Method
CameraInterface.sequence(camera::DCAM4Camera, nframes::Real)

Start a sequence of nframes and return. A task marks is_running false when the sequence ends, or after capture_timeout_ms(N * exposure, N * readout), when it stops a capture still running (logged, with last_error set). The task acts only while the sequence is current (no abort, live, sequence, capture or getdata since); it always ends, and a throw inside it still clears is_running for its own sequence.

The stack is read with getdata, (height, width, N) indexed [y, x, frame] (lab decision 0040; see docs/src/conventions.md).

source
MicroscopeControl.HardwareInterfaces.CameraInterface.setroi! — Method
setroi!(camera::DCAM4Camera, roi::CameraROI)

A failed read-back sets last_error and throws while keeping the requested ROI; it never records failed-read zeros.

Apply roi to the camera. Prefer this over the four-argument form, whose positional order is (hpos, hsize, vpos, vsize) — that is (x, WIDTH, y, HEIGHT) — while CameraROI's field order is (x_start, y_start, width, height). Passing a CameraROI's fields positionally in their own order therefore swaps y_start with width, and before v0.2.3 the resulting mismatch was only warned about, so the wrong region went through. Reported from a rig running an ORCA C11440-22CU.

Positions are 0-based, and the ORCA wants positions and sizes in multiples of 4; a value the camera does not accept now throws.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.setroi! — Method
setroi!(camera::DCAM4Camera, hpos, hsize, vpos, vsize)

Apply an ROI given as (x, WIDTH, y, HEIGHT) — note that this is not CameraROI's field order, which is (x_start, y_start, width, height). The setroi!(camera, ::CameraROI) method above avoids the confusion and is preferred.

source
MicroscopeControl.export_state — Method
export_state(camera::DCAM4Camera)

Settings only: data is nothing, so the state holds no image. A driver that puts frames there follows the image layout, (height, width[, N]) indexed [y, x], unpermuted (lab decision 0040; see docs/src/conventions.md).

source
MicroscopeControl.shutdown — Method
shutdown(camera::DCAM4Camera)

Shut the camera down in one step, under its acquisition lock: aborts and joins every frame wait in progress (a getlastframe loop on another thread needs no abort first), stops and releases any capture, makes every sequence poller and getdata in progress stale, closes the device, and only then gives back this camera's count of the DCAM API. The API is uninitialized when the last holder gives its count back, and never before the device close has returned, so shutting one camera down leaves another one in the process working. Returns the DCAMERR of dcamapi_uninit when it uninitialized the API, and DCAMERR_SUCCESS when another holder keeps it up. A second shutdown, concurrent or later, waits for the first to finish, touches nothing and returns DCAMERR_SUCCESS. A shutdown that is interrupted before it finishes is resumed by the next one, including a concurrent one that was waiting for it: a step that never began runs, a finished step is skipped, and a step interrupted mid-call (the device close, or dcamapi_uninit) is logged once as of unknown outcome and not repeated. After shutdown, getlastframe and getdata return nothing and capture throws; live and sequence log an error and return, and set last_error to DCAMERR_INVALIDHANDLE where they set it at all; none of them makes a DCAM call.

source

Andor cameras (SDK3)

MicroscopeControl.HardwareImplementations.AndorSDK3 — Module
AndorSDK3

The driver for Andor cameras through the SDK3 library (atcore; the Zyla family, Neo, Sona): AndorSDK3Camera, its Camera interface methods, and the binding it calls. The raw binding (atcore.jl) and its checked layer (checked.jl) are the only files that name a library function; the binding takes a SDK3Binding as its first argument, so a test substitutes a recorder for the library.

source
MicroscopeControl.HardwareImplementations.AndorSDK3.AndorSDK3Camera — Type
AndorSDK3Camera(; serial, unique_id = "AndorSDK3Camera", exposure_time = 0.01, roi = nothing,
                trigger_mode = AndorSDK3.INTERNAL, sequence_length = 1, frame_timeout_s = nothing,
                cooling = true, features = Pair{String,Any}[], sdk = AndorSDK3.AtCore())

An Andor camera driven through the SDK3 library (atcore; the Zyla family, Neo, Sona), found by serial number. The library is named by Libraries.libatcore; set MICROSCOPECONTROL_LIBATCORE to override it. On Linux the default is the unversioned libatcore.so, found through the loader's path (Andor's install_andor puts it in /usr/local/lib and registers that folder).

The constructor is pure: it makes no library call and loads no library, on any system. The camera opens in initialize, which opens the camera whose SerialNumber equals serial (never the one at an index, which can be one of Andor's simulated cameras) and throws, listing every camera it found, when none does. initialize on an open camera throws. shutdown stops any acquisition, closes the camera and gives back its count of the library; the last holder finalizes the library, so several cameras and AndorSDK3.list_cameras can share one process.

What a caller sets

  • exposure_time::Float64: seconds; roi::CameraROI: sensor pixels with origin 1 (x_start, y_start, width, height; a zero-size roi, the default, means the full sensor and initialize replaces it); trigger_mode; frame_timeout_s, required with any external trigger because the driver cannot know the period. setexposuretime!, setroi! and settriggermode! send them, and so does every start: there is no cached "already set up". The driver never overwrites a field the caller set; what the camera reported is in exposure_time_actual, readout_time_s, pixel_encoding and layout.
  • features: an ordered list of "FeatureName" => value pairs sent at initialize after the driver's own defaults and read back. A Bool goes to AT_SetBool, an Integer to AT_SetInt, an AbstractFloat to AT_SetFloat and a String to AT_SetEnumString. Order matters: changing the gain control changes PixelEncoding. The driver owns the area-of-interest and binning features, VerticallyCentreAOI, ExposureTime, FrameRate, FrameCount, CycleMode, TriggerMode, AccumulateCount and MetadataEnable, and refuses them here and in AndorSDK3.setfeature!. features must be an ordered collection of pairs, not a Dict.
  • cooling: switch SensorCooling on at initialize. The driver does not wait for the temperature; read it with AndorSDK3.sensor_temperature.

What the driver does

Pixels are decoded here, not through atutility: Mono16 and Mono12 frames (16-bit, little endian) come back as Matrix{UInt16} (height, width), [y, x], converted once with rowmajor_to_yx with the camera's row padding dropped. Other encodings throw, naming the encoding. Metadata is off and binning is 1 x 1.

The driver starts no task, and its waits do not sit in the library: a wait calls AT_WaitBuffer with a timeout of zero, which returns at once, and sleeps, releasing the camera's lock between polls, so an abort from another task runs while a capture waits. Every wait has a deadline. AT_Command (the start and the stop) does block until the camera has done the action (the SDK3 manual, 2.3.7). A camera is in one phase, :closed, :idle or :acquiring, and is_running is true exactly in :acquiring. A start is allowed only from :idle.

The driver checks every library return code and throws an error naming the call and its code, and cleans up after a failure with an ordinary try/finally; the error thrown is the first one. It does not make a camera safe against an interrupt: a Ctrl-C may leave the camera in any state, and stopping it (abort, shutdown) is the caller's.

[limitation] This version has capture, abort and the three setters. live, sequence, getdata and getlastframe throw, making no library call.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.abort — Method
abort(camera::AndorSDK3Camera)

Stop any acquisition: AcquisitionStop, then AT_Flush whatever the stop answered. During a capture the stop is always sent, even if the camera's one-frame cycle has already ended; on an idle camera it is sent only when CameraAcquiring reads true, so abort on an idle camera sends no stop. The camera is left open and :idle. A call that fails is thrown, the first one if both did. A task waiting in capture sees the acquisition replaced and throws. Throws if the camera is not initialized.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.capture — Method
capture(camera::AndorSDK3Camera) -> Matrix{UInt16}

Acquire one frame and return it as (height, width), indexed [y, x], [1, 1] at the top left, with the camera's row padding dropped. Every start sends every setting (exposure, region of interest, trigger mode), sets a fixed cycle of one frame, then reads back what the camera reports (exposure_time_actual, readout_time_s, pixel_encoding) and the frame layout (layout), flushes the library's queues, queues one buffer and starts. The frame is awaited by polling, with a deadline fixed before the start (frame_timeout_s, which must be a positive number when set, else 2 * period + 1 seconds, the period being the longer of the cycle time and exposure plus readout); with an external trigger frame_timeout_s is required and capture throws without a library call if it is not set.

After the frame is read the acquisition is stopped (AcquisitionStop, AT_Flush, as Andor's single-frame example does), and a stop that fails throws. Any other failure, the deadline included, stops the acquisition too and then throws the error: a stop that fails as well does not replace it. The exposure, region, trigger mode and timeout are read once at the start and that one set is checked and sent. A shutdown or abort from another task while capture waits makes capture throw without touching the camera. Never returns nothing. Throws unless the camera is idle.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.setexposuretime! — Method
setexposuretime!(camera::AndorSDK3Camera)

Send camera.exposure_time (seconds) and read back what the camera set into exposure_time_actual; the request is never overwritten. An exposure outside the camera's range throws ArgumentError naming the range, with no set. Only while the camera is idle.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.setroi! — Method
setroi!(camera::AndorSDK3Camera)

Send camera.roi (sensor pixels, origin 1) as AOIWidth, AOILeft, AOIHeight, AOITop, in Andor's order, and read each back. A region outside the sensor or a feature's range throws ArgumentError; a read-back that differs throws. roi is unchanged either way. Only while the camera is idle.

source
MicroscopeControl.export_state — Method
export_state(camera::AndorSDK3Camera) -> (attributes, nothing, children)

The camera's state for save_h5, all attributes HDF5-safe: the identity (unique_id, serial, model, firmware_version, interface_type, sdk_version), the sensor (camera_format_x_pixels, camera_format_y_pixels, camera_format_pixelsize), what was requested (exposure_time, roi_x, roi_y, roi_width, roi_height, roi_origin (1), capture_mode, trigger_mode, sequence_length, frame_timeout_s, cooling_requested, one feature.<Name> per feature given in features or set with AndorSDK3.setfeature!, as last read back, under the spelling it was last set with) and what the camera reported (exposure_time_actual, readout_time_s, pixel_encoding, sensor_temperature_c, temperature_status, temperature_fresh), and the driver's state (phase, is_running). A temperature that could not be read is NaN with temperature_fresh = false; it never makes the export throw. data is nothing; children is empty.

source
MicroscopeControl.initialize — Method
initialize(camera::AndorSDK3Camera)

Take a count of the library, open the camera whose serial is camera.serial, read what it reports (model, firmware, interface, sensor size and pixel size into info and camera_format), send the driver's defaults (binning 1 x 1, one accumulation, metadata off, the AOI not vertically centred, SensorCooling as cooling; each skipped when the camera does not implement it), then each of features in order with a read-back, then the exposure, the region of interest and the trigger mode. Throws when no camera has that serial, listing the cameras found (and, on Linux, when nothing real opened, naming the two usual causes), and when the camera is already initialized. A roi that is not the default zero-size one is sent as given and refused as setroi! refuses it. On Linux, with the real library, every operation that may open an index first refuses (throws, rather than letting the library crash the process) when Andor's scratch files in /tmp exist and belong to another account; the message names each file and its owner, and the same operation refuses a 32-bit Julia before the library is loaded. A failure at any step closes what was opened and gives back the library count before it is rethrown, so initialize can be called again; a failure of that cleanup does not replace the error thrown. If the close failed, the camera stays open (:idle, holding its handle and its count of the library) and shutdown retries it.

source
MicroscopeControl.shutdown — Method
shutdown(camera::AndorSDK3Camera)

Stop any acquisition, close the camera, and give back the camera's count of the library; the last holder finalizes it. The close is attempted even when the stop failed, and the count is given back only after a close that succeeded; the first failure is thrown at the end. When the close succeeded the camera is :closed, its handle cleared, and initialize may be called again. When the close failed the camera keeps its handle, its record of the open index and its count of the library, and stays open (:idle): calling shutdown again retries the close, and no listing opens that index meanwhile. shutdown replaces the acquisition a capture in another task is waiting for, so that task throws and does not touch the closed camera.

source

Thorlabs scientific cameras (CS series)

MicroscopeControl.HardwareImplementations.ThorCamCSC.ThorCamCSCCamera — Type
ThorCamCSCCamera(; exposure_time=40, camera_format=CameraFormat(1440, 1080, 1, 0, "CMOS"),
                 roi=CameraROI(1, 1, 1440, 1080), sequence_length=10, poll_timeout=nothing, kwargs...)

A Thorlabs scientific camera (CS-series) driven through the Thorlabs TSI camera SDK (thorlabs_tsi_camera_sdk.dll, so Windows only).

The keyword constructor opens the camera. It initializes the SDK, has the SDK write the available camera ids into the unique_id buffer (5 bytes by default), and passes that buffer to the open call. A failed SDK step prints or logs an error and does not throw. A missing DLL still throws, and so does a negative exposure when poll_timeout is left to follow it (the default). [limitation] After a failed discovery, camera_handle keeps the keyword's value (C_NULL by default); after a failed open it holds whatever the SDK left in an uninitialized reference. So a non-null handle does not prove the camera opened. [limitation] There is no initialize method for this type, so initialize(camera) throws "initialize not implemented". shutdown closes the camera and uninitializes the SDK for the whole process, and returns both SDK codes. [limitation] abort calls shutdown, so after an abort (including closing a start_live window) the object cannot be used again; construct a new one.

Keywords and fields

  • exposure_time::Clonglong = 40: microseconds. capture, live and sequence write it to the camera before they start; setexposuretime!(camera, t::Clonglong) writes it at once. (setexposuretime!(camera) with no value is not implemented for this type.)
  • poll_timeout::Union{Nothing,Cint} = nothing: frame poll timeout in milliseconds. nothing follows the exposure (two exposures plus one second); a value, or setpolltimeout!, fixes it.
  • camera_format::CameraFormat: must state the sensor size the camera delivers. The driver copies x_pixels * y_pixels pixels from the SDK buffer on every frame, so a larger value reads past the buffer and a smaller one shears the image.
  • roi::CameraROI: 1-based offsets; the full sensor frame is cropped to it in Julia.
  • sequence_length::Int = 10: frames per sequence.
  • operation_mode, number_of_frames_to_buffer: written when capture, live and sequence set up and arm the camera. frames_per_trigger_zero_for_unlimited is written by capture; live and sequence set it to 0 (unlimited).
  • frame_rate: stored only. trigger_mode: stored and exported.
source
MicroscopeControl.HardwareInterfaces.CameraInterface.capture — Method
CameraInterface.capture(camera::ThorCamCSCCamera)

Capture one frame and return it, (roi.height, roi.width) indexed [y, x], the full sensor cropped to roi in software (see getlastframe, including its requirement that camera_format state the sensor the camera delivers; lab decision 0040, docs/src/conventions.md). Throws if the frame does not arrive; no placeholder is returned.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getdata — Method
CameraInterface.getdata(camera::ThorCamCSCCamera)

(roi.height, roi.width, sequence_length) in SEQUENCE mode and (roi.height, roi.width) otherwise, indexed [y, x[, frame]] (lab decision 0040; see docs/src/conventions.md). Each frame is the full sensor cropped to roi in software; see getlastframe, including its requirement that camera_format state the sensor the camera delivers. Throws on a failed read or poll timeout, naming the missing sequence frame; no incomplete stack is returned.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getlastframe — Method
CameraInterface.getlastframe(camera::ThorCamCSCCamera)

The last frame, (roi.height, roi.width) indexed [y, x] (lab decision 0040; see docs/src/conventions.md). The camera always delivers the full sensor, camera_format.y_pixels x camera_format.x_pixels, because the driver never sends roi to it: the SDK's row-major buffer is converted once with CameraInterface.rowmajor_to_yx, and roi (x_start, y_start, 1-based) is then applied in software, so a small roi gives no readout speedup. Throws an ArgumentError, before anything is copied, if roi is not inside the sensor. Returns nothing if the poll times out or the SDK read fails, with last_error set (-1 is the driver poll-timeout sentinel). Unless set explicitly with the constructor keyword, setpolltimeout!, or a poll_timeout field assignment, the poll timeout follows exposure: two exposures plus one second, rounded up to milliseconds and bounded by the SDK integer limit. Explicit timeouts survive acquisition and exposure changes; refused writes preserve the timeout cache. No placeholder image is returned.

camera_format must state the sensor the camera delivers: the driver does not ask the SDK for the image size, so a camera_format larger than the sensor makes the copy read past the SDK's buffer, and a smaller one returns a sheared image.

source
MicroscopeControl.export_state — Method
export_state(camera::ThorCamCSCCamera)

Settings only, with exposure in microseconds and 1-based software ROI offsets. No SDK calls or image reads.

source

Thorlabs DCx cameras (uc480)

MicroscopeControl.HardwareImplementations.ThorCamDCx.ThorcamDCXCamera — Type
ThorcamDCXCamera(unique_id="ThorcamDCXCamera", camera_format=CameraFormat(1280, 1024, 5.2, 1, "CMOS"),
                 camera_handle=0, exposure_time=0.01, frame_rate=20.0, roi=CameraROI(0, 0, 1280, 1024), ...)

A Thorlabs DCx camera driven through the uc480 SDK (C:\Windows\System32\uc480_64.dll, so Windows only). [limitation] The constructor's arguments are positional with defaults, not keywords: ThorcamDCXCamera() takes every default, and changing roi means passing the arguments before it.

The constructor does not touch the hardware. initialize opens the first camera the SDK finds, reads the sensor size and pixel size into camera_format, sets 8-bit monochrome mode, sets the pixel clock near the top of its range, and applies frame_rate (frames per second; it stores the rate the camera accepted). If no camera is found or the open fails it logs an error and returns without throwing. shutdown closes the camera.

Fields a caller sets

  • exposure_time::Float64: seconds; setexposuretime!(camera) writes it (the SDK takes milliseconds).
  • roi::CameraROI: the SDK's area of interest, passed to it unchanged (the default starts at 0, 0); setroi!(camera) writes it. capture writes both before it acquires.
  • sequence_length: frames per sequence.

Frames are UInt8, (roi.height, roi.width) indexed [y, x].

[limitation] getdata does not wait for a sequence: it copies every sequence buffer at once, without checking the frame count or the copy status, then calls abort, so a getdata right after sequence can return a stack of the right shape whose later frames were never exposed. When the capture starts, sequence returns the Task that polls the frame count and then tries to stop the capture (when a buffer or the start fails, it logs an error and returns nothing). So check that t = sequence(camera) is a Task, then wait(t) before getdata(camera); nothing else signals the end. The task does not check whether the stop succeeded, leaves is_running set, and prints "Sequence finished" either way. abort stops the capture and frees the sequence buffers. live, sequence and abort have no docstrings of their own.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.capture — Method
CameraInterface.capture(camera::ThorcamDCXCamera)

Capture one frame and return it, (roi.height, roi.width) indexed [y, x] (see getlastframe; lab decision 0040, docs/src/conventions.md). If selecting the image buffer, the capture or the frame copy fails it logs an error and returns nothing; the allocation's own result is not checked.

source
MicroscopeControl.HardwareInterfaces.CameraInterface.getdata — Method
CameraInterface.getdata(camera::ThorcamDCXCamera)

The sequence as (roi.height, roi.width, sequence_length) UInt8, indexed [y, x, frame], each frame converted once from the SDK's row-major buffer with CameraInterface.rowmajor_to_yx (lab decision 0040; see docs/src/conventions.md). [limitation] It copies the buffers at once, without waiting for the sequence or checking each copy, and then calls abort, which frees them; see ThorcamDCXCamera.

source
MicroscopeControl.export_state — Method
export_state(camera::ThorcamDCXCamera)

Settings only: data is nothing, so the state holds no image. A driver that puts frames there follows the image layout, (height, width[, N]) indexed [y, x], unpermuted (lab decision 0040; see docs/src/conventions.md).

source

Camera internals

Helpers the interface and the drivers define but do not export: the shared GUI loop, the row-major conversion every driver calls, and each driver's SDK bindings.

MicroscopeControl.HardwareInterfaces.CameraInterface.run_live_loop — Method
run_live_loop(show_frame, camera; fps = 60, stop = Threads.Atomic{Bool}(false)) -> (reader, display_task, stop)

Read frames from camera while camera.is_running == 1 and pass each to show_frame. The blocking getlastframe runs on its own thread (Threads.@spawn), so a frame wait of up to the camera's timeout does not stall the thread that renders; a task on the calling thread (@async) alone calls show_frame, which updates the Observables (GLMakie Observables are not thread-safe). The two hand frames over through a one-slot channel, so the reader runs at most one frame ahead of the display. A nothing frame (a timeout, a failed read, or a stopped capture) is skipped and does not end the loop. A frame that show_frame throws on is logged and skipped. With one Julia thread the reader shares it with the display task and the wait blocks both, as before. Setting stop[] ends the reader (at its next frame or timeout); the display task ends when the reader has.

source
MicroscopeControl.HardwareImplementations.DCAM4.DCAM_API_USERS — Constant
DCAM_API_USERS

The number of holders of the DCAM API in this process: every DCAM4Camera (the keyword constructor initializes the API; the positional one adopts the caller's initialization), until its shutdown, and every showdevicelist while it runs. The library is initialized (dcamapi_init) when the first one arrives and uninitialized (dcamapi_uninit) when the last leaves, so shutting one camera down leaves the API up under another. Guarded by DCAM_API_LOCK.

source
MicroscopeControl.HardwareImplementations.DCAM4.api_acquire! — Method
api_acquire!() -> (err, device_count)

Take a count of the DCAM API, initializing it if this is the first. If dcamapi_init fails, it calls dcamapi_uninit (as the constructor always did), takes no count, and returns the error. The device count is the one the library reported when it was initialized.

source
MicroscopeControl.HardwareImplementations.DCAM4.api_release! — Method
api_release!(camera::DCAM4Camera) -> err

shutdown's API step: give back the camera's count, clearing api_held and decrementing DCAM_API_USERS in one hold of DCAM_API_LOCK, so an interrupt while waiting for that lock leaves both untouched. The last holder records api_step = 1 before dcamapi_uninit and 2 after it, so a retry after an interrupt inside the call knows the outcome is unknown. Returns the DCAMERR of dcamapi_uninit when it ran, else DCAMERR_SUCCESS.

source
MicroscopeControl.HardwareImplementations.DCAM4.capture_timeout_ms — Method
capture_timeout_ms(exposure_s, readout_s) -> Int32

The timeout for one frame wait, in milliseconds: 2 * (exposure_s + readout_s) seconds plus 1 s. The readout term matters: a full ORCA frame reads out in tens of milliseconds, far longer than a short exposure. Throws for a negative or non-finite input, and for a result beyond typemax(Int32) ms, so a wait is never unbounded (DCAM reads the negative value 0x80000000 as INFINITE).

source
MicroscopeControl.HardwareImplementations.DCAM4.dcam_trace! — Method
dcam_trace!(path)
dcam_trace!(nothing)

Append a trace line for every DCAM library call to path, or stop tracing and close the file. This is the only way to turn tracing on.

path must be on a local disk: a write to a network path can stall, and a stalled write stalls the DCAM call it brackets. Line formats, each after <time> pid=<pid> tid=<tid>:

BEGIN <name> id=<n> args=(...) gc_ms=.. sp_total_ms=.. sp_max_ms=..
END <name> id=<n> elapsed_ms=<ms> ret=<ret> gc_ms=.. sp_total_ms=.. sp_max_ms=..
THROW <name> id=<n> elapsed_ms=<ms> err=<Type>: <message> gc_ms=.. sp_total_ms=.. sp_max_ms=..
NOTE  <text>

A failed write to the file turns tracing off with one warning; the DCAM call still runs.

Ids count up from 1 in each process and are not reset. The file is appended to, so each NOTE trace on line starts a segment. The trace off and trace on lines end with inflight=none or inflight=<id>:<name>@tid<tid>,... (sorted by id). A call in flight when the trace was switched or turned off is listed on those lines. Its BEGIN is in the earlier segment and its END or THROW, if it ever comes, is in the later one. With the pid on every line, the pair (pid, id) matches a BEGIN to its END or THROW across segments.

While tracing is on, a heartbeat writes NOTE heartbeat gc_ms=.. every second. Heartbeats that keep coming while a BEGIN has no END mean the call is blocking in the library; heartbeats that stop mean every Julia thread is held at a GC stop, waiting for that call, or that other tasks keep every default-pool thread busy (the heartbeat is one task among them). A GC wait shows as sp_total_ms rising by about the stall from the call's BEGIN to its END, or across a silent stretch of heartbeats; heartbeats that stop with no rise in sp_total_ms mean the default threads were busy. Do not use sp_max_ms for this: it is a process-wide high-water mark that is never reset, so after an earlier long wait a new one shows no jump in it. Julia's sleep and timers fire from the libuv event loop, which thread 1 runs, so a sleep-based heartbeat would be silent during any ccall on thread 1; this one blocks its own thread in a sleep call and yields between waits. The cost while tracing is on: on Julia 1.12+ the heartbeat sleeps 100 ms per wait in a GC-safe call, so it adds nothing to a GC's time-to-safepoint. On 1.11 it waits 1 ms per wait (up to about 16 ms on Windows) in a call that is not GC-safe, and each GC can wait that long for it. A GC held by a hung DCAM call shows as seconds either way. The heartbeat runs on the default pool, so it needs a default-pool thread other than the caller's. On Julia 1.12+ the main task runs on the interactive thread, so the default thread that 1.12+ starts with is enough. On 1.11 start Julia with -t 2 or more. With a single thread in all, the heartbeat goes silent during every ccall.

Reading a trace: first check the console for the tracing is now off warning; if it fired, the file stops there because the trace stopped, not because a call hung. A hung call is one listed in inflight= on a trace off or trace on line, or the last BEGIN with no END or THROW of the same id in its segment. Heartbeats after its BEGIN mean the call is blocking in the library. Heartbeats that stopped mean a GC wait only when sp_total_ms rises across the silent stretch (on the next line written, or on the call's END); otherwise the default threads were busy (given the thread rule above).

source
MicroscopeControl.HardwareImplementations.DCAM4.dcamprop_queryvalue — Method

Option to request the kind of value. This parameter can be one of following values; DCAMPROPOPTIONNONE return value is the actual set value for the device when host software calls dcampropsetvalue() DCAMPROPOPTIONPRIOR return value is the prior value DCAMPROPOPTION_NEXT return value is the next value

source
MicroscopeControl.HardwareImplementations.DCAM4.finish_wait! — Method
finish_wait!(camera::DCAM4Camera, hwait)

End a frame wait registered by open_wait!: close its handle and unregister it in one hold of the acquisition lock, then tell the drain that may be waiting for it. A drain that ends therefore leaves no wait handle open. It does nothing for a handle that is not registered, so it is safe on every exit and when called twice. It is the only place a wait handle is closed. Call it before anything that calls stop_and_release!, which would otherwise wait for this wait.

source
MicroscopeControl.HardwareImplementations.DCAM4.open_wait! — Method
open_wait!(camera::DCAM4Camera) -> (err, hwait)

Open a frame wait and register it with the camera, so a drain (drain_waits!) can abort it and join it. Call it with camera.acquisition_lock held, before the wait starts, and put what follows in a try whose finally calls finish_wait!. No wait is registered when the open fails (the returned handle is then C_NULL); one that was opened and cannot be registered is closed before the error propagates.

source
MicroscopeControl.HardwareImplementations.DCAM4.readout_time — Method
readout_time(camera::DCAM4Camera) -> Float64

The sensor readout time in seconds, read from the camera's DCAM_IDPROP_TIMING_READOUTTIME, which depends on the current ROI and readout speed, so read it after setroi!. After shutdown it refuses (see refused_closed!) and returns READOUT_FALLBACK_S without caching it. It reads the camera and caches the value in camera.readout_s. If the read fails or the value is not a finite, non-negative number, it warns and returns (and caches) READOUT_FALLBACK_S.

source
MicroscopeControl.HardwareImplementations.DCAM4.showdevicelist — Method
showdevicelist()

Print the DCAM devices. It borrows a count of the DCAM API (api_acquire!), so it neither initializes the API under a camera that is open nor uninitializes it afterwards. Returns the DCAMERR of dcamapi_uninit when it uninitialized the API, as before, and DCAMERR_SUCCESS when another holder keeps the API up.

source
MicroscopeControl.HardwareImplementations.DCAM4.stop_and_release! — Method
stop_and_release!(camera::DCAM4Camera; current = () -> true)

Leave the camera with no capture running and no buffer attached, whatever an earlier call left behind (a live view, a sequence, or a capture that failed). It first checks current(): when it is false the capture the caller meant to stop has been replaced, and nothing is touched, no wait aborted. Otherwise it aborts every frame wait in progress (getlastframe, capture) and waits for it to end, with the acquisition lock released, as the vendor's samples do, and checks current() again; only then does it stop the capture and release the buffer, so no frame wait is inside the library when its buffer goes. It reads the status next and does nothing more only when the status is known to be STABLE (no buffer) or UNSTABLE. A failed status read, BUSY or ERROR is stopped (unless READY, which is already stopped); then anything with a buffer is released. The helpers log their own failures and never throw. When the stop and the release both worked, or nothing was running, it sets camera.is_running = false and increments capture_generation, so a sequence poller or getdata started before it no longer acts. When the stop or the release failed it records that error in last_error, leaves is_running as it was and leaves the generation alone, since the capture may still be running and whoever owned it still does. A capture whose wait that stop aborted does not own it: the failed stop leaves it as a leftover that the next start, capture or abort stops and releases. It does nothing on a camera that has been shut down. Every start goes through it first: live and sequence through abort, and capture directly. It holds the camera's acquisition lock throughout except while it waits for the frame waits to end (see DCAM4Camera), and its drain is empty inside a start, which drained first.

source
MicroscopeControl.HardwareImplementations.DCAM4.wait_not_busy — Method
wait_not_busy(camera::DCAM4Camera, timeout_ms, what; current = () -> true) -> Bool

Poll the capture status every STATUS_POLL_S until it is no longer BUSY, for at most timeout_ms. Returns true when the capture has ended. A failed status read is logged once and retried until the deadline. At the deadline it logs (naming what), sets last_error (the status read's error if the last read failed, else DCAMERR_TIMEOUT) and returns false. It sleeps between polls, so an interrupt can land, unlike a blocking DCAM wait. It also returns false as soon as current() is false (a newer capture replaced the one it watches), touching nothing.

source
MicroscopeControl.HardwareImplementations.DCAM4.@dcamcall — Macro
@dcamcall [lib.]fn(arg::T, ...)::Ret
@dcamcall gc_safe = true [lib.]fn(arg::T, ...)::Ret

@ccall, plus a BEGIN and an END (or THROW) trace line when tracing is on (see dcam_trace!). Each argument expression is evaluated once.

gc_safe = true is passed to @ccall on Julia 1.12 and later, and ignored before (the keyword does not exist in 1.11, where the call stays a plain @ccall). It lets the garbage collector run while the thread is inside the call, which would otherwise stall every other thread at its next collection. Use it only for a call that can block for a long time and touches no Julia object while it runs: its arguments must not be moved or freed meanwhile, and it must not call back into Julia.

source
MicroscopeControl.HardwareImplementations.AndorSDK3.AndorSDK3Error — Type
AndorSDK3.AndorSDK3Error(call, feature, code, name)

A call into Andor's SDK3 library answered something other than AT_SUCCESS. call is the library function ("AT_SetFloat"), feature the feature it named ("" for a call that takes none), code the integer it returned and name that code's name in atcore.h ("AT_ERR_OUTOFRANGE").

source
MicroscopeControl.HardwareImplementations.AndorSDK3.getfeature — Method
AndorSDK3.getfeature(camera::AndorSDK3Camera, name, T)

Read the feature name as T, one of Bool, Int, Float64 or String. String reads an enumerated feature's current option as its string; the camera has no call that says a feature's type, so the caller's T does. Throws if the feature is not implemented or not readable. Not exported.

source
MicroscopeControl.HardwareImplementations.AndorSDK3.list_cameras — Function
AndorSDK3.list_cameras(sdk = AndorSDK3.AtCore()) -> Vector{NamedTuple}

The cameras the library lists, as (index, model, serial): each is opened to read them and closed again. A camera that another object in this process holds is listed from that object's record without being opened, and an index that will not open or read (another program holds it, AT_ERR_DEVICEINUSE) is listed with the call that failed and its code in place of its model; if the cleanup after a failure fails too, the first failure is thrown. It takes a count of the library, so it never finalizes the library under an open camera, and it holds the process's record of open handles for its whole run, so no other initialize or list_cameras opens an index meanwhile. Not exported.

source
MicroscopeControl.HardwareImplementations.AndorSDK3.sensor_temperature — Method
AndorSDK3.sensor_temperature(camera::AndorSDK3Camera) -> (celsius::Float64, status::String)

The sensor temperature and the cooler's status string ("Cooler Off", "Stabilised", "Cooling", "Drift", "Not Stabilised", "Fault"; "" when the camera has no TemperatureStatus). The driver never waits for the temperature: how long to wait is the instrument's decision. Throws if the camera is not initialized or has no SensorTemperature. Not exported.

source
MicroscopeControl.HardwareImplementations.AndorSDK3.setfeature! — Method
AndorSDK3.setfeature!(camera::AndorSDK3Camera, name, value)

Set the feature name by the Julia type of value (Bool, Integer, AbstractFloat, or String for an enumerated option) and return the value read back; export_state then reports that value, with the exposure, readout time and pixel encoding the camera reports after the write. Only while the camera is idle; throws if the feature is not implemented or not writable, or if the read-back differs. Throws ArgumentError, with no library call, for a feature the driver sets itself (the area of interest and binning, ExposureTime, FrameRate, FrameCount, CycleMode, TriggerMode, AccumulateCount, MetadataEnable, VerticallyCentreAOI): use the camera's fields and setters for those. Not exported.

source

CameraInterface.rowmajor_to_yx, the conversion every hardware camera driver calls, is documented on the Image layout page.