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

Use multipart for any mediaType and for OHIF use original transfer syntax #3307

Merged
merged 3 commits into from
Jan 17, 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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public static IEnumerable<object[]> AnyMediaTypeHeadersList()
ValidStudyAcceptHeaderDescriptor.TransferSyntaxWhenMissing)
},
ResourceType.Study,
KnownContentTypes.ApplicationDicom
KnownContentTypes.ApplicationDicom,
PayloadTypes.MultipartRelated,
};
yield return new object[]
{
Expand All @@ -88,7 +89,8 @@ public static IEnumerable<object[]> AnyMediaTypeHeadersList()
ValidStudyAcceptHeaderDescriptor.PayloadType)
},
ResourceType.Series,
KnownContentTypes.ApplicationDicom
KnownContentTypes.ApplicationDicom,
PayloadTypes.MultipartRelated,
};
yield return new object[]
{
Expand All @@ -99,7 +101,8 @@ public static IEnumerable<object[]> AnyMediaTypeHeadersList()
ValidStudyAcceptHeaderDescriptor.PayloadType)
},
ResourceType.Frames,
KnownContentTypes.ApplicationOctetStream
KnownContentTypes.ApplicationOctetStream,
PayloadTypes.MultipartRelated,
};
}

Expand Down Expand Up @@ -227,15 +230,14 @@ public void GivenMultipleMatchedAcceptHeaderNoQuality_WhenTransferSyntaxRequeste
Assert.Equivalent(requestedAcceptHeader2, matchedAcceptHeader, strict: true);
}



[Theory]
[MemberData(nameof(AnyMediaTypeHeadersList))]
public void
GivenASingleRequestedAcceptHeaderWithAnyMediaType_WhenRequestedMatchesHeadersWeAccept_ThenShouldReturnAcceptedHeaderWithTransferSyntaxAndDescriptorThatMatched(
List<AcceptHeader> requestedAcceptHeaders,
ResourceType requestedResourceType,
string mediaType)
string mediaType,
PayloadTypes payloadType)
{
AcceptHeader matchedAcceptHeader = _handler.GetValidAcceptHeader(
requestedResourceType,
Expand All @@ -247,6 +249,7 @@ public void
requestedAcceptHeaders.First().TransferSyntax.Value;

Assert.Equal(mediaType, matchedAcceptHeader.MediaType);
Assert.Equal(payloadType, matchedAcceptHeader.PayloadType);
Assert.Equal(expectedTransferSyntax, matchedAcceptHeader.TransferSyntax);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public AcceptHeader GetValidAcceptHeader(ResourceType resourceType, IReadOnlyCol
{
selectedHeader = new AcceptHeader(
GetMediaTypesString(header.MediaType, resourceType),
header.PayloadType,
GetPayloadType(header),
descriptor.GetTransferSyntax(header),
header.Quality);

Expand All @@ -105,6 +105,16 @@ private static bool IsHigherPriorityTransferSyntax(AcceptHeader header, AcceptHe
return (header.TransferSyntax.Value == DicomTransferSyntaxUids.Original && isQualityGreater);
}

private static PayloadTypes GetPayloadType(AcceptHeader header)
{
if (header.MediaType != KnownContentTypes.AnyMediaType)
{
return header.PayloadType;
}

return PayloadTypes.MultipartRelated;
}

// If the media type is */* then we need to return the default media type for the resource type
private static StringSegment GetMediaTypesString(StringSegment mediaType, ResourceType resourceType)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Health.Dicom.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"EnableExport": true,
"EnableDataPartitions": false,
"EnableFullDicomItemValidation": false,
"EnableOhifViewer": false,
"EnableOhifViewer": true,
"EnableExternalStore": false,
"DisableOperations": false
},
Expand Down
6 changes: 5 additions & 1 deletion src/Microsoft.Health.Dicom.Web/wwwroot/app-config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
var rootUrl = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/v1`;
var rootUrl = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/v2`;
window.config = {
routerBasename: '/',
// whiteLabeling: {},
extensions: [],
modes: [],
customizationService: {
dicomUploadComponent:
'@ohif/extension-cornerstone.customizationModule.cornerstoneDicomUploadComponent',
// Shows a custom route -access via http://localhost:3000/custom
// helloPage: '@ohif/extension-default.customizationModule.helloPage',
},
Expand Down Expand Up @@ -42,6 +44,7 @@ window.config = {
configuration: {
friendlyName: 'Azure Dicom Web',
name: 'AzureDicomWeb',
dicomUploadEnabled: true,
wadoUriRoot: rootUrl,
qidoRoot: rootUrl,
wadoRoot: rootUrl,
Expand All @@ -53,6 +56,7 @@ window.config = {
supportsFuzzyMatching: true,
supportsWildcard: false,
staticWado: true,
requestTransferSyntaxUID: '*',
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
Expand Down