large-image-source-bioformats 1.33.4.dev21__py3-none-any.whl → 1.33.4.dev29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of large-image-source-bioformats might be problematic. Click here for more details.
- large_image_source_bioformats/__init__.py +37 -0
- {large_image_source_bioformats-1.33.4.dev21.dist-info → large_image_source_bioformats-1.33.4.dev29.dist-info}/METADATA +3 -3
- large_image_source_bioformats-1.33.4.dev29.dist-info/RECORD +8 -0
- large_image_source_bioformats-1.33.4.dev21.dist-info/RECORD +0 -8
- {large_image_source_bioformats-1.33.4.dev21.dist-info → large_image_source_bioformats-1.33.4.dev29.dist-info}/WHEEL +0 -0
- {large_image_source_bioformats-1.33.4.dev21.dist-info → large_image_source_bioformats-1.33.4.dev29.dist-info}/entry_points.txt +0 -0
- {large_image_source_bioformats-1.33.4.dev21.dist-info → large_image_source_bioformats-1.33.4.dev29.dist-info}/licenses/LICENSE +0 -0
- {large_image_source_bioformats-1.33.4.dev21.dist-info → large_image_source_bioformats-1.33.4.dev29.dist-info}/top_level.txt +0 -0
|
@@ -339,6 +339,7 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
339
339
|
delattr(self, '_lastGetTileException')
|
|
340
340
|
except Exception as exc:
|
|
341
341
|
raise TileSourceError('Bioformats cannot read a tile: %r' % exc)
|
|
342
|
+
self._checkForOffset()
|
|
342
343
|
self._populatedLevels = len([
|
|
343
344
|
v for v in self._metadata['frameSeries'][0]['series'] if v is not None])
|
|
344
345
|
|
|
@@ -357,6 +358,40 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
357
358
|
if javabridge.get_env():
|
|
358
359
|
javabridge.detach()
|
|
359
360
|
|
|
361
|
+
def _checkForOffset(self):
|
|
362
|
+
"""
|
|
363
|
+
The bioformats DICOM reader does unfortunate things to MONOCHROME1
|
|
364
|
+
16-bit images. Store an offset to undo it, if appropriate.
|
|
365
|
+
"""
|
|
366
|
+
if self._metadata.get('readerClassName') != 'loci.formats.in.DicomReader':
|
|
367
|
+
return
|
|
368
|
+
if self._metadata.get('seriesMetadata', {}).get(
|
|
369
|
+
'0028,0004 Photometric Interpretation') != 'MONOCHROME1':
|
|
370
|
+
return
|
|
371
|
+
if np.issubdtype(self.dtype, np.uint8):
|
|
372
|
+
self._fix_offset = 255
|
|
373
|
+
return
|
|
374
|
+
if not np.issubdtype(self.dtype, np.int16) and not np.issubdtype(self.dtype, '>i2'):
|
|
375
|
+
return
|
|
376
|
+
# This is bioformats behavior
|
|
377
|
+
try:
|
|
378
|
+
maxPixelRange = int(self._metadata['seriesMetadata'].get(
|
|
379
|
+
'0028,1051 Window Width', 0))
|
|
380
|
+
except Exception:
|
|
381
|
+
maxPixelRange = -1
|
|
382
|
+
try:
|
|
383
|
+
centerPixelValue = int(self._metadata['seriesMetadata'].get(
|
|
384
|
+
'0028,1050 Window Center', 0))
|
|
385
|
+
except Exception:
|
|
386
|
+
centerPixelValue = -1
|
|
387
|
+
maxPixelValue = maxPixelRange + (centerPixelValue // 2)
|
|
388
|
+
maxAllowRange = 2 ** int(self._metadata['seriesMetadata'].get(
|
|
389
|
+
'0028,0101 Bits Stored', 16)) - 1
|
|
390
|
+
if maxPixelRange == -1 or centerPixelValue < maxPixelRange // 2:
|
|
391
|
+
maxPixelValue = maxAllowRange
|
|
392
|
+
if maxPixelValue:
|
|
393
|
+
self._fix_offset = maxPixelValue
|
|
394
|
+
|
|
360
395
|
def _metadataForCurrentSeries(self, rdr):
|
|
361
396
|
self._metadata = getattr(self, '_metadata', {})
|
|
362
397
|
self._metadata.update({
|
|
@@ -723,6 +758,8 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
723
758
|
retile[0:min(tile.shape[0], finalHeight), 0:min(tile.shape[1], finalWidth)] = tile[
|
|
724
759
|
0:min(tile.shape[0], finalHeight), 0:min(tile.shape[1], finalWidth)]
|
|
725
760
|
tile = retile
|
|
761
|
+
if hasattr(self, '_fix_offset') and format == TILE_FORMAT_NUMPY:
|
|
762
|
+
tile = self._fix_offset - tile
|
|
726
763
|
return self._outputTile(tile, format, x, y, z, pilImageAllowed, numpyAllowed, **kwargs)
|
|
727
764
|
|
|
728
765
|
def getAssociatedImagesList(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: large-image-source-bioformats
|
|
3
|
-
Version: 1.33.4.
|
|
3
|
+
Version: 1.33.4.dev29
|
|
4
4
|
Summary: An bioformats tilesource for large_image.
|
|
5
5
|
Home-page: https://github.com/girder/large_image
|
|
6
6
|
Author: Kitware, Inc.
|
|
@@ -17,10 +17,10 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
17
17
|
Requires-Python: >=3.9
|
|
18
18
|
Description-Content-Type: text/x-rst
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: large-image>=1.33.4.
|
|
20
|
+
Requires-Dist: large-image>=1.33.4.dev29
|
|
21
21
|
Requires-Dist: python-bioformats>=1.5.2
|
|
22
22
|
Provides-Extra: girder
|
|
23
|
-
Requires-Dist: girder-large-image>=1.33.4.
|
|
23
|
+
Requires-Dist: girder-large-image>=1.33.4.dev29; extra == "girder"
|
|
24
24
|
Dynamic: author
|
|
25
25
|
Dynamic: author-email
|
|
26
26
|
Dynamic: classifier
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
large_image_source_bioformats/__init__.py,sha256=sBCg-N7s1mN29q8EIaY4Nr34ir7Oi8DINtV5mOT0cqM,36468
|
|
2
|
+
large_image_source_bioformats/girder_source.py,sha256=t0X1P0m4qMsRklpdxoPH-yqgHByMvQIzFJ4qRIUykVI,1355
|
|
3
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
4
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/METADATA,sha256=7Z6qPoVqCZg90eh6Tw0yzRSt0xIur-y4sVd9opRYyKY,1269
|
|
5
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/entry_points.txt,sha256=xgIbKr53QhQkyRFkr87fkagfPWweeqhHHekUEMrcpF8,202
|
|
7
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/top_level.txt,sha256=e0enjlcFXwPi638IhE71Rk5-eeriA7W3M3IsQ6yH3RI,30
|
|
8
|
+
large_image_source_bioformats-1.33.4.dev29.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
large_image_source_bioformats/__init__.py,sha256=IWOpHHPAX3pYmqOJx3cPmEmvkHU_pMbhiTLdxXVBH3o,34872
|
|
2
|
-
large_image_source_bioformats/girder_source.py,sha256=t0X1P0m4qMsRklpdxoPH-yqgHByMvQIzFJ4qRIUykVI,1355
|
|
3
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
4
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/METADATA,sha256=YjQIb4J5Zj0SdBMB4L4vYU5-QBe_XspsIEHF81UUye0,1269
|
|
5
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/entry_points.txt,sha256=xgIbKr53QhQkyRFkr87fkagfPWweeqhHHekUEMrcpF8,202
|
|
7
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/top_level.txt,sha256=e0enjlcFXwPi638IhE71Rk5-eeriA7W3M3IsQ6yH3RI,30
|
|
8
|
-
large_image_source_bioformats-1.33.4.dev21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|