-
Notifications
You must be signed in to change notification settings - Fork 171
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
Prioritize original transfer syntax when multiple accepts with no quality provided #2753
Conversation
src/Microsoft.Health.Dicom.Core/Messages/Retrieve/AcceptHeader.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Core/Features/Retrieve/AcceptHeaderHandler.cs
Outdated
Show resolved
Hide resolved
private static bool IsHigherPriorityTransferSyntax(AcceptHeader header, AcceptHeader selectedHeader) | ||
{ | ||
bool isQualityGreater = (header.Quality ?? 0.000) >= (selectedHeader.Quality ?? 0.000); | ||
return (header.TransferSyntax.Value == DicomTransferSyntaxUids.Original && isQualityGreater); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This naming is misleading: Original
should really be called Any
. If we want to prioritize the original, we should look up the original transfer syntax from the DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I am not seeing the difference. It is still saying the same without knowing the exact transfer syntax UID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic will prioritize the original syntax if the request specifies any transfer syntax for the media type via *
.
However, if we have an image stored in Explicit VR Little Endian
and a caller sends the following in the Accept
header:
- media type
application/dicom
, transfer syntaxJPEG 2000
, no qvalue - media type
application/dicom
, transfer syntaxExplicit VR Little Endian
, no qvalue
Then this tie-breaking logic will pick JPEG 2000
as the transfer syntax to return and we will transcode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The goal is not to avoid transcoding, it is to prioritize * when given in a list of media type with no q value
Description
SLIM viewer sends multiple accept headers to get frames. Original is the last, this causes us to pick another accept and fail because today our code needs entire file to do transcoding and will throw when file size is greater than 100M.
This fix will make us prioritize picking original if available in the accept list.
Related issues
ImagingDataCommons/dicom-microscopy-viewer#95
Testing
Added unit tests