Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up dicom adjacent file detection when it doesn't succeed #1436

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Improvements
- Read config values from the environment variables ([#1422](../../pull/1422))
- Optimizing when reading arrays rather than images from tiff files ([#1423](../../pull/1423))
- Better filter DICOM adjacent files to ensure they share series instance IDs ([#1424](../../pull/1424))
- Better filter DICOM adjacent files to ensure they share series instance IDs ([#1424](../../pull/1424), [#1436](../../pull/1436))
- Optimizing small getRegion calls and some tiff tile fetches ([#1427](../../pull/1427))
- Started adding python types to the core library ([#1432](../../pull/1432), [#1433](../../pull/1433))
- Use parallelism in computing tile frames ([#1434](../../pull/1434))
Expand Down
9 changes: 6 additions & 3 deletions sources/dicom/large_image_source_dicom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,12 @@ def _pathMightBeDicom(self, path, basepath=None):
if mightbe and basepath:
try:
_lazyImportPydicom()
base_series_uid = pydicom.filereader.dcmread(
basepath, stop_before_pixels=True,
)[pydicom.tag.Tag('SeriesInstanceUID')].value
base = pydicom.filereader.dcmread(basepath, stop_before_pixels=True)
except Exception as exc:
msg = f'File cannot be opened via dicom tile source ({exc}).'
raise TileSourceError(msg)
try:
base_series_uid = base[pydicom.tag.Tag('SeriesInstanceUID')].value
except Exception:
base_series_uid = None
if base_series_uid:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ deps =
allowlist_externals = {[testenv:test]allowlist_externals}
commands =
rm -rf build/test/coverage/web_temp
rm ./monkeytype.sqlite3
-rm ./monkeytype.sqlite3
girder build --dev
pytest --numprocesses 0 -m 'not notebook' --no-cov --suppress-no-test-exit-code --monkeytype-output=./monkeytype.sqlite3 {posargs}
- npx nyc report --temp-dir build/test/coverage/web_temp --report-dir build/test/coverage --reporter cobertura --reporter text-summary
Expand Down