large-image-source-tifffile 1.30.7.dev10__py3-none-any.whl → 1.30.7.dev12__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.
- large_image_source_tifffile/__init__.py +39 -0
- {large_image_source_tifffile-1.30.7.dev10.dist-info → large_image_source_tifffile-1.30.7.dev12.dist-info}/METADATA +3 -3
- large_image_source_tifffile-1.30.7.dev12.dist-info/RECORD +8 -0
- large_image_source_tifffile-1.30.7.dev10.dist-info/RECORD +0 -8
- {large_image_source_tifffile-1.30.7.dev10.dist-info → large_image_source_tifffile-1.30.7.dev12.dist-info}/LICENSE +0 -0
- {large_image_source_tifffile-1.30.7.dev10.dist-info → large_image_source_tifffile-1.30.7.dev12.dist-info}/WHEEL +0 -0
- {large_image_source_tifffile-1.30.7.dev10.dist-info → large_image_source_tifffile-1.30.7.dev12.dist-info}/entry_points.txt +0 -0
- {large_image_source_tifffile-1.30.7.dev10.dist-info → large_image_source_tifffile-1.30.7.dev12.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,7 @@ import os
|
|
5
5
|
import threading
|
6
6
|
from importlib.metadata import PackageNotFoundError
|
7
7
|
from importlib.metadata import version as _importlib_version
|
8
|
+
from pathlib import Path
|
8
9
|
|
9
10
|
import numpy as np
|
10
11
|
|
@@ -83,6 +84,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
83
84
|
'scn': SourcePriority.PREFERRED,
|
84
85
|
'tif': SourcePriority.LOW,
|
85
86
|
'tiff': SourcePriority.LOW,
|
87
|
+
'ome': SourcePriority.HIGHER,
|
86
88
|
}
|
87
89
|
mimeTypes = {
|
88
90
|
None: SourcePriority.FALLBACK,
|
@@ -120,6 +122,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
120
122
|
raise TileSourceFileNotFoundError(self._largeImagePath) from None
|
121
123
|
msg = 'File cannot be opened via tifffile.'
|
122
124
|
raise TileSourceError(msg)
|
125
|
+
self._checkForOmeBinaryonly()
|
123
126
|
maxseries, maxsamples = self._biggestSeries()
|
124
127
|
self.tileWidth = self.tileHeight = self._tileSize
|
125
128
|
s = self._tf.series[maxseries]
|
@@ -127,6 +130,9 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
127
130
|
if len(s.levels) == 1:
|
128
131
|
self.tileWidth = self.tileHeight = self._singleTileSize
|
129
132
|
page = s.pages[0]
|
133
|
+
if not hasattr(page, 'tags'):
|
134
|
+
msg = 'File will not be opened via tifffile.'
|
135
|
+
raise TileSourceError(msg)
|
130
136
|
if ('TileWidth' in page.tags and
|
131
137
|
self._minTileSize <= page.tags['TileWidth'].value <= self._maxTileSize):
|
132
138
|
self.tileWidth = page.tags['TileWidth'].value
|
@@ -137,6 +143,10 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
137
143
|
self._iccprofiles = [page.tags['InterColorProfile'].value]
|
138
144
|
self.sizeX = s.shape[s.axes.index('X')]
|
139
145
|
self.sizeY = s.shape[s.axes.index('Y')]
|
146
|
+
while (self.tileWidth // 2 >= self.sizeX and self.tileHeight // 2 >= self.sizeY and
|
147
|
+
min(self.tileWidth, self.tileHeight) // 2 >= self._minTileSize):
|
148
|
+
self.tileWidth //= 2
|
149
|
+
self.tileHeight //= 2
|
140
150
|
self._mm_x = self._mm_y = None
|
141
151
|
try:
|
142
152
|
unit = {2: 25.4, 3: 10}[page.tags['ResolutionUnit'].value.real]
|
@@ -170,6 +180,35 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
170
180
|
msg = 'File cannot be opened via tifffile: axes and shape do not match access pattern.'
|
171
181
|
raise TileSourceError(msg)
|
172
182
|
|
183
|
+
def _checkForOmeBinaryonly(self):
|
184
|
+
from xml.etree import ElementTree as etree
|
185
|
+
|
186
|
+
omexml = getattr(self._tf, 'ome_metadata', None)
|
187
|
+
if not omexml:
|
188
|
+
return
|
189
|
+
try:
|
190
|
+
root = etree.fromstring(omexml)
|
191
|
+
except Exception:
|
192
|
+
return
|
193
|
+
metadatafile = None
|
194
|
+
for element in root:
|
195
|
+
if element.tag.endswith('BinaryOnly'):
|
196
|
+
metadatafile = element.attrib.get('MetadataFile', '')
|
197
|
+
if not metadatafile:
|
198
|
+
return
|
199
|
+
path = Path(self._largeImagePath).parent / metadatafile
|
200
|
+
if not path.is_file():
|
201
|
+
return
|
202
|
+
try:
|
203
|
+
newxml = path.open('r').read()
|
204
|
+
except Exception:
|
205
|
+
return
|
206
|
+
try:
|
207
|
+
root = etree.fromstring(newxml)
|
208
|
+
except Exception:
|
209
|
+
return
|
210
|
+
self._tf._omexml = newxml
|
211
|
+
|
173
212
|
def _biggestSeries(self):
|
174
213
|
"""
|
175
214
|
Find the series with the most pixels. Use all series that have the
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: large-image-source-tifffile
|
3
|
-
Version: 1.30.7.
|
3
|
+
Version: 1.30.7.dev12
|
4
4
|
Summary: A tifffile tilesource for large_image.
|
5
5
|
Home-page: https://github.com/girder/large_image
|
6
6
|
Author: Kitware, Inc.
|
@@ -19,12 +19,12 @@ Classifier: Programming Language :: Python :: 3.13
|
|
19
19
|
Requires-Python: >=3.8
|
20
20
|
Description-Content-Type: text/x-rst
|
21
21
|
License-File: LICENSE
|
22
|
-
Requires-Dist: large-image>=1.30.7.
|
22
|
+
Requires-Dist: large-image>=1.30.7.dev12
|
23
23
|
Requires-Dist: dask[array]
|
24
24
|
Requires-Dist: tifffile[all]
|
25
25
|
Requires-Dist: zarr
|
26
26
|
Provides-Extra: girder
|
27
|
-
Requires-Dist: girder-large-image>=1.30.7.
|
27
|
+
Requires-Dist: girder-large-image>=1.30.7.dev12; extra == "girder"
|
28
28
|
Dynamic: author
|
29
29
|
Dynamic: author-email
|
30
30
|
Dynamic: classifier
|
@@ -0,0 +1,8 @@
|
|
1
|
+
large_image_source_tifffile/__init__.py,sha256=WsyPJKR2Iij1V7maAfv4-m1xEhEUHLlRsO3qOK9IIWc,30244
|
2
|
+
large_image_source_tifffile/girder_source.py,sha256=8YsxpSK_UzbAcpjn6fIMlgKye2FchkB8_HTSQV0FpRA,1064
|
3
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
4
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/METADATA,sha256=DwwJpYFWMtn8Tp7_mYPoplHzoqmMpoZ43B9xK7nZuZc,1405
|
5
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
|
7
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
|
8
|
+
large_image_source_tifffile-1.30.7.dev12.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
large_image_source_tifffile/__init__.py,sha256=vU1bFrCyklocQjzwiwiAITwLm0sfk-TnyDlIAwxqFeA,28899
|
2
|
-
large_image_source_tifffile/girder_source.py,sha256=8YsxpSK_UzbAcpjn6fIMlgKye2FchkB8_HTSQV0FpRA,1064
|
3
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
4
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/METADATA,sha256=ESkktkSCBeCvqOXMH5oFMgUnce9s94mAc3CkHO2o-V4,1405
|
5
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
|
7
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
|
8
|
-
large_image_source_tifffile-1.30.7.dev10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|