Skip to content

Commit

Permalink
Update tifffile/tifffile.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohlke committed Jul 3, 2024
1 parent 796adde commit bcff15c
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions tifffile/tifffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
(1) store NumPy arrays in TIFF (Tagged Image File Format) files, and
(2) read image and metadata from TIFF-like files used in bioimaging.

Image and metadata can be read from TIFF, BigTIFF, OME-TIFF, DNG, STK, LSM,
SGI, NIHImage, ImageJ, MMStack, NDTiff, FluoView, ScanImage, SEQ, GEL,
SVS, SCN, SIS, BIF, ZIF (Zoomable Image File Format), QPTIFF (QPI, PKI), NDPI,
AVS, Philips DP, and GeoTIFF formatted files.
Image and metadata can be read from TIFF, BigTIFF, OME-TIFF, GeoTIFF,
Adobe DNG, ZIF (Zoomable Image File Format), MetaMorph STK, Zeiss LSM,
ImageJ hyperstack, Micro-Manager MMStack and NDTiff, SGI, NIHImage,
Olympus FluoView and SIS, ScanImage, Molecular Dynamics GEL,
Aperio SVS, Leica SCN, Roche BIF, PerkinElmer QPTIFF (QPI, PKI),
Hamamatsu NDPI, Argos AVS, and Philips DP formatted files.

Image data can be read as NumPy arrays or Zarr arrays/groups from strips,
tiles, pages (IFDs), SubIFDs, higher order series, and pyramidal levels.
Expand All @@ -60,7 +62,7 @@

:Author: `Christoph Gohlke <https://www.cgohlke.com>`_
:License: BSD 3-Clause
:Version: 2024.6.18
:Version: 2024.7.2
:DOI: `10.5281/zenodo.6795860 <https://doi.org/10.5281/zenodo.6795860>`_

Quickstart
Expand Down Expand Up @@ -96,7 +98,7 @@
This revision was tested with the following requirements and dependencies
(other versions may work):

- `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.9, 3.12.4, 64-bit
- `CPython <https://www.python.org>`_ 3.10.11, 3.11.9, 3.12.4, 3.13.0b3, 64-bit
- `NumPy <https://pypi.org/project/numpy/>`_ 2.0.0
- `Imagecodecs <https://pypi.org/project/imagecodecs/>`_ 2024.1.1
(required for encoding or decoding LZW, JPEG, etc. compressed segments)
Expand All @@ -106,15 +108,20 @@
(required only for validating and printing XML)
- `Zarr <https://pypi.org/project/zarr/>`_ 2.18.2
(required only for opening Zarr stores)
- `Fsspec <https://pypi.org/project/fsspec/>`_ 2024.6.0
- `Fsspec <https://pypi.org/project/fsspec/>`_ 2024.6.1
(required only for opening ReferenceFileSystem files)

Revisions
---------

2024.6.18
2024.7.2

- Pass 5086 tests.
- Enable memmap to create empty files with non-native byte order.
- Deprecate Python 3.9, support Python 3.13.

2024.6.18

- Ensure TiffPage.nodata is castable to dtype (breaking, #260).
- Support Argos AVS slides.

Expand Down Expand Up @@ -237,12 +244,7 @@
-----

TIFF, the Tagged Image File Format, was created by the Aldus Corporation and
Adobe Systems Incorporated. STK, LSM, FluoView, SGI, SEQ, GEL, QPTIFF, NDPI,
SCN, SVS, ZIF, BIF, and OME-TIFF, are custom extensions defined by Molecular
Devices (Universal Imaging Corporation), Carl Zeiss MicroImaging, Olympus,
Silicon Graphics International, Media Cybernetics, Molecular Dynamics,
PerkinElmer, Hamamatsu, Leica, ObjectivePathology, Roche Digital Pathology,
and the Open Microscopy Environment consortium, respectively.
Adobe Systems Incorporated.

Tifffile supports a subset of the TIFF6 specification, mainly 8, 16, 32, and
64-bit integer, 16, 32 and 64-bit float, grayscale and multi-sample images.
Expand Down Expand Up @@ -817,7 +819,7 @@

from __future__ import annotations

__version__ = '2024.6.18'
__version__ = '2024.7.2'

__all__ = [
'TiffFile',
Expand Down Expand Up @@ -1493,7 +1495,7 @@ def memmap(
/,
*,
shape: Sequence[int] | None = None,
dtype: numpy.dtype[Any] | None = None,
dtype: DTypeLike | None = None,
page: int | None = None,
series: int = 0,
level: int = 0,
Expand Down Expand Up @@ -1543,6 +1545,9 @@ def memmap(
shape = tuple(shape)
if shape is not None and dtype is not None:
# create a new, empty array
dtype = numpy.dtype(dtype)
if 'byteorder' in kwargs:
dtype = dtype.newbyteorder(kwargs['byteorder'])
kwargs.update(
data=None,
shape=shape,
Expand Down Expand Up @@ -2199,8 +2204,6 @@ def write(
if any(size >= 4294967296 for size in datashape):
raise ValueError('invalid data shape')

returnoffset = returnoffset and datadtype.isnative

bilevel = datadtype.char == '?'
if bilevel:
index = -1 if datashape[-1] > 1 else -2
Expand Down Expand Up @@ -20670,7 +20673,7 @@ def read_micromanager_metadata(
The Summary and IndexMap metadata are stored at the beginning of
the file, while DisplaySettings and Comments are towards the end.
Excluding DisplaySettings and Comments from the results may
significantly spead up reading metadata of interest.
significantly speed up reading metadata of interest.

References:
- https://micro-manager.org/Micro-Manager_File_Formats
Expand Down

0 comments on commit bcff15c

Please sign in to comment.