Skip to content

Commit

Permalink
Harden bioformats shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Nov 16, 2023
1 parent 32b8d01 commit 6aeed8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Changes
- Update WsiDicomWebClient init call ([#1371](../../pull/1371))
- Rename DICOMweb AssetstoreImportView ([#1372](../../pull/1372))
- Harden bioformats shutdown ([#1375](../../pull/1375))

### Bug Fixes
- Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359))
Expand Down
9 changes: 7 additions & 2 deletions sources/bioformats/large_image_source_bioformats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def _monitor_thread():
source._bioimage.close()
except Exception:
pass
source._bioimage = None
try:
source._bioimage = None
except Exception:
pass
except AssertionError:
pass
finally:
Expand Down Expand Up @@ -178,7 +181,7 @@ def __init__(self, path, **kwargs): # noqa
super().__init__(path, **kwargs)

largeImagePath = str(self._getLargeImagePath())
self._ignoreSourceNames('bioformats', largeImagePath, r'\.png$')
self._ignoreSourceNames('bioformats', largeImagePath, r'(^[^.]*|\.(png|zarr(\.db|\.zip)))$')

if not _startJavabridge(self.logger):
msg = 'File cannot be opened by bioformats reader because javabridge failed to start'
Expand Down Expand Up @@ -276,6 +279,8 @@ def __del__(self):
self._bioimage.close()
del self._bioimage
_openImages.remove(weakref.ref(self))
except Exception:
pass
finally:
if javabridge.get_env():
javabridge.detach()
Expand Down

0 comments on commit 6aeed8d

Please sign in to comment.