ZarrTiffStore

final class tifffile.ZarrTiffStore(arg, /, *, level=None, chunkmode=None, fillvalue=None, zattrs=None, multiscales=None, lock=None, squeeze=None, maxworkers=None, buffersize=None, _openfiles=None)

Zarr store interface to image array in TiffPage or TiffPageSeries.

ZarrTiffStore is using a TiffFile instance for reading and decoding chunks. Therefore, ZarrTiffStore instances cannot be pickled.

For writing, image data must be stored in uncompressed, unpredicted, and unpacked form. Sparse strips and tiles are not written.

Parameters:
  • arg (TiffPage | TiffFrame | TiffPageSeries) – TIFF page or series to wrap as Zarr store.

  • level (int | None) – Pyramidal level to wrap. The default is 0.

  • chunkmode (CHUNKMODE | int | str | None) – Use strips or tiles (0) or whole page data (2) as chunks. The default is 0.

  • fillvalue (int | float | None) – Value to use for missing chunks. The default is 0.

  • zattrs (dict[str, Any] | None) – Additional attributes to store in .zattrs.

  • multiscales (bool | None) – Create a multiscales compatible Zarr group store. By default, create a Zarr array store for pages and non-pyramidal series.

  • lock (threading.RLock | NullContext | None) – Reentrant lock to synchronize seeks and reads from file. By default, the lock of the parent’s file handle is used.

  • squeeze (bool | None) – Remove length-1 dimensions from shape of TiffPageSeries.

  • maxworkers (int | None) – Maximum number of threads to concurrently decode strips or tiles if chunkmode=2. If None or 0, use up to _TIFF.MAXWORKERS threads.

  • buffersize (int | None) – Approximate number of bytes to read from file in one pass if chunkmode=2. The default is _TIFF.BUFFERSIZE.

  • _openfiles (int | None) – Internal API.

close()

Close open file handles.

Return type:

None

write_fsspec(jsonfile, /, url, *, groupname=None, templatename=None, compressors=None, version=None, _shape=None, _axes=None, _index=None, _append=False, _close=True)

Write fsspec ReferenceFileSystem as JSON to file.

Parameters:
  • jsonfile (str | os.PathLike[Any] | TextIO) – Name or open file handle of output JSON file.

  • url (str) – Remote location of TIFF file(s) without file name(s).

  • groupname (str | None) – Zarr group name.

  • templatename (str | None) – Version 1 URL template name. The default is ‘u’.

  • compressors (dict[COMPRESSION | int, str | None] | None) – Mapping of COMPRESSION codes to Numcodecs codec names.

  • version (int | None) – Version of fsspec file to write. The default is 0.

  • _shape (Sequence[int] | None) – Shape of file sequence (experimental).

  • _axes (Sequence[str] | None) – Axes of file sequence (experimental).

  • _index (Sequence[int] | None) – Index of file in sequence (experimental).

  • _append (bool) – If True, only write index keys and values (experimental).

  • _close (bool) – If True, no more appends (experimental).

Raises:

ValueError – ZarrTiffStore cannot be represented as ReferenceFileSystem due to features that are not supported by Zarr, Numcodecs, or Imagecodecs: - compressors, such as CCITT - filters, such as bitorder reversal, packed integers - dtypes, such as float24, complex integers - JPEGTables in multi-page series - incomplete chunks, such as imagelength % rowsperstrip != 0 Files containing incomplete tiles may fail at runtime.

Return type:

None

Notes

Parameters _shape, _axes, _index, _append, and _close are an experimental API for joining the ReferenceFileSystems of multiple files of a TiffSequence.

References