Skip to content

bqapi cannot load pixels as array from video #6

@anantajit

Description

@anantajit

Calling image.pixels().asarray() on a BQImage which is a video (4 channel) generates the following error:

Traceback (most recent call last):
  File "main.py", line 11, in <module>
    array = pixels.asarray()
            ^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/bqapi/bqclass.py", line 471, in asarray
    return tifffile.imread(io.BytesIO(response.content))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/tifffile/tifffile.py", line 424, in imread
    with TiffFile(files, **kwargs_file) as tif:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/tifffile/tifffile.py", line 1686, in __init__
    raise ValueError('invalid TIFF file')
ValueError: invalid TIFF file

Package versions:

  • Python 3.11
  • bqapi-ucsb 1.0.7
  • tifffile 0.14.0

Note: I chose this version of tifffile because it matches the version used in bisqueUCSB. Note that the error persists with latest tifffile version 2025.9.30.

To reproduce, run the following:

import bqapi

session = bqapi.BQSession()
session.init(bisque_url="https://bisque2.ece.ucsb.edu")

# uri = "00-sAWcivf6tPqGUk6FsnEX5i" # aerial (works)
uri = "00-FM84WchNQhjwAGaTaNvvBL" # RGB video (does not work)

image = session.load(uri)
pixels = image.pixels()
array = pixels.asarray()

print(array.shape)

The script behaves as intended for the aerial photo commented out above (X, Y, C) but not for the video (X, Y, T, C).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions