large-image-source-tiff 1.27.3.dev26__py3-none-any.whl → 1.27.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -596,13 +596,27 @@ class TiledTiffDirectory:
596
596
  self._tiffFile).value
597
597
  stripsCount = min(self._stripsPerTile, self._stripCount - tileNum)
598
598
  tileSize = stripSize * self._stripsPerTile
599
- imageBuffer = ctypes.create_string_buffer(tileSize)
599
+ tw, th = self._tileWidth, self._tileHeight
600
+ if self._tiffInfo.get('orientation') in {
601
+ libtiff_ctypes.ORIENTATION_LEFTTOP,
602
+ libtiff_ctypes.ORIENTATION_RIGHTTOP,
603
+ libtiff_ctypes.ORIENTATION_RIGHTBOT,
604
+ libtiff_ctypes.ORIENTATION_LEFTBOT}:
605
+ tw, th = th, tw
606
+ format = (
607
+ self._tiffInfo.get('bitspersample'),
608
+ self._tiffInfo.get('sampleformat') if self._tiffInfo.get(
609
+ 'sampleformat') is not None else libtiff_ctypes.SAMPLEFORMAT_UINT)
610
+ image = np.empty((th, tw, self._tiffInfo['samplesperpixel']),
611
+ dtype=_ctypesFormattbl[format])
612
+ imageBuffer = image.ctypes.data_as(ctypes.POINTER(ctypes.c_char))
600
613
  if self._tiffInfo.get('istiled'):
601
614
  with self._tileLock:
602
615
  readSize = libtiff_ctypes.libtiff.TIFFReadEncodedTile(
603
616
  self._tiffFile, tileNum, imageBuffer, tileSize)
604
617
  else:
605
618
  readSize = 0
619
+ imageBuffer = ctypes.cast(imageBuffer, ctypes.POINTER(ctypes.c_char * 2)).contents
606
620
  for stripNum in range(stripsCount):
607
621
  with self._tileLock:
608
622
  chunkSize = libtiff_ctypes.libtiff.TIFFReadEncodedStrip(
@@ -621,21 +635,6 @@ class TiledTiffDirectory:
621
635
  raise IOTiffError(
622
636
  'Read an unexpected number of bytes from an encoded tile' if readSize >= 0 else
623
637
  'Failed to read from an encoded tile')
624
- tw, th = self._tileWidth, self._tileHeight
625
- if self._tiffInfo.get('orientation') in {
626
- libtiff_ctypes.ORIENTATION_LEFTTOP,
627
- libtiff_ctypes.ORIENTATION_RIGHTTOP,
628
- libtiff_ctypes.ORIENTATION_RIGHTBOT,
629
- libtiff_ctypes.ORIENTATION_LEFTBOT}:
630
- tw, th = th, tw
631
- format = (
632
- self._tiffInfo.get('bitspersample'),
633
- self._tiffInfo.get('sampleformat') if self._tiffInfo.get(
634
- 'sampleformat') is not None else libtiff_ctypes.SAMPLEFORMAT_UINT)
635
- image = np.ctypeslib.as_array(ctypes.cast(
636
- imageBuffer, ctypes.POINTER(ctypes.c_uint8)), (tileSize, )).view(
637
- _ctypesFormattbl[format]).reshape(
638
- (th, tw, self._tiffInfo['samplesperpixel']))
639
638
  if (self._tiffInfo.get('samplesperpixel') == 3 and
640
639
  self._tiffInfo.get('photometric') == libtiff_ctypes.PHOTOMETRIC_YCBCR):
641
640
  if self._tiffInfo.get('bitspersample') == 16:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tiff
3
- Version: 1.27.3.dev26
3
+ Version: 1.27.4
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.3.dev26
20
+ Requires-Dist: large-image >=1.27.4
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.3.dev26 ; extra == 'girder'
24
+ Requires-Dist: girder-large-image >=1.27.4 ; 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=xZGz9P97LHfL5kmxVCL1ek0ry259LNp39yGls6tnpnM,38634
5
+ large_image_source_tiff-1.27.4.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
6
+ large_image_source_tiff-1.27.4.dist-info/METADATA,sha256=OmevImKgVIfixE3oZLCU_nG3q6wi5S-5KrF2kd_HEwY,1016
7
+ large_image_source_tiff-1.27.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
+ large_image_source_tiff-1.27.4.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
9
+ large_image_source_tiff-1.27.4.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
10
+ large_image_source_tiff-1.27.4.dist-info/RECORD,,
@@ -1,10 +0,0 @@
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=hv9ux30nLh_A46MRJqgUJoEGUIoOuJAQfLh_5VrVyDk,38643
5
- large_image_source_tiff-1.27.3.dev26.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
6
- large_image_source_tiff-1.27.3.dev26.dist-info/METADATA,sha256=gbmeZLPkhwxM_YpGGmZhoO4w61f-j9PydnEcOT21xmE,1034
7
- large_image_source_tiff-1.27.3.dev26.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
- large_image_source_tiff-1.27.3.dev26.dist-info/entry_points.txt,sha256=iZ43sIcj98SND7nDUC-_4qroBL6apyXN4iSbPXZ8LE4,166
9
- large_image_source_tiff-1.27.3.dev26.dist-info/top_level.txt,sha256=QRx_D2oeiOOz_5FlBOAoDPF-E4Q-aFmerUWlaeP14B8,24
10
- large_image_source_tiff-1.27.3.dev26.dist-info/RECORD,,