large-image-source-test 1.35.1.dev11__tar.gz → 1.35.1.dev13__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_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/PKG-INFO +2 -2
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test/__init__.py +64 -43
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test.egg-info/PKG-INFO +2 -2
- large_image_source_test-1.35.1.dev13/large_image_source_test.egg-info/requires.txt +1 -0
- large_image_source_test-1.35.1.dev11/large_image_source_test.egg-info/requires.txt +0 -1
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/LICENSE +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/README.rst +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test.egg-info/SOURCES.txt +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test.egg-info/dependency_links.txt +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test.egg-info/entry_points.txt +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/large_image_source_test.egg-info/top_level.txt +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/pyproject.toml +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/setup.cfg +0 -0
- {large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: large-image-source-test
|
|
3
|
-
Version: 1.35.1.
|
|
3
|
+
Version: 1.35.1.dev13
|
|
4
4
|
Summary: A fractal test tilesource for large_image.
|
|
5
5
|
Home-page: https://github.com/girder/large_image
|
|
6
6
|
Author: Kitware, Inc.
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/x-rst
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: large-image>=1.35.1.
|
|
20
|
+
Requires-Dist: large-image>=1.35.1.dev13
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -49,7 +49,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
49
49
|
def __init__(self, ignored_path=None, minLevel=0, maxLevel=9,
|
|
50
50
|
tileWidth=256, tileHeight=256, sizeX=None, sizeY=None,
|
|
51
51
|
fractal=False, frames=None, monochrome=False, bands=None,
|
|
52
|
-
**kwargs):
|
|
52
|
+
failBelowMinLevel=True, **kwargs):
|
|
53
53
|
"""
|
|
54
54
|
Initialize the tile class. See the base class for other available
|
|
55
55
|
parameters.
|
|
@@ -77,6 +77,11 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
77
77
|
the specified ranges. The internal dtype with be uint8, uint16, or
|
|
78
78
|
float depending on the union of the specified ranges. If no ranges
|
|
79
79
|
are specified at all, it is the same as 0-255.
|
|
80
|
+
:param failBelowMinLevel: if True and a tile is requested outside of
|
|
81
|
+
the minLevel and maxLevel, throw an error. If false, interpolate
|
|
82
|
+
lower level tiles. Throwing is useful when testing how viewers
|
|
83
|
+
handle missing levels; interpolating is useful for testing
|
|
84
|
+
interpolation functions.
|
|
80
85
|
"""
|
|
81
86
|
if not kwargs.get('encoding'):
|
|
82
87
|
kwargs = kwargs.copy()
|
|
@@ -100,8 +105,10 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
100
105
|
self.sizeX / self.tileWidth, self.sizeY / self.tileHeight)))))
|
|
101
106
|
self.minLevel = min(self.minLevel, self.maxLevel)
|
|
102
107
|
self.monochrome = bool(monochrome)
|
|
108
|
+
self._failBelowMinLevel = bool(failBelowMinLevel)
|
|
103
109
|
self._bands = None
|
|
104
110
|
self._dtype = np.uint8
|
|
111
|
+
self._bandCount = 1 if self.monochrome else 3
|
|
105
112
|
if bands:
|
|
106
113
|
bands = [re.match(
|
|
107
114
|
r'^(?P<key>[^=]+)(|=(?P<low>[+-]?((\d+(|\.\d*)))|(\.\d+))-(?P<high>[+-]?((\d+(|\.\d*))|(\.\d+))))$', # noqa
|
|
@@ -126,6 +133,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
126
133
|
self._dtype = np.dtype(float)
|
|
127
134
|
elif low >= 256 or high >= 256:
|
|
128
135
|
self._dtype = np.uint16
|
|
136
|
+
self._bandCount = len(self._bands) if not self.monochrome else 1
|
|
129
137
|
# Used for reporting tile information
|
|
130
138
|
self.levels = self.maxLevel + 1
|
|
131
139
|
if frames:
|
|
@@ -266,52 +274,65 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
266
274
|
)
|
|
267
275
|
return image
|
|
268
276
|
|
|
277
|
+
def _nonemptyLevelsList(self, frame=0):
|
|
278
|
+
"""
|
|
279
|
+
Return a list of one value per level where the value is None if the
|
|
280
|
+
level does not exist in the file and any other value if it does.
|
|
281
|
+
|
|
282
|
+
:param frame: the frame number.
|
|
283
|
+
:returns: a list of levels length.
|
|
284
|
+
"""
|
|
285
|
+
return [True if self.minLevel <= idx <= self.maxLevel else None
|
|
286
|
+
for idx in range(self.levels)]
|
|
287
|
+
|
|
269
288
|
@methodcache()
|
|
270
289
|
def getTile(self, x, y, z, *args, **kwargs):
|
|
271
290
|
frame = self._getFrame(**kwargs)
|
|
272
291
|
self._xyzInRange(x, y, z, frame, len(self._frames) if hasattr(self, '_frames') else None)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
msg = 'z layer does not exist'
|
|
276
|
-
raise TileSourceError(msg)
|
|
277
|
-
_counters['tiles'] += 1
|
|
278
|
-
|
|
279
|
-
xFraction = (x + 0.5) * self.tileWidth * 2 ** (self.levels - 1 - z) / self.sizeX
|
|
280
|
-
yFraction = (y + 0.5) * self.tileHeight * 2 ** (self.levels - 1 - z) / self.sizeY
|
|
281
|
-
fFraction = yFraction
|
|
282
|
-
if hasattr(self, '_frames'):
|
|
283
|
-
fFraction = float(frame) / (len(self._frames) - 1)
|
|
284
|
-
|
|
285
|
-
backgroundColor = colorsys.hsv_to_rgb(
|
|
286
|
-
h=xFraction,
|
|
287
|
-
s=(0.3 + (0.7 * fFraction)),
|
|
288
|
-
v=(0.3 + (0.7 * yFraction)),
|
|
289
|
-
)
|
|
290
|
-
rgbColor = tuple(int(val * 255) for val in backgroundColor)
|
|
291
|
-
|
|
292
|
-
if not self._bands or len(self._bands) == (1 if self.monochrome else 3):
|
|
293
|
-
image = self._tileImage(rgbColor, x, y, z, frame)
|
|
294
|
-
if self.monochrome:
|
|
295
|
-
image = image.convert('L')
|
|
296
|
-
format = TILE_FORMAT_PIL
|
|
292
|
+
if z < self.minLevel and not self._failBelowMinLevel:
|
|
293
|
+
image, format = self._getTileFromEmptyLevel(x, y, z, **kwargs)
|
|
297
294
|
else:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
295
|
+
if not (self.minLevel <= z <= self.maxLevel):
|
|
296
|
+
msg = 'z layer does not exist'
|
|
297
|
+
raise TileSourceError(msg)
|
|
298
|
+
_counters['tiles'] += 1
|
|
299
|
+
|
|
300
|
+
xFraction = (x + 0.5) * self.tileWidth * 2 ** (self.levels - 1 - z) / self.sizeX
|
|
301
|
+
yFraction = (y + 0.5) * self.tileHeight * 2 ** (self.levels - 1 - z) / self.sizeY
|
|
302
|
+
fFraction = yFraction
|
|
303
|
+
if hasattr(self, '_frames'):
|
|
304
|
+
fFraction = float(frame) / (len(self._frames) - 1)
|
|
305
|
+
|
|
306
|
+
backgroundColor = colorsys.hsv_to_rgb(
|
|
307
|
+
h=xFraction,
|
|
308
|
+
s=(0.3 + (0.7 * fFraction)),
|
|
309
|
+
v=(0.3 + (0.7 * yFraction)),
|
|
310
|
+
)
|
|
311
|
+
rgbColor = tuple(int(val * 255) for val in backgroundColor)
|
|
312
|
+
|
|
313
|
+
if not self._bands or len(self._bands) == (1 if self.monochrome else 3):
|
|
314
|
+
image = self._tileImage(rgbColor, x, y, z, frame)
|
|
315
|
+
if self.monochrome:
|
|
316
|
+
image = image.convert('L')
|
|
317
|
+
format = TILE_FORMAT_PIL
|
|
318
|
+
else:
|
|
319
|
+
image = np.zeros(
|
|
320
|
+
(self.tileHeight, self.tileWidth, len(self._bands)), dtype=self._dtype)
|
|
321
|
+
for bandnum, band in enumerate(self._bands):
|
|
322
|
+
bandimg = self._tileImage(rgbColor, x, y, z, frame, band, bandnum)
|
|
323
|
+
if self.monochrome or band.upper() in {'grey', 'gray', 'alpha'}:
|
|
324
|
+
bandimg = bandimg.convert('L')
|
|
325
|
+
bandimg = _imageToNumpy(bandimg)[0]
|
|
326
|
+
if (self._dtype != np.uint8 or
|
|
327
|
+
self._bands[band]['low'] != 0 or
|
|
328
|
+
self._bands[band]['high'] != 255):
|
|
329
|
+
bandimg = bandimg.astype(float)
|
|
330
|
+
bandimg = (bandimg / 255) * (
|
|
331
|
+
self._bands[band]['high'] - self._bands[band]['low']
|
|
332
|
+
) + self._bands[band]['low']
|
|
333
|
+
bandimg = bandimg.astype(self._dtype)
|
|
334
|
+
image[:, :, bandnum] = bandimg[:, :, bandnum % bandimg.shape[2]]
|
|
335
|
+
format = TILE_FORMAT_NUMPY
|
|
315
336
|
return self._outputTile(image, format, x, y, z, **kwargs)
|
|
316
337
|
|
|
317
338
|
@staticmethod
|
|
@@ -323,7 +344,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
|
323
344
|
kwargs.get('tileWidth'), kwargs.get('tileHeight'),
|
|
324
345
|
kwargs.get('fractal'), kwargs.get('sizeX'), kwargs.get('sizeY'),
|
|
325
346
|
kwargs.get('frames'), kwargs.get('monochrome'),
|
|
326
|
-
kwargs.get('bands'),
|
|
347
|
+
kwargs.get('bands'), kwargs.get('failBelowMinLevel'),
|
|
327
348
|
)
|
|
328
349
|
|
|
329
350
|
def getState(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: large-image-source-test
|
|
3
|
-
Version: 1.35.1.
|
|
3
|
+
Version: 1.35.1.dev13
|
|
4
4
|
Summary: A fractal test tilesource for large_image.
|
|
5
5
|
Home-page: https://github.com/girder/large_image
|
|
6
6
|
Author: Kitware, Inc.
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/x-rst
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: large-image>=1.35.1.
|
|
20
|
+
Requires-Dist: large-image>=1.35.1.dev13
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
large-image>=1.35.1.dev13
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
large-image>=1.35.1.dev11
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{large_image_source_test-1.35.1.dev11 → large_image_source_test-1.35.1.dev13}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|