large-image-source-tiff 1.26.0__tar.gz → 1.26.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (16) hide show
  1. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/PKG-INFO +1 -1
  2. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff/__init__.py +8 -61
  3. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff.egg-info/PKG-INFO +1 -1
  4. large-image-source-tiff-1.26.1/large_image_source_tiff.egg-info/requires.txt +6 -0
  5. large-image-source-tiff-1.26.0/large_image_source_tiff.egg-info/requires.txt +0 -6
  6. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/LICENSE +0 -0
  7. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/README.rst +0 -0
  8. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff/exceptions.py +0 -0
  9. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff/girder_source.py +0 -0
  10. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff/tiff_reader.py +0 -0
  11. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff.egg-info/SOURCES.txt +0 -0
  12. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff.egg-info/dependency_links.txt +0 -0
  13. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff.egg-info/entry_points.txt +0 -0
  14. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/large_image_source_tiff.egg-info/top_level.txt +0 -0
  15. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/setup.cfg +0 -0
  16. {large-image-source-tiff-1.26.0 → large-image-source-tiff-1.26.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tiff
3
- Version: 1.26.0
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.
@@ -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.getTileFromEmptyDirectory(x, y, z, **kwargs)
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 getTileFromEmptyDirectory(self, x, y, z, **kwargs):
708
+ def _nonemptyLevelsList(self, frame=0):
717
709
  """
718
- Given the x, y, z tile location in an unpopulated level, get tiles from
719
- higher resolution levels to make the lower-res tile.
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 x: location of tile within original level.
722
- :param y: location of tile within original level.
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 = self._getFrame(**kwargs)
717
+ frame = int(frame or 0)
730
718
  if frame > 0 and hasattr(self, '_frames'):
731
719
  dirlist = self._frames[frame]['dirs']
732
- while dirlist[z] is None:
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
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tiff
3
- Version: 1.26.0
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.
@@ -0,0 +1,6 @@
1
+ large-image>=1.26.1
2
+ pylibtiff
3
+ tifftools>=1.2.0
4
+
5
+ [girder]
6
+ girder-large-image>=1.26.1
@@ -1,6 +0,0 @@
1
- large-image>=1.26.0
2
- pylibtiff
3
- tifftools>=1.2.0
4
-
5
- [girder]
6
- girder-large-image>=1.26.0