diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b8cc32e..9b4c74bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Configurable item list grid view ([#1363](../../pull/1363)) - Allow labels in item list view ([#1366](../../pull/1366)) - Improve cache key guard ([#1368](../../pull/1368)) +- Improve handling dicom files in the working directory ([#1370](../../pull/137068)) ### Bug Fixes - Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359)) diff --git a/sources/dicom/large_image_source_dicom/__init__.py b/sources/dicom/large_image_source_dicom/__init__.py index ede687db5..89ba73de0 100644 --- a/sources/dicom/large_image_source_dicom/__init__.py +++ b/sources/dicom/large_image_source_dicom/__init__.py @@ -127,12 +127,13 @@ def __init__(self, path, **kwargs): path = str(path) if not os.path.isfile(path): raise TileSourceFileNotFoundError(path) from None - root = os.path.dirname(path) + root = os.path.dirname(path) or '.' self._largeImagePath = [ os.path.join(root, entry) for entry in os.listdir(root) if os.path.isfile(os.path.join(root, entry)) and self._pathMightBeDicom(entry)] - if path not in self._largeImagePath: + if (path not in self._largeImagePath and + os.path.join(root, os.path.basename(path)) not in self._largeImagePath): self._largeImagePath = [path] else: self._largeImagePath = path