Ingesting folder of images

In the TileDB-Py examples there is one of writing a dense array. Do you have an example of “writing” image data into just local tiledb store? I need to ingest a folder of .tif images and for each one, store the name of the file either in the metadata or as an attribute stored with the image. Later… need to be able to read the image by original file name/title.
I see the bioimage example of reading and it has a C++ program but I need it in Python.

Also I installed tiledb-bioimage and just imported it in python. Without even trying to use any commands I get this error:

C:\ProgramData\miniconda3\envs\conda-tiledb\lib\site-packages\tiledb\cloud\config.py:96: UserWarning: You must first login before you can run commands. Please run tiledb.cloud.login.
  warnings.warn(
Traceback (most recent call last):
  File "./timtest.py", line 2, in <module>
    from tiledb.bioimg.converters.ome_tiff import OMETiffConverter      
  File "C:\ProgramData\miniconda3\envs\conda-tiledb\lib\site-packages\tiledb\bioimg\__init__.py", line 7, in <module>
    from .wrappers import from_bioimg, to_bioimg
  File "C:\ProgramData\miniconda3\envs\conda-tiledb\lib\site-packages\tiledb\bioimg\wrappers.py", line 8, in <module>
    from .converters.openslide import OpenSlideConverter

So does this mean tiledb-bioimage ONLY works with tiledb Cloud?

Hi @Tim_Turner,

So does this mean tiledb-bioimage ONLY works with tiledb Cloud?

No, it is designed to work locally, but it looks like we are missing an import guard. We’ll get a release with fix-ups out soon, but in the meantime please try pip install tiledb-bioimg[full].

After that, to ingest, see: BioImaging | TileDB Embedded Docs

store the name of the file either in the metadata or as an attribute stored with the image

Each image will be stored as a group containing one or more arrays (one for each level of multi-resolution pyramid, if applicable). After ingestion you can add metadata to the TileDB group created by the ingestion, or to one of the arrays in the group using TileDB-Py APIs (1, 2). Here’s an example, using this sample image:

import tiledb, tiledb.bioimg
tiledb.bioimg.from_bioimg("CMU-1.tiff", "CMU-1.tdb")
with tiledb.Group("CMU-1.tdb", "w") as g:
    g.meta["mykey"] = "myval"
with tiledb.Group("CMU-1.tdb") as g:
    print(g.meta["mykey"])
# should print 'myval'

(the image can be viewed on TileDB Cloud or with our Napari integration - after install, run napari CMU-1.tdb).

Hope this helps,
Isaiah

Just importing the tiledb-bioimage causes the cloud login error so I can’t do anything with it until u fix that issue.
Thx.

Hi @Tim_Turner, could you clarify whether there is an additional error after the one you posted? If it’s only a warning, you should be able to ignore the warning proceed with all of the local functions. We’ll get a release out soon with the warning removed.
Best,
Isaiah