data#
Acquisition-time data management.
Centralises three responsibilities:
managerorchestrates per-run data collection, notes, and timestamp writing.writerdefines the OME-TIFF (CustomWriter) and MP4 (CV2Writer) frame handlers.batchprovides batch / post-hoc utilities used by analysis scripts.
CustomWriter and CV2Writer are re-exported from this package so
that from mesofield.data import CustomWriter continues to work in
existing experiment scripts.
- class mesofield.data.CustomWriter[source]#
Bases:
OMETiffWriterOME-TIFF writer extending pymmcore-plus’s
OMETiffWriter.Two divergences from the public base:
Uses
bigtiff=Trueso multi-GiB mesoscope acquisitions write cleanly.Emits the per-frame metadata JSON sidecar mesofield’s downstream parsers (and the AcquisitionManifest’s
metadata_path) depend on.
Everything else – filename validation, frame writing, OME-XML sequence metadata, memmap handling – is inherited from
OMETiffWriter.
- class mesofield.data.CV2Writer[source]#
Bases:
OMETiffWriterWrite frames to an mp4/avi video using OpenCV.
Subclasses the public
OMETiffWriteronly to reuse its inherited MDA-signal handling (frameReady/sequenceStarted/sequenceFinished/store_frame_metadataand theframe_metadatasaccumulation). Every TIFF-specific method (__init__/new_array/write_frame/finalize_metadata) is overridden below to emit video instead, so none ofOMETiffWriter’s tifffile machinery is ever reached.Two usage modes share the same codec/fourcc/metadata logic:
MDA-driven (
new_array/write_frame/finalize_metadata) when handed toCMMCorePlus.run_mdaas an output handler.Direct (
begin/add_frame/finish) for cameras that run their own capture loop (e.g.OpenCVCamera).
- new_array(position_key, dtype, sizes)[source]#
Create a new tifffile file and memmap for this position.
- finalize_metadata()[source]#
Called during sequenceFinished before clearing sequence metadata.
Subclasses may override this method to flush any accumulated frame metadata to disk at the end of the sequence.
- Return type:
None
- begin(width, height, is_color=True)[source]#
Open the underlying
cv2.VideoWriterfor a self-driven loop.