large-image-source-tiff 1.27.0__py3-none-any.whl → 1.27.1.dev5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -645,7 +645,7 @@ class TiffFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
645
645
  allowStyle = False
646
646
  format = TILE_FORMAT_PIL
647
647
  else:
648
- tile = dir.getTile(x, y)
648
+ tile = dir.getTile(x, y, asarray=numpyAllowed == 'always')
649
649
  format = 'JPEG'
650
650
  if isinstance(tile, PIL.Image.Image):
651
651
  format = TILE_FORMAT_PIL
@@ -754,7 +754,7 @@ class TiledTiffDirectory:
754
754
  def pixelInfo(self):
755
755
  return self._pixelInfo
756
756
 
757
- def getTile(self, x, y):
757
+ def getTile(self, x, y, asarray=False):
758
758
  """
759
759
  Get the complete JPEG image from a tile.
760
760
 
@@ -762,6 +762,8 @@ class TiledTiffDirectory:
762
762
  :type x: int
763
763
  :param y: The row index of the desired tile.
764
764
  :type y: int
765
+ :param asarray: If True, read jpeg compressed images as arrays.
766
+ :type asarray: boolean
765
767
  :return: either a buffer with a JPEG or a PIL image.
766
768
  :rtype: bytes
767
769
  :raises: InvalidOperationTiffError or IOTiffError
@@ -774,11 +776,14 @@ class TiledTiffDirectory:
774
776
  tileNum = self._toTileNum(x, y)
775
777
 
776
778
  if (not self._tiffInfo.get('istiled') or
777
- self._tiffInfo.get('compression') not in (
778
- libtiff_ctypes.COMPRESSION_JPEG, 33003, 33005, 34712) or
779
+ self._tiffInfo.get('compression') not in {
780
+ libtiff_ctypes.COMPRESSION_JPEG, 33003, 33005, 34712} or
779
781
  self._tiffInfo.get('bitspersample') != 8 or
780
782
  self._tiffInfo.get('sampleformat') not in {
781
- None, libtiff_ctypes.SAMPLEFORMAT_UINT}):
783
+ None, libtiff_ctypes.SAMPLEFORMAT_UINT} or
784
+ (asarray and self._tiffInfo.get('compression') not in {33003, 33005, 34712} and (
785
+ self._tiffInfo.get('compression') != libtiff_ctypes.COMPRESSION_JPEG or
786
+ self._tiffInfo.get('photometric') != libtiff_ctypes.PHOTOMETRIC_YCBCR))):
782
787
  return self._getUncompressedTile(tileNum)
783
788
 
784
789
  imageBuffer = io.BytesIO()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tiff
3
- Version: 1.27.0
3
+ Version: 1.27.1.dev5
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.27.0
20
+ Requires-Dist: large-image >=1.27.1.dev5
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.27.0 ; extra == 'girder'
24
+ Requires-Dist: girder-large-image >=1.27.1.dev5 ; 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=0XCpYfa6BDT4m22xtLYO6qlxJ7vCFrWopWQQQo37FGQ,33986
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=fJ2J_XDthk_LNXly4p0Zf6ZNjHZhfQxo1laBixoRbIc,38497
5
+ large_image_source_tiff-1.27.1.dev5.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
6
+ large_image_source_tiff-1.27.1.dev5.dist-info/METADATA,sha256=ZFq-qbYHiOLcbuDM7A9UQr5jvnZafKHGzzrAxhcdU38,1031
7
+ large_image_source_tiff-1.27.1.dev5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
+ large_image_source_tiff-1.27.1.dev5.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
9
+ large_image_source_tiff-1.27.1.dev5.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
10
+ large_image_source_tiff-1.27.1.dev5.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- large_image_source_tiff/__init__.py,sha256=mCcJqAbDqdaaCPqD5Zfu8saj-j8KZZoTqdMyy9RAlWw,33952
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=i6HztBXfPWEIncUo_y3rWuhUNrv3CG8oAVKOUWCkn2A,38094
5
- large_image_source_tiff-1.27.0.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
6
- large_image_source_tiff-1.27.0.dist-info/METADATA,sha256=wfkgSV_6vUcZVz90w50nIthAkBh4Xrnlutymy_bzQpc,1016
7
- large_image_source_tiff-1.27.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
- large_image_source_tiff-1.27.0.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
9
- large_image_source_tiff-1.27.0.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
10
- large_image_source_tiff-1.27.0.dist-info/RECORD,,