large-image-source-bioformats 1.32.12.dev30__tar.gz → 1.33.6.dev41__tar.gz
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.
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/PKG-INFO +5 -5
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats/__init__.py +46 -20
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats.egg-info/PKG-INFO +5 -5
- large_image_source_bioformats-1.33.6.dev41/large_image_source_bioformats.egg-info/requires.txt +5 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/setup.py +2 -2
- large_image_source_bioformats-1.32.12.dev30/large_image_source_bioformats.egg-info/requires.txt +0 -5
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/LICENSE +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/README.rst +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats/girder_source.py +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats.egg-info/SOURCES.txt +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats.egg-info/dependency_links.txt +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats.egg-info/entry_points.txt +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/large_image_source_bioformats.egg-info/top_level.txt +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/pyproject.toml +0 -0
- {large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/setup.cfg +0 -0
{large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: large-image-source-bioformats
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.33.6.dev41
|
|
4
4
|
Summary: An bioformats tilesource for large_image.
|
|
5
5
|
Home-page: https://github.com/girder/large_image
|
|
6
6
|
Author: Kitware, Inc.
|
|
@@ -9,18 +9,18 @@ License: Apache-2.0
|
|
|
9
9
|
Keywords: large_image,tile source
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/x-rst
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: large-image>=1.
|
|
20
|
+
Requires-Dist: large-image>=1.33.6.dev41
|
|
21
21
|
Requires-Dist: python-bioformats>=1.5.2
|
|
22
22
|
Provides-Extra: girder
|
|
23
|
-
Requires-Dist: girder-large-image>=1.
|
|
23
|
+
Requires-Dist: girder-large-image>=1.33.6.dev41; extra == "girder"
|
|
24
24
|
Dynamic: author
|
|
25
25
|
Dynamic: author-email
|
|
26
26
|
Dynamic: classifier
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
import atexit
|
|
26
26
|
import builtins
|
|
27
|
+
import contextlib
|
|
28
|
+
import importlib.metadata
|
|
27
29
|
import logging
|
|
28
30
|
import math
|
|
29
31
|
import os
|
|
@@ -33,8 +35,6 @@ import threading
|
|
|
33
35
|
import types
|
|
34
36
|
import weakref
|
|
35
37
|
import zipfile
|
|
36
|
-
from importlib.metadata import PackageNotFoundError
|
|
37
|
-
from importlib.metadata import version as _importlib_version
|
|
38
38
|
|
|
39
39
|
import numpy as np
|
|
40
40
|
|
|
@@ -45,11 +45,8 @@ from large_image.constants import TILE_FORMAT_NUMPY, SourcePriority
|
|
|
45
45
|
from large_image.exceptions import TileSourceError, TileSourceFileNotFoundError
|
|
46
46
|
from large_image.tilesource import FileTileSource, nearPowerOfTwo
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
__version__ =
|
|
50
|
-
except PackageNotFoundError:
|
|
51
|
-
# package is not installed
|
|
52
|
-
pass
|
|
48
|
+
with contextlib.suppress(importlib.metadata.PackageNotFoundError):
|
|
49
|
+
__version__ = importlib.metadata.version(__name__)
|
|
53
50
|
|
|
54
51
|
bioformats = None
|
|
55
52
|
# import javabridge
|
|
@@ -78,14 +75,10 @@ def _monitor_thread():
|
|
|
78
75
|
while len(_openImages):
|
|
79
76
|
source = _openImages.pop()
|
|
80
77
|
source = source()
|
|
81
|
-
|
|
78
|
+
with contextlib.suppress(Exception):
|
|
82
79
|
source._bioimage.close()
|
|
83
|
-
|
|
84
|
-
pass
|
|
85
|
-
try:
|
|
80
|
+
with contextlib.suppress(Exception):
|
|
86
81
|
source._bioimage = None
|
|
87
|
-
except Exception:
|
|
88
|
-
pass
|
|
89
82
|
except Exception:
|
|
90
83
|
pass
|
|
91
84
|
finally:
|
|
@@ -247,11 +240,9 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
247
240
|
# release some file handles.
|
|
248
241
|
self._bioimage.init_reader()
|
|
249
242
|
except Exception as exc:
|
|
250
|
-
|
|
243
|
+
with contextlib.suppress(Exception):
|
|
251
244
|
# Ask to open a file that should never exist
|
|
252
245
|
self._bioimage.rdr.setId('__\0__')
|
|
253
|
-
except Exception:
|
|
254
|
-
pass
|
|
255
246
|
self._bioimage.close()
|
|
256
247
|
self._bioimage = None
|
|
257
248
|
raise exc
|
|
@@ -336,9 +327,10 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
336
327
|
try:
|
|
337
328
|
self._lastGetTileException = 'raise'
|
|
338
329
|
self.getTile(0, 0, self.levels - 1)
|
|
339
|
-
|
|
330
|
+
del self._lastGetTileException
|
|
340
331
|
except Exception as exc:
|
|
341
332
|
raise TileSourceError('Bioformats cannot read a tile: %r' % exc)
|
|
333
|
+
self._checkForOffset()
|
|
342
334
|
self._populatedLevels = len([
|
|
343
335
|
v for v in self._metadata['frameSeries'][0]['series'] if v is not None])
|
|
344
336
|
|
|
@@ -357,6 +349,40 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
357
349
|
if javabridge.get_env():
|
|
358
350
|
javabridge.detach()
|
|
359
351
|
|
|
352
|
+
def _checkForOffset(self):
|
|
353
|
+
"""
|
|
354
|
+
The bioformats DICOM reader does unfortunate things to MONOCHROME1
|
|
355
|
+
16-bit images. Store an offset to undo it, if appropriate.
|
|
356
|
+
"""
|
|
357
|
+
if self._metadata.get('readerClassName') != 'loci.formats.in.DicomReader':
|
|
358
|
+
return
|
|
359
|
+
if self._metadata.get('seriesMetadata', {}).get(
|
|
360
|
+
'0028,0004 Photometric Interpretation') != 'MONOCHROME1':
|
|
361
|
+
return
|
|
362
|
+
if np.issubdtype(self.dtype, np.uint8):
|
|
363
|
+
self._fix_offset = 255
|
|
364
|
+
return
|
|
365
|
+
if not np.issubdtype(self.dtype, np.int16) and not np.issubdtype(self.dtype, '>i2'):
|
|
366
|
+
return
|
|
367
|
+
# This is bioformats behavior
|
|
368
|
+
try:
|
|
369
|
+
maxPixelRange = int(self._metadata['seriesMetadata'].get(
|
|
370
|
+
'0028,1051 Window Width', 0))
|
|
371
|
+
except Exception:
|
|
372
|
+
maxPixelRange = -1
|
|
373
|
+
try:
|
|
374
|
+
centerPixelValue = int(self._metadata['seriesMetadata'].get(
|
|
375
|
+
'0028,1050 Window Center', 0))
|
|
376
|
+
except Exception:
|
|
377
|
+
centerPixelValue = -1
|
|
378
|
+
maxPixelValue = maxPixelRange + (centerPixelValue // 2)
|
|
379
|
+
maxAllowRange = 2 ** int(self._metadata['seriesMetadata'].get(
|
|
380
|
+
'0028,0101 Bits Stored', 16)) - 1
|
|
381
|
+
if maxPixelRange == -1 or centerPixelValue < maxPixelRange // 2:
|
|
382
|
+
maxPixelValue = maxAllowRange
|
|
383
|
+
if maxPixelValue:
|
|
384
|
+
self._fix_offset = maxPixelValue
|
|
385
|
+
|
|
360
386
|
def _metadataForCurrentSeries(self, rdr):
|
|
361
387
|
self._metadata = getattr(self, '_metadata', {})
|
|
362
388
|
self._metadata.update({
|
|
@@ -553,11 +579,9 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
553
579
|
if metadata.get(key):
|
|
554
580
|
found = re.match(r'^[^0-9.]*(\d*\.?\d+)[^0-9.]+(\d*\.?\d+)\D*$', metadata[key])
|
|
555
581
|
if found:
|
|
556
|
-
|
|
582
|
+
with contextlib.suppress(Exception):
|
|
557
583
|
self._magnification['mm_x'], self._magnification['mm_y'] = (
|
|
558
584
|
float(found.groups()[0]) * units, float(found.groups()[1]) * units)
|
|
559
|
-
except Exception:
|
|
560
|
-
pass
|
|
561
585
|
for key in magkeys:
|
|
562
586
|
if metadata.get(key):
|
|
563
587
|
self._magnification['magnification'] = float(metadata[key])
|
|
@@ -723,6 +747,8 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
|
723
747
|
retile[0:min(tile.shape[0], finalHeight), 0:min(tile.shape[1], finalWidth)] = tile[
|
|
724
748
|
0:min(tile.shape[0], finalHeight), 0:min(tile.shape[1], finalWidth)]
|
|
725
749
|
tile = retile
|
|
750
|
+
if hasattr(self, '_fix_offset') and format == TILE_FORMAT_NUMPY:
|
|
751
|
+
tile = self._fix_offset - tile
|
|
726
752
|
return self._outputTile(tile, format, x, y, z, pilImageAllowed, numpyAllowed, **kwargs)
|
|
727
753
|
|
|
728
754
|
def getAssociatedImagesList(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: large-image-source-bioformats
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.33.6.dev41
|
|
4
4
|
Summary: An bioformats tilesource for large_image.
|
|
5
5
|
Home-page: https://github.com/girder/large_image
|
|
6
6
|
Author: Kitware, Inc.
|
|
@@ -9,18 +9,18 @@ License: Apache-2.0
|
|
|
9
9
|
Keywords: large_image,tile source
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/x-rst
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: large-image>=1.
|
|
20
|
+
Requires-Dist: large-image>=1.33.6.dev41
|
|
21
21
|
Requires-Dist: python-bioformats>=1.5.2
|
|
22
22
|
Provides-Extra: girder
|
|
23
|
-
Requires-Dist: girder-large-image>=1.
|
|
23
|
+
Requires-Dist: girder-large-image>=1.33.6.dev41; extra == "girder"
|
|
24
24
|
Dynamic: author
|
|
25
25
|
Dynamic: author-email
|
|
26
26
|
Dynamic: classifier
|
{large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/setup.py
RENAMED
|
@@ -25,13 +25,13 @@ setup(
|
|
|
25
25
|
classifiers=[
|
|
26
26
|
'Development Status :: 5 - Production/Stable',
|
|
27
27
|
'Programming Language :: Python :: 3',
|
|
28
|
-
'Programming Language :: Python :: 3.9',
|
|
29
28
|
'Programming Language :: Python :: 3.10',
|
|
30
29
|
'Programming Language :: Python :: 3.11',
|
|
31
30
|
'Programming Language :: Python :: 3.12',
|
|
32
31
|
'Programming Language :: Python :: 3.13',
|
|
32
|
+
'Programming Language :: Python :: 3.14',
|
|
33
33
|
],
|
|
34
|
-
python_requires='>=3.
|
|
34
|
+
python_requires='>=3.10',
|
|
35
35
|
install_requires=[
|
|
36
36
|
f'large-image{limit_version}',
|
|
37
37
|
'python-bioformats>=1.5.2',
|
{large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{large_image_source_bioformats-1.32.12.dev30 → large_image_source_bioformats-1.33.6.dev41}/setup.cfg
RENAMED
|
File without changes
|