large-image-source-openslide 1.27.5.dev4__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.
Files changed (15) hide show
  1. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/PKG-INFO +13 -2
  2. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/README.rst +20 -40
  3. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide/__init__.py +39 -2
  4. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide.egg-info/PKG-INFO +13 -2
  5. large_image_source_openslide-1.30.7.dev10/large_image_source_openslide.egg-info/requires.txt +21 -0
  6. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/setup.py +9 -3
  7. large-image-source-openslide-1.27.5.dev4/large_image_source_openslide.egg-info/requires.txt +0 -6
  8. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/LICENSE +0 -0
  9. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide/girder_source.py +0 -0
  10. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide.egg-info/SOURCES.txt +0 -0
  11. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide.egg-info/dependency_links.txt +0 -0
  12. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide.egg-info/entry_points.txt +0 -0
  13. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/large_image_source_openslide.egg-info/top_level.txt +0 -0
  14. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/pyproject.toml +0 -0
  15. {large-image-source-openslide-1.27.5.dev4 → large_image_source_openslide-1.30.7.dev10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-openslide
3
- Version: 1.27.5.dev4
3
+ Version: 1.30.7.dev10
4
4
  Summary: An Openslide tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -15,9 +15,20 @@ 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
- Provides-Extra: girder
20
+ Description-Content-Type: text/x-rst
20
21
  License-File: LICENSE
22
+ Requires-Dist: large-image>=1.30.7.dev10
23
+ Requires-Dist: openslide-python>=1.4.1
24
+ Requires-Dist: openslide-bin; platform_system == "Linux" and platform_machine == "x86_64"
25
+ Requires-Dist: openslide-bin; platform_system == "Linux" and platform_machine == "aarch64"
26
+ Requires-Dist: openslide-bin; platform_system == "Windows" and platform_machine == "AMD64"
27
+ Requires-Dist: openslide-bin; platform_system == "Darwin" and platform_machine == "arm64"
28
+ Requires-Dist: openslide-bin; platform_system == "Darwin" and platform_machine == "x86_64"
29
+ Requires-Dist: tifftools>=1.2.0
30
+ Provides-Extra: girder
31
+ Requires-Dist: girder-large-image>=1.30.7.dev10; extra == "girder"
21
32
 
22
33
  An Openslide tilesource for large_image.
23
34
 
@@ -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
- Install all tile sources and all Girder plugins on linux::
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. Some of the source modules are available on conda-forge. You can install the following::
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 images.
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 some multi-frame OMETiff files.
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
- - As a Girder plugin:
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
- - ``girder-large-image``: Large Image as a Girder_ 3.x plugin.
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-annotation``: Annotations for large images as a Girder_ 3.x plugin.
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://github.com/girder/girder
169
+ .. _Girder: https://girder.readthedocs.io/en/latest/
@@ -47,6 +47,8 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
47
47
  extensions = {
48
48
  None: SourcePriority.MEDIUM,
49
49
  'bif': SourcePriority.LOW, # Ventana
50
+ 'dcm': SourcePriority.LOW, # DICOM
51
+ 'ini': SourcePriority.LOW, # Part of mrxs
50
52
  'mrxs': SourcePriority.PREFERRED, # MIRAX
51
53
  'ndpi': SourcePriority.PREFERRED, # Hamamatsu
52
54
  'scn': SourcePriority.LOW, # Leica
@@ -92,6 +94,13 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
92
94
  tifftools.Tag.ICCProfile.value]['data']]
93
95
  except Exception:
94
96
  pass
97
+ if hasattr(self, '_tiffinfo'):
98
+ for ifd in self._tiffinfo['ifds']:
99
+ if (tifftools.Tag.NDPI_FOCAL_PLANE.value in ifd['tags'] and
100
+ ifd['tags'][tifftools.Tag.NDPI_FOCAL_PLANE.value]['data'][0] != 0):
101
+ msg = ('File will not be opened via OpenSlide; '
102
+ 'non-zero focal planes would be missed.')
103
+ raise TileSourceError(msg)
95
104
 
96
105
  svsAvailableLevels = self._getAvailableLevels(self._largeImagePath)
97
106
  if not len(svsAvailableLevels):
@@ -153,6 +162,30 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
153
162
  'svslevel': bestlevel,
154
163
  'scale': scale,
155
164
  })
165
+ self._bounds = None
166
+ try:
167
+ bounds = {
168
+ 'x': int(self._openslide.properties[openslide.PROPERTY_NAME_BOUNDS_X]),
169
+ 'y': int(self._openslide.properties[openslide.PROPERTY_NAME_BOUNDS_Y]),
170
+ 'width': int(self._openslide.properties[openslide.PROPERTY_NAME_BOUNDS_WIDTH]),
171
+ 'height': int(self._openslide.properties[openslide.PROPERTY_NAME_BOUNDS_HEIGHT]),
172
+ }
173
+ if (
174
+ bounds['x'] >= 0 and bounds['width'] > 0 and
175
+ bounds['x'] + bounds['width'] <= self.sizeX and
176
+ bounds['y'] >= 0 and bounds['height'] > 0 and
177
+ bounds['y'] + bounds['height'] <= self.sizeY and
178
+ (bounds['width'] < self.sizeX or bounds['height'] < self.sizeY)
179
+ ):
180
+ self._bounds = bounds
181
+ self.sizeX, self.sizeY = bounds['width'], bounds['height']
182
+ prevlevels = self.levels
183
+ self.levels = int(math.ceil(max(
184
+ math.log(float(self.sizeX) / self.tileWidth),
185
+ math.log(float(self.sizeY) / self.tileHeight)) / math.log(2))) + 1
186
+ self._svslevels = self._svslevels[prevlevels - self.levels:]
187
+ except Exception:
188
+ pass
156
189
  self._populatedLevels = len({l['svslevel'] for l in self._svslevels})
