[Git][debian-gis-team/pylibtiff][upstream] New upstream version 0.5.0
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Dec 17 14:23:23 GMT 2022
Antonio Valentino pushed to branch upstream at Debian GIS Project / pylibtiff
Commits:
ff8cd69c by Antonio Valentino at 2022-12-17T10:53:19+00:00
New upstream version 0.5.0
- - - - -
26 changed files:
- PKG-INFO
- libtiff/__init__.py
- libtiff/libtiff_ctypes.py
- libtiff/lsm.py
- libtiff/lzw.py
- libtiff/script_options.py
- − libtiff/setup.py
- libtiff/test_bittools.py
- libtiff/tiff_array.py
- libtiff/tiff_channels_and_files.py
- libtiff/tiff_data.py
- libtiff/tiff_file.py
- libtiff/tiff_files.py
- + libtiff/tiff_h_4_2_0.py
- + libtiff/tiff_h_4_3_0.py
- libtiff/tiff_image.py
- libtiff/tiff_sample_plane.py
- libtiff/utils.py
- libtiff/version.py
- pylibtiff.egg-info/PKG-INFO
- pylibtiff.egg-info/SOURCES.txt
- + pylibtiff.egg-info/entry_points.txt
- + pylibtiff.egg-info/requires.txt
- + pyproject.toml
- setup.cfg
- setup.py
Changes:
=====================================
PKG-INFO
=====================================
@@ -1,32 +1,407 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: pylibtiff
-Version: 0.4.4
+Version: 0.5.0
Summary: PyLibTiff: a Python tiff library.
Home-page: https://github.com/pearu/pylibtiff
Author: Pearu Peterson
Author-email: pearu.peterson at gmail.com
License: https://github.com/pearu/pylibtiff/blob/master/LICENSE
-Description:
- PyLibTiff? is a Python package that provides the following modules:
-
- libtiff - a wrapper of C libtiff library using ctypes.
- tiff - a numpy.memmap view of tiff files.
-
-Platform: All
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
-Requires-Python: >=2.7
+Requires-Python: >=3.8
+Description-Content-Type: text/markdown
+Provides-Extra: bitarray
+License-File: LICENSE
+
+
+[](https://github.com/pearu/pylibtiff/actions/workflows/ci.yaml)
+
+PyLibTiff is a package that provides:
+
+* a wrapper to the [libtiff](http://www.simplesystems.org/libtiff/)
+ library to [Python](http://www.python.org) using
+ [ctypes](http://docs.python.org/library/ctypes.html).
+
+* a pure Python module for reading and writing TIFF and LSM files. The
+ images are read as `numpy.memmap` objects so that it is possible to
+ open images that otherwise would not fit to computers RAM. Both TIFF
+ strips and tiles are supported for low-level data storage.
+
+There exists many Python packages such as
+[PIL](http://www.pythonware.com/products/pil/),
+[FreeImagePy](http://freeimagepy.sourceforge.net/) that support
+reading and writing TIFF files. The PyLibTiff project was started to
+have an efficient and direct way to read and write TIFF files using
+the libtiff library without the need to install any unnecessary
+packages or libraries. The pure Python module was created for reading
+"broken" TIFF files such as LSM files that in some places use
+different interpretation of TIFF tags than what specified in the TIFF
+specification document. The libtiff library would just fail reading
+such files. In addition, the pure Python module is more memory
+efficient as the arrays are returned as memory maps. Support for
+compressed files is not implemented yet.
+
+[tifffile.py](http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html) by
+Christoph Gohlke is an excellent module for reading TIFF as well as
+LSM files, it is as fast as libtiff.py by using numpy.
+
+
+# Usage example (libtiff wrapper) #
+
+```
+>>> from libtiff import TIFF
+>>> # to open a tiff file for reading:
+>>> tif = TIFF.open('filename.tif', mode='r')
+>>> # to read an image in the currect TIFF directory and return it as numpy array:
+>>> image = tif.read_image()
+>>> # to read all images in a TIFF file:
+>>> for image in tif.iter_images(): # do stuff with image
+>>> # to open a tiff file for writing:
+>>> tif = TIFF.open('filename.tif', mode='w')
+>>> # to write a image to tiff file
+>>> tif.write_image(image)
+```
+
+# Usage example (pure Python module) #
+
+```
+>>> from libtiff import TIFFfile, TIFFimage
+>>> # to open a tiff file for reading
+>>> tif = TIFFfile('filename.tif')
+>>> # to return memmaps of images and sample names (eg channel names, SamplesPerPixel>=1)
+>>> samples, sample_names = tiff.get_samples()
+>>> # to create a tiff structure from image data
+>>> tiff = TIFFimage(data, description='')
+>>> # to write tiff structure to file
+>>> tiff.write_file('filename.tif', compression='none') # or 'lzw'
+>>> del tiff # flushes data to disk
+```
+
+# Script usage examples #
+
+```
+$ libtiff.info -i result_0.tif --no-gui
+IFDEntry(tag=ImageWidth, value=512, count=1, offset=None)
+IFDEntry(tag=ImageLength, value=512, count=1, offset=None)
+IFDEntry(tag=BitsPerSample, value=32, count=1, offset=None)
+IFDEntry(tag=Compression, value=1, count=1, offset=None)
+IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None)
+IFDEntry(tag=StripOffsets, value=8, count=1, offset=None)
+IFDEntry(tag=Orientation, value=6, count=1, offset=None)
+IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None)
+IFDEntry(tag=PlanarConfiguration, value=1, count=1, offset=None)
+IFDEntry(tag=SampleFormat, value=3, count=1, offset=None)
+Use --ifd to see the rest of 31 IFD entries
+data is contiguous: False
+memory usage is ok: True
+sample data shapes and names:
+
+width : 512
+length : 512
+samples_per_pixel : 1
+planar_config : 1
+bits_per_sample : 32
+strip_length : 1048576
+
+[('memmap', (32, 512, 512), dtype('float32'))] ['sample0']
+```
+
+```
+$ libtiff.info --no-gui -i psf_1024_z5_airy1_set1.lsm
+IFDEntry(tag=NewSubfileType, value=0, count=1, offset=None)
+IFDEntry(tag=ImageWidth, value=1024, count=1, offset=None)
+IFDEntry(tag=ImageLength, value=1024, count=1, offset=None)
+IFDEntry(tag=BitsPerSample, value=8, count=1, offset=None)
+IFDEntry(tag=Compression, value=1, count=1, offset=None)
+IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None)
+IFDEntry(tag=StripOffsets, value=97770, count=1, offset=None)
+IFDEntry(tag=SamplesPerPixel, value=1, count=1, offset=None)
+IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None)
+IFDEntry(tag=PlanarConfiguration, value=2, count=1, offset=None)
+IFDEntry(tag=CZ_LSMInfo, value=CZ_LSMInfo276(
+ MagicNumber=[67127628],
+ StructureSize=[500],
+ DimensionX=[1024],
+ DimensionY=[1024],
+ DimensionZ=[20],
+ DimensionChannels=[1],
+ DimensionTime=[1],
+ SDataType=[1],
+ ThumbnailX=[128],
+ ThumbnailY=[128],
+ VoxelSizeX=[ 2.79017865e-08],
+ VoxelSizeY=[ 2.79017865e-08],
+ VoxelSizeZ=[ 3.60105263e-07],
+ OriginX=[ -2.22222228e-07],
+ OriginY=[ 1.90476196e-07],
+ OriginZ=[ 0.],
+ ScanType=[0],
+ SpectralScan=[0],
+ DataType=[0],
+ OffsetVectorOverlay->DrawingElement(name='OffsetVectorOverlay', size=200, offset=6560),
+ OffsetInputLut->LookupTable(name='OffsetInputLut', size=8388, subblocks=6, channels=1, offset=7560),
+ OffsetOutputLut->LookupTable(name='OffsetOutputLut', size=24836, subblocks=3, channels=3, offset=15948),
+ OffsetChannelColors->ChannelColors (names=['Ch3'], colors=[(255, 0, 0, 0)]),
+ TimeInterval=[ 0.],
+ OffsetChannelDataTypes->None,
+ OffsetScanInformation->recording[size=3535]
+ name = 'psf_1024_z5_airy1_set1'
+ description = ' '
+ notes = ' '
+ objective = 'C-Apochromat 63x/1.20 W Korr UV-VIS-IR M27'
+ special scan mode = 'FocusStep'
+ scan type = ''
+ scan mode = 'Stack'
+ number of stacks = 10
+ lines per plane = 1024
+ samples per line = 1024
+ planes per volume = 20
+ images width = 1024
+ images height = 1024
+ images number planes = 20
+ images number stacks = 1
+ images number channels = 1
+ linescan xy size = 512
+ scan direction = 0
+ scan directionz = 0
+ time series = 0
+ original scan data = 1
+ zoom x = 5.0000000000000009
+ zoom y = 5.0000000000000009
+ zoom z = 1.0
+ sample 0x = -0.22200000000000006
+ sample 0y = 0.19000000000000006
+ sample 0z = 6.8420000000000014
+ sample spacing = 0.028000000000000008
+ line spacing = 0.028000000000000008
+ plane spacing = 0.3600000000000001
+ rotation = 0.0
+ nutation = 0.0
+ precession = 0.0
+ sample 0time = 39583.598368055624
+ start scan trigger in = ''
+ start scan trigger out = ''
+ start scan event = 0
+ start scan time = 0.0
+ stop scan trigger in = ''
+ stop scan trigger out = ''
+ stop scan event = 0
+ start scan time = 0.0
+ use rois = 0
+ use reduced memory rois = 0
+ user = 'User Name'
+ usebccorrection = 0
+ positionbccorrection1 = 0.0
+ positionbccorrection2 = 0.0
+ interpolationy = 1
+ camera binning = 1
+ camera supersampling = 0
+ camera frame width = 1388
+ camera frame height = 1040
+ camera offsetx = 0.0
+ camera offsety = 0.0
+ rt binning = 1
+ ENTRY0x10000064L = 1
+ rt frame width = 512
+ rt frame height = 512
+ rt region width = 512
+ rt region height = 512
+ rt offsetx = 0.0
+ rt offsety = 0.0
+ rt zoom = 1.0000000000000004
+ rt lineperiod = 112.43300000000002
+ prescan = 0
+ lasers[size=188]
+ laser[size=80]
+ name = 'HeNe633'
+ acquire = 1
+ power = 5.0000000000000009
+ end laser
+ laser[size=84]
+ name = 'DPSS 532-75'
+ acquire = 1
+ power = 75.000000000000014
+ end laser
+ end lasers
+ tracks[size=2071]
+ track[size=2047]
+ pixel time = 1.5980000000000003
+ time between stacks = 1.0
+ multiplex type = 1
+ multiplex order = 1
+ sampling mode = 2
+ sampling method = 1
+ sampling number = 8
+ acquire = 1
+ name = 'Track'
+ collimator1 position = 16
+ collimator1 name = 'IR/Vis'
+ collimator2 position = 66
+ collimator2 name = 'UV/Vis'
+ is bleach track = 0
+ is bleach after scan number = 0
+ bleach scan number = 0
+ trigger in = ''
+ trigger out = ''
+ is ratio track = 0
+ bleach count = 0
+ spi center wavelength = 582.53000000000009
+ id condensor aperture = 'KAB1'
+ condensor aperture = 0.55000000000000016
+ id condensor revolver = 'FW2'
+ condensor filter = 'HF'
+ id tubelens = 'Tubelens'
+ id tubelens position = 'Lens LSM'
+ transmitted light = 0.0
+ reflected light = -1.0000000000000002
+ detection channels[size=695]
+ detection channel[size=671]
+ detector gain first = 700.00000000000011
+ detector gain last = 700.00000000000011
+ amplifier gain first = 1.0000000000000002
+ amplifier gain last = 1.0000000000000002
+ amplifier offs first = 0.10000000000000002
+ amplifier offs last = 0.10000000000000002
+ pinhole diameter = 144.00000000000003
+ counting trigger = 5.0
+ acquire = 1
+ integration mode = 0
+ special mode = 0
+ detector name = 'Pmt3'
+ amplifier name = 'Amplifier1'
+ pinhole name = 'PH3'
+ filter set name = 'EF3'
+ filter name = 'LP 650'
+ ENTRY0x70000011L = ''
+ ENTRY0x70000012L = ''
+ integrator name = 'Integrator3'
+ detection channel name = 'Ch3'
+ detector gain bc1 = 0.0
+ detector gain bc2 = 0.0
+ amplifier gain bc1 = 0.0
+ amplifier gain bc2 = 0.0
+ amplifier offs bc1 = 0.0
+ amplifier offs bc2 = 0.0
+ spectral scan channels = 32
+ spi wavelength start = 415.0
+ spi wavelength end = 735.0
+ ENTRY0x70000024L = 575.0
+ ENTRY0x70000025L = 575.0
+ dye name = ''
+ dye folder = ''
+ ENTRY0x70000028L = 1.0000000000000004
+ ENTRY0x70000029L = 0.0
+ end detection channel
+ end detection channels
+ beam splitters[size=330]
+ beam splitter[size=82]
+ filter set = 'HT'
+ filter = 'HFT 405/514/633'
+ name = 'HT'
+ end beam splitter
+ beam splitter[size=75]
+ filter set = 'NT1'
+ filter = 'Mirror'
+ name = 'NT1'
+ end beam splitter
+ beam splitter[size=76]
+ filter set = 'NT2'
+ filter = 'NFT 565'
+ name = 'NT2'
+ end beam splitter
+ beam splitter[size=73]
+ filter set = 'FW1'
+ filter = 'None'
+ name = 'FW1'
+ end beam splitter
+ end beam splitters
+ illumination channels[size=160]
+ illumination channel[size=136]
+ name = '633'
+ power = 0.30000000000000004
+ wavelength = 633.0
+ aquire = 1
+ power bc1 = 0.0
+ power bc2 = 0.0
+ end illumination channel
+ end illumination channels
+ data channels[size=338]
+ data channel[size=314]
+ name = 'Ch3'
+ acquire = 1
+ acquire = 0
+ color = 255
+ sampletype = 1
+ bitspersample = 8
+ ratio type = 0
+ ratio track1 = 0
+ ratio track2 = 0
+ ratio channel1 = ''
+ ratio channel2 = ''
+ ratio const1 = 0.0
+ ratio const2 = 0.0
+ ratio const3 = 1.0
+ ratio const4 = 0.0
+ ratio const5 = 0.0
+ ratio const6 = 0.0
+ end data channel
+ end data channels
+ end track
+ end tracks
+ timers[size=24]
+ end timers
+ markers[size=24]
+ end markers
+end recording,
+ OffsetKsData->OffsetData(name='OffsetKsData', size=8, offset=48590),
+ OffsetTimeStamps->TimeStamps(stamps=[ 2335.75582836]),
+ OffsetEventList->EventList(events=[]),
+ OffsetRoi->DrawingElement(name='OffsetRoi', size=200, offset=6160),
+ OffsetBleachRoi->DrawingElement(name='OffsetBleachRoi', size=200, offset=6360),
+ OffsetNextRecording->None,
+ DisplayAspectX=[ 1.],
+ DisplayAspectY=[ 1.],
+ DisplayAspectZ=[ 1.],
+ DisplayAspectTime=[ 1.],
+ OffsetMeanOfRoisOverlay->DrawingElement(name='OffsetMeanOfRoisOverlay', size=200, offset=6760),
+ OffsetTopoIsolineOverlay->DrawingElement(name='OffsetTopoIsolineOverlay', size=200, offset=7160),
+ OffsetTopoProfileOverlay->DrawingElement(name='OffsetTopoProfileOverlay', size=200, offset=7360),
+ OffsetLinescanOverlay->DrawingElement(name='OffsetLinescanOverlay', size=200, offset=6960),
+ ToolbarFlags=[0],
+ OffsetChannelWavelength->ChannelWavelength (ranges=[(-1.0, -1.0)]),
+ OffsetChannelFactors->ChannelFactors(size=36, offset=40836),
+ ObjectiveSphereCorrection=[ 0.],
+ OffsetUnmixParameters->OffsetData(name='OffsetUnmixParameters', size=124, offset=48466),
+ Reserved=[[40896 44726 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0]]))
+Use --ifd to see the rest of 39 IFD entries
+data is contiguous: False
+memory usage is ok: True
+sample data shapes and names:
+
+width : 1024
+length : 1024
+samples_per_pixel : 1
+planar_config : 2
+bits_per_sample : 8
+strip_length : 1048576
+
+[('memmap', (20, 1024, 1024), dtype('uint8'))] ['Ch3']
+[((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8'))] ['red', 'green', 'blue']
+```
=====================================
libtiff/__init__.py
=====================================
@@ -19,6 +19,13 @@ __autodoc__ = ['libtiff_ctypes', 'tiff', 'tiff_file',
__all__ = ['TIFF', 'TIFF3D', 'TIFFfile', 'TiffArray', 'TiffFile',
'TiffFiles', 'TiffChannelsAndFiles', 'TiffBase']
+try:
+ from libtiff.version import version as __version__ # noqa
+except ModuleNotFoundError:
+ raise ModuleNotFoundError(
+ "No module named libtiff.version. This could mean "
+ "you didn't install 'pylibtiff' properly. Try reinstalling ('pip "
+ "install').")
from .libtiff_ctypes import libtiff, TIFF, TIFF3D # noqa: F401
from .tiff import TIFFfile, TIFFimage, TiffArray # noqa: F401
@@ -26,11 +33,3 @@ from .tiff_file import TiffFile
from .tiff_files import TiffFiles
from .tiff_channels_and_files import TiffChannelsAndFiles
from .tiff_base import TiffBase
-
-# Make bitarray location available, when running from source,
-import os as _os
-import sys as _sys
-_sys.path.append(_os.path.join(_os.path.dirname(__file__),
- 'bitarray-a1646c0'))
-import bitarray as _bitarray # noqa: F402
-_sys.modules['libtiff.bitarray'] = _bitarray
=====================================
libtiff/libtiff_ctypes.py
=====================================
@@ -23,10 +23,11 @@ cwd = os.getcwd()
try:
os.chdir(os.path.dirname(__file__))
if os.name == 'nt':
- # assume that the directory of libtiff3.dll is in PATH.
- lib = ctypes.util.find_library('libtiff3')
+ # assume that the directory of libtiff.dll is in PATH.
+ lib = ctypes.util.find_library('libtiff.dll')
if lib is None:
- lib = ctypes.util.find_library('libtiff.dll')
+ # Fallback to the old "libtiff3" name
+ lib = ctypes.util.find_library('libtiff3')
if lib is None:
# try default installation path:
lib = r'C:\Program Files\GnuWin32\bin\libtiff3.dll'
@@ -640,7 +641,7 @@ class TIFF(ctypes.c_void_p):
arr = np.ascontiguousarray(arr)
if arr.dtype in np.sctypes['float']:
sample_format = SAMPLEFORMAT_IEEEFP
- elif arr.dtype in np.sctypes['uint'] + [np.bool]:
+ elif arr.dtype in np.sctypes['uint'] + [np.bool_]:
sample_format = SAMPLEFORMAT_UINT
elif arr.dtype in np.sctypes['int']:
sample_format = SAMPLEFORMAT_INT
@@ -727,7 +728,7 @@ class TIFF(ctypes.c_void_p):
if arr.dtype in np.sctypes['float']:
sample_format = SAMPLEFORMAT_IEEEFP
- elif arr.dtype in np.sctypes['uint'] + [np.bool]:
+ elif arr.dtype in np.sctypes['uint'] + [np.bool_]:
sample_format = SAMPLEFORMAT_UINT
elif arr.dtype in np.sctypes['int']:
sample_format = SAMPLEFORMAT_INT
=====================================
libtiff/lsm.py
=====================================
@@ -41,7 +41,7 @@ def IFDEntry_lsm_init_hook(ifdentry):
CZ_LSMInfo_type = (CZ_LSMInfo_tag, reserved_bytes)
if CZ_LSMInfo_type not in tiff_module_dict['type2dtype']:
dtype = numpy.dtype(CZ_LSMInfo_dtype_fields + [
- ('Reserved', numpy.dtype('(%s,)u4' % (reserved_bytes//4)))])
+ ('Reserved', numpy.dtype('(%s,)u4' % (reserved_bytes // 4)))])
CZ_LSMInfo_type_name = 'CZ_LSMInfo%s' % (reserved_bytes)
CZ_LSMInfo_type_size = dtype.itemsize
tiff_module_dict['type2dtype'][CZ_LSMInfo_type] = dtype
@@ -80,7 +80,7 @@ def IFDEntry_lsm_finalize_hook(ifdentry):
if verbose_lsm_memory_usage:
ifdentry.memory_usage.append(
(start, end,
- ifdentry.tag_name+' '+name[6:]))
+ ifdentry.tag_name + ' ' + name[6:]))
if verbose_lsm_memory_usage:
for offset in ifdentry.value['Reserved'][0]:
if offset:
@@ -159,7 +159,7 @@ class LSMBlock:
def __str__(self):
return '%s(offset=%s, size=%s, end=%s)' % (
self.__class__.__name__, self.offset, self.get_size(),
- self.offset+self.get_size())
+ self.offset + self.get_size())
def get_data(self, new_offset):
raise NotImplementedError(repr(new_offset))
@@ -181,7 +181,7 @@ def lsmblock(ifdentry, debug=True):
if debug:
arr = r.toarray()
offset = r.offset
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -189,6 +189,7 @@ def lsmblock(ifdentry, debug=True):
class ScanInfoEntry:
""" Holds scan information entry data structure.
"""
+
def __init__(self, entry, type_name, label, data):
self._offset = None
self.record = (entry, type_name, label, data)
@@ -196,7 +197,7 @@ class ScanInfoEntry:
if type_name == 'ASCII':
self.type = 2
self.header = numpy.array(
- [entry, 2, len(data)+1], dtype=numpy.uint32).view(
+ [entry, 2, len(data) + 1], dtype=numpy.uint32).view(
dtype=numpy.ubyte)
elif type_name == 'LONG':
self.type = 4
@@ -283,13 +284,13 @@ class ScanInfoEntry:
item.toarray(target[n:])
n += item.get_size()
elif type_name == 'ASCII':
- target[12:12+len(data)+1] = numpy.array(
- [data+'\0']).view(dtype=dtype)
+ target[12:12 + len(data) + 1] = numpy.array(
+ [data + '\0']).view(dtype=dtype)
elif type_name == 'LONG':
- target[12:12+4] = numpy.array(
+ target[12:12 + 4] = numpy.array(
[data], dtype=numpy.uint32).view(dtype=dtype)
elif type_name == 'DOUBLE':
- target[12:12+8] = numpy.array(
+ target[12:12 + 8] = numpy.array(
[data], dtype=numpy.float64).view(dtype=dtype)
else:
raise NotImplementedError(repr(self.record))
@@ -307,7 +308,7 @@ class ScanInfoEntry:
lst = ['%s%s[size=%s]' % (tab, label, self.get_size())]
for item in data:
if not short or item.data:
- lst.append(item.tostr(tab=tab+' ', short=short))
+ lst.append(item.tostr(tab=tab + ' ', short=short))
return '\n'.join(lst)
if label.startswith(parent_label):
label = label[len(parent_label):]
@@ -374,7 +375,7 @@ def scaninfo(ifdentry, debug=True):
continue
if type_name == 'ASCII':
assert type == 2, repr((hex(entry), type, size))
- value = ifdentry.tiff.get_string(n, size-1)
+ value = ifdentry.tiff.get_string(n, size - 1)
elif type_name == 'LONG':
assert type == 4, repr((hex(entry), type,
size, scaninfo_map[entry]))
@@ -394,7 +395,7 @@ def scaninfo(ifdentry, debug=True):
record_size = record.get_size()
assert size == record_size, repr((size, record_size))
arr = record.toarray()
- arr2 = ifdentry.tiff.data[n1:n1+size]
+ arr2 = ifdentry.tiff.data[n1:n1 + size]
assert (arr == arr2).all()
record.offset = n1
@@ -405,6 +406,7 @@ def scaninfo(ifdentry, debug=True):
class TimeStamps:
""" Holds LSM time stamps information.
"""
+
def __init__(self, ifdentry):
self.ifdentry = ifdentry
self._offset = None
@@ -438,7 +440,7 @@ class TimeStamps:
return '%s(stamps=%s)' % (self.__class__.__name__, self.stamps)
def get_size(self):
- return 8+self.stamps.nbytes
+ return 8 + self.stamps.nbytes
def toarray(self, target=None):
sz = self.get_size()
@@ -450,7 +452,7 @@ class TimeStamps:
assert header.nbytes == 8, repr(header.nbytes)
data = self.stamps.view(dtype=dtype)
target[:header.nbytes] = header
- target[header.nbytes:header.nbytes+data.nbytes] = data
+ target[header.nbytes:header.nbytes + data.nbytes] = data
return target
@@ -467,7 +469,7 @@ def timestamps(ifdentry, debug=True):
r = TimeStamps(ifdentry)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -502,7 +504,7 @@ class EventEntry:
self.time, self.type_name, self.description)
def get_size(self):
- return 4+8+4+4+len(self.description)+1
+ return 4 + 8 + 4 + 4 + len(self.description) + 1
def toarray(self, target=None):
sz = self.get_size()
@@ -510,18 +512,19 @@ class EventEntry:
target = numpy.zeros((sz,), dtype=numpy.ubyte)
dtype = target.dtype
target[:4].view(dtype=numpy.uint32)[0] = sz
- target[4:4+8].view(dtype=numpy.float64)[0] = self.time
+ target[4:4 + 8].view(dtype=numpy.float64)[0] = self.time
target[12:16].view(dtype=numpy.uint32)[0] = self.type
target[16:20].view(dtype=numpy.uint32)[0] = self.record[3]
ln = len(self.description)
- target[20:20+ln] = numpy.array([self.description]).view(dtype=dtype)
- target[20+ln] = 0
+ target[20:20 + ln] = numpy.array([self.description]).view(dtype=dtype)
+ target[20 + ln] = 0
return target
class EventList:
""" Holds LSM event list information.
"""
+
def __init__(self, ifdentry):
self.ifdentry = ifdentry
self._offset = None
@@ -547,14 +550,14 @@ class EventList:
n = self.header['NumberEvents']
offset = self.offset + self.header.nbytes
self._events = []
- for i in range(n):
+ for _ in range(n):
entry_size = self.ifdentry.tiff.get_value(offset, numpy.uint32)
- time = self.ifdentry.tiff.get_value(offset+4, numpy.float64)
+ time = self.ifdentry.tiff.get_value(offset + 4, numpy.float64)
event_type = self.ifdentry.tiff.get_value(
- offset + 4+8, numpy.uint32)
+ offset + 4 + 8, numpy.uint32)
unknown = self.ifdentry.tiff.get_value(
- offset + 4+8+4, numpy.uint32)
- descr = self.ifdentry.tiff.get_string(offset + 4+8+4+4)
+ offset + 4 + 8 + 4, numpy.uint32)
+ descr = self.ifdentry.tiff.get_string(offset + 4 + 8 + 4 + 4)
self._events.append(EventEntry(
entry_size, time, event_type, unknown, descr))
offset += entry_size
@@ -598,7 +601,7 @@ def eventlist(ifdentry, debug=True):
r = EventList(ifdentry)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -606,6 +609,7 @@ def eventlist(ifdentry, debug=True):
class ChannelWavelength:
""" Holds LSM channel wavelength information.
"""
+
def __init__(self, ifdentry):
self.ifdentry = ifdentry
self._offset = None
@@ -625,7 +629,7 @@ class ChannelWavelength:
n = self.ifdentry.tiff.get_value(offset, numpy.int32)
for i in range(n):
start, end = self.ifdentry.tiff.get_values(
- offset + 4 + i*(8+8), numpy.float64, 2)
+ offset + 4 + i * (8 + 8), numpy.float64, 2)
self._ranges.append((start, end))
return self._ranges
@@ -633,7 +637,7 @@ class ChannelWavelength:
return '%s (ranges=%s)' % (self.__class__.__name__, self.ranges)
def get_size(self):
- return 4 + len(self.ranges)*16
+ return 4 + len(self.ranges) * 16
def toarray(self, target=None):
sz = self.get_size()
@@ -642,7 +646,7 @@ class ChannelWavelength:
dtype = target.dtype
target[:4].view(dtype=numpy.int32)[0] = len(self.ranges)
data = numpy.array(self.ranges).ravel()
- target[4:4+data.nbytes] = data.view(dtype=dtype)
+ target[4:4 + data.nbytes] = data.view(dtype=dtype)
return target
@@ -659,7 +663,7 @@ def channelwavelength(ifdentry, debug=True):
r = ChannelWavelength(ifdentry)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -667,6 +671,7 @@ def channelwavelength(ifdentry, debug=True):
class ChannelColors:
""" Holds LSM channel name and color information.
"""
+
def __init__(self, ifdentry):
self.ifdentry = ifdentry
self._offset = None
@@ -701,7 +706,7 @@ class ChannelColors:
n = header[2]
offset = self.offset + header[4] + 4
self._names = []
- for i in range(n):
+ for _ in range(n):
name = self.ifdentry.tiff.get_string(offset)
offset += len(name) + 1 + 4
self._names.append(name)
@@ -714,7 +719,7 @@ class ChannelColors:
n = header[1]
offset = self.offset + header[3]
self._colors = []
- for i in range(n):
+ for _ in range(n):
color = self.ifdentry.tiff.get_values(offset, numpy.uint8, 4)
offset += color.nbytes
self._colors.append(tuple(color))
@@ -769,8 +774,8 @@ def channelcolors(ifdentry, debug=True):
r = ChannelColors(ifdentry)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
- assert(arr == arr2).all()
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
+ assert (arr == arr2).all()
return r
@@ -822,7 +827,7 @@ def channelfactors(ifdentry, debug=True):
r = ChannelFactors(ifdentry)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -929,7 +934,7 @@ def offsetdata(ifdentry, offset_name, debug=True):
r = OffsetData(ifdentry, offset_name)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -952,7 +957,7 @@ class DrawingElement:
def data(self):
if self._data is None:
# n = self.ifdentry.tiff.get_value(self.offset, numpy.int32)
- sz = self.ifdentry.tiff.get_value(self.offset+4, numpy.int32)
+ sz = self.ifdentry.tiff.get_value(self.offset + 4, numpy.int32)
self._data = self.ifdentry.tiff.get_values(
self.offset, numpy.ubyte, sz)
return self._data
@@ -984,7 +989,7 @@ def drawingelement(ifdentry, offset_name, debug=True):
r = DrawingElement(ifdentry, offset_name)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -1012,8 +1017,8 @@ class LookupTable:
return self._data
def __str__(self):
- nsubblocks = self.ifdentry.tiff.get_value(self.offset+4, numpy.uint32)
- nchannels = self.ifdentry.tiff.get_value(self.offset+8, numpy.uint32)
+ nsubblocks = self.ifdentry.tiff.get_value(self.offset + 4, numpy.uint32)
+ nchannels = self.ifdentry.tiff.get_value(self.offset + 8, numpy.uint32)
return '%s(name=%r, size=%r, subblocks=%r, channels=%r, offset=%r)' \
% (self.__class__.__name__, self.offset_name, self.get_size(),
nsubblocks, nchannels, self.offset)
@@ -1039,7 +1044,7 @@ def lookuptable(ifdentry, offset_name, debug=True):
r = LookupTable(ifdentry, offset_name)
if debug:
arr = r.toarray()
- arr2 = ifdentry.tiff.data[offset:offset+arr.nbytes]
+ arr2 = ifdentry.tiff.data[offset:offset + arr.nbytes]
assert (arr == arr2).all()
return r
@@ -1113,7 +1118,7 @@ CZ_LSMOffsetField_readers = dict(
OffsetTopoIsolineOverlay=topoisolineoverlay,
OffsetTopoProfileOverlay=topoprofileoverlay,
OffsetLinescanOverlay=linescanoverlay,
- )
+)
CZ_LSMInfo_dtype_fields = [
('MagicNumber', numpy.uint32),
@@ -1170,26 +1175,26 @@ CZ_LSMInfo_dtype_fields = [
('OffsetUnmixParameters', numpy.uint32),
# ('Reserved', numpy.dtype('(69,)u4')),
# depends on the version of LSM file
- ]
+]
CZ_LSMInfo_dtype_fields_size = 0
for item in CZ_LSMInfo_dtype_fields:
CZ_LSMInfo_dtype_fields_size += item[1]().itemsize
CZ_LSMTimeStamps_header_dtype = numpy.dtype([
- ('Size', numpy.int32),
- ('NumberTimeStamps', numpy.int32),
- # ('TimeStamp<N>', numpy.float64)
- ])
+ ('Size', numpy.int32),
+ ('NumberTimeStamps', numpy.int32),
+ # ('TimeStamp<N>', numpy.float64)
+])
CZ_LSMEventList_header_dtype = numpy.dtype([
- ('Size', numpy.int32),
- ('NumberEvents', numpy.int32),
- # ('Event<N>', EventListEntry)
- ])
+ ('Size', numpy.int32),
+ ('NumberEvents', numpy.int32),
+ # ('Event<N>', EventListEntry)
+])
scaninfo_map = {
- 0x0ffffffff: ('end', 'SUBBLOCK'),
+ 0x0ffffffff: ('end', 'SUBBLOCK'),
0x010000000: ('recording', 'SUBBLOCK'),
0x010000001: ('recording name', 'ASCII'),
0x010000002: ('recording description', 'ASCII'),
=====================================
libtiff/lzw.py
=====================================
@@ -104,10 +104,10 @@ def encode_bittools(seq, max_bits=12):
decode_bittools
"""
if isinstance(seq, numpy.ndarray):
- nbytes = seq.nbytes*2
+ nbytes = seq.nbytes * 2
seq = seq.tostring()
else:
- nbytes = len(seq)*2
+ nbytes = len(seq) * 2
r = numpy.zeros((nbytes,), dtype=numpy.ubyte)
init_table = [(chr(code), code) for code in range(256)]
@@ -151,7 +151,7 @@ def encode_bittools(seq, max_bits=12):
index = setword(r, index, bits, table_get(s), 1)
index = setword(r, index, bits, CODEEOI)
bytes = index // 8
- if 8*bytes < index:
+ if 8 * bytes < index:
bytes += 1
return r[:bytes]
@@ -309,22 +309,22 @@ def test_lzw():
f = open(fn, 'rb')
s = f.read()
f.close()
- t = time.time()-t0
+ t = time.time() - t0
print('Reading %s took %.3f seconds, bytes = %s' % (fn, t, len(s)))
t0 = time.time()
r = encode(s)
- t = time.time()-t0
+ t = time.time() - t0
sz = len(r)
if default_backend == 'bitarray':
sz //= 8
print('Encoding took %.3f seconds, compress ratio = %.3f,'
' Kbytes per second = %.3f'
- % (t, len(s)/sz, len(s)/t/1024))
+ % (t, len(s) / sz, len(s) / t / 1024))
t0 = time.time()
s1 = decode(r)
- t = time.time()-t0
+ t = time.time() - t0
print('Decoding took %.3f seconds, Kbytes per second = %.3f'
- % (t, (sz/t)/1024))
+ % (t, (sz / t) / 1024))
assert s1 == s
=====================================
libtiff/script_options.py
=====================================
@@ -28,7 +28,7 @@ class MyHelpFormatter(TitledHelpFormatter):
if choice == option.default:
if ' ' in choice:
choice = repr(choice)
- choice = '['+choice+']'
+ choice = '[' + choice + ']'
else:
if ' ' in choice:
choice = repr(choice)
=====================================
libtiff/setup.py deleted
=====================================
@@ -1,87 +0,0 @@
-
-import sys
-from os.path import join, basename, splitext
-from glob import glob
-
-from numpy.distutils import log
-from distutils.dep_util import newer
-
-
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- package_name = 'libtiff'
- config = Configuration(package_name, parent_package, top_path)
-
- bitarray_path = 'bitarray-a1646c0/bitarray'
-
- # Add subpackages here:
- config.add_subpackage('bitarray', bitarray_path)
- # eof add.
-
- # Add extensions here:
- config.add_extension('bitarray._bitarray',
- join(bitarray_path, '_bitarray.c'))
- config.add_extension('bittools', join('src', 'bittools.c'))
- config.add_extension('tif_lzw', join('src', 'tif_lzw.c'))
- # eof add.
-
- wininst = 'bdist_wininst' in sys.argv
-
- # Scripts support: files in scripts directories are considered as
- # python scripts that will be installed as
- # <package_name>.<script_name> to scripts installation directory.
- scripts = glob(join(config.local_path, 'scripts', '*.py'))
- scripts += glob(join(config.local_path, '*', 'scripts', '*.py'))
- for script in scripts:
- if basename(script).startswith(package_name):
- config.add_scripts(script)
- continue
-
- def generate_a_script(build_dir, script=script, config=config):
- dist = config.get_distribution()
- install_lib = dist.get_command_obj('install_lib')
- if not install_lib.finalized:
- install_lib.finalize_options()
-
- script_replace_text = ''
- install_lib = install_lib.install_dir
- if install_lib is not None:
- script_replace_text = '''
-import sys
-if %(d)r not in sys.path:
- sys.path.insert(0, %(d)r)
-''' % dict(d=install_lib)
-
- start_mark = '### START UPDATE SYS.PATH ###'
- end_mark = '### END UPDATE SYS.PATH ###'
- name = basename(script)
- if name.startswith(package_name):
- target_name = name
- elif wininst:
- target_name = package_name + '_' + name
- else:
- target_name = package_name + '.' + splitext(name)[0]
- target = join(build_dir, target_name)
- if newer(script, target) or 1:
- log.info('Creating %r', target)
- f = open(script, 'r')
- text = f.read()
- f.close()
-
- i = text.find(start_mark)
- if i != -1:
- j = text.find(end_mark)
- if j == -1:
- log.warn("%r missing %r line", script, start_mark)
- new_text = (text[:i + len(start_mark)]
- + script_replace_text + text[j:])
- else:
- new_text = text
-
- f = open(target, 'w')
- f.write(new_text)
- f.close()
- print("*****{0}".format(target_name))
- config.add_scripts(generate_a_script)
-
- return config
=====================================
libtiff/test_bittools.py
=====================================
@@ -5,7 +5,7 @@ from . import bittools
def tobinary(arr):
return ''.join([str(bittools.getbit(arr, i))
- for i in range(arr.nbytes*8)])
+ for i in range(arr.nbytes * 8)])
def test_setgetbit():
@@ -23,16 +23,16 @@ def test_setgetword():
arr = numpy.array(list(range(-256, 256)), dtype=dtype)
arr2 = numpy.zeros(arr.shape, dtype=arr.dtype)
for i in range(arr.nbytes):
- word, next = bittools.getword(arr, i*8, 8)
- bittools.setword(arr2, i*8, 8, word)
+ word, next = bittools.getword(arr, i * 8, 8)
+ bittools.setword(arr2, i * 8, 8, word)
assert (arr == arr2).all(), repr((arr, arr2))
def test_wordbits():
dtype = numpy.dtype(numpy.int_)
- for width in range(1, dtype.itemsize*8+1):
+ for width in range(1, dtype.itemsize * 8 + 1):
arr = numpy.array([17, 131, 235], dtype=dtype)
- arr2 = numpy.zeros((1+width//8), dtype=dtype)
+ arr2 = numpy.zeros((1 + width // 8), dtype=dtype)
bstr = tobinary(arr)
word, next = bittools.getword(arr, 0, width)
if width > 7:
=====================================
libtiff/tiff_array.py
=====================================
@@ -39,7 +39,7 @@ class TiffArray:
return self.planes[index][()]
elif isinstance(index, slice):
indices = list(range(*index.indices(self.shape[0])))
- r = numpy.empty((len(indices), )+self.shape[1:],
+ r = numpy.empty((len(indices), ) + self.shape[1:],
dtype=self.dtype)
for i, j in enumerate(indices):
r[i] = self.planes[j][()]
@@ -77,7 +77,7 @@ class TiffArray:
' sample type), expected %s but got %s'
% ((self.planes[0].shape, self.dtype),
(plane.shape, plane.dtype)))
- self.shape = (self.shape[0]+1,) + self.shape[1:]
+ self.shape = (self.shape[0] + 1,) + self.shape[1:]
else:
self.dtype = plane.dtype
self.shape = (1, ) + plane.shape
=====================================
libtiff/tiff_channels_and_files.py
=====================================
@@ -55,10 +55,10 @@ class TiffChannelsAndFiles(TiffBase):
lst = []
for channel, tiff in list(self.channels_files_map.items()):
lst.append('Channel %s:' % (channel))
- lst.append('-'*len(lst[-1]))
+ lst.append('-' * len(lst[-1]))
lst.append(tiff.get_info())
return '\n'.join(lst)
def close(self):
- for channel, tiff in list(self.channels_files_map.items()):
+ for tiff in self.channels_files_map.values():
tiff.close()
=====================================
libtiff/tiff_data.py
=====================================
@@ -179,7 +179,7 @@ EXIF_ImageUniqueID a420 ASCII 33
'''
default_tag_values = dict(BitsPerSample=8, SampleFormat=1,
- RowsPerStrip=2**32-1,
+ RowsPerStrip=2**32 - 1,
SamplesPerPixel=1, ExtraSamples=None,
PlanarConfiguration=1,
Compression=1, Predictor=1,
@@ -225,7 +225,7 @@ for line in tag_info.split('\n'):
pass
else:
n, h, t = line.split()[:3]
- h = eval('0x'+h)
+ h = eval('0x' + h)
tag_value2name[h] = n
tag_value2type[h] = t
tag_name2value[n] = h
=====================================
libtiff/tiff_file.py
=====================================
@@ -342,7 +342,7 @@ class TIFFfile(TiffBase):
start = strip_offsets0
end = strip_offsets1 + strip_nbytes1
return self.data[start:end].view(dtype=dtype).reshape(
- (depth, width, length))
+ (depth, width, length))
def get_subfile_types(self):
""" Return a list of subfile types.
@@ -503,7 +503,7 @@ class TIFFfile(TiffBase):
assert width == ifd.get_value('ImageWidth', width), repr(
(width, ifd.get_value('ImageWidth')))
assert length == ifd.get_value('ImageLength', length), repr(
- (length, ifd.get_value('ImageLength')))
+ (length, ifd.get_value('ImageLength')))
# assert samples_per_pixel == ifd.get(
# 'SamplesPerPixel').value, `samples_per_pixel, ifd.get(
# 'SamplesPerPixel').value`
@@ -511,12 +511,12 @@ class TIFFfile(TiffBase):
planar_config)
if can_return_memmap:
assert strip_length == lst[-1][1] - lst[-1][0], repr(
- (strip_length, lst[-1][1] - lst[-1][0]))
+ (strip_length, lst[-1][1] - lst[-1][0]))
else:
strip_length = max(strip_length, lst[-1][1] - lst[-1][0])
strip_length_str = ' < ' + bytes2str(strip_length)
- assert(bits_per_sample == ifd.get_value(
+ assert (bits_per_sample == ifd.get_value(
'BitsPerSample',
bits_per_sample)).all(), repr(
(bits_per_sample, ifd.get_value('BitsPerSample')))
@@ -573,7 +573,7 @@ strip_length : %(strip_length_str)s
arr[i:i + d.nbytes] = d
i += d.nbytes
arr = arr.view(dtype=dtype_lst[0]).reshape(
- (depth, length, width))
+ (depth, length, width))
return [arr], sample_names
else:
i = 0
@@ -603,11 +603,11 @@ strip_length : %(strip_length_str)s
end = lst[-1][1]
if start > step:
arr = self.data[start - step: end].reshape(
- (depth, strip_length + step))
+ (depth, strip_length + step))
k = step
elif end <= self.data.size - step:
arr = self.data[start: end + step].reshape(
- (depth, strip_length + step))
+ (depth, strip_length + step))
k = 0
else:
raise NotImplementedError(repr((start, end, step)))
@@ -792,8 +792,7 @@ class IFD:
'DocumentName', 'Model', 'Make', 'PageName',
'DateTime', 'Artist', 'HostComputer']:
if value is not None:
- return value.view('|S{!s}'.format(str(value.nbytes //
- value.size))).tostring()
+ return value.view('|S{!s}'.format(str(value.nbytes // value.size))).tostring()
if human:
if tag_name == 'Compression':
value = {1: 'Uncompressed', 2: 'CCITT1D', 3: 'Group3Fax',
@@ -918,10 +917,8 @@ class IFD:
if isinstance(bits_per_sample, numpy.ndarray):
dtype = getattr(self.dtypes,
'uint%s' % (bits_per_sample[i]))
- r[channel_names[i]] = self.tiff.data[
- strip_offsets[i]:strip_offsets[i] +
- strip_nbytes[i]].view(
- dtype=dtype).reshape((width, length))
+ subdata = self.tiff.data[strip_offsets[i]: strip_offsets[i] + strip_nbytes[i]]
+ r[channel_names[i]] = subdata.view(dtype=dtype).reshape((width, length))
else:
dtype = getattr(self.dtypes, 'uint%s' % (bits_per_sample))
r[channel_names[i]] = self.tiff.data[
@@ -980,9 +977,9 @@ class IFD:
if descr.startswith('<?xml') or descr[:4].lower() == '<ome':
raise NotImplementedError(
'getting pixels sizes from OME-XML string')
- for vx, vy, vz in [('PixelSizeX', 'PixelSizeY', 'PixelSizeZ'),
- ('VoxelSizeX', 'VoxelSizeY', 'VoxelSizeZ'),
- ]:
+ for vx, vy in [('PixelSizeX', 'PixelSizeY'),
+ ('VoxelSizeX', 'VoxelSizeY'),
+ ]:
ix = descr.find(vx)
iy = descr.find(vy)
if ix == -1:
=====================================
libtiff/tiff_files.py
=====================================
@@ -17,7 +17,7 @@ class TiffFiles(TiffBase):
TiffFile, TiffChannelsAndFiles
"""
- def __init__(self, files, time_map={}, verbose=False, local_cache=None):
+ def __init__(self, files, time_map=None, verbose=False, local_cache=None):
"""
Parameters
----------
@@ -34,7 +34,7 @@ class TiffFiles(TiffBase):
"""
self.verbose = verbose
self.files = files
- self.tiff_files = {}
+ self.tiff_files = time_map or {}
self.time_map = time_map
self.local_cache = local_cache
@@ -116,7 +116,7 @@ class TiffFiles(TiffBase):
tiff_array = TiffArray(planes)
if self.verbose:
print('%s.get_tiff_array: took %ss' % (self.__class__.__name__,
- time.time()-start))
+ time.time() - start))
return tiff_array
def close(self):
=====================================
libtiff/tiff_h_4_2_0.py
=====================================
@@ -0,0 +1,528 @@
+TIFF_VERSION_CLASSIC = 42
+TIFF_VERSION_BIG = 43
+TIFF_BIGENDIAN = 19789
+TIFF_LITTLEENDIAN = 18761
+MDI_LITTLEENDIAN = 20549
+MDI_BIGENDIAN = 17744
+TIFFTAG_SUBFILETYPE = 254
+FILETYPE_REDUCEDIMAGE = 1
+FILETYPE_PAGE = 2
+FILETYPE_MASK = 4
+TIFFTAG_OSUBFILETYPE = 255
+OFILETYPE_IMAGE = 1
+OFILETYPE_REDUCEDIMAGE = 2
+OFILETYPE_PAGE = 3
+TIFFTAG_IMAGEWIDTH = 256
+TIFFTAG_IMAGELENGTH = 257
+TIFFTAG_BITSPERSAMPLE = 258
+TIFFTAG_COMPRESSION = 259
+COMPRESSION_NONE = 1
+COMPRESSION_CCITTRLE = 2
+COMPRESSION_CCITTFAX3 = 3
+COMPRESSION_CCITT_T4 = 3
+COMPRESSION_CCITTFAX4 = 4
+COMPRESSION_CCITT_T6 = 4
+COMPRESSION_LZW = 5
+COMPRESSION_OJPEG = 6
+COMPRESSION_JPEG = 7
+COMPRESSION_T85 = 9
+COMPRESSION_T43 = 10
+COMPRESSION_NEXT = 32766
+COMPRESSION_CCITTRLEW = 32771
+COMPRESSION_PACKBITS = 32773
+COMPRESSION_THUNDERSCAN = 32809
+COMPRESSION_IT8CTPAD = 32895
+COMPRESSION_IT8LW = 32896
+COMPRESSION_IT8MP = 32897
+COMPRESSION_IT8BL = 32898
+COMPRESSION_PIXARFILM = 32908
+COMPRESSION_PIXARLOG = 32909
+COMPRESSION_DEFLATE = 32946
+COMPRESSION_ADOBE_DEFLATE = 8
+COMPRESSION_DCS = 32947
+COMPRESSION_JBIG = 34661
+COMPRESSION_SGILOG = 34676
+COMPRESSION_SGILOG24 = 34677
+COMPRESSION_JP2000 = 34712
+COMPRESSION_LERC = 34887
+COMPRESSION_LZMA = 34925
+COMPRESSION_ZSTD = 50000
+COMPRESSION_WEBP = 50001
+TIFFTAG_PHOTOMETRIC = 262
+PHOTOMETRIC_MINISWHITE = 0
+PHOTOMETRIC_MINISBLACK = 1
+PHOTOMETRIC_RGB = 2
+PHOTOMETRIC_PALETTE = 3
+PHOTOMETRIC_MASK = 4
+PHOTOMETRIC_SEPARATED = 5
+PHOTOMETRIC_YCBCR = 6
+PHOTOMETRIC_CIELAB = 8
+PHOTOMETRIC_ICCLAB = 9
+PHOTOMETRIC_ITULAB = 10
+PHOTOMETRIC_CFA = 32803
+PHOTOMETRIC_LOGL = 32844
+PHOTOMETRIC_LOGLUV = 32845
+TIFFTAG_THRESHHOLDING = 263
+THRESHHOLD_BILEVEL = 1
+THRESHHOLD_HALFTONE = 2
+THRESHHOLD_ERRORDIFFUSE = 3
+TIFFTAG_CELLWIDTH = 264
+TIFFTAG_CELLLENGTH = 265
+TIFFTAG_FILLORDER = 266
+FILLORDER_MSB2LSB = 1
+FILLORDER_LSB2MSB = 2
+TIFFTAG_DOCUMENTNAME = 269
+TIFFTAG_IMAGEDESCRIPTION = 270
+TIFFTAG_MAKE = 271
+TIFFTAG_MODEL = 272
+TIFFTAG_STRIPOFFSETS = 273
+TIFFTAG_ORIENTATION = 274
+ORIENTATION_TOPLEFT = 1
+ORIENTATION_TOPRIGHT = 2
+ORIENTATION_BOTRIGHT = 3
+ORIENTATION_BOTLEFT = 4
+ORIENTATION_LEFTTOP = 5
+ORIENTATION_RIGHTTOP = 6
+ORIENTATION_RIGHTBOT = 7
+ORIENTATION_LEFTBOT = 8
+TIFFTAG_SAMPLESPERPIXEL = 277
+TIFFTAG_ROWSPERSTRIP = 278
+TIFFTAG_STRIPBYTECOUNTS = 279
+TIFFTAG_MINSAMPLEVALUE = 280
+TIFFTAG_MAXSAMPLEVALUE = 281
+TIFFTAG_XRESOLUTION = 282
+TIFFTAG_YRESOLUTION = 283
+TIFFTAG_PLANARCONFIG = 284
+PLANARCONFIG_CONTIG = 1
+PLANARCONFIG_SEPARATE = 2
+TIFFTAG_PAGENAME = 285
+TIFFTAG_XPOSITION = 286
+TIFFTAG_YPOSITION = 287
+TIFFTAG_FREEOFFSETS = 288
+TIFFTAG_FREEBYTECOUNTS = 289
+TIFFTAG_GRAYRESPONSEUNIT = 290
+GRAYRESPONSEUNIT_10S = 1
+GRAYRESPONSEUNIT_100S = 2
+GRAYRESPONSEUNIT_1000S = 3
+GRAYRESPONSEUNIT_10000S = 4
+GRAYRESPONSEUNIT_100000S = 5
+TIFFTAG_GRAYRESPONSECURVE = 291
+TIFFTAG_GROUP3OPTIONS = 292
+TIFFTAG_T4OPTIONS = 292
+GROUP3OPT_2DENCODING = 1
+GROUP3OPT_UNCOMPRESSED = 2
+GROUP3OPT_FILLBITS = 4
+TIFFTAG_GROUP4OPTIONS = 293
+TIFFTAG_T6OPTIONS = 293
+GROUP4OPT_UNCOMPRESSED = 2
+TIFFTAG_RESOLUTIONUNIT = 296
+RESUNIT_NONE = 1
+RESUNIT_INCH = 2
+RESUNIT_CENTIMETER = 3
+TIFFTAG_PAGENUMBER = 297
+TIFFTAG_COLORRESPONSEUNIT = 300
+COLORRESPONSEUNIT_10S = 1
+COLORRESPONSEUNIT_100S = 2
+COLORRESPONSEUNIT_1000S = 3
+COLORRESPONSEUNIT_10000S = 4
+COLORRESPONSEUNIT_100000S = 5
+TIFFTAG_TRANSFERFUNCTION = 301
+TIFFTAG_SOFTWARE = 305
+TIFFTAG_DATETIME = 306
+TIFFTAG_ARTIST = 315
+TIFFTAG_HOSTCOMPUTER = 316
+TIFFTAG_PREDICTOR = 317
+PREDICTOR_NONE = 1
+PREDICTOR_HORIZONTAL = 2
+PREDICTOR_FLOATINGPOINT = 3
+TIFFTAG_WHITEPOINT = 318
+TIFFTAG_PRIMARYCHROMATICITIES = 319
+TIFFTAG_COLORMAP = 320
+TIFFTAG_HALFTONEHINTS = 321
+TIFFTAG_TILEWIDTH = 322
+TIFFTAG_TILELENGTH = 323
+TIFFTAG_TILEOFFSETS = 324
+TIFFTAG_TILEBYTECOUNTS = 325
+TIFFTAG_BADFAXLINES = 326
+TIFFTAG_CLEANFAXDATA = 327
+CLEANFAXDATA_CLEAN = 0
+CLEANFAXDATA_REGENERATED = 1
+CLEANFAXDATA_UNCLEAN = 2
+TIFFTAG_CONSECUTIVEBADFAXLINES = 328
+TIFFTAG_SUBIFD = 330
+TIFFTAG_INKSET = 332
+INKSET_CMYK = 1
+INKSET_MULTIINK = 2
+TIFFTAG_INKNAMES = 333
+TIFFTAG_NUMBEROFINKS = 334
+TIFFTAG_DOTRANGE = 336
+TIFFTAG_TARGETPRINTER = 337
+TIFFTAG_EXTRASAMPLES = 338
+EXTRASAMPLE_UNSPECIFIED = 0
+EXTRASAMPLE_ASSOCALPHA = 1
+EXTRASAMPLE_UNASSALPHA = 2
+TIFFTAG_SAMPLEFORMAT = 339
+SAMPLEFORMAT_UINT = 1
+SAMPLEFORMAT_INT = 2
+SAMPLEFORMAT_IEEEFP = 3
+SAMPLEFORMAT_VOID = 4
+SAMPLEFORMAT_COMPLEXINT = 5
+SAMPLEFORMAT_COMPLEXIEEEFP = 6
+TIFFTAG_SMINSAMPLEVALUE = 340
+TIFFTAG_SMAXSAMPLEVALUE = 341
+TIFFTAG_CLIPPATH = 343
+TIFFTAG_XCLIPPATHUNITS = 344
+TIFFTAG_YCLIPPATHUNITS = 345
+TIFFTAG_INDEXED = 346
+TIFFTAG_JPEGTABLES = 347
+TIFFTAG_OPIPROXY = 351
+TIFFTAG_GLOBALPARAMETERSIFD = 400
+TIFFTAG_PROFILETYPE = 401
+PROFILETYPE_UNSPECIFIED = 0
+PROFILETYPE_G3_FAX = 1
+TIFFTAG_FAXPROFILE = 402
+FAXPROFILE_S = 1
+FAXPROFILE_F = 2
+FAXPROFILE_J = 3
+FAXPROFILE_C = 4
+FAXPROFILE_L = 5
+FAXPROFILE_M = 6
+TIFFTAG_CODINGMETHODS = 403
+CODINGMETHODS_T4_1D = 2
+CODINGMETHODS_T4_2D = 4
+CODINGMETHODS_T6 = 8
+CODINGMETHODS_T85 = 16
+CODINGMETHODS_T42 = 32
+CODINGMETHODS_T43 = 64
+TIFFTAG_VERSIONYEAR = 404
+TIFFTAG_MODENUMBER = 405
+TIFFTAG_DECODE = 433
+TIFFTAG_IMAGEBASECOLOR = 434
+TIFFTAG_T82OPTIONS = 435
+TIFFTAG_JPEGPROC = 512
+JPEGPROC_BASELINE = 1
+JPEGPROC_LOSSLESS = 14
+TIFFTAG_JPEGIFOFFSET = 513
+TIFFTAG_JPEGIFBYTECOUNT = 514
+TIFFTAG_JPEGRESTARTINTERVAL = 515
+TIFFTAG_JPEGLOSSLESSPREDICTORS = 517
+TIFFTAG_JPEGPOINTTRANSFORM = 518
+TIFFTAG_JPEGQTABLES = 519
+TIFFTAG_JPEGDCTABLES = 520
+TIFFTAG_JPEGACTABLES = 521
+TIFFTAG_YCBCRCOEFFICIENTS = 529
+TIFFTAG_YCBCRSUBSAMPLING = 530
+TIFFTAG_YCBCRPOSITIONING = 531
+YCBCRPOSITION_CENTERED = 1
+YCBCRPOSITION_COSITED = 2
+TIFFTAG_REFERENCEBLACKWHITE = 532
+TIFFTAG_STRIPROWCOUNTS = 559
+TIFFTAG_XMLPACKET = 700
+TIFFTAG_OPIIMAGEID = 32781
+TIFFTAG_TIFFANNOTATIONDATA = 32932
+TIFFTAG_REFPTS = 32953
+TIFFTAG_REGIONTACKPOINT = 32954
+TIFFTAG_REGIONWARPCORNERS = 32955
+TIFFTAG_REGIONAFFINE = 32956
+TIFFTAG_MATTEING = 32995
+TIFFTAG_DATATYPE = 32996
+TIFFTAG_IMAGEDEPTH = 32997
+TIFFTAG_TILEDEPTH = 32998
+TIFFTAG_PIXAR_IMAGEFULLWIDTH = 33300
+TIFFTAG_PIXAR_IMAGEFULLLENGTH = 33301
+TIFFTAG_PIXAR_TEXTUREFORMAT = 33302
+TIFFTAG_PIXAR_WRAPMODES = 33303
+TIFFTAG_PIXAR_FOVCOT = 33304
+TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN = 33305
+TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA = 33306
+TIFFTAG_WRITERSERIALNUMBER = 33405
+TIFFTAG_CFAREPEATPATTERNDIM = 33421
+TIFFTAG_CFAPATTERN = 33422
+TIFFTAG_COPYRIGHT = 33432
+TIFFTAG_MD_FILETAG = 33445
+TIFFTAG_MD_SCALEPIXEL = 33446
+TIFFTAG_MD_COLORTABLE = 33447
+TIFFTAG_MD_LABNAME = 33448
+TIFFTAG_MD_SAMPLEINFO = 33449
+TIFFTAG_MD_PREPDATE = 33450
+TIFFTAG_MD_PREPTIME = 33451
+TIFFTAG_MD_FILEUNITS = 33452
+TIFFTAG_RICHTIFFIPTC = 33723
+TIFFTAG_INGR_PACKET_DATA_TAG = 33918
+TIFFTAG_INGR_FLAG_REGISTERS = 33919
+TIFFTAG_IRASB_TRANSORMATION_MATRIX = 33920
+TIFFTAG_MODELTIEPOINTTAG = 33922
+TIFFTAG_IT8SITE = 34016
+TIFFTAG_IT8COLORSEQUENCE = 34017
+TIFFTAG_IT8HEADER = 34018
+TIFFTAG_IT8RASTERPADDING = 34019
+TIFFTAG_IT8BITSPERRUNLENGTH = 34020
+TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH = 34021
+TIFFTAG_IT8COLORTABLE = 34022
+TIFFTAG_IT8IMAGECOLORINDICATOR = 34023
+TIFFTAG_IT8BKGCOLORINDICATOR = 34024
+TIFFTAG_IT8IMAGECOLORVALUE = 34025
+TIFFTAG_IT8BKGCOLORVALUE = 34026
+TIFFTAG_IT8PIXELINTENSITYRANGE = 34027
+TIFFTAG_IT8TRANSPARENCYINDICATOR = 34028
+TIFFTAG_IT8COLORCHARACTERIZATION = 34029
+TIFFTAG_IT8HCUSAGE = 34030
+TIFFTAG_IT8TRAPINDICATOR = 34031
+TIFFTAG_IT8CMYKEQUIVALENT = 34032
+TIFFTAG_FRAMECOUNT = 34232
+TIFFTAG_MODELTRANSFORMATIONTAG = 34264
+TIFFTAG_PHOTOSHOP = 34377
+TIFFTAG_EXIFIFD = 34665
+TIFFTAG_ICCPROFILE = 34675
+TIFFTAG_IMAGELAYER = 34732
+TIFFTAG_JBIGOPTIONS = 34750
+TIFFTAG_GPSIFD = 34853
+TIFFTAG_FAXRECVPARAMS = 34908
+TIFFTAG_FAXSUBADDRESS = 34909
+TIFFTAG_FAXRECVTIME = 34910
+TIFFTAG_FAXDCS = 34911
+TIFFTAG_STONITS = 37439
+TIFFTAG_FEDEX_EDR = 34929
+TIFFTAG_IMAGESOURCEDATA = 37724
+TIFFTAG_INTEROPERABILITYIFD = 40965
+TIFFTAG_GDAL_METADATA = 42112
+TIFFTAG_GDAL_NODATA = 42113
+TIFFTAG_OCE_SCANJOB_DESCRIPTION = 50215
+TIFFTAG_OCE_APPLICATION_SELECTOR = 50216
+TIFFTAG_OCE_IDENTIFICATION_NUMBER = 50217
+TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS = 50218
+TIFFTAG_LERC_PARAMETERS = 50674
+TIFFTAG_DNGVERSION = 50706
+TIFFTAG_DNGBACKWARDVERSION = 50707
+TIFFTAG_UNIQUECAMERAMODEL = 50708
+TIFFTAG_LOCALIZEDCAMERAMODEL = 50709
+TIFFTAG_CFAPLANECOLOR = 50710
+TIFFTAG_CFALAYOUT = 50711
+TIFFTAG_LINEARIZATIONTABLE = 50712
+TIFFTAG_BLACKLEVELREPEATDIM = 50713
+TIFFTAG_BLACKLEVEL = 50714
+TIFFTAG_BLACKLEVELDELTAH = 50715
+TIFFTAG_BLACKLEVELDELTAV = 50716
+TIFFTAG_WHITELEVEL = 50717
+TIFFTAG_DEFAULTSCALE = 50718
+TIFFTAG_DEFAULTCROPORIGIN = 50719
+TIFFTAG_DEFAULTCROPSIZE = 50720
+TIFFTAG_COLORMATRIX1 = 50721
+TIFFTAG_COLORMATRIX2 = 50722
+TIFFTAG_CAMERACALIBRATION1 = 50723
+TIFFTAG_CAMERACALIBRATION2 = 50724
+TIFFTAG_REDUCTIONMATRIX1 = 50725
+TIFFTAG_REDUCTIONMATRIX2 = 50726
+TIFFTAG_ANALOGBALANCE = 50727
+TIFFTAG_ASSHOTNEUTRAL = 50728
+TIFFTAG_ASSHOTWHITEXY = 50729
+TIFFTAG_BASELINEEXPOSURE = 50730
+TIFFTAG_BASELINENOISE = 50731
+TIFFTAG_BASELINESHARPNESS = 50732
+TIFFTAG_BAYERGREENSPLIT = 50733
+TIFFTAG_LINEARRESPONSELIMIT = 50734
+TIFFTAG_CAMERASERIALNUMBER = 50735
+TIFFTAG_LENSINFO = 50736
+TIFFTAG_CHROMABLURRADIUS = 50737
+TIFFTAG_ANTIALIASSTRENGTH = 50738
+TIFFTAG_SHADOWSCALE = 50739
+TIFFTAG_DNGPRIVATEDATA = 50740
+TIFFTAG_MAKERNOTESAFETY = 50741
+TIFFTAG_CALIBRATIONILLUMINANT1 = 50778
+TIFFTAG_CALIBRATIONILLUMINANT2 = 50779
+TIFFTAG_BESTQUALITYSCALE = 50780
+TIFFTAG_RAWDATAUNIQUEID = 50781
+TIFFTAG_ORIGINALRAWFILENAME = 50827
+TIFFTAG_ORIGINALRAWFILEDATA = 50828
+TIFFTAG_ACTIVEAREA = 50829
+TIFFTAG_MASKEDAREAS = 50830
+TIFFTAG_ASSHOTICCPROFILE = 50831
+TIFFTAG_ASSHOTPREPROFILEMATRIX = 50832
+TIFFTAG_CURRENTICCPROFILE = 50833
+TIFFTAG_CURRENTPREPROFILEMATRIX = 50834
+TIFFTAG_RPCCOEFFICIENT = 50844
+TIFFTAG_ALIAS_LAYER_METADATA = 50784
+TIFFTAG_TIFF_RSID = 50908
+TIFFTAG_GEO_METADATA = 50909
+TIFFTAG_EXTRACAMERAPROFILES = 50933
+TIFFTAG_DCSHUESHIFTVALUES = 65535
+TIFFTAG_FAXMODE = 65536
+FAXMODE_CLASSIC = 0
+FAXMODE_NORTC = 1
+FAXMODE_NOEOL = 2
+FAXMODE_BYTEALIGN = 4
+FAXMODE_WORDALIGN = 8
+FAXMODE_CLASSF = 1
+TIFFTAG_JPEGQUALITY = 65537
+TIFFTAG_JPEGCOLORMODE = 65538
+JPEGCOLORMODE_RAW = 0
+JPEGCOLORMODE_RGB = 1
+TIFFTAG_JPEGTABLESMODE = 65539
+JPEGTABLESMODE_QUANT = 1
+JPEGTABLESMODE_HUFF = 2
+TIFFTAG_FAXFILLFUNC = 65540
+TIFFTAG_PIXARLOGDATAFMT = 65549
+PIXARLOGDATAFMT_8BIT = 0
+PIXARLOGDATAFMT_8BITABGR = 1
+PIXARLOGDATAFMT_11BITLOG = 2
+PIXARLOGDATAFMT_12BITPICIO = 3
+PIXARLOGDATAFMT_16BIT = 4
+PIXARLOGDATAFMT_FLOAT = 5
+TIFFTAG_DCSIMAGERTYPE = 65550
+DCSIMAGERMODEL_M3 = 0
+DCSIMAGERMODEL_M5 = 1
+DCSIMAGERMODEL_M6 = 2
+DCSIMAGERFILTER_IR = 0
+DCSIMAGERFILTER_MONO = 1
+DCSIMAGERFILTER_CFA = 2
+DCSIMAGERFILTER_OTHER = 3
+TIFFTAG_DCSINTERPMODE = 65551
+DCSINTERPMODE_NORMAL = 0
+DCSINTERPMODE_PREVIEW = 1
+TIFFTAG_DCSBALANCEARRAY = 65552
+TIFFTAG_DCSCORRECTMATRIX = 65553
+TIFFTAG_DCSGAMMA = 65554
+TIFFTAG_DCSTOESHOULDERPTS = 65555
+TIFFTAG_DCSCALIBRATIONFD = 65556
+TIFFTAG_ZIPQUALITY = 65557
+TIFFTAG_PIXARLOGQUALITY = 65558
+TIFFTAG_DCSCLIPRECTANGLE = 65559
+TIFFTAG_SGILOGDATAFMT = 65560
+SGILOGDATAFMT_FLOAT = 0
+SGILOGDATAFMT_16BIT = 1
+SGILOGDATAFMT_RAW = 2
+SGILOGDATAFMT_8BIT = 3
+TIFFTAG_SGILOGENCODE = 65561
+SGILOGENCODE_NODITHER = 0
+SGILOGENCODE_RANDITHER = 1
+TIFFTAG_LZMAPRESET = 65562
+TIFFTAG_PERSAMPLE = 65563
+PERSAMPLE_MERGED = 0
+PERSAMPLE_MULTI = 1
+TIFFTAG_ZSTD_LEVEL = 65564
+TIFFTAG_LERC_VERSION = 65565
+LERC_VERSION_2_4 = 4
+TIFFTAG_LERC_ADD_COMPRESSION = 65566
+LERC_ADD_COMPRESSION_NONE = 0
+LERC_ADD_COMPRESSION_DEFLATE = 1
+LERC_ADD_COMPRESSION_ZSTD = 2
+TIFFTAG_LERC_MAXZERROR = 65567
+TIFFTAG_WEBP_LEVEL = 65568
+TIFFTAG_WEBP_LOSSLESS = 65569
+TIFFTAG_DEFLATE_SUBCODEC = 65570
+DEFLATE_SUBCODEC_ZLIB = 0
+DEFLATE_SUBCODEC_LIBDEFLATE = 1
+EXIFTAG_EXPOSURETIME = 33434
+EXIFTAG_FNUMBER = 33437
+EXIFTAG_EXPOSUREPROGRAM = 34850
+EXIFTAG_SPECTRALSENSITIVITY = 34852
+EXIFTAG_ISOSPEEDRATINGS = 34855
+EXIFTAG_PHOTOGRAPHICSENSITIVITY = 34855
+EXIFTAG_OECF = 34856
+EXIFTAG_EXIFVERSION = 36864
+EXIFTAG_DATETIMEORIGINAL = 36867
+EXIFTAG_DATETIMEDIGITIZED = 36868
+EXIFTAG_COMPONENTSCONFIGURATION = 37121
+EXIFTAG_COMPRESSEDBITSPERPIXEL = 37122
+EXIFTAG_SHUTTERSPEEDVALUE = 37377
+EXIFTAG_APERTUREVALUE = 37378
+EXIFTAG_BRIGHTNESSVALUE = 37379
+EXIFTAG_EXPOSUREBIASVALUE = 37380
+EXIFTAG_MAXAPERTUREVALUE = 37381
+EXIFTAG_SUBJECTDISTANCE = 37382
+EXIFTAG_METERINGMODE = 37383
+EXIFTAG_LIGHTSOURCE = 37384
+EXIFTAG_FLASH = 37385
+EXIFTAG_FOCALLENGTH = 37386
+EXIFTAG_SUBJECTAREA = 37396
+EXIFTAG_MAKERNOTE = 37500
+EXIFTAG_USERCOMMENT = 37510
+EXIFTAG_SUBSECTIME = 37520
+EXIFTAG_SUBSECTIMEORIGINAL = 37521
+EXIFTAG_SUBSECTIMEDIGITIZED = 37522
+EXIFTAG_FLASHPIXVERSION = 40960
+EXIFTAG_COLORSPACE = 40961
+EXIFTAG_PIXELXDIMENSION = 40962
+EXIFTAG_PIXELYDIMENSION = 40963
+EXIFTAG_RELATEDSOUNDFILE = 40964
+EXIFTAG_FLASHENERGY = 41483
+EXIFTAG_SPATIALFREQUENCYRESPONSE = 41484
+EXIFTAG_FOCALPLANEXRESOLUTION = 41486
+EXIFTAG_FOCALPLANEYRESOLUTION = 41487
+EXIFTAG_FOCALPLANERESOLUTIONUNIT = 41488
+EXIFTAG_SUBJECTLOCATION = 41492
+EXIFTAG_EXPOSUREINDEX = 41493
+EXIFTAG_SENSINGMETHOD = 41495
+EXIFTAG_FILESOURCE = 41728
+EXIFTAG_SCENETYPE = 41729
+EXIFTAG_CFAPATTERN = 41730
+EXIFTAG_CUSTOMRENDERED = 41985
+EXIFTAG_EXPOSUREMODE = 41986
+EXIFTAG_WHITEBALANCE = 41987
+EXIFTAG_DIGITALZOOMRATIO = 41988
+EXIFTAG_FOCALLENGTHIN35MMFILM = 41989
+EXIFTAG_SCENECAPTURETYPE = 41990
+EXIFTAG_GAINCONTROL = 41991
+EXIFTAG_CONTRAST = 41992
+EXIFTAG_SATURATION = 41993
+EXIFTAG_SHARPNESS = 41994
+EXIFTAG_DEVICESETTINGDESCRIPTION = 41995
+EXIFTAG_SUBJECTDISTANCERANGE = 41996
+EXIFTAG_IMAGEUNIQUEID = 42016
+EXIFTAG_SENSITIVITYTYPE = 34864
+EXIFTAG_STANDARDOUTPUTSENSITIVITY = 34865
+EXIFTAG_RECOMMENDEDEXPOSUREINDEX = 34866
+EXIFTAG_ISOSPEED = 34867
+EXIFTAG_ISOSPEEDLATITUDEYYY = 34868
+EXIFTAG_ISOSPEEDLATITUDEZZZ = 34869
+EXIFTAG_OFFSETTIME = 36880
+EXIFTAG_OFFSETTIMEORIGINAL = 36881
+EXIFTAG_OFFSETTIMEDIGITIZED = 36882
+EXIFTAG_TEMPERATURE = 37888
+EXIFTAG_HUMIDITY = 37889
+EXIFTAG_PRESSURE = 37890
+EXIFTAG_WATERDEPTH = 37891
+EXIFTAG_ACCELERATION = 37892
+EXIFTAG_CAMERAELEVATIONANGLE = 37893
+EXIFTAG_CAMERAOWNERNAME = 42032
+EXIFTAG_BODYSERIALNUMBER = 42033
+EXIFTAG_LENSSPECIFICATION = 42034
+EXIFTAG_LENSMAKE = 42035
+EXIFTAG_LENSMODEL = 42036
+EXIFTAG_LENSSERIALNUMBER = 42037
+EXIFTAG_GAMMA = 42240
+EXIFTAG_COMPOSITEIMAGE = 42080
+EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE = 42081
+EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE = 42082
+GPSTAG_VERSIONID = 0
+GPSTAG_LATITUDEREF = 1
+GPSTAG_LATITUDE = 2
+GPSTAG_LONGITUDEREF = 3
+GPSTAG_LONGITUDE = 4
+GPSTAG_ALTITUDEREF = 5
+GPSTAG_ALTITUDE = 6
+GPSTAG_TIMESTAMP = 7
+GPSTAG_SATELLITES = 8
+GPSTAG_STATUS = 9
+GPSTAG_MEASUREMODE = 10
+GPSTAG_DOP = 11
+GPSTAG_SPEEDREF = 12
+GPSTAG_SPEED = 13
+GPSTAG_TRACKREF = 14
+GPSTAG_TRACK = 15
+GPSTAG_IMGDIRECTIONREF = 16
+GPSTAG_IMGDIRECTION = 17
+GPSTAG_MAPDATUM = 18
+GPSTAG_DESTLATITUDEREF = 19
+GPSTAG_DESTLATITUDE = 20
+GPSTAG_DESTLONGITUDEREF = 21
+GPSTAG_DESTLONGITUDE = 22
+GPSTAG_DESTBEARINGREF = 23
+GPSTAG_DESTBEARING = 24
+GPSTAG_DESTDISTANCEREF = 25
+GPSTAG_DESTDISTANCE = 26
+GPSTAG_PROCESSINGMETHOD = 27
+GPSTAG_AREAINFORMATION = 28
+GPSTAG_DATESTAMP = 29
+GPSTAG_DIFFERENTIAL = 30
+GPSTAG_GPSHPOSITIONINGERROR = 31
=====================================
libtiff/tiff_h_4_3_0.py
=====================================
@@ -0,0 +1,529 @@
+TIFF_VERSION_CLASSIC = 42
+TIFF_VERSION_BIG = 43
+TIFF_BIGENDIAN = 19789
+TIFF_LITTLEENDIAN = 18761
+MDI_LITTLEENDIAN = 20549
+MDI_BIGENDIAN = 17744
+TIFFTAG_SUBFILETYPE = 254
+FILETYPE_REDUCEDIMAGE = 1
+FILETYPE_PAGE = 2
+FILETYPE_MASK = 4
+TIFFTAG_OSUBFILETYPE = 255
+OFILETYPE_IMAGE = 1
+OFILETYPE_REDUCEDIMAGE = 2
+OFILETYPE_PAGE = 3
+TIFFTAG_IMAGEWIDTH = 256
+TIFFTAG_IMAGELENGTH = 257
+TIFFTAG_BITSPERSAMPLE = 258
+TIFFTAG_COMPRESSION = 259
+COMPRESSION_NONE = 1
+COMPRESSION_CCITTRLE = 2
+COMPRESSION_CCITTFAX3 = 3
+COMPRESSION_CCITT_T4 = 3
+COMPRESSION_CCITTFAX4 = 4
+COMPRESSION_CCITT_T6 = 4
+COMPRESSION_LZW = 5
+COMPRESSION_OJPEG = 6
+COMPRESSION_JPEG = 7
+COMPRESSION_T85 = 9
+COMPRESSION_T43 = 10
+COMPRESSION_NEXT = 32766
+COMPRESSION_CCITTRLEW = 32771
+COMPRESSION_PACKBITS = 32773
+COMPRESSION_THUNDERSCAN = 32809
+COMPRESSION_IT8CTPAD = 32895
+COMPRESSION_IT8LW = 32896
+COMPRESSION_IT8MP = 32897
+COMPRESSION_IT8BL = 32898
+COMPRESSION_PIXARFILM = 32908
+COMPRESSION_PIXARLOG = 32909
+COMPRESSION_DEFLATE = 32946
+COMPRESSION_ADOBE_DEFLATE = 8
+COMPRESSION_DCS = 32947
+COMPRESSION_JBIG = 34661
+COMPRESSION_SGILOG = 34676
+COMPRESSION_SGILOG24 = 34677
+COMPRESSION_JP2000 = 34712
+COMPRESSION_LERC = 34887
+COMPRESSION_LZMA = 34925
+COMPRESSION_ZSTD = 50000
+COMPRESSION_WEBP = 50001
+COMPRESSION_JXL = 50002
+TIFFTAG_PHOTOMETRIC = 262
+PHOTOMETRIC_MINISWHITE = 0
+PHOTOMETRIC_MINISBLACK = 1
+PHOTOMETRIC_RGB = 2
+PHOTOMETRIC_PALETTE = 3
+PHOTOMETRIC_MASK = 4
+PHOTOMETRIC_SEPARATED = 5
+PHOTOMETRIC_YCBCR = 6
+PHOTOMETRIC_CIELAB = 8
+PHOTOMETRIC_ICCLAB = 9
+PHOTOMETRIC_ITULAB = 10
+PHOTOMETRIC_CFA = 32803
+PHOTOMETRIC_LOGL = 32844
+PHOTOMETRIC_LOGLUV = 32845
+TIFFTAG_THRESHHOLDING = 263
+THRESHHOLD_BILEVEL = 1
+THRESHHOLD_HALFTONE = 2
+THRESHHOLD_ERRORDIFFUSE = 3
+TIFFTAG_CELLWIDTH = 264
+TIFFTAG_CELLLENGTH = 265
+TIFFTAG_FILLORDER = 266
+FILLORDER_MSB2LSB = 1
+FILLORDER_LSB2MSB = 2
+TIFFTAG_DOCUMENTNAME = 269
+TIFFTAG_IMAGEDESCRIPTION = 270
+TIFFTAG_MAKE = 271
+TIFFTAG_MODEL = 272
+TIFFTAG_STRIPOFFSETS = 273
+TIFFTAG_ORIENTATION = 274
+ORIENTATION_TOPLEFT = 1
+ORIENTATION_TOPRIGHT = 2
+ORIENTATION_BOTRIGHT = 3
+ORIENTATION_BOTLEFT = 4
+ORIENTATION_LEFTTOP = 5
+ORIENTATION_RIGHTTOP = 6
+ORIENTATION_RIGHTBOT = 7
+ORIENTATION_LEFTBOT = 8
+TIFFTAG_SAMPLESPERPIXEL = 277
+TIFFTAG_ROWSPERSTRIP = 278
+TIFFTAG_STRIPBYTECOUNTS = 279
+TIFFTAG_MINSAMPLEVALUE = 280
+TIFFTAG_MAXSAMPLEVALUE = 281
+TIFFTAG_XRESOLUTION = 282
+TIFFTAG_YRESOLUTION = 283
+TIFFTAG_PLANARCONFIG = 284
+PLANARCONFIG_CONTIG = 1
+PLANARCONFIG_SEPARATE = 2
+TIFFTAG_PAGENAME = 285
+TIFFTAG_XPOSITION = 286
+TIFFTAG_YPOSITION = 287
+TIFFTAG_FREEOFFSETS = 288
+TIFFTAG_FREEBYTECOUNTS = 289
+TIFFTAG_GRAYRESPONSEUNIT = 290
+GRAYRESPONSEUNIT_10S = 1
+GRAYRESPONSEUNIT_100S = 2
+GRAYRESPONSEUNIT_1000S = 3
+GRAYRESPONSEUNIT_10000S = 4
+GRAYRESPONSEUNIT_100000S = 5
+TIFFTAG_GRAYRESPONSECURVE = 291
+TIFFTAG_GROUP3OPTIONS = 292
+TIFFTAG_T4OPTIONS = 292
+GROUP3OPT_2DENCODING = 1
+GROUP3OPT_UNCOMPRESSED = 2
+GROUP3OPT_FILLBITS = 4
+TIFFTAG_GROUP4OPTIONS = 293
+TIFFTAG_T6OPTIONS = 293
+GROUP4OPT_UNCOMPRESSED = 2
+TIFFTAG_RESOLUTIONUNIT = 296
+RESUNIT_NONE = 1
+RESUNIT_INCH = 2
+RESUNIT_CENTIMETER = 3
+TIFFTAG_PAGENUMBER = 297
+TIFFTAG_COLORRESPONSEUNIT = 300
+COLORRESPONSEUNIT_10S = 1
+COLORRESPONSEUNIT_100S = 2
+COLORRESPONSEUNIT_1000S = 3
+COLORRESPONSEUNIT_10000S = 4
+COLORRESPONSEUNIT_100000S = 5
+TIFFTAG_TRANSFERFUNCTION = 301
+TIFFTAG_SOFTWARE = 305
+TIFFTAG_DATETIME = 306
+TIFFTAG_ARTIST = 315
+TIFFTAG_HOSTCOMPUTER = 316
+TIFFTAG_PREDICTOR = 317
+PREDICTOR_NONE = 1
+PREDICTOR_HORIZONTAL = 2
+PREDICTOR_FLOATINGPOINT = 3
+TIFFTAG_WHITEPOINT = 318
+TIFFTAG_PRIMARYCHROMATICITIES = 319
+TIFFTAG_COLORMAP = 320
+TIFFTAG_HALFTONEHINTS = 321
+TIFFTAG_TILEWIDTH = 322
+TIFFTAG_TILELENGTH = 323
+TIFFTAG_TILEOFFSETS = 324
+TIFFTAG_TILEBYTECOUNTS = 325
+TIFFTAG_BADFAXLINES = 326
+TIFFTAG_CLEANFAXDATA = 327
+CLEANFAXDATA_CLEAN = 0
+CLEANFAXDATA_REGENERATED = 1
+CLEANFAXDATA_UNCLEAN = 2
+TIFFTAG_CONSECUTIVEBADFAXLINES = 328
+TIFFTAG_SUBIFD = 330
+TIFFTAG_INKSET = 332
+INKSET_CMYK = 1
+INKSET_MULTIINK = 2
+TIFFTAG_INKNAMES = 333
+TIFFTAG_NUMBEROFINKS = 334
+TIFFTAG_DOTRANGE = 336
+TIFFTAG_TARGETPRINTER = 337
+TIFFTAG_EXTRASAMPLES = 338
+EXTRASAMPLE_UNSPECIFIED = 0
+EXTRASAMPLE_ASSOCALPHA = 1
+EXTRASAMPLE_UNASSALPHA = 2
+TIFFTAG_SAMPLEFORMAT = 339
+SAMPLEFORMAT_UINT = 1
+SAMPLEFORMAT_INT = 2
+SAMPLEFORMAT_IEEEFP = 3
+SAMPLEFORMAT_VOID = 4
+SAMPLEFORMAT_COMPLEXINT = 5
+SAMPLEFORMAT_COMPLEXIEEEFP = 6
+TIFFTAG_SMINSAMPLEVALUE = 340
+TIFFTAG_SMAXSAMPLEVALUE = 341
+TIFFTAG_CLIPPATH = 343
+TIFFTAG_XCLIPPATHUNITS = 344
+TIFFTAG_YCLIPPATHUNITS = 345
+TIFFTAG_INDEXED = 346
+TIFFTAG_JPEGTABLES = 347
+TIFFTAG_OPIPROXY = 351
+TIFFTAG_GLOBALPARAMETERSIFD = 400
+TIFFTAG_PROFILETYPE = 401
+PROFILETYPE_UNSPECIFIED = 0
+PROFILETYPE_G3_FAX = 1
+TIFFTAG_FAXPROFILE = 402
+FAXPROFILE_S = 1
+FAXPROFILE_F = 2
+FAXPROFILE_J = 3
+FAXPROFILE_C = 4
+FAXPROFILE_L = 5
+FAXPROFILE_M = 6
+TIFFTAG_CODINGMETHODS = 403
+CODINGMETHODS_T4_1D = 2
+CODINGMETHODS_T4_2D = 4
+CODINGMETHODS_T6 = 8
+CODINGMETHODS_T85 = 16
+CODINGMETHODS_T42 = 32
+CODINGMETHODS_T43 = 64
+TIFFTAG_VERSIONYEAR = 404
+TIFFTAG_MODENUMBER = 405
+TIFFTAG_DECODE = 433
+TIFFTAG_IMAGEBASECOLOR = 434
+TIFFTAG_T82OPTIONS = 435
+TIFFTAG_JPEGPROC = 512
+JPEGPROC_BASELINE = 1
+JPEGPROC_LOSSLESS = 14
+TIFFTAG_JPEGIFOFFSET = 513
+TIFFTAG_JPEGIFBYTECOUNT = 514
+TIFFTAG_JPEGRESTARTINTERVAL = 515
+TIFFTAG_JPEGLOSSLESSPREDICTORS = 517
+TIFFTAG_JPEGPOINTTRANSFORM = 518
+TIFFTAG_JPEGQTABLES = 519
+TIFFTAG_JPEGDCTABLES = 520
+TIFFTAG_JPEGACTABLES = 521
+TIFFTAG_YCBCRCOEFFICIENTS = 529
+TIFFTAG_YCBCRSUBSAMPLING = 530
+TIFFTAG_YCBCRPOSITIONING = 531
+YCBCRPOSITION_CENTERED = 1
+YCBCRPOSITION_COSITED = 2
+TIFFTAG_REFERENCEBLACKWHITE = 532
+TIFFTAG_STRIPROWCOUNTS = 559
+TIFFTAG_XMLPACKET = 700
+TIFFTAG_OPIIMAGEID = 32781
+TIFFTAG_TIFFANNOTATIONDATA = 32932
+TIFFTAG_REFPTS = 32953
+TIFFTAG_REGIONTACKPOINT = 32954
+TIFFTAG_REGIONWARPCORNERS = 32955
+TIFFTAG_REGIONAFFINE = 32956
+TIFFTAG_MATTEING = 32995
+TIFFTAG_DATATYPE = 32996
+TIFFTAG_IMAGEDEPTH = 32997
+TIFFTAG_TILEDEPTH = 32998
+TIFFTAG_PIXAR_IMAGEFULLWIDTH = 33300
+TIFFTAG_PIXAR_IMAGEFULLLENGTH = 33301
+TIFFTAG_PIXAR_TEXTUREFORMAT = 33302
+TIFFTAG_PIXAR_WRAPMODES = 33303
+TIFFTAG_PIXAR_FOVCOT = 33304
+TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN = 33305
+TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA = 33306
+TIFFTAG_WRITERSERIALNUMBER = 33405
+TIFFTAG_CFAREPEATPATTERNDIM = 33421
+TIFFTAG_CFAPATTERN = 33422
+TIFFTAG_COPYRIGHT = 33432
+TIFFTAG_MD_FILETAG = 33445
+TIFFTAG_MD_SCALEPIXEL = 33446
+TIFFTAG_MD_COLORTABLE = 33447
+TIFFTAG_MD_LABNAME = 33448
+TIFFTAG_MD_SAMPLEINFO = 33449
+TIFFTAG_MD_PREPDATE = 33450
+TIFFTAG_MD_PREPTIME = 33451
+TIFFTAG_MD_FILEUNITS = 33452
+TIFFTAG_RICHTIFFIPTC = 33723
+TIFFTAG_INGR_PACKET_DATA_TAG = 33918
+TIFFTAG_INGR_FLAG_REGISTERS = 33919
+TIFFTAG_IRASB_TRANSORMATION_MATRIX = 33920
+TIFFTAG_MODELTIEPOINTTAG = 33922
+TIFFTAG_IT8SITE = 34016
+TIFFTAG_IT8COLORSEQUENCE = 34017
+TIFFTAG_IT8HEADER = 34018
+TIFFTAG_IT8RASTERPADDING = 34019
+TIFFTAG_IT8BITSPERRUNLENGTH = 34020
+TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH = 34021
+TIFFTAG_IT8COLORTABLE = 34022
+TIFFTAG_IT8IMAGECOLORINDICATOR = 34023
+TIFFTAG_IT8BKGCOLORINDICATOR = 34024
+TIFFTAG_IT8IMAGECOLORVALUE = 34025
+TIFFTAG_IT8BKGCOLORVALUE = 34026
+TIFFTAG_IT8PIXELINTENSITYRANGE = 34027
+TIFFTAG_IT8TRANSPARENCYINDICATOR = 34028
+TIFFTAG_IT8COLORCHARACTERIZATION = 34029
+TIFFTAG_IT8HCUSAGE = 34030
+TIFFTAG_IT8TRAPINDICATOR = 34031
+TIFFTAG_IT8CMYKEQUIVALENT = 34032
+TIFFTAG_FRAMECOUNT = 34232
+TIFFTAG_MODELTRANSFORMATIONTAG = 34264
+TIFFTAG_PHOTOSHOP = 34377
+TIFFTAG_EXIFIFD = 34665
+TIFFTAG_ICCPROFILE = 34675
+TIFFTAG_IMAGELAYER = 34732
+TIFFTAG_JBIGOPTIONS = 34750
+TIFFTAG_GPSIFD = 34853
+TIFFTAG_FAXRECVPARAMS = 34908
+TIFFTAG_FAXSUBADDRESS = 34909
+TIFFTAG_FAXRECVTIME = 34910
+TIFFTAG_FAXDCS = 34911
+TIFFTAG_STONITS = 37439
+TIFFTAG_FEDEX_EDR = 34929
+TIFFTAG_IMAGESOURCEDATA = 37724
+TIFFTAG_INTEROPERABILITYIFD = 40965
+TIFFTAG_GDAL_METADATA = 42112
+TIFFTAG_GDAL_NODATA = 42113
+TIFFTAG_OCE_SCANJOB_DESCRIPTION = 50215
+TIFFTAG_OCE_APPLICATION_SELECTOR = 50216
+TIFFTAG_OCE_IDENTIFICATION_NUMBER = 50217
+TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS = 50218
+TIFFTAG_LERC_PARAMETERS = 50674
+TIFFTAG_DNGVERSION = 50706
+TIFFTAG_DNGBACKWARDVERSION = 50707
+TIFFTAG_UNIQUECAMERAMODEL = 50708
+TIFFTAG_LOCALIZEDCAMERAMODEL = 50709
+TIFFTAG_CFAPLANECOLOR = 50710
+TIFFTAG_CFALAYOUT = 50711
+TIFFTAG_LINEARIZATIONTABLE = 50712
+TIFFTAG_BLACKLEVELREPEATDIM = 50713
+TIFFTAG_BLACKLEVEL = 50714
+TIFFTAG_BLACKLEVELDELTAH = 50715
+TIFFTAG_BLACKLEVELDELTAV = 50716
+TIFFTAG_WHITELEVEL = 50717
+TIFFTAG_DEFAULTSCALE = 50718
+TIFFTAG_DEFAULTCROPORIGIN = 50719
+TIFFTAG_DEFAULTCROPSIZE = 50720
+TIFFTAG_COLORMATRIX1 = 50721
+TIFFTAG_COLORMATRIX2 = 50722
+TIFFTAG_CAMERACALIBRATION1 = 50723
+TIFFTAG_CAMERACALIBRATION2 = 50724
+TIFFTAG_REDUCTIONMATRIX1 = 50725
+TIFFTAG_REDUCTIONMATRIX2 = 50726
+TIFFTAG_ANALOGBALANCE = 50727
+TIFFTAG_ASSHOTNEUTRAL = 50728
+TIFFTAG_ASSHOTWHITEXY = 50729
+TIFFTAG_BASELINEEXPOSURE = 50730
+TIFFTAG_BASELINENOISE = 50731
+TIFFTAG_BASELINESHARPNESS = 50732
+TIFFTAG_BAYERGREENSPLIT = 50733
+TIFFTAG_LINEARRESPONSELIMIT = 50734
+TIFFTAG_CAMERASERIALNUMBER = 50735
+TIFFTAG_LENSINFO = 50736
+TIFFTAG_CHROMABLURRADIUS = 50737
+TIFFTAG_ANTIALIASSTRENGTH = 50738
+TIFFTAG_SHADOWSCALE = 50739
+TIFFTAG_DNGPRIVATEDATA = 50740
+TIFFTAG_MAKERNOTESAFETY = 50741
+TIFFTAG_CALIBRATIONILLUMINANT1 = 50778
+TIFFTAG_CALIBRATIONILLUMINANT2 = 50779
+TIFFTAG_BESTQUALITYSCALE = 50780
+TIFFTAG_RAWDATAUNIQUEID = 50781
+TIFFTAG_ORIGINALRAWFILENAME = 50827
+TIFFTAG_ORIGINALRAWFILEDATA = 50828
+TIFFTAG_ACTIVEAREA = 50829
+TIFFTAG_MASKEDAREAS = 50830
+TIFFTAG_ASSHOTICCPROFILE = 50831
+TIFFTAG_ASSHOTPREPROFILEMATRIX = 50832
+TIFFTAG_CURRENTICCPROFILE = 50833
+TIFFTAG_CURRENTPREPROFILEMATRIX = 50834
+TIFFTAG_RPCCOEFFICIENT = 50844
+TIFFTAG_ALIAS_LAYER_METADATA = 50784
+TIFFTAG_TIFF_RSID = 50908
+TIFFTAG_GEO_METADATA = 50909
+TIFFTAG_EXTRACAMERAPROFILES = 50933
+TIFFTAG_DCSHUESHIFTVALUES = 65535
+TIFFTAG_FAXMODE = 65536
+FAXMODE_CLASSIC = 0
+FAXMODE_NORTC = 1
+FAXMODE_NOEOL = 2
+FAXMODE_BYTEALIGN = 4
+FAXMODE_WORDALIGN = 8
+FAXMODE_CLASSF = 1
+TIFFTAG_JPEGQUALITY = 65537
+TIFFTAG_JPEGCOLORMODE = 65538
+JPEGCOLORMODE_RAW = 0
+JPEGCOLORMODE_RGB = 1
+TIFFTAG_JPEGTABLESMODE = 65539
+JPEGTABLESMODE_QUANT = 1
+JPEGTABLESMODE_HUFF = 2
+TIFFTAG_FAXFILLFUNC = 65540
+TIFFTAG_PIXARLOGDATAFMT = 65549
+PIXARLOGDATAFMT_8BIT = 0
+PIXARLOGDATAFMT_8BITABGR = 1
+PIXARLOGDATAFMT_11BITLOG = 2
+PIXARLOGDATAFMT_12BITPICIO = 3
+PIXARLOGDATAFMT_16BIT = 4
+PIXARLOGDATAFMT_FLOAT = 5
+TIFFTAG_DCSIMAGERTYPE = 65550
+DCSIMAGERMODEL_M3 = 0
+DCSIMAGERMODEL_M5 = 1
+DCSIMAGERMODEL_M6 = 2
+DCSIMAGERFILTER_IR = 0
+DCSIMAGERFILTER_MONO = 1
+DCSIMAGERFILTER_CFA = 2
+DCSIMAGERFILTER_OTHER = 3
+TIFFTAG_DCSINTERPMODE = 65551
+DCSINTERPMODE_NORMAL = 0
+DCSINTERPMODE_PREVIEW = 1
+TIFFTAG_DCSBALANCEARRAY = 65552
+TIFFTAG_DCSCORRECTMATRIX = 65553
+TIFFTAG_DCSGAMMA = 65554
+TIFFTAG_DCSTOESHOULDERPTS = 65555
+TIFFTAG_DCSCALIBRATIONFD = 65556
+TIFFTAG_ZIPQUALITY = 65557
+TIFFTAG_PIXARLOGQUALITY = 65558
+TIFFTAG_DCSCLIPRECTANGLE = 65559
+TIFFTAG_SGILOGDATAFMT = 65560
+SGILOGDATAFMT_FLOAT = 0
+SGILOGDATAFMT_16BIT = 1
+SGILOGDATAFMT_RAW = 2
+SGILOGDATAFMT_8BIT = 3
+TIFFTAG_SGILOGENCODE = 65561
+SGILOGENCODE_NODITHER = 0
+SGILOGENCODE_RANDITHER = 1
+TIFFTAG_LZMAPRESET = 65562
+TIFFTAG_PERSAMPLE = 65563
+PERSAMPLE_MERGED = 0
+PERSAMPLE_MULTI = 1
+TIFFTAG_ZSTD_LEVEL = 65564
+TIFFTAG_LERC_VERSION = 65565
+LERC_VERSION_2_4 = 4
+TIFFTAG_LERC_ADD_COMPRESSION = 65566
+LERC_ADD_COMPRESSION_NONE = 0
+LERC_ADD_COMPRESSION_DEFLATE = 1
+LERC_ADD_COMPRESSION_ZSTD = 2
+TIFFTAG_LERC_MAXZERROR = 65567
+TIFFTAG_WEBP_LEVEL = 65568
+TIFFTAG_WEBP_LOSSLESS = 65569
+TIFFTAG_DEFLATE_SUBCODEC = 65570
+DEFLATE_SUBCODEC_ZLIB = 0
+DEFLATE_SUBCODEC_LIBDEFLATE = 1
+EXIFTAG_EXPOSURETIME = 33434
+EXIFTAG_FNUMBER = 33437
+EXIFTAG_EXPOSUREPROGRAM = 34850
+EXIFTAG_SPECTRALSENSITIVITY = 34852
+EXIFTAG_ISOSPEEDRATINGS = 34855
+EXIFTAG_PHOTOGRAPHICSENSITIVITY = 34855
+EXIFTAG_OECF = 34856
+EXIFTAG_EXIFVERSION = 36864
+EXIFTAG_DATETIMEORIGINAL = 36867
+EXIFTAG_DATETIMEDIGITIZED = 36868
+EXIFTAG_COMPONENTSCONFIGURATION = 37121
+EXIFTAG_COMPRESSEDBITSPERPIXEL = 37122
+EXIFTAG_SHUTTERSPEEDVALUE = 37377
+EXIFTAG_APERTUREVALUE = 37378
+EXIFTAG_BRIGHTNESSVALUE = 37379
+EXIFTAG_EXPOSUREBIASVALUE = 37380
+EXIFTAG_MAXAPERTUREVALUE = 37381
+EXIFTAG_SUBJECTDISTANCE = 37382
+EXIFTAG_METERINGMODE = 37383
+EXIFTAG_LIGHTSOURCE = 37384
+EXIFTAG_FLASH = 37385
+EXIFTAG_FOCALLENGTH = 37386
+EXIFTAG_SUBJECTAREA = 37396
+EXIFTAG_MAKERNOTE = 37500
+EXIFTAG_USERCOMMENT = 37510
+EXIFTAG_SUBSECTIME = 37520
+EXIFTAG_SUBSECTIMEORIGINAL = 37521
+EXIFTAG_SUBSECTIMEDIGITIZED = 37522
+EXIFTAG_FLASHPIXVERSION = 40960
+EXIFTAG_COLORSPACE = 40961
+EXIFTAG_PIXELXDIMENSION = 40962
+EXIFTAG_PIXELYDIMENSION = 40963
+EXIFTAG_RELATEDSOUNDFILE = 40964
+EXIFTAG_FLASHENERGY = 41483
+EXIFTAG_SPATIALFREQUENCYRESPONSE = 41484
+EXIFTAG_FOCALPLANEXRESOLUTION = 41486
+EXIFTAG_FOCALPLANEYRESOLUTION = 41487
+EXIFTAG_FOCALPLANERESOLUTIONUNIT = 41488
+EXIFTAG_SUBJECTLOCATION = 41492
+EXIFTAG_EXPOSUREINDEX = 41493
+EXIFTAG_SENSINGMETHOD = 41495
+EXIFTAG_FILESOURCE = 41728
+EXIFTAG_SCENETYPE = 41729
+EXIFTAG_CFAPATTERN = 41730
+EXIFTAG_CUSTOMRENDERED = 41985
+EXIFTAG_EXPOSUREMODE = 41986
+EXIFTAG_WHITEBALANCE = 41987
+EXIFTAG_DIGITALZOOMRATIO = 41988
+EXIFTAG_FOCALLENGTHIN35MMFILM = 41989
+EXIFTAG_SCENECAPTURETYPE = 41990
+EXIFTAG_GAINCONTROL = 41991
+EXIFTAG_CONTRAST = 41992
+EXIFTAG_SATURATION = 41993
+EXIFTAG_SHARPNESS = 41994
+EXIFTAG_DEVICESETTINGDESCRIPTION = 41995
+EXIFTAG_SUBJECTDISTANCERANGE = 41996
+EXIFTAG_IMAGEUNIQUEID = 42016
+EXIFTAG_SENSITIVITYTYPE = 34864
+EXIFTAG_STANDARDOUTPUTSENSITIVITY = 34865
+EXIFTAG_RECOMMENDEDEXPOSUREINDEX = 34866
+EXIFTAG_ISOSPEED = 34867
+EXIFTAG_ISOSPEEDLATITUDEYYY = 34868
+EXIFTAG_ISOSPEEDLATITUDEZZZ = 34869
+EXIFTAG_OFFSETTIME = 36880
+EXIFTAG_OFFSETTIMEORIGINAL = 36881
+EXIFTAG_OFFSETTIMEDIGITIZED = 36882
+EXIFTAG_TEMPERATURE = 37888
+EXIFTAG_HUMIDITY = 37889
+EXIFTAG_PRESSURE = 37890
+EXIFTAG_WATERDEPTH = 37891
+EXIFTAG_ACCELERATION = 37892
+EXIFTAG_CAMERAELEVATIONANGLE = 37893
+EXIFTAG_CAMERAOWNERNAME = 42032
+EXIFTAG_BODYSERIALNUMBER = 42033
+EXIFTAG_LENSSPECIFICATION = 42034
+EXIFTAG_LENSMAKE = 42035
+EXIFTAG_LENSMODEL = 42036
+EXIFTAG_LENSSERIALNUMBER = 42037
+EXIFTAG_GAMMA = 42240
+EXIFTAG_COMPOSITEIMAGE = 42080
+EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE = 42081
+EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE = 42082
+GPSTAG_VERSIONID = 0
+GPSTAG_LATITUDEREF = 1
+GPSTAG_LATITUDE = 2
+GPSTAG_LONGITUDEREF = 3
+GPSTAG_LONGITUDE = 4
+GPSTAG_ALTITUDEREF = 5
+GPSTAG_ALTITUDE = 6
+GPSTAG_TIMESTAMP = 7
+GPSTAG_SATELLITES = 8
+GPSTAG_STATUS = 9
+GPSTAG_MEASUREMODE = 10
+GPSTAG_DOP = 11
+GPSTAG_SPEEDREF = 12
+GPSTAG_SPEED = 13
+GPSTAG_TRACKREF = 14
+GPSTAG_TRACK = 15
+GPSTAG_IMGDIRECTIONREF = 16
+GPSTAG_IMGDIRECTION = 17
+GPSTAG_MAPDATUM = 18
+GPSTAG_DESTLATITUDEREF = 19
+GPSTAG_DESTLATITUDE = 20
+GPSTAG_DESTLONGITUDEREF = 21
+GPSTAG_DESTLONGITUDE = 22
+GPSTAG_DESTBEARINGREF = 23
+GPSTAG_DESTBEARING = 24
+GPSTAG_DESTDISTANCEREF = 25
+GPSTAG_DESTDISTANCE = 26
+GPSTAG_PROCESSINGMETHOD = 27
+GPSTAG_AREAINFORMATION = 28
+GPSTAG_DATESTAMP = 29
+GPSTAG_DIFFERENTIAL = 30
+GPSTAG_GPSHPOSITIONINGERROR = 31
=====================================
libtiff/tiff_image.py
=====================================
@@ -65,7 +65,7 @@ class TIFFentry:
@property
def offset_is_value(self):
return not self.values and self.count[0] == 1 and \
- self.type_nbytes <= 4 and self.type_name != 'ASCII'
+ self.type_nbytes <= 4 and self.type_name != 'ASCII'
def __getitem__(self, index):
if self.offset_is_value:
@@ -122,8 +122,7 @@ class TIFFentry:
data = numpy.array([self.values[0] + '\0'])
# print(type(data), data)
data = numpy.array([self.values[0] + '\0'],
- dtype='|S{}'.format(len(self.values[0]) +
- 1)).view(dtype=numpy.ubyte)
+ dtype='|S{}'.format(len(self.values[0]) + 1)).view(dtype=numpy.ubyte)
# print(type(data), data)
target[offset:offset + self.nbytes] = data
else:
@@ -203,7 +202,7 @@ class TIFFimage:
"""
if verbose is None:
nbytes = self.depth * self.length * self.width * \
- self.dtype.itemsize
+ self.dtype.itemsize
verbose = nbytes >= 1024 ** 2
if os.path.splitext(filename)[1].lower() not in ['.tif', '.tiff']:
@@ -425,9 +424,8 @@ class TIFFimage:
sys.stdout.write(
'\r filling records: %5s%% done (%s/s)%s' %
(int(100.0 * (i + 1) / len(image_directories)),
- bytes2str(int(float(image_data_offset -
- first_image_data_offset) /
- (time.time() - start_time))), ' ' * 2))
+ bytes2str(int(float(image_data_offset - first_image_data_offset) / (time.time() - start_time))),
+ ' ' * 2))
if (i + 1) == len(image_directories):
sys.stdout.write('\n')
sys.stdout.flush()
=====================================
libtiff/tiff_sample_plane.py
=====================================
@@ -48,8 +48,7 @@ class TiffSamplePlane:
self.shape = (int(rows_of_pixels), int(pixels_per_row))
rows_per_strip = ifd.get_value('RowsPerStrip')
- strips_per_image = (rows_of_pixels + rows_per_strip
- - 1) // rows_per_strip
+ strips_per_image = (rows_of_pixels + rows_per_strip - 1) // rows_per_strip
rows_per_strip = min(rows_of_pixels, rows_per_strip)
self.rows_per_strip = rows_per_strip
@@ -142,7 +141,7 @@ rows_per_strip=%(rows_per_strip)s
index += self.shape[0]
if index > self.shape[0] or index < 0:
raise IndexError('Row index %r out of bounds [0,%r]'
- % (index, self.shape[0]-1))
+ % (index, self.shape[0] - 1))
if self.planar_config == 1: # RGBRGB..
strip_index, row_index = divmod(index, self.rows_per_strip)
@@ -217,7 +216,7 @@ rows_per_strip=%(rows_per_strip)s
start = self.strip_offsets[0]
else:
start = self.strip_offsets[0] + self.sample_index * \
- self.bytes_per_sample_image
+ self.bytes_per_sample_image
stop = start + self.bytes_per_sample_image
image = self.ifd.tiff.data[start:stop]
image = image.view(dtype=self.dtype).reshape(self.shape)
@@ -244,7 +243,7 @@ rows_per_strip=%(rows_per_strip)s
print('%s.get_image warning: tiff data contains %s extra'
'bytes (compression=%r) that are ignored'
% (self.__class__.__name__,
- strip.nbytes-target.nbytes,
+ strip.nbytes - target.nbytes,
self.compression))
image[offset:offset + strip.nbytes] = strip[:target.nbytes]
offset += strip.nbytes
=====================================
libtiff/utils.py
=====================================
@@ -19,26 +19,26 @@ def isindisk(path):
def bytes2str(bytes):
lst = []
- Pbytes = bytes//1024**5
+ Pbytes = bytes // 1024**5
if Pbytes:
lst.append('%sPi' % (Pbytes))
bytes = bytes - 1024**5 * Pbytes
- Tbytes = bytes//1024**4
+ Tbytes = bytes // 1024**4
if Tbytes:
lst.append('%sTi' % (Tbytes))
bytes = bytes - 1024**4 * Tbytes
- Gbytes = bytes//1024**3
+ Gbytes = bytes // 1024**3
if Gbytes:
lst.append('%sGi' % (Gbytes))
bytes = bytes - 1024**3 * Gbytes
- Mbytes = bytes//1024**2
+ Mbytes = bytes // 1024**2
if Mbytes:
lst.append('%sMi' % (Mbytes))
bytes = bytes - 1024**2 * Mbytes
- kbytes = bytes//1024
+ kbytes = bytes // 1024
if kbytes:
lst.append('%sKi' % (kbytes))
- bytes = bytes - 1024*kbytes
+ bytes = bytes - 1024 * kbytes
if bytes:
lst.append('%s' % (bytes))
if not lst:
=====================================
libtiff/version.py
=====================================
@@ -1,9 +1,5 @@
-
-# THIS FILE IS GENERATED FROM PYLIBTIFF SETUP.PY
-short_version = '0.4.4'
-version = '0.4.4'
-full_version = '0.4.4'
-git_revision = '892df2482c869777798f37cdac29bf6dee221a5a'
-release = True
-if not release:
- version = full_version
+# coding: utf-8
+# file generated by setuptools_scm
+# don't change, don't track in version control
+__version__ = version = '0.5.0'
+__version_tuple__ = version_tuple = (0, 5, 0)
=====================================
pylibtiff.egg-info/PKG-INFO
=====================================
@@ -1,32 +1,407 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: pylibtiff
-Version: 0.4.4
+Version: 0.5.0
Summary: PyLibTiff: a Python tiff library.
Home-page: https://github.com/pearu/pylibtiff
Author: Pearu Peterson
Author-email: pearu.peterson at gmail.com
License: https://github.com/pearu/pylibtiff/blob/master/LICENSE
-Description:
- PyLibTiff? is a Python package that provides the following modules:
-
- libtiff - a wrapper of C libtiff library using ctypes.
- tiff - a numpy.memmap view of tiff files.
-
-Platform: All
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
-Requires-Python: >=2.7
+Requires-Python: >=3.8
+Description-Content-Type: text/markdown
+Provides-Extra: bitarray
+License-File: LICENSE
+
+
+[](https://github.com/pearu/pylibtiff/actions/workflows/ci.yaml)
+
+PyLibTiff is a package that provides:
+
+* a wrapper to the [libtiff](http://www.simplesystems.org/libtiff/)
+ library to [Python](http://www.python.org) using
+ [ctypes](http://docs.python.org/library/ctypes.html).
+
+* a pure Python module for reading and writing TIFF and LSM files. The
+ images are read as `numpy.memmap` objects so that it is possible to
+ open images that otherwise would not fit to computers RAM. Both TIFF
+ strips and tiles are supported for low-level data storage.
+
+There exists many Python packages such as
+[PIL](http://www.pythonware.com/products/pil/),
+[FreeImagePy](http://freeimagepy.sourceforge.net/) that support
+reading and writing TIFF files. The PyLibTiff project was started to
+have an efficient and direct way to read and write TIFF files using
+the libtiff library without the need to install any unnecessary
+packages or libraries. The pure Python module was created for reading
+"broken" TIFF files such as LSM files that in some places use
+different interpretation of TIFF tags than what specified in the TIFF
+specification document. The libtiff library would just fail reading
+such files. In addition, the pure Python module is more memory
+efficient as the arrays are returned as memory maps. Support for
+compressed files is not implemented yet.
+
+[tifffile.py](http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html) by
+Christoph Gohlke is an excellent module for reading TIFF as well as
+LSM files, it is as fast as libtiff.py by using numpy.
+
+
+# Usage example (libtiff wrapper) #
+
+```
+>>> from libtiff import TIFF
+>>> # to open a tiff file for reading:
+>>> tif = TIFF.open('filename.tif', mode='r')
+>>> # to read an image in the currect TIFF directory and return it as numpy array:
+>>> image = tif.read_image()
+>>> # to read all images in a TIFF file:
+>>> for image in tif.iter_images(): # do stuff with image
+>>> # to open a tiff file for writing:
+>>> tif = TIFF.open('filename.tif', mode='w')
+>>> # to write a image to tiff file
+>>> tif.write_image(image)
+```
+
+# Usage example (pure Python module) #
+
+```
+>>> from libtiff import TIFFfile, TIFFimage
+>>> # to open a tiff file for reading
+>>> tif = TIFFfile('filename.tif')
+>>> # to return memmaps of images and sample names (eg channel names, SamplesPerPixel>=1)
+>>> samples, sample_names = tiff.get_samples()
+>>> # to create a tiff structure from image data
+>>> tiff = TIFFimage(data, description='')
+>>> # to write tiff structure to file
+>>> tiff.write_file('filename.tif', compression='none') # or 'lzw'
+>>> del tiff # flushes data to disk
+```
+
+# Script usage examples #
+
+```
+$ libtiff.info -i result_0.tif --no-gui
+IFDEntry(tag=ImageWidth, value=512, count=1, offset=None)
+IFDEntry(tag=ImageLength, value=512, count=1, offset=None)
+IFDEntry(tag=BitsPerSample, value=32, count=1, offset=None)
+IFDEntry(tag=Compression, value=1, count=1, offset=None)
+IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None)
+IFDEntry(tag=StripOffsets, value=8, count=1, offset=None)
+IFDEntry(tag=Orientation, value=6, count=1, offset=None)
+IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None)
+IFDEntry(tag=PlanarConfiguration, value=1, count=1, offset=None)
+IFDEntry(tag=SampleFormat, value=3, count=1, offset=None)
+Use --ifd to see the rest of 31 IFD entries
+data is contiguous: False
+memory usage is ok: True
+sample data shapes and names:
+
+width : 512
+length : 512
+samples_per_pixel : 1
+planar_config : 1
+bits_per_sample : 32
+strip_length : 1048576
+
+[('memmap', (32, 512, 512), dtype('float32'))] ['sample0']
+```
+
+```
+$ libtiff.info --no-gui -i psf_1024_z5_airy1_set1.lsm
+IFDEntry(tag=NewSubfileType, value=0, count=1, offset=None)
+IFDEntry(tag=ImageWidth, value=1024, count=1, offset=None)
+IFDEntry(tag=ImageLength, value=1024, count=1, offset=None)
+IFDEntry(tag=BitsPerSample, value=8, count=1, offset=None)
+IFDEntry(tag=Compression, value=1, count=1, offset=None)
+IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None)
+IFDEntry(tag=StripOffsets, value=97770, count=1, offset=None)
+IFDEntry(tag=SamplesPerPixel, value=1, count=1, offset=None)
+IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None)
+IFDEntry(tag=PlanarConfiguration, value=2, count=1, offset=None)
+IFDEntry(tag=CZ_LSMInfo, value=CZ_LSMInfo276(
+ MagicNumber=[67127628],
+ StructureSize=[500],
+ DimensionX=[1024],
+ DimensionY=[1024],
+ DimensionZ=[20],
+ DimensionChannels=[1],
+ DimensionTime=[1],
+ SDataType=[1],
+ ThumbnailX=[128],
+ ThumbnailY=[128],
+ VoxelSizeX=[ 2.79017865e-08],
+ VoxelSizeY=[ 2.79017865e-08],
+ VoxelSizeZ=[ 3.60105263e-07],
+ OriginX=[ -2.22222228e-07],
+ OriginY=[ 1.90476196e-07],
+ OriginZ=[ 0.],
+ ScanType=[0],
+ SpectralScan=[0],
+ DataType=[0],
+ OffsetVectorOverlay->DrawingElement(name='OffsetVectorOverlay', size=200, offset=6560),
+ OffsetInputLut->LookupTable(name='OffsetInputLut', size=8388, subblocks=6, channels=1, offset=7560),
+ OffsetOutputLut->LookupTable(name='OffsetOutputLut', size=24836, subblocks=3, channels=3, offset=15948),
+ OffsetChannelColors->ChannelColors (names=['Ch3'], colors=[(255, 0, 0, 0)]),
+ TimeInterval=[ 0.],
+ OffsetChannelDataTypes->None,
+ OffsetScanInformation->recording[size=3535]
+ name = 'psf_1024_z5_airy1_set1'
+ description = ' '
+ notes = ' '
+ objective = 'C-Apochromat 63x/1.20 W Korr UV-VIS-IR M27'
+ special scan mode = 'FocusStep'
+ scan type = ''
+ scan mode = 'Stack'
+ number of stacks = 10
+ lines per plane = 1024
+ samples per line = 1024
+ planes per volume = 20
+ images width = 1024
+ images height = 1024
+ images number planes = 20
+ images number stacks = 1
+ images number channels = 1
+ linescan xy size = 512
+ scan direction = 0
+ scan directionz = 0
+ time series = 0
+ original scan data = 1
+ zoom x = 5.0000000000000009
+ zoom y = 5.0000000000000009
+ zoom z = 1.0
+ sample 0x = -0.22200000000000006
+ sample 0y = 0.19000000000000006
+ sample 0z = 6.8420000000000014
+ sample spacing = 0.028000000000000008
+ line spacing = 0.028000000000000008
+ plane spacing = 0.3600000000000001
+ rotation = 0.0
+ nutation = 0.0
+ precession = 0.0
+ sample 0time = 39583.598368055624
+ start scan trigger in = ''
+ start scan trigger out = ''
+ start scan event = 0
+ start scan time = 0.0
+ stop scan trigger in = ''
+ stop scan trigger out = ''
+ stop scan event = 0
+ start scan time = 0.0
+ use rois = 0
+ use reduced memory rois = 0
+ user = 'User Name'
+ usebccorrection = 0
+ positionbccorrection1 = 0.0
+ positionbccorrection2 = 0.0
+ interpolationy = 1
+ camera binning = 1
+ camera supersampling = 0
+ camera frame width = 1388
+ camera frame height = 1040
+ camera offsetx = 0.0
+ camera offsety = 0.0
+ rt binning = 1
+ ENTRY0x10000064L = 1
+ rt frame width = 512
+ rt frame height = 512
+ rt region width = 512
+ rt region height = 512
+ rt offsetx = 0.0
+ rt offsety = 0.0
+ rt zoom = 1.0000000000000004
+ rt lineperiod = 112.43300000000002
+ prescan = 0
+ lasers[size=188]
+ laser[size=80]
+ name = 'HeNe633'
+ acquire = 1
+ power = 5.0000000000000009
+ end laser
+ laser[size=84]
+ name = 'DPSS 532-75'
+ acquire = 1
+ power = 75.000000000000014
+ end laser
+ end lasers
+ tracks[size=2071]
+ track[size=2047]
+ pixel time = 1.5980000000000003
+ time between stacks = 1.0
+ multiplex type = 1
+ multiplex order = 1
+ sampling mode = 2
+ sampling method = 1
+ sampling number = 8
+ acquire = 1
+ name = 'Track'
+ collimator1 position = 16
+ collimator1 name = 'IR/Vis'
+ collimator2 position = 66
+ collimator2 name = 'UV/Vis'
+ is bleach track = 0
+ is bleach after scan number = 0
+ bleach scan number = 0
+ trigger in = ''
+ trigger out = ''
+ is ratio track = 0
+ bleach count = 0
+ spi center wavelength = 582.53000000000009
+ id condensor aperture = 'KAB1'
+ condensor aperture = 0.55000000000000016
+ id condensor revolver = 'FW2'
+ condensor filter = 'HF'
+ id tubelens = 'Tubelens'
+ id tubelens position = 'Lens LSM'
+ transmitted light = 0.0
+ reflected light = -1.0000000000000002
+ detection channels[size=695]
+ detection channel[size=671]
+ detector gain first = 700.00000000000011
+ detector gain last = 700.00000000000011
+ amplifier gain first = 1.0000000000000002
+ amplifier gain last = 1.0000000000000002
+ amplifier offs first = 0.10000000000000002
+ amplifier offs last = 0.10000000000000002
+ pinhole diameter = 144.00000000000003
+ counting trigger = 5.0
+ acquire = 1
+ integration mode = 0
+ special mode = 0
+ detector name = 'Pmt3'
+ amplifier name = 'Amplifier1'
+ pinhole name = 'PH3'
+ filter set name = 'EF3'
+ filter name = 'LP 650'
+ ENTRY0x70000011L = ''
+ ENTRY0x70000012L = ''
+ integrator name = 'Integrator3'
+ detection channel name = 'Ch3'
+ detector gain bc1 = 0.0
+ detector gain bc2 = 0.0
+ amplifier gain bc1 = 0.0
+ amplifier gain bc2 = 0.0
+ amplifier offs bc1 = 0.0
+ amplifier offs bc2 = 0.0
+ spectral scan channels = 32
+ spi wavelength start = 415.0
+ spi wavelength end = 735.0
+ ENTRY0x70000024L = 575.0
+ ENTRY0x70000025L = 575.0
+ dye name = ''
+ dye folder = ''
+ ENTRY0x70000028L = 1.0000000000000004
+ ENTRY0x70000029L = 0.0
+ end detection channel
+ end detection channels
+ beam splitters[size=330]
+ beam splitter[size=82]
+ filter set = 'HT'
+ filter = 'HFT 405/514/633'
+ name = 'HT'
+ end beam splitter
+ beam splitter[size=75]
+ filter set = 'NT1'
+ filter = 'Mirror'
+ name = 'NT1'
+ end beam splitter
+ beam splitter[size=76]
+ filter set = 'NT2'
+ filter = 'NFT 565'
+ name = 'NT2'
+ end beam splitter
+ beam splitter[size=73]
+ filter set = 'FW1'
+ filter = 'None'
+ name = 'FW1'
+ end beam splitter
+ end beam splitters
+ illumination channels[size=160]
+ illumination channel[size=136]
+ name = '633'
+ power = 0.30000000000000004
+ wavelength = 633.0
+ aquire = 1
+ power bc1 = 0.0
+ power bc2 = 0.0
+ end illumination channel
+ end illumination channels
+ data channels[size=338]
+ data channel[size=314]
+ name = 'Ch3'
+ acquire = 1
+ acquire = 0
+ color = 255
+ sampletype = 1
+ bitspersample = 8
+ ratio type = 0
+ ratio track1 = 0
+ ratio track2 = 0
+ ratio channel1 = ''
+ ratio channel2 = ''
+ ratio const1 = 0.0
+ ratio const2 = 0.0
+ ratio const3 = 1.0
+ ratio const4 = 0.0
+ ratio const5 = 0.0
+ ratio const6 = 0.0
+ end data channel
+ end data channels
+ end track
+ end tracks
+ timers[size=24]
+ end timers
+ markers[size=24]
+ end markers
+end recording,
+ OffsetKsData->OffsetData(name='OffsetKsData', size=8, offset=48590),
+ OffsetTimeStamps->TimeStamps(stamps=[ 2335.75582836]),
+ OffsetEventList->EventList(events=[]),
+ OffsetRoi->DrawingElement(name='OffsetRoi', size=200, offset=6160),
+ OffsetBleachRoi->DrawingElement(name='OffsetBleachRoi', size=200, offset=6360),
+ OffsetNextRecording->None,
+ DisplayAspectX=[ 1.],
+ DisplayAspectY=[ 1.],
+ DisplayAspectZ=[ 1.],
+ DisplayAspectTime=[ 1.],
+ OffsetMeanOfRoisOverlay->DrawingElement(name='OffsetMeanOfRoisOverlay', size=200, offset=6760),
+ OffsetTopoIsolineOverlay->DrawingElement(name='OffsetTopoIsolineOverlay', size=200, offset=7160),
+ OffsetTopoProfileOverlay->DrawingElement(name='OffsetTopoProfileOverlay', size=200, offset=7360),
+ OffsetLinescanOverlay->DrawingElement(name='OffsetLinescanOverlay', size=200, offset=6960),
+ ToolbarFlags=[0],
+ OffsetChannelWavelength->ChannelWavelength (ranges=[(-1.0, -1.0)]),
+ OffsetChannelFactors->ChannelFactors(size=36, offset=40836),
+ ObjectiveSphereCorrection=[ 0.],
+ OffsetUnmixParameters->OffsetData(name='OffsetUnmixParameters', size=124, offset=48466),
+ Reserved=[[40896 44726 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0]]))
+Use --ifd to see the rest of 39 IFD entries
+data is contiguous: False
+memory usage is ok: True
+sample data shapes and names:
+
+width : 1024
+length : 1024
+samples_per_pixel : 1
+planar_config : 2
+bits_per_sample : 8
+strip_length : 1048576
+
+[('memmap', (20, 1024, 1024), dtype('uint8'))] ['Ch3']
+[((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8'))] ['red', 'green', 'blue']
+```
=====================================
pylibtiff.egg-info/SOURCES.txt
=====================================
@@ -1,6 +1,8 @@
LICENSE
MANIFEST.in
README.txt
+pyproject.toml
+setup.cfg
setup.py
libtiff/__init__.py
libtiff/libtiff_ctypes.py
@@ -8,7 +10,6 @@ libtiff/lsm.py
libtiff/lzw.py
libtiff/optparse_gui.py
libtiff/script_options.py
-libtiff/setup.py
libtiff/test_bittools.py
libtiff/tiff.py
libtiff/tiff_array.py
@@ -30,16 +31,17 @@ libtiff/tiff_h_4_0_7.py
libtiff/tiff_h_4_0_8.py
libtiff/tiff_h_4_0_9.py
libtiff/tiff_h_4_1_0.py
+libtiff/tiff_h_4_2_0.py
+libtiff/tiff_h_4_3_0.py
libtiff/tiff_image.py
libtiff/tiff_sample_plane.py
libtiff/utils.py
libtiff/version.py
-libtiff/bitarray-a1646c0/bitarray/__init__.py
-libtiff/bitarray-a1646c0/bitarray/_bitarray.c
-libtiff/bitarray-a1646c0/bitarray/test_bitarray.py
libtiff/src/bittools.c
libtiff/src/tif_lzw.c
pylibtiff.egg-info/PKG-INFO
pylibtiff.egg-info/SOURCES.txt
pylibtiff.egg-info/dependency_links.txt
+pylibtiff.egg-info/entry_points.txt
+pylibtiff.egg-info/requires.txt
pylibtiff.egg-info/top_level.txt
\ No newline at end of file
=====================================
pylibtiff.egg-info/entry_points.txt
=====================================
@@ -0,0 +1,3 @@
+[console_scripts]
+libtiff.convert = libtiff.scripts.convert:main
+libtiff.info = libtiff.scripts.info:main
=====================================
pylibtiff.egg-info/requires.txt
=====================================
@@ -0,0 +1,4 @@
+numpy>=1.13.3
+
+[bitarray]
+bitarray
=====================================
pyproject.toml
=====================================
@@ -0,0 +1,7 @@
+[build-system]
+requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2", 'setuptools_scm_git_archive', 'oldest-supported-numpy']
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools_scm]
+write_to = "libtiff/version.py"
+
=====================================
setup.cfg
=====================================
@@ -1,3 +1,13 @@
+[flake8]
+max-line-length = 120
+ignore = D
+
+[coverage:run]
+relative_files = True
+omit =
+ libtiff/version.py
+ libtiff/tiff_h_*.py
+
[egg_info]
tag_build =
tag_date = 0
=====================================
setup.py
=====================================
@@ -1,235 +1,21 @@
#!/usr/bin/env python
-import os
-import sys
-import subprocess
-import textwrap
-import warnings
-
-CLASSIFIERS = """\
-Development Status :: 3 - Alpha
-Intended Audience :: Science/Research
-License :: OSI Approved
-Programming Language :: Python
-Programming Language :: Python :: 2
-Programming Language :: Python :: 2.7
-Programming Language :: Python :: 3
-Programming Language :: Python :: 3.5
-Programming Language :: Python :: 3.6
-Programming Language :: Python :: 3.7
-Topic :: Scientific/Engineering
-Topic :: Software Development
-Operating System :: Microsoft :: Windows
-Operating System :: POSIX
-Operating System :: Unix
-Operating System :: MacOS
-"""
-
-MAJOR = 0
-MINOR = 4
-MICRO = 4
-ISRELEASED = True
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
-if os.path.exists('MANIFEST'):
- os.remove('MANIFEST')
-
-
-def git_version():
- # Copied from scipy/setup.py
- def _minimal_ext_cmd(cmd):
- # construct minimal environment
- env = {}
- for k in ['SYSTEMROOT', 'PATH']:
- v = os.environ.get(k)
- if v is not None:
- env[k] = v
- # LANGUAGE is used on win32
- env['LANGUAGE'] = 'C'
- env['LANG'] = 'C'
- env['LC_ALL'] = 'C'
- out = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- env=env).communicate()[0]
- return out
-
- try:
- out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
- GIT_REVISION = out.strip().decode('ascii')
- except OSError:
- GIT_REVISION = "Unknown"
-
- return GIT_REVISION
-
-
-def get_version_info():
- # Copied from scipy/setup.py
- FULLVERSION = VERSION
- if os.path.exists('.git'):
- GIT_REVISION = git_version()
- elif os.path.exists('libtiff/version.py'):
- # must be a source distribution, use existing version file
- # load it as a separate module to not load libtiff/__init__.py
- import imp
- version = imp.load_source('libdiff.version', 'libtiff/version.py')
- GIT_REVISION = version.git_revision
- else:
- GIT_REVISION = "Unknown"
-
- if not ISRELEASED:
- FULLVERSION += '.dev0+' + GIT_REVISION[:7]
-
- return FULLVERSION, GIT_REVISION
-
-
-def write_version_py(filename='libtiff/version.py'):
- # Copied from scipy/setup.py
- cnt = """
-# THIS FILE IS GENERATED FROM PYLIBTIFF SETUP.PY
-short_version = '%(version)s'
-version = '%(version)s'
-full_version = '%(full_version)s'
-git_revision = '%(git_revision)s'
-release = %(isrelease)s
-if not release:
- version = full_version
-"""
- FULLVERSION, GIT_REVISION = get_version_info()
-
- a = open(filename, 'w')
- try:
- a.write(cnt % {'version': VERSION,
- 'full_version': FULLVERSION,
- 'git_revision': GIT_REVISION,
- 'isrelease': str(ISRELEASED)})
- finally:
- a.close()
-
-
-def parse_setuppy_commands():
- # Copied from scipy/setup.py
- args = sys.argv[1:]
-
- if not args:
- return True
-
- info_commands = ['--help-commands', '--name', '--version', '-V',
- '--fullname', '--author', '--author-email',
- '--maintainer', '--maintainer-email', '--contact',
- '--contact-email', '--url', '--license', '--description',
- '--long-description', '--platforms', '--classifiers',
- '--keywords', '--provides', '--requires', '--obsoletes']
-
- for command in info_commands:
- if command in args:
- return False
-
- good_commands = ('develop', 'sdist', 'build', 'build_ext', 'build_py',
- 'build_clib', 'build_scripts', 'bdist_wheel', 'bdist_rpm',
- 'bdist_wininst', 'bdist_msi', 'bdist_mpkg',
- 'build_sphinx')
-
- for command in good_commands:
- if command in args:
- return True
-
- if 'install' in args:
- print(textwrap.dedent("""
- Note: if you need reliable uninstall behavior, then install
- with pip instead of using `setup.py install`:
- - `pip install .` (from a git repo or downloaded source
- release)
- - `pip install pylibtiff` (last PyLibTiff release on PyPI)
- """))
- return True
-
- if '--help' in args or '-h' in sys.argv[1]:
- print(textwrap.dedent("""
- PyLibTiff-specific help
- -----------------------
- To install PyLibTiff from here with reliable uninstall, we
- recommend that you use `pip install .`. To install the
- latest PyLibTiff release from PyPI, use `pip install
- pylibtiff`.
-
- If you are sure that you have run into a bug, please
- report it at https://github.com/pearu/pylibtiff/issues.
-
- Setuptools commands help
- ------------------------
- """))
- return False
-
- # The following commands aren't supported. They can only be executed when
- # the user explicitly adds a --force command-line argument.
- bad_commands = dict(
- test="""
- `setup.py test` is not supported. Use one of the following
- instead:
- - `pytest -sv libtiff/`
- """,
- upload="""
- `setup.py upload` is not supported, because it's insecure.
- Instead, build what you want to upload and upload those files
- with `twine upload -s <filenames>` instead.
- """,
- upload_docs="`setup.py upload_docs` is not supported",
- easy_install="`setup.py easy_install` is not supported",
- clean="""
- `setup.py clean` is not supported, use one of the following instead:
- - `git clean -xdf` (cleans all files)
- - `git clean -Xdf` (cleans all versioned files, doesn't touch
- files that aren't checked into the git repo)
- """,
- check="`setup.py check` is not supported",
- register="`setup.py register` is not supported",
- bdist_dumb="`setup.py bdist_dumb` is not supported",
- bdist="`setup.py bdist` is not supported",
- flake8="`setup.py flake8` is not supported, use flake8 standalone",
- )
- bad_commands['nosetests'] = bad_commands['test']
- for command in ('upload_docs', 'easy_install', 'bdist', 'bdist_dumb',
- 'register', 'check', 'install_data', 'install_headers',
- 'install_lib', 'install_scripts', ):
- bad_commands[command] = "`setup.py %s` is not supported" % command
-
- for command in bad_commands.keys():
- if command in args:
- print(textwrap.dedent(bad_commands[command]) +
- "\nAdd `--force` to your command to use it anyway if you "
- "must (unsupported).\n")
- sys.exit(1)
-
- # Commands that do more than print info, but also don't need Cython and
- # template parsing.
- other_commands = ['egg_info', 'install_egg_info', 'rotate']
- for command in other_commands:
- if command in args:
- return False
-
- # If we got here, we didn't detect what setup.py command was given
- warnings.warn("Unrecognized setuptools command")
- return True
+import os
+from setuptools import find_packages, Extension, setup
+import numpy as np
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration(None, parent_package, top_path)
- config.add_subpackage('libtiff')
- config.get_version('libtiff/version.py')
- config.add_data_files(('libtiff', 'LICENSE'))
- return config
+try:
+ # HACK: https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286
+ # Stop setuptools_scm from including all repository files
+ import setuptools_scm.integration
+ setuptools_scm.integration.find_files = lambda _: []
+except ImportError:
+ pass
def setup_package():
- # Rewrite the version file every time
- write_version_py()
-
- try:
- import numpy # noqa: F401
- except ImportError: # We do not have numpy installed
- build_requires = ['numpy>=1.13.3']
- else:
- build_requires = (['numpy>=1.13.3'] if 'bdist_wheel' in sys.argv[1:]
- else [])
+ with open("README.md", "r") as readme:
+ long_description = readme.read()
metadata = dict(
name='pylibtiff',
@@ -237,35 +23,47 @@ def setup_package():
author_email='pearu.peterson at gmail.com',
license='https://github.com/pearu/pylibtiff/blob/master/LICENSE',
url='https://github.com/pearu/pylibtiff',
- # download_url = 'http://code.google.com/p/pylibtiff/downloads/',
- classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
+ classifiers=[
+ "Development Status :: 3 - Alpha",
+ "Intended Audience :: Science/Research",
+ "License :: OSI Approved",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Topic :: Scientific/Engineering",
+ "Topic :: Software Development",
+ "Operating System :: Microsoft :: Windows",
+ "Operating System :: POSIX",
+ "Operating System :: Unix",
+ "Operating System :: MacOS",
+ ],
description='PyLibTiff: a Python tiff library.',
- long_description='''\
-
-PyLibTiff? is a Python package that provides the following modules:
-
- libtiff - a wrapper of C libtiff library using ctypes.
- tiff - a numpy.memmap view of tiff files.
-''',
- platforms=["All"],
- setup_requires=build_requires,
- install_requires=build_requires,
- python_requires='>=2.7',
+ long_description=long_description,
+ long_description_content_type='text/markdown',
+ install_requires=['numpy>=1.13.3'],
+ python_requires='>=3.8',
+ extras_require={
+ 'bitarray': ['bitarray'],
+ },
+ include_package_data=True,
+ packages=find_packages(),
+ ext_modules=[
+ Extension(name="libtiff.bittools",
+ sources=[os.path.join("libtiff", "src", "bittools.c")],
+ include_dirs=[np.get_include()]),
+ Extension(name="libtiff.tif_lzw",
+ sources=[os.path.join("libtiff", "src", "tif_lzw.c")],
+ include_dirs=[np.get_include()]),
+ ],
+ entry_points={
+ 'console_scripts': [
+ 'libtiff.info = libtiff.scripts.info:main',
+ 'libtiff.convert = libtiff.scripts.convert:main',
+ ],
+ },
)
- if "--force" in sys.argv:
- run_build = True
- sys.argv.remove('--force')
- else:
- run_build = parse_setuppy_commands()
-
- from setuptools import setup
-
- if run_build:
- from numpy.distutils.core import setup # noqa: F811
- metadata['configuration'] = configuration
- else:
- metadata['version'] = get_version_info()[0]
-
setup(**metadata)
View it on GitLab: https://salsa.debian.org/debian-gis-team/pylibtiff/-/commit/ff8cd69cfb90fb00a31f92e15b117b6d7cddfa59
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pylibtiff/-/commit/ff8cd69cfb90fb00a31f92e15b117b6d7cddfa59
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20221217/2d1f4e6a/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list