-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add support for downloading DICOMweb files #1429
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psavery
commented
Jan 9, 2024
psavery
force-pushed
the
dicomweb-separate-files
branch
2 times, most recently
from
January 10, 2024 20:33
208fd54
to
e6e9629
Compare
This is ready for review! I added a test for downloading an item (which downloads each file). During local testing, I downloaded some DICOM files, uploaded them back to girder, and confirmed I could view them with large image (so this confirms that the downloaded DICOM files work correctly). |
psavery
force-pushed
the
dicomweb-separate-files
branch
2 times, most recently
from
January 15, 2024 18:07
d05a1a3
to
b9a1a16
Compare
psavery
commented
Jan 16, 2024
sources/dicom/large_image_source_dicom/assetstore/dicomweb_assetstore_adapter.py
Outdated
Show resolved
Hide resolved
psavery
commented
Jan 16, 2024
sources/dicom/large_image_source_dicom/assetstore/dicomweb_assetstore_adapter.py
Show resolved
Hide resolved
psavery
force-pushed
the
dicomweb-separate-files
branch
from
January 17, 2024 02:47
b9a1a16
to
305a705
Compare
Ready for review... |
manthey
reviewed
Jan 22, 2024
sources/dicom/large_image_source_dicom/assetstore/dicomweb_assetstore_adapter.py
Outdated
Show resolved
Hide resolved
This also adds download support. Signed-off-by: Patrick Avery <[email protected]>
This attempts a range request for file downloads, even though for every case we've seen, the DICOMweb server does not honor it... Signed-off-by: Patrick Avery <[email protected]>
This is more descriptive of what it contains compared to 'dicomweb_meta'. Signed-off-by: Patrick Avery <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
This also re-organizes a little code and adds FIXMEs for the range requests parts. Signed-off-by: Patrick Avery <[email protected]>
This prevents loading all of the data into memory, which is what we were doing before. It is somewhat complicated, but that is because the DICOMweb specification requires it to be multipart/related with boundaries. We have to be sure we remove those boundaries and stream only the DICOM file contents. Signed-off-by: Patrick Avery <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
Although I don't think it is likely (unless the chunk size is large), it is possible that the section right after the header might contain part of the ending. Thus, we should wait and check it, just as we do for all other chunks, before yielding it. Signed-off-by: Patrick Avery <[email protected]>
We also now verify that each download contains a certain amount of bytes. Signed-off-by: Patrick Avery <[email protected]>
If the ending is split between two chunks, then at most, the second chunk will contain ending_size - 1 bytes of the ending. So we should just check for this. We also don't need to add extra bytes to check for in the ending, because we don't care what comes after the ending. Signed-off-by: Patrick Avery <[email protected]>
This prevents a misleading file size of 0 bytes being displayed in girder. This is working without issues so far. Signed-off-by: Patrick Avery <[email protected]>
psavery
force-pushed
the
dicomweb-separate-files
branch
from
January 22, 2024 17:39
c23b4a0
to
15476f6
Compare
manthey
approved these changes
Jan 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Each girder item represents a series. Previously, each item would contain a single file with the same name.
Now, each instance (DICOM file) within a series is represented by separate girder files within the item.
This PR includes download support, so individual DICOM files can be downloaded, or all DICOM files in a series can be downloaded together by downloading the girder item.
Range requests for the DICOM files are attempted if requested. However, the DICOMweb standard doesn't guarantee that they will be supported, and none of the DICOMweb servers we have tried have supported range requests for DICOM files.
To do:
Fixes: #1309