large-image-source-tiff 1.26.0__py3-none-any.whl → 1.26.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- large_image_source_tiff/__init__.py +8 -61
- {large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/METADATA +3 -3
- large_image_source_tiff-1.26.1.dist-info/RECORD +10 -0
- large_image_source_tiff-1.26.0.dist-info/RECORD +0 -10
- {large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/LICENSE +0 -0
- {large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/WHEEL +0 -0
- {large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/entry_points.txt +0 -0
- {large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/top_level.txt +0 -0
@@ -72,14 +72,6 @@ class TiffFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
72
72
|
'image/x-ptif': SourcePriority.PREFERRED,
|
73
73
|
}
|
74
74
|
|
75
|
-
# When getting tiles for otherwise empty directories (missing powers of
|
76
|
-
# two), we composite the tile from higher resolution levels. This can use
|
77
|
-
# excessive memory if there are too many missing levels. For instance, if
|
78
|
-
# there are six missing levels and the tile size is 1024 square RGBA, then
|
79
|
-
# 16 Gb are needed for the composited tile at a minimum. By setting
|
80
|
-
# _maxSkippedLevels, such large gaps are composited in stages.
|
81
|
-
_maxSkippedLevels = 3
|
82
|
-
|
83
75
|
_maxAssociatedImageSize = 8192
|
84
76
|
|
85
77
|
def __init__(self, path, **kwargs): # noqa
|
@@ -643,7 +635,7 @@ class TiffFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
643
635
|
if dir is None:
|
644
636
|
try:
|
645
637
|
if not kwargs.get('inSparseFallback'):
|
646
|
-
tile = self.
|
638
|
+
tile = self._getTileFromEmptyLevel(x, y, z, **kwargs)
|
647
639
|
else:
|
648
640
|
raise IOTiffError('Missing z level %d' % z)
|
649
641
|
except Exception:
|
@@ -713,64 +705,19 @@ class TiffFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
713
705
|
numpyAllowed, applyStyle=False, **kwargs)
|
714
706
|
raise TileSourceError('Internal I/O failure: %s' % exception.args[0])
|
715
707
|
|
716
|
-
def
|
708
|
+
def _nonemptyLevelsList(self, frame=0):
|
717
709
|
"""
|
718
|
-
|
719
|
-
|
710
|
+
Return a list of one value per level where the value is None if the
|
711
|
+
level does not exist in the file and any other value if it does.
|
720
712
|
|
721
|
-
:param
|
722
|
-
:
|
723
|
-
:param z: original level.
|
724
|
-
:returns: tile in PIL format.
|
713
|
+
:param frame: the frame number.
|
714
|
+
:returns: a list of levels length.
|
725
715
|
"""
|
726
|
-
basez = z
|
727
|
-
scale = 1
|
728
716
|
dirlist = self._tiffDirectories
|
729
|
-
frame =
|
717
|
+
frame = int(frame or 0)
|
730
718
|
if frame > 0 and hasattr(self, '_frames'):
|
731
719
|
dirlist = self._frames[frame]['dirs']
|
732
|
-
|
733
|
-
scale *= 2
|
734
|
-
z += 1
|
735
|
-
while z - basez > self._maxSkippedLevels:
|
736
|
-
z -= self._maxSkippedLevels
|
737
|
-
scale = int(scale / 2 ** self._maxSkippedLevels)
|
738
|
-
tile = PIL.Image.new('RGBA', (
|
739
|
-
min(self.sizeX, self.tileWidth * scale), min(self.sizeY, self.tileHeight * scale)))
|
740
|
-
maxX = 2.0 ** (z + 1 - self.levels) * self.sizeX / self.tileWidth
|
741
|
-
maxY = 2.0 ** (z + 1 - self.levels) * self.sizeY / self.tileHeight
|
742
|
-
for newX in range(scale):
|
743
|
-
for newY in range(scale):
|
744
|
-
if ((newX or newY) and ((x * scale + newX) >= maxX or
|
745
|
-
(y * scale + newY) >= maxY)):
|
746
|
-
continue
|
747
|
-
subtile = self.getTile(
|
748
|
-
x * scale + newX, y * scale + newY, z,
|
749
|
-
pilImageAllowed=True, numpyAllowed=False,
|
750
|
-
sparseFallback=True, edge=False, frame=frame)
|
751
|
-
if not isinstance(subtile, PIL.Image.Image):
|
752
|
-
subtile = PIL.Image.open(io.BytesIO(subtile))
|
753
|
-
tile.paste(subtile, (newX * self.tileWidth,
|
754
|
-
newY * self.tileHeight))
|
755
|
-
return tile.resize((self.tileWidth, self.tileHeight),
|
756
|
-
getattr(PIL.Image, 'Resampling', PIL.Image).LANCZOS)
|
757
|
-
|
758
|
-
def getPreferredLevel(self, level):
|
759
|
-
"""
|
760
|
-
Given a desired level (0 is minimum resolution, self.levels - 1 is max
|
761
|
-
resolution), return the level that contains actual data that is no
|
762
|
-
lower resolution.
|
763
|
-
|
764
|
-
:param level: desired level
|
765
|
-
:returns level: a level with actual data that is no lower resolution.
|
766
|
-
"""
|
767
|
-
level = max(0, min(level, self.levels - 1))
|
768
|
-
baselevel = level
|
769
|
-
while self._tiffDirectories[level] is None and level < self.levels - 1:
|
770
|
-
level += 1
|
771
|
-
while level - baselevel >= self._maxSkippedLevels:
|
772
|
-
level -= self._maxSkippedLevels
|
773
|
-
return level
|
720
|
+
return dirlist
|
774
721
|
|
775
722
|
def getAssociatedImagesList(self):
|
776
723
|
"""
|
{large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: large-image-source-tiff
|
3
|
-
Version: 1.26.
|
3
|
+
Version: 1.26.1
|
4
4
|
Summary: A TIFF tilesource for large_image.
|
5
5
|
Home-page: https://github.com/girder/large_image
|
6
6
|
Author: Kitware, Inc.
|
@@ -17,11 +17,11 @@ Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
18
|
Requires-Python: >=3.8
|
19
19
|
License-File: LICENSE
|
20
|
-
Requires-Dist: large-image >=1.26.
|
20
|
+
Requires-Dist: large-image >=1.26.1
|
21
21
|
Requires-Dist: pylibtiff
|
22
22
|
Requires-Dist: tifftools >=1.2.0
|
23
23
|
Provides-Extra: girder
|
24
|
-
Requires-Dist: girder-large-image >=1.26.
|
24
|
+
Requires-Dist: girder-large-image >=1.26.1 ; extra == 'girder'
|
25
25
|
|
26
26
|
A TIFF tilesource for large_image.
|
27
27
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
large_image_source_tiff/__init__.py,sha256=40kACkpiNCPxIaqIilveB7eacsdr39UpsvPG23zfnGg,34043
|
2
|
+
large_image_source_tiff/exceptions.py,sha256=NgdwloaDCtbtUMe2BU2lXEU8IwQSYtaokIwGIFypCps,617
|
3
|
+
large_image_source_tiff/girder_source.py,sha256=Dp2e3O4VTANYXZI_eybgzs5BcyuMcw2-MAzCUJ8zzPg,1031
|
4
|
+
large_image_source_tiff/tiff_reader.py,sha256=2dUHzjCtk43k3eigqUteISKKFPVDX420gV0qVvU_KHU,38110
|
5
|
+
large_image_source_tiff-1.26.1.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
6
|
+
large_image_source_tiff-1.26.1.dist-info/METADATA,sha256=z-k_D1V1_dGOYIVQ_jcOYdcZOmCNAZtxKzu5_E_LIec,1016
|
7
|
+
large_image_source_tiff-1.26.1.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
8
|
+
large_image_source_tiff-1.26.1.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
|
9
|
+
large_image_source_tiff-1.26.1.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
|
10
|
+
large_image_source_tiff-1.26.1.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
large_image_source_tiff/__init__.py,sha256=h6tmNU9i9GEfKT9Nd51MrSm5m6vFHldUVH2i3w1HFcg,36696
|
2
|
-
large_image_source_tiff/exceptions.py,sha256=NgdwloaDCtbtUMe2BU2lXEU8IwQSYtaokIwGIFypCps,617
|
3
|
-
large_image_source_tiff/girder_source.py,sha256=Dp2e3O4VTANYXZI_eybgzs5BcyuMcw2-MAzCUJ8zzPg,1031
|
4
|
-
large_image_source_tiff/tiff_reader.py,sha256=2dUHzjCtk43k3eigqUteISKKFPVDX420gV0qVvU_KHU,38110
|
5
|
-
large_image_source_tiff-1.26.0.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
6
|
-
large_image_source_tiff-1.26.0.dist-info/METADATA,sha256=4x_XleuBvT94wDojxiSdjs8qIXW_pSAfNEEwt0N6hVE,1016
|
7
|
-
large_image_source_tiff-1.26.0.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
8
|
-
large_image_source_tiff-1.26.0.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
|
9
|
-
large_image_source_tiff-1.26.0.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
|
10
|
-
large_image_source_tiff-1.26.0.dist-info/RECORD,,
|
{large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
{large_image_source_tiff-1.26.0.dist-info → large_image_source_tiff-1.26.1.dist-info}/top_level.txt
RENAMED
File without changes
|