cameras#
- class mesofield.devices.cameras.MMCamera[source]#
Bases:
BaseCamera,DataProducer,HardwareDeviceMicro-Manager-backed camera.
Inherits the common camera surface (identity, output paths, manifest metadata,
arm/set_sequencedefaults,status,calibration) fromBaseCamera, and duck-types theDataProducer/HardwareDeviceProtocols so existing isinstance() checks keep working. The actual frame flow is driven by pymmcore-plus’s MDA event system; this class wires those events into the standardDeviceSignalsbundle and constructs aCustomWriter(OME-TIFF) orCV2Writer(MP4) for the output.- set_sequence(build_mda)[source]#
Build the MDA sequence (Micro-Manager backend only).
- Parameters:
build_mda (Callable[[DataProducer], Any])
- initialize()[source]#
Apply the YAML
propertiesblock to the underlying camera.Each
{device_id: {property: value}}pair is forwarded to the backend (core.setROIfor ROIs,core.setPropertyotherwise) with special handling for the syntheticfps,viewer_type, andauto_contrastkeys.
- start_led_sequence(pattern)[source]#
Start the LED pattern.
If
led_serialis configured on this camera, sends the configured raw byte sequences via MM’s SerialManager. Otherwise falls back to the originalArduino-Switch.State.loadSequence/startSequencepath.- Return type:
None
- stop_led_sequence()[source]#
Stop the LED pattern (mirror of
start_led_sequence()).- Return type:
None
- start()[source]#
Launch the MDA sequence non-blocking.
- Returns:
Always
True. The sequence runs asynchronously on the camera backend; lifecycle is reported viaself.signals.- Return type:
- stop()[source]#
Stop acquisition.
Non-primary Micro-Manager cameras must be told explicitly to halt their sequence acquisition — the primary camera’s MDA driver does not stop them.
- Return type:
- start_live()[source]#
Begin continuous (untimed) sequence acquisition for preview.
- Return type:
None
- class mesofield.devices.cameras.OpenCVCamera[source]#
Bases:
BaseCamera,QThreadBackground-thread OpenCV camera capturing to MP4.
- Emits via
self.signals(amesofield.signals.DeviceSignals): signals.started/signals.finishedfor lifecycle.signals.data(idx, device_ts)per frame, consumed byDataManager.register_hardware_device().
- Plus Qt live-preview signals (GUI-only, decoupled from DataQueue):
frame_ready(np.ndarray)/image_ready(np.ndarray).
Inherits the common camera surface (identity, output paths, manifest metadata,
arm/set_sequencedefaults) fromBaseCamera, and runs its own capture loop on top ofQThread.- set_writer(make_path)[source]#
Resolve the output path and build the
CV2Writer.BaseCamera.set_writerresolvesoutput_path, constructs theCV2Writer(the project’s shared MP4 writer), and copies its sidecar path ontometadata_path. The capture loop drives the writer directly viabegin/add_frame/finish.
- start()[source]#
Spawn the capture thread and begin writing frames to MP4.
- Returns:
Trueif the thread started,Falseif it was already running.- Return type:
- shutdown()[source]#
Tear down the capture thread.
stop()joins the capture thread; itsrun()finally-block releases theCV2Writerand writes the sidecar JSON.- Return type:
None
- Emits via