large-image-source-bioformats 1.27.5.dev57__tar.gz → 1.27.5.dev63__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.
Files changed (15) hide show
  1. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/PKG-INFO +1 -1
  2. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats/__init__.py +29 -3
  3. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats.egg-info/PKG-INFO +1 -1
  4. large-image-source-bioformats-1.27.5.dev63/large_image_source_bioformats.egg-info/requires.txt +5 -0
  5. large-image-source-bioformats-1.27.5.dev57/large_image_source_bioformats.egg-info/requires.txt +0 -5
  6. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/LICENSE +0 -0
  7. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/README.rst +0 -0
  8. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats/girder_source.py +0 -0
  9. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats.egg-info/SOURCES.txt +0 -0
  10. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats.egg-info/dependency_links.txt +0 -0
  11. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats.egg-info/entry_points.txt +0 -0
  12. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/large_image_source_bioformats.egg-info/top_level.txt +0 -0
  13. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/pyproject.toml +0 -0
  14. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/setup.cfg +0 -0
  15. {large-image-source-bioformats-1.27.5.dev57 → large-image-source-bioformats-1.27.5.dev63}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-bioformats
3
- Version: 1.27.5.dev57
3
+ Version: 1.27.5.dev63
4
4
  Summary: An bioformats tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -61,8 +61,7 @@ _openImages = []
61
61
 
62
62
 
63
63
  # Default to ignoring files with no extension and some specific extensions.
64
- config.ConfigValues['source_bioformats_ignored_names'] = \
65
- r'(^[^.]*|\.(jpg|jpeg|jpe|png|tif|tiff|ndpi|nd2|ome|nc|json|isyntax|mrxs|zarr(\.db|\.zip)))$'
64
+ config.ConfigValues['source_bioformats_ignored_names'] = r'(^[^.]*|\.(jpg|jpeg|jpe|png|tif|tiff|ndpi|nd2|ome|nc|json|isyntax|mrxs|zip|zarr(\.db|\.zip)))$' # noqa
66
65
 
67
66
 
68
67
  def _monitor_thread():
@@ -215,13 +214,28 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
215
214
  if not _startJavabridge(self.logger):
216
215
  msg = 'File cannot be opened by bioformats reader because javabridge failed to start'
217
216
  raise TileSourceError(msg)
217
+ self.addKnownExtensions()
218
218
 
219
219
  self._tileLock = threading.RLock()
220
220
 
221
221
  try:
222
222
  javabridge.attach()
223
223
  try:
224
- self._bioimage = bioformats.ImageReader(largeImagePath)
224
+ self._bioimage = bioformats.ImageReader(largeImagePath, perform_init=False)
225
+ try:
226
+ # So this as a separate step so, if it fails, we can ask to
227
+ # open something that does not exist and bioformats will
228
+ # release some file handles.
229
+ self._bioimage.init_reader()
230
+ except Exception as exc:
231
+ try:
232
+ # Ask to open a file that should never exist
233
+ self._bioimage.rdr.setId('__\0__')
234
+ except Exception:
235
+ pass
236
+ self._bioimage.close()
237
+ self._bioimage = None
238
+ raise exc
225
239
  except (AttributeError, OSError) as exc:
226
240
  if not os.path.isfile(largeImagePath):
227
241
  raise TileSourceFileNotFoundError(largeImagePath) from None
@@ -699,6 +713,18 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
699
713
  javabridge.detach()
700
714
  return large_image.tilesource.base._imageToPIL(image)
701
715
 
716
+ @classmethod
717
+ def addKnownExtensions(cls):
718
+ # This starts javabridge/bioformats if needed
719
+ _getBioformatsVersion()
720
+ if not hasattr(cls, '_addedExtensions'):
721
+ cls._addedExtensions = True
722
+ cls.extensions = cls.extensions.copy()
723
+ for dotext in bioformats.READABLE_FORMATS:
724
+ ext = dotext.strip('.')
725
+ if ext not in cls.extensions:
726
+ cls.extensions[ext] = SourcePriority.IMPLICIT
727
+
702
728
 
703
729
  def open(*args, **kwargs):
704
730
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-bioformats
3
- Version: 1.27.5.dev57
3
+ Version: 1.27.5.dev63
4
4
  Summary: An bioformats tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -0,0 +1,5 @@
1
+ large-image>=1.27.5.dev63
2
+ python-bioformats>=1.5.2
3
+
4
+ [girder]
5
+ girder-large-image>=1.27.5.dev63
@@ -1,5 +0,0 @@
1
- large-image>=1.27.5.dev57
2
- python-bioformats>=1.5.2
3
-
4
- [girder]
5
- girder-large-image>=1.27.5.dev57