large-image-source-test 1.23.3.dev62__py3-none-any.whl → 1.23.3.dev67__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_test/__init__.py +16 -15
- {large_image_source_test-1.23.3.dev62.dist-info → large_image_source_test-1.23.3.dev67.dist-info}/METADATA +2 -2
- large_image_source_test-1.23.3.dev67.dist-info/RECORD +7 -0
- large_image_source_test-1.23.3.dev62.dist-info/RECORD +0 -7
- {large_image_source_test-1.23.3.dev62.dist-info → large_image_source_test-1.23.3.dev67.dist-info}/LICENSE +0 -0
- {large_image_source_test-1.23.3.dev62.dist-info → large_image_source_test-1.23.3.dev67.dist-info}/WHEEL +0 -0
- {large_image_source_test-1.23.3.dev62.dist-info → large_image_source_test-1.23.3.dev67.dist-info}/entry_points.txt +0 -0
- {large_image_source_test-1.23.3.dev62.dist-info → large_image_source_test-1.23.3.dev67.dist-info}/top_level.txt +0 -0
@@ -19,7 +19,7 @@ import itertools
|
|
19
19
|
import math
|
20
20
|
import re
|
21
21
|
|
22
|
-
import numpy
|
22
|
+
import numpy as np
|
23
23
|
from PIL import Image, ImageDraw, ImageFont
|
24
24
|
|
25
25
|
from large_image.cache_util import LruCacheMetaclass, methodcache, strhash
|
@@ -42,7 +42,7 @@ except PackageNotFoundError:
|
|
42
42
|
|
43
43
|
|
44
44
|
_counters = {
|
45
|
-
'tiles': 0
|
45
|
+
'tiles': 0,
|
46
46
|
}
|
47
47
|
|
48
48
|
|
@@ -50,7 +50,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
50
50
|
cacheName = 'tilesource'
|
51
51
|
name = 'test'
|
52
52
|
extensions = {
|
53
|
-
None: SourcePriority.MANUAL
|
53
|
+
None: SourcePriority.MANUAL,
|
54
54
|
}
|
55
55
|
|
56
56
|
def __init__(self, ignored_path=None, minLevel=0, maxLevel=9,
|
@@ -110,7 +110,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
110
110
|
self.minLevel = min(self.minLevel, self.maxLevel)
|
111
111
|
self.monochrome = bool(monochrome)
|
112
112
|
self._bands = None
|
113
|
-
self._dtype =
|
113
|
+
self._dtype = np.uint8
|
114
114
|
if bands:
|
115
115
|
bands = [re.match(
|
116
116
|
r'^(?P<key>[^=]+)(|=(?P<low>[+-]?((\d+(|\.\d*)))|(\.\d+))-(?P<high>[+-]?((\d+(|\.\d*))|(\.\d+))))$', # noqa
|
@@ -134,7 +134,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
134
134
|
if low < 0 or high < 2 or low >= 65536 or high >= 65536:
|
135
135
|
self._dtype = float
|
136
136
|
elif low >= 256 or high >= 256:
|
137
|
-
self._dtype =
|
137
|
+
self._dtype = np.uint16
|
138
138
|
# Used for reporting tile information
|
139
139
|
self.levels = self.maxLevel + 1
|
140
140
|
if frames:
|
@@ -226,7 +226,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
226
226
|
image = Image.new(
|
227
227
|
mode='RGB',
|
228
228
|
size=(self.tileWidth, self.tileHeight),
|
229
|
-
color=(rgbColor if not self.fractal else (255, 255, 255))
|
229
|
+
color=(rgbColor if not self.fractal else (255, 255, 255)),
|
230
230
|
)
|
231
231
|
if self.fractal:
|
232
232
|
self.fractalTile(image, x, y, 2 ** z, rgbColor)
|
@@ -236,17 +236,17 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
236
236
|
'r', 'red', 'g', 'green', 'b', 'blue', 'grey', 'gray', 'alpha'}:
|
237
237
|
bandtext += band
|
238
238
|
image = _imageToNumpy(image)[0].astype(float)
|
239
|
-
vstripe =
|
239
|
+
vstripe = np.array([
|
240
240
|
int(x / (self.tileWidth / bandnum / 2)) % 2
|
241
241
|
for x in range(self.tileWidth)])
|
242
|
-
hstripe =
|
242
|
+
hstripe = np.array([
|
243
243
|
int(y / (self.tileHeight / (bandnum % self.tileWidth) / 2)) % 2
|
244
244
|
if bandnum > self.tileWidth else 1 for y in range(self.tileHeight)])
|
245
245
|
simage = image.copy()
|
246
246
|
simage[hstripe == 0, :, :] /= 2
|
247
247
|
simage[:, vstripe == 0, :] /= 2
|
248
|
-
image =
|
249
|
-
image = image.astype(
|
248
|
+
image = np.where(image != 255, simage, image)
|
249
|
+
image = image.astype(np.uint8)
|
250
250
|
image = _imageToPIL(image)
|
251
251
|
|
252
252
|
imageDraw = ImageDraw.Draw(image)
|
@@ -263,7 +263,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
263
263
|
# the font size should fill the whole tile
|
264
264
|
imageDrawFont = ImageFont.truetype(
|
265
265
|
font='/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',
|
266
|
-
size=int(fontsize * min(self.tileWidth, self.tileHeight))
|
266
|
+
size=int(fontsize * min(self.tileWidth, self.tileHeight)),
|
267
267
|
)
|
268
268
|
except OSError:
|
269
269
|
imageDrawFont = ImageFont.load_default()
|
@@ -271,7 +271,7 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
271
271
|
xy=(10, 10),
|
272
272
|
text=text,
|
273
273
|
fill=(0, 0, 0) if band != 'alpha' else (255, 255, 255),
|
274
|
-
font=imageDrawFont
|
274
|
+
font=imageDrawFont,
|
275
275
|
)
|
276
276
|
return image
|
277
277
|
|
@@ -281,7 +281,8 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
281
281
|
self._xyzInRange(x, y, z, frame, len(self._frames) if hasattr(self, '_frames') else None)
|
282
282
|
|
283
283
|
if not (self.minLevel <= z <= self.maxLevel):
|
284
|
-
|
284
|
+
msg = 'z layer does not exist'
|
285
|
+
raise TileSourceError(msg)
|
285
286
|
_counters['tiles'] += 1
|
286
287
|
|
287
288
|
xFraction = (x + 0.5) * self.tileWidth * 2 ** (self.levels - 1 - z) / self.sizeX
|
@@ -303,14 +304,14 @@ class TestTileSource(TileSource, metaclass=LruCacheMetaclass):
|
|
303
304
|
image = image.convert('L')
|
304
305
|
format = TILE_FORMAT_PIL
|
305
306
|
else:
|
306
|
-
image =
|
307
|
+
image = np.zeros(
|
307
308
|
(self.tileHeight, self.tileWidth, len(self._bands)), dtype=self._dtype)
|
308
309
|
for bandnum, band in enumerate(self._bands):
|
309
310
|
bandimg = self._tileImage(rgbColor, x, y, z, frame, band, bandnum)
|
310
311
|
if self.monochrome or band.upper() in {'grey', 'gray', 'alpha'}:
|
311
312
|
bandimg = bandimg.convert('L')
|
312
313
|
bandimg = _imageToNumpy(bandimg)[0]
|
313
|
-
if (self._dtype !=
|
314
|
+
if (self._dtype != np.uint8 or
|
314
315
|
self._bands[band]['low'] != 0 or
|
315
316
|
self._bands[band]['high'] != 255):
|
316
317
|
bandimg = bandimg.astype(float)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: large-image-source-test
|
3
|
-
Version: 1.23.3.
|
3
|
+
Version: 1.23.3.dev67
|
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.
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
19
19
|
Requires-Python: >=3.6
|
20
20
|
License-File: LICENSE
|
21
|
-
Requires-Dist: large-image (>=1.23.3.
|
21
|
+
Requires-Dist: large-image (>=1.23.3.dev67)
|
22
22
|
Requires-Dist: importlib-metadata (<5) ; python_version < "3.8"
|
23
23
|
|
24
24
|
A fractal test tilesource for large_image.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
large_image_source_test/__init__.py,sha256=jTNFtFhXSRUsR3061IXaJ4yQt0rm_vV8Nc6dWbAnlQk,14867
|
2
|
+
large_image_source_test-1.23.3.dev67.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
3
|
+
large_image_source_test-1.23.3.dev67.dist-info/METADATA,sha256=otG7cKK-KZwUlbc4-0XUfGIu2pH-EOV7tI6mZObuT-I,1015
|
4
|
+
large_image_source_test-1.23.3.dev67.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
5
|
+
large_image_source_test-1.23.3.dev67.dist-info/entry_points.txt,sha256=FvMJVuA21U5zXsIxhuCizP_hTIdSh8C5IvY8OSHY0bw,142
|
6
|
+
large_image_source_test-1.23.3.dev67.dist-info/top_level.txt,sha256=6FCQXW4RZzwmKGAfNHlGFkdsCfxTMz5QUrMXLZuSAKM,24
|
7
|
+
large_image_source_test-1.23.3.dev67.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
large_image_source_test/__init__.py,sha256=AAe45C0HzKeqnRcEh68keTqubZ88e6PkxTWvFT2zW_M,14858
|
2
|
-
large_image_source_test-1.23.3.dev62.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
3
|
-
large_image_source_test-1.23.3.dev62.dist-info/METADATA,sha256=b7rjlPTmG6QuftyG2AHgi0oUfnRz8EcnFdlBYr-SonE,1015
|
4
|
-
large_image_source_test-1.23.3.dev62.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
5
|
-
large_image_source_test-1.23.3.dev62.dist-info/entry_points.txt,sha256=FvMJVuA21U5zXsIxhuCizP_hTIdSh8C5IvY8OSHY0bw,142
|
6
|
-
large_image_source_test-1.23.3.dev62.dist-info/top_level.txt,sha256=6FCQXW4RZzwmKGAfNHlGFkdsCfxTMz5QUrMXLZuSAKM,24
|
7
|
-
large_image_source_test-1.23.3.dev62.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|