157
190
 
158
191
  def _getTileSize(self):
@@ -291,11 +324,14 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
291
324
  scale = 2 ** (self.levels - 1 - z)
292
325
  offsetx = x * self.tileWidth * scale
293
326
  offsety = y * self.tileHeight * scale
327
+ if self._bounds is not None:
328
+ offsetx += self._bounds['x'] // svslevel['scale']
329
+ offsety += self._bounds['y'] // svslevel['scale']
294
330
  # We ask to read an area that will cover the tile at the z level. The
295
331
  # scale we computed in the __init__ process for this svs level tells
296
332
  # how much larger a region we need to read.
297
333
  if svslevel['scale'] > 2 ** self._maxSkippedLevels:
298
- tile = self._getTileFromEmptyLevel(x, y, z, **kwargs)
334
+ tile, format = self._getTileFromEmptyLevel(x, y, z, **kwargs)
299
335
  else:
300
336
  retries = 3
301
337
  while retries > 0:
@@ -304,6 +340,7 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
304
340
  (offsetx, offsety), svslevel['svslevel'],
305
341
  (self.tileWidth * svslevel['scale'],
306
342
  self.tileHeight * svslevel['scale']))
343
+ format = TILE_FORMAT_PIL
307
344
  break
308
345
  except openslide.lowlevel.OpenSlideError as exc:
309
346
  self._largeImagePath = str(self._getLargeImagePath())
@@ -323,7 +360,7 @@ class OpenslideFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
323
360
  if svslevel['scale'] != 1:
324
361
  tile = tile.resize((self.tileWidth, self.tileHeight),
325
362
  getattr(PIL.Image, 'Resampling', PIL.Image).LANCZOS)
326
- return self._outputTile(tile, TILE_FORMAT_PIL, x, y, z, pilImageAllowed,
363
+ return self._outputTile(tile, format, x, y, z, pilImageAllowed,
327
364
  numpyAllowed, **kwargs)
328
365
 
329
366
  def getPreferredLevel(self, level):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-openslide
3
- Version: 1.27.5.dev4
3
+ Version: 1.30.7.dev10
4
4
  Summary: An Openslide tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -15,9 +15,20 @@ 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
- Provides-Extra: girder
20
+ Description-Content-Type: text/x-rst
20
21
  License-File: LICENSE
22
+ Requires-Dist: large-image>=1.30.7.dev10
23
+ Requires-Dist: openslide-python>=1.4.1
24
+ Requires-Dist: openslide-bin; platform_system == "Linux" and platform_machine == "x86_64"
25
+ Requires-Dist: openslide-bin; platform_system == "Linux" and platform_machine == "aarch64"
26
+ Requires-Dist: openslide-bin; platform_system == "Windows" and platform_machine == "AMD64"
27
+ Requires-Dist: openslide-bin; platform_system == "Darwin" and platform_machine == "arm64"
28
+ Requires-Dist: openslide-bin; platform_system == "Darwin" and platform_machine == "x86_64"
29
+ Requires-Dist: tifftools>=1.2.0
30
+ Provides-Extra: girder
31
+ Requires-Dist: girder-large-image>=1.30.7.dev10; extra == "girder"
21
32
 
22
33
  An Openslide tilesource for large_image.
23
34
 
@@ -0,0 +1,21 @@
1
+ large-image>=1.30.7.dev10
2
+ openslide-python>=1.4.1
3
+ tifftools>=1.2.0
4
+
5
+ [:platform_system == "Darwin" and platform_machine == "arm64"]
6
+ openslide-bin
7
+
8
+ [:platform_system == "Darwin" and platform_machine == "x86_64"]
9
+ openslide-bin
10
+
11
+ [:platform_system == "Linux" and platform_machine == "aarch64"]
12
+ openslide-bin
13
+
14
+ [:platform_system == "Linux" and platform_machine == "x86_64"]
15
+ openslide-bin
16
+
17
+ [:platform_system == "Windows" and platform_machine == "AMD64"]
18
+ openslide-bin
19
+
20
+ [girder]
21
+ girder-large-image>=1.30.7.dev10
@@ -19,8 +19,7 @@ def prerelease_local_scheme(version):
19
19
 
20
20
  if os.getenv('CIRCLE_BRANCH') in ('master', ):
21
21
  return ''
22
- else:
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,10 +49,16 @@ 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}',
55
- 'openslide-python>=1.1.0',
56
+ 'openslide-python>=1.4.1',
57
+ 'openslide-bin; platform_system=="Linux" and platform_machine=="x86_64"',
58
+ 'openslide-bin; platform_system=="Linux" and platform_machine=="aarch64"',
59
+ 'openslide-bin; platform_system=="Windows" and platform_machine=="AMD64"',
60
+ 'openslide-bin; platform_system=="Darwin" and platform_machine=="arm64"',
61
+ 'openslide-bin; platform_system=="Darwin" and platform_machine=="x86_64"',
56
62
  'tifftools>=1.2.0',
57
63
  ],
58
64
  extras_require={
@@ -1,6 +0,0 @@
1
- large-image>=1.27.5.dev4
2
- openslide-python>=1.1.0
3
- tifftools>=1.2.0
4
-
5
- [girder]
6
- girder-large-image>=1.27.5.dev4