large-image-source-tifffile 1.27.5.dev6__tar.gz → 1.30.7.dev10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/PKG-INFO +9 -2
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/README.rst +20 -40
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile/__init__.py +149 -29
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile.egg-info/PKG-INFO +9 -2
- large_image_source_tifffile-1.30.7.dev10/large_image_source_tifffile.egg-info/requires.txt +7 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/setup.py +3 -2
- large-image-source-tifffile-1.27.5.dev6/large_image_source_tifffile.egg-info/requires.txt +0 -7
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/LICENSE +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile/girder_source.py +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile.egg-info/SOURCES.txt +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile.egg-info/dependency_links.txt +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile.egg-info/entry_points.txt +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/large_image_source_tifffile.egg-info/top_level.txt +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/pyproject.toml +0 -0
- {large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/setup.cfg +0 -0
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: large-image-source-tifffile
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.30.7.dev10
|
4
4
|
Summary: A tifffile tilesource for large_image.
|
5
5
|
Home-page: https://github.com/girder/large_image
|
6
6
|
Author: Kitware, Inc.
|
@@ -15,9 +15,16 @@ 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
|
19
|
-
|
20
|
+
Description-Content-Type: text/x-rst
|
20
21
|
License-File: LICENSE
|
22
|
+
Requires-Dist: large-image>=1.30.7.dev10
|
23
|
+
Requires-Dist: dask[array]
|
24
|
+
Requires-Dist: tifffile[all]
|
25
|
+
Requires-Dist: zarr
|
26
|
+
Provides-Extra: girder
|
27
|
+
Requires-Dist: girder-large-image>=1.30.7.dev10; extra == "girder"
|
21
28
|
|
22
29
|
A tifffile tilesource for large_image.
|
23
30
|
|
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/README.rst
RENAMED
@@ -15,7 +15,7 @@ Large Image
|
|
15
15
|
:target: https://codecov.io/github/girder/large_image?branch=master
|
16
16
|
:alt: codecov.io
|
17
17
|
|
18
|
-
.. |doi-badge| image:: https://img.shields.io/badge/DOI-10.5281%2Fzenodo.4723355-blue
|
18
|
+
.. |doi-badge| image:: https://img.shields.io/badge/DOI-10.5281%2Fzenodo.4723355-blue.svg
|
19
19
|
:target: https://zenodo.org/badge/latestdoi/45569214
|
20
20
|
|
21
21
|
.. |pypi-badge| image:: https://img.shields.io/pypi/v/large-image.svg?logo=python&logoColor=white
|
@@ -39,7 +39,7 @@ Highlights
|
|
39
39
|
Installation
|
40
40
|
------------
|
41
41
|
|
42
|
-
In addition to installing the ``large-image`` package, you'll need at least one tile source (a ``large-image-source-xxx`` package). You can install everything from the main project with one of these commands:
|
42
|
+
In addition to installing the base ``large-image`` package, you'll need at least one tile source which corresponds to your target file format(s) (a ``large-image-source-xxx`` package). You can install everything from the main project with one of these commands:
|
43
43
|
|
44
44
|
Pip
|
45
45
|
~~~
|
@@ -52,7 +52,7 @@ Install all tile sources on linux::
|
|
52
52
|
|
53
53
|
pip install large-image[all] --find-links https://girder.github.io/large_image_wheels
|
54
54
|
|
55
|
-
|
55
|
+
When using large-image with an instance of `Girder`_, install all tile sources and all Girder plugins on linux::
|
56
56
|
|
57
57
|
pip install large-image[all] girder-large-image-annotation[tasks] --find-links https://girder.github.io/large_image_wheels
|
58
58
|
|
@@ -60,8 +60,9 @@ Install all tile sources and all Girder plugins on linux::
|
|
60
60
|
Conda
|
61
61
|
~~~~~
|
62
62
|
|
63
|
-
Conda makes dependency management a bit easier if not on Linux.
|
63
|
+
Conda makes dependency management a bit easier if not on Linux. The base module, converter module, and two of the source modules are available on conda-forge. You can install the following::
|
64
64
|
|
65
|
+
conda install -c conda-forge large-image
|
65
66
|
conda install -c conda-forge large-image-source-gdal
|
66
67
|
conda install -c conda-forge large-image-source-tiff
|
67
68
|
conda install -c conda-forge large-image-converter
|
@@ -118,7 +119,7 @@ Large Image consists of several Python modules designed to work together. These
|
|
118
119
|
|
119
120
|
- ``large-image-source-deepzoom``: A tile source for reading Deepzoom tiles.
|
120
121
|
|
121
|
-
- ``large-image-source-dicom``: A tile source for reading DICOM WSI
|
122
|
+
- ``large-image-source-dicom``: A tile source for reading DICOM Whole Slide Images (WSI).
|
122
123
|
|
123
124
|
- ``large-image-source-gdal``: A tile source for reading geotiff files via GDAL. This handles source data with more complex transforms than the mapnik tile source.
|
124
125
|
|
@@ -128,62 +129,41 @@ Large Image consists of several Python modules designed to work together. These
|
|
128
129
|
|
129
130
|
- ``large-image-source-nd2``: A tile source for reading nd2 (NIS Element) images.
|
130
131
|
|
131
|
-
- ``large-image-source-ometiff``: A tile source using the tiff library that can handle
|
132
|
+
- ``large-image-source-ometiff``: A tile source using the tiff library that can handle most multi-frame OMETiff files that are compliant with the specification.
|
132
133
|
|
133
134
|
- ``large-image-source-openjpeg``: A tile source using the Glymur library to read jp2 (JPEG 2000) files.
|
134
135
|
|
135
136
|
- ``large-image-source-openslide``: A tile source using the OpenSlide library. This works with svs, ndpi, Mirax, tiff, vms, and other file formats.
|
136
137
|
|
137
|
-
- ``large-image-source-pil``: A tile source for small images via the Python Imaging Library (Pillow).
|
138
|
+
- ``large-image-source-pil``: A tile source for small images via the Python Imaging Library (Pillow). By default, the maximum size is 4096, but the maximum size can be configured.
|
138
139
|
|
139
140
|
- ``large-image-source-tiff``: A tile source for reading pyramidal tiff files in common compression formats.
|
140
141
|
|
141
142
|
- ``large-image-source-tifffile``: A tile source using the tifffile library that can handle a wide variety of tiff-like files.
|
142
143
|
|
143
|
-
- ``large-image-source-vips``: A tile source for reading any files handled by libvips. This also can be used for writing tiled images from numpy arrays.
|
144
|
+
- ``large-image-source-vips``: A tile source for reading any files handled by libvips. This also can be used for writing tiled images from numpy arrays (up to 4 dimensions).
|
144
145
|
|
145
|
-
- ``large-image-source-zarr``: A tile source using the zarr library that can handle OME-Zarr (OME-NGFF) files as well as some other zarr files.
|
146
|
+
- ``large-image-source-zarr``: A tile source using the zarr library that can handle OME-Zarr (OME-NGFF) files as well as some other zarr files. This can also be used for writing N-dimensional tiled images from numpy arrays. Written images can be saved as any supported format.
|
146
147
|
|
147
148
|
- ``large-image-source-test``: A tile source that generates test tiles, including a simple fractal pattern. Useful for testing extreme zoom levels.
|
148
149
|
|
149
|
-
- ``large-image-source-dummy``: A tile source that does nothing.
|
150
|
+
- ``large-image-source-dummy``: A tile source that does nothing. This is an absolutely minimal implementation of a tile source used for testing. If you want to create a custom tile source, start with this implementation.
|
150
151
|
|
151
|
-
Most tile sources can be used with girder-large-image. You can specific an extras_require of ``girder`` to include ``girder-large-image`` with the source.
|
152
152
|
|
153
|
-
|
153
|
+
As a `Girder`_ plugin, ``large-image`` adds end points to access all of the image formats it can read both to get metadata and to act as a tile server.
|
154
|
+
In the Girder UI, ``large-image`` shows images on item pages, and can show thumbnails in item lists when browsing folders.
|
155
|
+
There is also cache management to balance memory use and speed of response in Girder when ``large-image`` is used as a tile server.
|
154
156
|
|
155
|
-
|
156
|
-
You can specify extras_require of ``tasks`` to install a Girder Worker task that can convert otherwise unreadable images to pyramidal tiff files.
|
157
|
+
Most tile sources can be used with Girder Large Image. You can specify an extras_require of ``girder`` to install the following packages:
|
157
158
|
|
158
|
-
- ``girder-large-image
|
159
|
+
- ``girder-large-image``: Large Image as a Girder 3.x plugin.
|
160
|
+
You can install ``large-image[tasks]`` to install a Girder Worker task that can convert otherwise unreadable images to pyramidal tiff files.
|
161
|
+
|
162
|
+
- ``girder-large-image-annotation``: Adds models to the Girder database for supporting annotating large images. These annotations can be rendered on images. Annotations can include polygons, points, image overlays, and other types. Each annotation can have a label and metadata.
|
159
163
|
|
160
164
|
- ``large-image-tasks``: A utility for running the converter via Girder Worker.
|
161
165
|
You can specify an extras_require of ``girder`` to include modules needed to work with the Girder remote worker or ``worker`` to include modules needed on the remote side of the Girder remote worker. If neither is specified, some conversion tasks can be run using Girder local jobs.
|
162
166
|
|
163
167
|
|
164
|
-
Developer Installation
|
165
|
-
----------------------
|
166
|
-
|
167
|
-
To install all packages from source, clone the repository::
|
168
|
-
|
169
|
-
git clone https://github.com/girder/large_image.git
|
170
|
-
cd large_image
|
171
|
-
|
172
|
-
Install all packages and dependencies::
|
173
|
-
|
174
|
-
pip install -e . -r requirements-dev.txt
|
175
|
-
|
176
|
-
If you aren't developing with Girder 3, you can skip installing those components. Use ``requirements-dev-core.txt`` instead of ``requirements-dev.txt``::
|
177
|
-
|
178
|
-
pip install -e . -r requirements-dev-core.txt
|
179
|
-
|
180
|
-
|
181
|
-
Tile source prerequisites
|
182
|
-
=========================
|
183
|
-
|
184
|
-
Many tile sources have complex prerequisites. These can be installed directly using your system's package manager or from some prebuilt Python wheels for Linux. The prebuilt wheels are not official packages, but they can be used by instructing pip to use them by preference::
|
185
|
-
|
186
|
-
pip install -e . -r requirements-dev.txt --find-links https://girder.github.io/large_image_wheels
|
187
|
-
|
188
168
|
|
189
|
-
.. _Girder: https://
|
169
|
+
.. _Girder: https://girder.readthedocs.io/en/latest/
|
@@ -7,7 +7,6 @@ from importlib.metadata import PackageNotFoundError
|
|
7
7
|
from importlib.metadata import version as _importlib_version
|
8
8
|
|
9
9
|
import numpy as np
|
10
|
-
import zarr
|
11
10
|
|
12
11
|
import large_image
|
13
12
|
from large_image.cache_util import LruCacheMetaclass, methodcache
|
@@ -16,6 +15,7 @@ from large_image.exceptions import TileSourceError, TileSourceFileNotFoundError
|
|
16
15
|
from large_image.tilesource import FileTileSource
|
17
16
|
|
18
17
|
tifffile = None
|
18
|
+
zarr = None
|
19
19
|
|
20
20
|
try:
|
21
21
|
__version__ = _importlib_version(__name__)
|
@@ -37,6 +37,7 @@ def _lazyImport():
|
|
37
37
|
module initialization because it is slow.
|
38
38
|
"""
|
39
39
|
global tifffile
|
40
|
+
global zarr
|
40
41
|
|
41
42
|
if tifffile is None:
|
42
43
|
try:
|
@@ -55,6 +56,8 @@ def _lazyImport():
|
|
55
56
|
logging.getLogger('tifffile.tifffile').addHandler(checkForMissingDataHandler())
|
56
57
|
logging.getLogger('tifffile').setLevel(logging.WARNING)
|
57
58
|
logging.getLogger('tifffile').addHandler(checkForMissingDataHandler())
|
59
|
+
if zarr is None:
|
60
|
+
import zarr
|
58
61
|
|
59
62
|
|
60
63
|
def et_findall(tag, text):
|
@@ -109,6 +112,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
109
112
|
self._largeImagePath = str(self._getLargeImagePath())
|
110
113
|
|
111
114
|
_lazyImport()
|
115
|
+
self.addKnownExtensions()
|
112
116
|
try:
|
113
117
|
self._tf = tifffile.TiffFile(self._largeImagePath)
|
114
118
|
except Exception:
|
@@ -179,7 +183,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
179
183
|
ex = 'no maximum series'
|
180
184
|
try:
|
181
185
|
for idx, s in enumerate(self._tf.series):
|
182
|
-
samples =
|
186
|
+
samples = math.prod(s.shape)
|
183
187
|
if samples > maxsamples and 'X' in s.axes and 'Y' in s.axes:
|
184
188
|
maxseries = idx
|
185
189
|
maxsamples = samples
|
@@ -228,7 +232,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
228
232
|
'sizeX': s.shape[s.axes.index('X')], 'sizeY': s.shape[s.axes.index('Y')]})
|
229
233
|
self.sizeX = max(self.sizeX, s.shape[s.axes.index('X')])
|
230
234
|
self.sizeY = max(self.sizeY, s.shape[s.axes.index('Y')])
|
231
|
-
self._framecount = len(self._series) *
|
235
|
+
self._framecount = len(self._series) * math.prod(tuple(
|
232
236
|
1 if base.axes[sidx] in 'YXS' else v for sidx, v in enumerate(base.shape)))
|
233
237
|
self._basis = {}
|
234
238
|
basis = 1
|
@@ -255,14 +259,17 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
255
259
|
for p in self._tf.pages:
|
256
260
|
if (p not in pagesInSeries and getattr(p, 'keyframe', None) is not None and
|
257
261
|
p.hash not in hashes and not len(set(p.axes) - set('YXS'))):
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
262
|
+
try:
|
263
|
+
id = 'image_%s' % p.index
|
264
|
+
entry = {'page': p.index}
|
265
|
+
entry['width'] = p.shape[p.axes.index('X')]
|
266
|
+
entry['height'] = p.shape[p.axes.index('Y')]
|
267
|
+
if (id not in self._associatedImages and
|
268
|
+
max(entry['width'], entry['height']) <= self._maxAssociatedImageSize and
|
269
|
+
max(entry['width'], entry['height']) >= self._minAssociatedImageSize):
|
270
|
+
self._associatedImages[id] = entry
|
271
|
+
except Exception:
|
272
|
+
pass
|
266
273
|
for sidx, s in enumerate(self._tf.series):
|
267
274
|
if sidx not in self._series and not len(set(s.axes) - set('YXS')):
|
268
275
|
id = 'series_%d' % sidx
|
@@ -285,6 +292,79 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
285
292
|
except Exception:
|
286
293
|
pass
|
287
294
|
|
295
|
+
def _handle_indica(self):
|
296
|
+
import xml.etree.ElementTree
|
297
|
+
|
298
|
+
import large_image.tilesource.utilities
|
299
|
+
|
300
|
+
try:
|
301
|
+
root = xml.etree.ElementTree.fromstring(self._tf.pages[0].description)
|
302
|
+
self._xml = large_image.tilesource.utilities.etreeToDict(root)
|
303
|
+
self._channels = [c['name'] for c in
|
304
|
+
self._xml['indica']['image']['channels']['channel']]
|
305
|
+
if len(self._basis) == 1 and 'I' in self._basis:
|
306
|
+
self._basis['C'] = self._basis.pop('I')
|
307
|
+
self._associatedImages.clear()
|
308
|
+
except Exception:
|
309
|
+
pass
|
310
|
+
|
311
|
+
def _handle_ome(self):
|
312
|
+
"""
|
313
|
+
For OME Tiff, if we didn't parse the mangification elsewhere, try to
|
314
|
+
parse it here.
|
315
|
+
"""
|
316
|
+
import xml.etree.ElementTree
|
317
|
+
|
318
|
+
import large_image.tilesource.utilities
|
319
|
+
|
320
|
+
_omeUnitsToMeters = {
|
321
|
+
'Ym': 1e24,
|
322
|
+
'Zm': 1e21,
|
323
|
+
'Em': 1e18,
|
324
|
+
'Pm': 1e15,
|
325
|
+
'Tm': 1e12,
|
326
|
+
'Gm': 1e9,
|
327
|
+
'Mm': 1e6,
|
328
|
+
'km': 1e3,
|
329
|
+
'hm': 1e2,
|
330
|
+
'dam': 1e1,
|
331
|
+
'm': 1,
|
332
|
+
'dm': 1e-1,
|
333
|
+
'cm': 1e-2,
|
334
|
+
'mm': 1e-3,
|
335
|
+
'\u00b5m': 1e-6,
|
336
|
+
'nm': 1e-9,
|
337
|
+
'pm': 1e-12,
|
338
|
+
'fm': 1e-15,
|
339
|
+
'am': 1e-18,
|
340
|
+
'zm': 1e-21,
|
341
|
+
'ym': 1e-24,
|
342
|
+
'\u00c5': 1e-10,
|
343
|
+
}
|
344
|
+
|
345
|
+
try:
|
346
|
+
root = xml.etree.ElementTree.fromstring(self._tf.pages[0].description)
|
347
|
+
self._xml = large_image.tilesource.utilities.etreeToDict(root)
|
348
|
+
except Exception:
|
349
|
+
return
|
350
|
+
try:
|
351
|
+
try:
|
352
|
+
base = self._xml['OME']['Image'][0]['Pixels']
|
353
|
+
except Exception:
|
354
|
+
base = self._xml['OME']['Image']['Pixels']
|
355
|
+
if self._mm_x is None and 'PhysicalSizeX' in base:
|
356
|
+
self._mm_x = (
|
357
|
+
float(base['PhysicalSizeX']) * 1e3 *
|
358
|
+
_omeUnitsToMeters[base.get('PhysicalSizeXUnit', '\u00b5m')])
|
359
|
+
if self._mm_y is None and 'PhysicalSizeY' in base:
|
360
|
+
self._mm_y = (
|
361
|
+
float(base['PhysicalSizeY']) * 1e3 *
|
362
|
+
_omeUnitsToMeters[base.get('PhysicalSizeYUnit', '\u00b5m')])
|
363
|
+
self._mm_x = self._mm_x or self._mm_y
|
364
|
+
self._mm_y = self._mm_y or self._mm_x
|
365
|
+
except Exception:
|
366
|
+
pass
|
367
|
+
|
288
368
|
def _handle_scn(self): # noqa
|
289
369
|
"""
|
290
370
|
For SCN files, parse the xml and possibly adjust how associated images
|
@@ -350,6 +430,20 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
350
430
|
except Exception:
|
351
431
|
pass
|
352
432
|
|
433
|
+
def _handle_internal_ndpi(self, intmeta):
|
434
|
+
try:
|
435
|
+
ndpi = intmeta.pop('65449')
|
436
|
+
intmeta['ndpi'] = {}
|
437
|
+
for line in ndpi.replace('\r', '\n').split('\n'):
|
438
|
+
if '=' in line:
|
439
|
+
key, value = line.split('=', 1)
|
440
|
+
key = key.strip()
|
441
|
+
value = value.strip()
|
442
|
+
if key and key not in intmeta['ndpi'] and value:
|
443
|
+
intmeta['ndpi'][key] = value
|
444
|
+
except Exception:
|
445
|
+
pass
|
446
|
+
|
353
447
|
def getNativeMagnification(self):
|
354
448
|
"""
|
355
449
|
Get the magnification at a particular level.
|
@@ -419,6 +513,10 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
419
513
|
json.dumps(result[key][subkey])
|
420
514
|
except Exception:
|
421
515
|
del result[key][subkey]
|
516
|
+
for key in dir(self._tf):
|
517
|
+
if (key.startswith('is_') and hasattr(self, '_handle_internal_' + key[3:]) and
|
518
|
+
getattr(self._tf, key)):
|
519
|
+
getattr(self, '_handle_internal_' + key[3:])(result)
|
422
520
|
if hasattr(self, '_xml') and 'xml' not in result:
|
423
521
|
result.pop('ImageDescription', None)
|
424
522
|
result['xml'] = self._xml
|
@@ -473,19 +571,12 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
473
571
|
sidx = frame // self._basis['P'][0]
|
474
572
|
else:
|
475
573
|
sidx = 0
|
476
|
-
series = self._tf.series[self._series[sidx]]
|
477
574
|
nonempty = [None] * self.levels
|
478
575
|
nonempty[self.levels - 1] = True
|
576
|
+
series = self._tf.series[self._series[sidx]]
|
577
|
+
za, hasgbs = self._getZarrArray(series, sidx)
|
479
578
|
xidx = series.axes.index('X')
|
480
579
|
yidx = series.axes.index('Y')
|
481
|
-
with self._zarrlock:
|
482
|
-
if sidx not in self._zarrcache:
|
483
|
-
if len(self._zarrcache) > 10:
|
484
|
-
self._zarrcache = {}
|
485
|
-
za = zarr.open(series.aszarr(), mode='r')
|
486
|
-
hasgbs = hasattr(za[0], 'get_basic_selection')
|
487
|
-
self._zarrcache[sidx] = (za, hasgbs)
|
488
|
-
za, hasgbs = self._zarrcache[sidx]
|
489
580
|
for ll in range(1, len(series.levels)):
|
490
581
|
scale = round(math.log(max(za[0].shape[xidx] / za[ll].shape[xidx],
|
491
582
|
za[0].shape[yidx] / za[ll].shape[yidx])) / math.log(2))
|
@@ -496,6 +587,30 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
496
587
|
self._nonempty_levels_list[frame] = nonempty
|
497
588
|
return nonempty
|
498
589
|
|
590
|
+
def getPreferredLevel(self, level):
|
591
|
+
"""
|
592
|
+
Given a desired level (0 is minimum resolution, self.levels - 1 is max
|
593
|
+
resolution), return the level that contains actual data that is no
|
594
|
+
lower resolution.
|
595
|
+
|
596
|
+
:param level: desired level
|
597
|
+
:returns level: a level with actual data that is no lower resolution.
|
598
|
+
"""
|
599
|
+
return max(0, min(level, self.levels - 1))
|
600
|
+
|
601
|
+
def _getZarrArray(self, series, sidx):
|
602
|
+
with self._zarrlock:
|
603
|
+
if sidx not in self._zarrcache:
|
604
|
+
if len(self._zarrcache) > 10:
|
605
|
+
self._zarrcache = {}
|
606
|
+
za = zarr.open(series.aszarr(), mode='r')
|
607
|
+
hasgbs = hasattr(za[0], 'get_basic_selection')
|
608
|
+
if not hasgbs and math.prod(series.shape) < 256 * 1024 ** 2:
|
609
|
+
za = series.asarray()
|
610
|
+
self._zarrcache[sidx] = (za, hasgbs)
|
611
|
+
za, hasgbs = self._zarrcache[sidx]
|
612
|
+
return za, hasgbs
|
613
|
+
|
499
614
|
@methodcache()
|
500
615
|
def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False, **kwargs):
|
501
616
|
frame = self._getFrame(**kwargs)
|
@@ -506,14 +621,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
506
621
|
else:
|
507
622
|
sidx = 0
|
508
623
|
series = self._tf.series[self._series[sidx]]
|
509
|
-
|
510
|
-
if sidx not in self._zarrcache:
|
511
|
-
if len(self._zarrcache) > 10:
|
512
|
-
self._zarrcache = {}
|
513
|
-
za = zarr.open(series.aszarr(), mode='r')
|
514
|
-
hasgbs = hasattr(za[0], 'get_basic_selection')
|
515
|
-
self._zarrcache[sidx] = (za, hasgbs)
|
516
|
-
za, hasgbs = self._zarrcache[sidx]
|
624
|
+
za, hasgbs = self._getZarrArray(series, sidx)
|
517
625
|
xidx = series.axes.index('X')
|
518
626
|
yidx = series.axes.index('Y')
|
519
627
|
if hasgbs:
|
@@ -533,7 +641,7 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
533
641
|
else:
|
534
642
|
bza = za
|
535
643
|
if step > 2 ** self._maxSkippedLevels:
|
536
|
-
tile = self._getTileFromEmptyLevel(x, y, z, **kwargs)
|
644
|
+
tile, _format = self._getTileFromEmptyLevel(x, y, z, **kwargs)
|
537
645
|
tile = large_image.tilesource.base._imageToNumpy(tile)[0]
|
538
646
|
else:
|
539
647
|
sel = []
|
@@ -549,6 +657,8 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
549
657
|
sel.append(slice(series.shape[aidx]))
|
550
658
|
baxis += 'S'
|
551
659
|
else:
|
660
|
+
if axis not in self._basis and axis == 'I':
|
661
|
+
axis = 'C'
|
552
662
|
sel.append((frame // self._basis[axis][0]) % self._basis[axis][2])
|
553
663
|
tile = bza[tuple(sel)]
|
554
664
|
# rotate
|
@@ -558,6 +668,16 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
558
668
|
return self._outputTile(tile, TILE_FORMAT_NUMPY, x, y, z,
|
559
669
|
pilImageAllowed, numpyAllowed, **kwargs)
|
560
670
|
|
671
|
+
@classmethod
|
672
|
+
def addKnownExtensions(cls):
|
673
|
+
if not hasattr(cls, '_addedExtensions'):
|
674
|
+
_lazyImport()
|
675
|
+
cls._addedExtensions = True
|
676
|
+
cls.extensions = cls.extensions.copy()
|
677
|
+
for ext in tifffile.TIFF.FILE_EXTENSIONS:
|
678
|
+
if ext not in cls.extensions:
|
679
|
+
cls.extensions[ext] = SourcePriority.IMPLICIT
|
680
|
+
|
561
681
|
|
562
682
|
def open(*args, **kwargs):
|
563
683
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: large-image-source-tifffile
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.30.7.dev10
|
4
4
|
Summary: A tifffile tilesource for large_image.
|
5
5
|
Home-page: https://github.com/girder/large_image
|
6
6
|
Author: Kitware, Inc.
|
@@ -15,9 +15,16 @@ 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
|
19
|
-
|
20
|
+
Description-Content-Type: text/x-rst
|
20
21
|
License-File: LICENSE
|
22
|
+
Requires-Dist: large-image>=1.30.7.dev10
|
23
|
+
Requires-Dist: dask[array]
|
24
|
+
Requires-Dist: tifffile[all]
|
25
|
+
Requires-Dist: zarr
|
26
|
+
Provides-Extra: girder
|
27
|
+
Requires-Dist: girder-large-image>=1.30.7.dev10; extra == "girder"
|
21
28
|
|
22
29
|
A tifffile tilesource for large_image.
|
23
30
|
|
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/setup.py
RENAMED
@@ -19,8 +19,7 @@ def prerelease_local_scheme(version):
|
|
19
19
|
|
20
20
|
if os.getenv('CIRCLE_BRANCH') in ('master', ):
|
21
21
|
return ''
|
22
|
-
|
23
|
-
return get_local_node_and_date(version)
|
22
|
+
return get_local_node_and_date(version)
|
24
23
|
|
25
24
|
|
26
25
|
try:
|
@@ -37,6 +36,7 @@ setup(
|
|
37
36
|
'fallback_version': '0.0.0'},
|
38
37
|
description=description,
|
39
38
|
long_description=long_description,
|
39
|
+
long_description_content_type='text/x-rst',
|
40
40
|
license='Apache Software License 2.0',
|
41
41
|
author='Kitware, Inc.',
|
42
42
|
author_email='kitware@kitware.com',
|
@@ -49,6 +49,7 @@ setup(
|
|
49
49
|
'Programming Language :: Python :: 3.10',
|
50
50
|
'Programming Language :: Python :: 3.11',
|
51
51
|
'Programming Language :: Python :: 3.12',
|
52
|
+
'Programming Language :: Python :: 3.13',
|
52
53
|
],
|
53
54
|
install_requires=[
|
54
55
|
f'large-image{limit_version}',
|
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/pyproject.toml
RENAMED
File without changes
|
{large-image-source-tifffile-1.27.5.dev6 → large_image_source_tifffile-1.30.7.dev10}/setup.cfg
RENAMED
File without changes
|