diff --git a/tifffile/tifffile.py b/tifffile/tifffile.py index 83dd6d2..0e0baa6 100644 --- a/tifffile/tifffile.py +++ b/tifffile/tifffile.py @@ -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. @@ -60,7 +62,7 @@ :Author: `Christoph Gohlke `_ :License: BSD 3-Clause -:Version: 2024.6.18 +:Version: 2024.7.2 :DOI: `10.5281/zenodo.6795860 `_ Quickstart @@ -96,7 +98,7 @@ This revision was tested with the following requirements and dependencies (other versions may work): -- `CPython `_ 3.9.13, 3.10.11, 3.11.9, 3.12.4, 64-bit +- `CPython `_ 3.10.11, 3.11.9, 3.12.4, 3.13.0b3, 64-bit - `NumPy `_ 2.0.0 - `Imagecodecs `_ 2024.1.1 (required for encoding or decoding LZW, JPEG, etc. compressed segments) @@ -106,15 +108,20 @@ (required only for validating and printing XML) - `Zarr `_ 2.18.2 (required only for opening Zarr stores) -- `Fsspec `_ 2024.6.0 +- `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. @@ -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. @@ -817,7 +819,7 @@ from __future__ import annotations -__version__ = '2024.6.18' +__version__ = '2024.7.2' __all__ = [ 'TiffFile', @@ -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, @@ -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, @@ -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 @@ -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