large-image-source-ometiff 1.27.5.dev4__py3-none-any.whl → 1.30.7.dev10__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- large_image_source_ometiff/__init__.py +70 -3
- {large_image_source_ometiff-1.27.5.dev4.dist-info → large_image_source_ometiff-1.30.7.dev10.dist-info}/METADATA +19 -5
- large_image_source_ometiff-1.30.7.dev10.dist-info/RECORD +8 -0
- {large_image_source_ometiff-1.27.5.dev4.dist-info → large_image_source_ometiff-1.30.7.dev10.dist-info}/WHEEL +1 -1
- large_image_source_ometiff-1.27.5.dev4.dist-info/RECORD +0 -8
- {large_image_source_ometiff-1.27.5.dev4.dist-info → large_image_source_ometiff-1.30.7.dev10.dist-info}/LICENSE +0 -0
- {large_image_source_ometiff-1.27.5.dev4.dist-info → large_image_source_ometiff-1.30.7.dev10.dist-info}/entry_points.txt +0 -0
- {large_image_source_ometiff-1.27.5.dev4.dist-info → large_image_source_ometiff-1.30.7.dev10.dist-info}/top_level.txt +0 -0
@@ -105,6 +105,7 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
105
105
|
msg = 'Not a recognized OME Tiff'
|
106
106
|
raise TileSourceError(msg)
|
107
107
|
info = getattr(base, '_description_record', None)
|
108
|
+
self._associatedImages = {}
|
108
109
|
if not info or not info.get('OME'):
|
109
110
|
msg = 'Not an OME Tiff'
|
110
111
|
raise TileSourceError(msg)
|
@@ -115,6 +116,7 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
115
116
|
except KeyError:
|
116
117
|
msg = 'Not a recognized OME Tiff'
|
117
118
|
raise TileSourceError(msg)
|
119
|
+
usesSubIfds = self._checkForSubIfds(base)
|
118
120
|
omeimages = [
|
119
121
|
entry['Pixels'] for entry in self._omeinfo['Image'] if
|
120
122
|
len(entry['Pixels']['TiffData']) == len(self._omebase['TiffData'])]
|
@@ -125,10 +127,16 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
125
127
|
omebylevel = dict(zip(levels, omeimages))
|
126
128
|
self._omeLevels = [omebylevel.get(key) for key in range(max(omebylevel.keys()) + 1)]
|
127
129
|
if base._tiffInfo.get('istiled'):
|
130
|
+
if usesSubIfds:
|
131
|
+
self._omeLevels = [None] * max(usesSubIfds) + [self._omeLevels[-1]]
|
128
132
|
self._tiffDirectories = [
|
129
133
|
self.getTiffDir(int(entry['TiffData'][0].get('IFD', 0)))
|
130
134
|
if entry else None
|
131
135
|
for entry in self._omeLevels]
|
136
|
+
if usesSubIfds:
|
137
|
+
for lvl in usesSubIfds:
|
138
|
+
if self._tiffDirectories[lvl] is None:
|
139
|
+
self._tiffDirectories[lvl] = False
|
132
140
|
else:
|
133
141
|
self._tiffDirectories = [
|
134
142
|
self.getTiffDir(0, mustBeTiled=None)
|
@@ -149,7 +157,6 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
149
157
|
# We can get the embedded images, but we don't currently use non-tiled
|
150
158
|
# images as associated images. This would require enumerating tiff
|
151
159
|
# directories not mentioned by the ome list.
|
152
|
-
self._associatedImages = {}
|
153
160
|
self._checkForInefficientDirectories()
|
154
161
|
|
155
162
|
def _checkForOMEZLoop(self):
|
@@ -199,6 +206,40 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
199
206
|
info['Image']['Pixels']['PlanesFromZloop'] = 'true'
|
200
207
|
info['Image']['Pixels']['SizeZ'] = str(zloop)
|
201
208
|
|
209
|
+
def _checkForSubIfds(self, base):
|
210
|
+
"""
|
211
|
+
Check if the first ifd has sub-ifds. If so, expect lower resolutions
|
212
|
+
to be in subifds, not in primary ifds.
|
213
|
+
|
214
|
+
:param base: base tiff directory
|
215
|
+
:returns: either False if no subifds are lower resolution, or a
|
216
|
+
dictionary of levels (keys) and values that are subifd numbers.
|
217
|
+
"""
|
218
|
+
try:
|
219
|
+
levels = int(max(0, math.ceil(max(
|
220
|
+
math.log(float(base.imageWidth) / base.tileWidth),
|
221
|
+
math.log(float(base.imageHeight) / base.tileHeight)) / math.log(2))) + 1)
|
222
|
+
filled = {}
|
223
|
+
for z in range(levels - 2, -1, -1):
|
224
|
+
subdir = levels - 1 - z
|
225
|
+
scale = int(2 ** subdir)
|
226
|
+
try:
|
227
|
+
dir = self.getTiffDir(0, mustBeTiled=True, subDirectoryNum=subdir)
|
228
|
+
except Exception:
|
229
|
+
continue
|
230
|
+
if (dir is not None and
|
231
|
+
(dir.tileWidth in {base.tileWidth, dir.imageWidth}) and
|
232
|
+
(dir.tileHeight in {base.tileHeight, dir.imageHeight}) and
|
233
|
+
abs(dir.imageWidth * scale - base.imageWidth) <= scale and
|
234
|
+
abs(dir.imageHeight * scale - base.imageHeight) <= scale):
|
235
|
+
filled[z] = subdir
|
236
|
+
if not len(filled):
|
237
|
+
return False
|
238
|
+
filled[levels - 1] = 0
|
239
|
+
return filled
|
240
|
+
except TiffError:
|
241
|
+
return False
|
242
|
+
|
202
243
|
def _parseOMEInfo(self): # noqa
|
203
244
|
if isinstance(self._omeinfo['Image'], dict):
|
204
245
|
self._omeinfo['Image'] = [self._omeinfo['Image']]
|
@@ -241,6 +282,32 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
241
282
|
for entry in self._omebase['TiffData']}) > 1:
|
242
283
|
msg = 'OME Tiff references multiple files'
|
243
284
|
raise TileSourceError(msg)
|
285
|
+
if (len(self._omebase['TiffData']) ==
|
286
|
+
int(self._omebase['SizeT']) * int(self._omebase['SizeZ'])):
|
287
|
+
self._omebase['SizeC'] = 1
|
288
|
+
for img in self._omeinfo['Image'][1:]:
|
289
|
+
try:
|
290
|
+
if img['Name'] and img['Pixels']['TiffData'][0]['IFD']:
|
291
|
+
self._addAssociatedImage(
|
292
|
+
int(img['Pixels']['TiffData'][0]['IFD']),
|
293
|
+
None, None, img['Name'].split()[0])
|
294
|
+
except Exception:
|
295
|
+
pass
|
296
|
+
elif len(self._omeinfo['Image']) > 1:
|
297
|
+
multiple = False
|
298
|
+
for img in self._omeinfo['Image'][1:]:
|
299
|
+
try:
|
300
|
+
bpix = self._omeinfo['Image'][0]['Pixels']
|
301
|
+
imgpix = img['Pixels']
|
302
|
+
if imgpix['SizeX'] == bpix['SizeX'] and imgpix['SizeY'] == bpix['SizeY']:
|
303
|
+
multiple = True
|
304
|
+
break
|
305
|
+
except Exception:
|
306
|
+
multiple = True
|
307
|
+
if multiple:
|
308
|
+
# We should handle this as SizeXY
|
309
|
+
msg = 'OME Tiff references multiple images'
|
310
|
+
raise TileSourceError(msg)
|
244
311
|
if (len(self._omebase['TiffData']) != int(self._omebase['SizeC']) *
|
245
312
|
int(self._omebase['SizeT']) * int(self._omebase['SizeZ']) or
|
246
313
|
len(self._omebase['TiffData']) != len(
|
@@ -343,8 +410,8 @@ class OMETiffFileTileSource(TiffFileTileSource, metaclass=LruCacheMetaclass):
|
|
343
410
|
if subdir:
|
344
411
|
scale = int(2 ** subdir)
|
345
412
|
if (dir is None or
|
346
|
-
(dir.tileWidth
|
347
|
-
(dir.tileHeight
|
413
|
+
(dir.tileWidth not in {self.tileWidth, dir.imageWidth}) or
|
414
|
+
(dir.tileHeight not in {self.tileHeight, dir.imageHeight}) or
|
348
415
|
abs(dir.imageWidth * scale - self.sizeX) > scale or
|
349
416
|
abs(dir.imageHeight * scale - self.sizeY) > scale):
|
350
417
|
return super().getTile(
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: large-image-source-ometiff
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.30.7.dev10
|
4
4
|
Summary: An OMETiff tilesource for large_image.
|
5
5
|
Home-page: https://github.com/girder/large_image
|
6
6
|
Author: Kitware, Inc.
|
@@ -15,12 +15,26 @@ Classifier: Programming Language :: Python :: 3.9
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
18
19
|
Requires-Python: >=3.8
|
20
|
+
Description-Content-Type: text/x-rst
|
19
21
|
License-File: LICENSE
|
20
|
-
Requires-Dist: large-image
|
21
|
-
Requires-Dist: large-image-source-tiff
|
22
|
+
Requires-Dist: large-image>=1.30.7.dev10
|
23
|
+
Requires-Dist: large-image-source-tiff>=1.30.7.dev10
|
22
24
|
Provides-Extra: girder
|
23
|
-
Requires-Dist: girder-large-image
|
25
|
+
Requires-Dist: girder-large-image>=1.30.7.dev10; extra == "girder"
|
26
|
+
Dynamic: author
|
27
|
+
Dynamic: author-email
|
28
|
+
Dynamic: classifier
|
29
|
+
Dynamic: description
|
30
|
+
Dynamic: description-content-type
|
31
|
+
Dynamic: home-page
|
32
|
+
Dynamic: keywords
|
33
|
+
Dynamic: license
|
34
|
+
Dynamic: provides-extra
|
35
|
+
Dynamic: requires-dist
|
36
|
+
Dynamic: requires-python
|
37
|
+
Dynamic: summary
|
24
38
|
|
25
39
|
An OMETiff tilesource for large_image.
|
26
40
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
large_image_source_ometiff/__init__.py,sha256=_Ok3Ohef7-DnHE8PqOxQY4SgoSzQcXw2Durca2crtrc,20490
|
2
|
+
large_image_source_ometiff/girder_source.py,sha256=QotYLsC_JY3pOixVOXZ_wwtHJABSuWw_f_8Q5pDnNWo,1047
|
3
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
4
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/METADATA,sha256=elQGBQtYoJxld69qp_iPrhexe6Y9mzzT4pCQ0FgGGzw,1381
|
5
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/entry_points.txt,sha256=-xiaxFJTzRayHYwLkPsBXF0grk8j5nQy5cizSazP404,184
|
7
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/top_level.txt,sha256=Me0pziNZRmyYLdGAKu9zgDHHINn_7ayKLLYxTGXv5lo,27
|
8
|
+
large_image_source_ometiff-1.30.7.dev10.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
large_image_source_ometiff/__init__.py,sha256=ufxVdvDPSk1QwoIBSAyfwB6EHI78FnDnQPqO9Lx1PYU,17350
|
2
|
-
large_image_source_ometiff/girder_source.py,sha256=QotYLsC_JY3pOixVOXZ_wwtHJABSuWw_f_8Q5pDnNWo,1047
|
3
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
4
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/METADATA,sha256=yw8osQsBrWbmZWPwPFHW9CgJYXF9eQfz2_a5oPaRloc,1037
|
5
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/entry_points.txt,sha256=-xiaxFJTzRayHYwLkPsBXF0grk8j5nQy5cizSazP404,184
|
7
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/top_level.txt,sha256=Me0pziNZRmyYLdGAKu9zgDHHINn_7ayKLLYxTGXv5lo,27
|
8
|
-
large_image_source_ometiff-1.27.5.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|