acquire-project / acquire-python

Acquire: a multi-camera video streaming software focusing on microscopy
Apache License 2.0
18 stars 9 forks source link

Tiff-json storage device not working #104

Open dgmccart opened 1 year ago

dgmccart commented 1 year ago

Specifying "tiff-json" storage device causes a acquire api status check error. The code is below. The same code runs fine when "tiff" is used as the storage device.

import acquire
import json

# Instantiate a Runtime object
runtime = acquire.Runtime()

# Initialize the device manager
dm = runtime.device_manager()

# Grab the current configuration
config = runtime.get_configuration() 

# Select the uniform random simulated camera as the video source (using regular expressions)
config.video[0].camera.identifier = dm.select(acquire.DeviceKind.Camera, ".*random.*")

# Select the tiff storage device
config.video[0].storage.identifier = dm.select(acquire.DeviceKind.Storage, "tiff-json")

# Set the data filename to out.tif in your current directory (provide the whole filetree to save to a different directory)
config.video[0].storage.settings.filename = "out.tif" 

# Set the time for collecting data for a each frame
config.video[0].camera.settings.exposure_time_us = 5e4  # 500 ms

# Set the shape of the image ROI 
config.video[0].camera.settings.shape = (300, 200) # (width, height)

# Set the max frame count to 2**(64-1) the largest number supported by Uint64 for essentially infinite acquisition
config.video[0].max_frame_count = 3

#config.video[0].storage.settings.external_metadata_json = json.dumps({"hello": "world"})

# Update the configuration with the chosen parameters 
config = runtime.set_configuration(config)

runtime.start()
print(runtime.get_state())
print(config.video[0].storage.settings.dict())
runtime.stop()
print(runtime.get_state())

Error:

ERROR acquire.runtime 2023-11-02 15:46:31,989 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\acquire-core-libs\src\acquire-device-hal\device\hal\loader.c:114 - driver_load(): Failed to load driver at "acquire-driver-hdcam".
ERROR acquire.runtime 2023-11-02 15:46:31,994 runtime.rs:40 C:\actions-runner\_work\acquire-driver-egrabber\acquire-driver-egrabber\src\euresys.egrabber.cpp:934 - acquire_driver_init_v0(): Exception: EURESYS_COAXLINK_GENTL64_CTI is not set

ERROR acquire.runtime 2023-11-02 15:46:31,994 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\acquire-core-libs\src\acquire-device-hal\device\hal\loader.c:125 - driver_load(): Failed to initialize driver at "acquire-driver-egrabber"
ERROR acquire.runtime 2023-11-02 15:46:34,180 runtime.rs:40 D:\a\acquire-driver-common\acquire-driver-common\src\storage\side-by-side-tiff.cpp:78 - `anonymous-namespace'::validate_json(): nbytes (1) is too small. Expected a null-terminated json string.
ERROR acquire.runtime 2023-11-02 15:46:34,187 runtime.rs:40 D:\a\acquire-driver-common\acquire-driver-common\src\storage\side-by-side-tiff.cpp:116 - `anonymous-namespace'::side_by_side_tiff_set(): Exception: Expression was false: nbytes >= 3

ERROR acquire.runtime 2023-11-02 15:46:34,187 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\acquire-core-libs\src\acquire-device-hal\device\hal\storage.c:64 - storage_validate(): self->state == DeviceState_Armed
ERROR acquire.runtime 2023-11-02 15:46:34,189 runtime.rs:40 D:\a\acquire-python\acquire-python\acquire-video-runtime\src\runtime\sink.c:168 - video_sink_configure(): Storage properties failed to validate.
ERROR acquire.runtime 2023-11-02 15:46:34,189 runtime.rs:40 D:\a\acquire-python\acquire-python\acquire-video-runtime\src\acquire.c:288 - configure_video_stream(): Failed to configure video stream.
ERROR acquire.runtime 2023-11-02 15:46:34,189 runtime.rs:40 D:\a\acquire-python\acquire-python\acquire-video-runtime\src\acquire.c:499 - acquire_start(): At least one video stream must be marked valid
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[9], line 36
     31 #config.video[0].storage.settings.external_metadata_json = json.dumps({"hello": "world"})
     32 
     33 # Update the configuration with the chosen parameters 
     34 config = runtime.set_configuration(config)
---> 36 runtime.start()
     37 print(runtime.get_state())
     38 print(config.video[0].storage.settings.dict())

RuntimeError: Failed acquire api status check

When "tiff" is the storage device, the output is as expected:

ERROR acquire.runtime 2023-11-02 15:50:08,751 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\acquire-core-libs\src\acquire-device-hal\device\hal\loader.c:114 - driver_load(): Failed to load driver at "acquire-driver-hdcam".
ERROR acquire.runtime 2023-11-02 15:50:08,756 runtime.rs:40 C:\actions-runner\_work\acquire-driver-egrabber\acquire-driver-egrabber\src\euresys.egrabber.cpp:934 - acquire_driver_init_v0(): Exception: EURESYS_COAXLINK_GENTL64_CTI is not set

ERROR acquire.runtime 2023-11-02 15:50:08,756 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\acquire-core-libs\src\acquire-device-hal\device\hal\loader.c:125 - driver_load(): Failed to initialize driver at "acquire-driver-egrabber"
DeviceState.Running
{'filename': 'out.tif', 'external_metadata_json': '', 'first_frame_id': 0, 'pixel_scale_um': (0.0, 0.0), 'chunking': {'max_bytes_per_chunk': 16777216, 'tile': {'width': 0, 'height': 0, 'planes': 0}}, 'enable_multiscale': False}
DeviceState.Armed
dgmccart commented 3 months ago

Even if I uncomment config.video[0].storage.settings.external_metadata_json = json.dumps({"hello": "world"}) I get the same error.