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

Fix dicom import from inside database folder and performance improvements #957

Merged

Conversation

lassoan
Copy link
Member

@lassoan lassoan commented Apr 8, 2021

This fixes an issue when retrieving values from tagcache fails when loading files that Slicer's DICOMwebBrowser retrieved (those files are imported from within the database folder, to avoid copying the files).

The performance and API improvements allow about 2x faster examining and loading of DICOM series that contain many instances.

@lassoan lassoan requested a review from cpinter April 8, 2021 14:49
@lassoan lassoan self-assigned this Apr 8, 2021
jcfr and others added 3 commits April 8, 2021 15:52
When data sets were imported from within the DICOM database folder without copying to the database, the full absolute path was stored in the database.
However, when later the filename was used, it was determined to be a file within the database folder and therefore the filename was converted to relative path.

Fixed the issue by always using relative paths if a data set is imported from within the database folder.

This allows passing ownership of DICOM files to the database without making a copy (by moving the files to anywhere within the database folder and import from there without requesting a copy).
- Improve tag caching performance. There were unnecessary database queries due to looking up cache entries twice and looking up SOP instance UID for file. Also reduced some code duplication by factoring out reading of DICOM tags from files into a new helper function (readValueFromFile).
- Add API to get first file or instance of a series.
- Cache DatabaseDirectory to avoid recomputing it each time a file path is converted between relative and absolute.
@jcfr jcfr force-pushed the fix-dicom-import-from-inside-database-folder branch from f758191 to 5be81f2 Compare April 8, 2021 19:57
@jcfr
Copy link
Member

jcfr commented Apr 8, 2021

To streamline review, I moved the fix of line endings into its own commit.

@jcfr jcfr merged commit 2e0abb8 into commontk:master Apr 8, 2021
@lassoan lassoan deleted the fix-dicom-import-from-inside-database-folder branch April 8, 2021 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants