WIP accept header
This commit is contained in:
parent
56633a67d9
commit
f670678cf0
@ -54,20 +54,6 @@ export default function initWADOImageLoader(
|
|||||||
// we should set this flag to false.
|
// we should set this flag to false.
|
||||||
convertFloatPixelDataToInt: false,
|
convertFloatPixelDataToInt: false,
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
TODO (Salim) : Seems to be implemented in createDicomWebApi, check if safe to remove
|
|
||||||
beforeSend: function (xhr) {
|
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
|
||||||
|
|
||||||
const xhrRequestHeaders = {}
|
|
||||||
|
|
||||||
if (headers) {
|
|
||||||
Object.assign(xhrRequestHeaders, headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
return xhrRequestHeaders;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
errorInterceptor: error => {
|
errorInterceptor: error => {
|
||||||
errorHandler.getHTTPErrorHandler(error);
|
errorHandler.getHTTPErrorHandler(error);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -60,73 +60,16 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
supportsReject,
|
supportsReject,
|
||||||
staticWado,
|
staticWado,
|
||||||
singlepart,
|
singlepart,
|
||||||
requestTransferSyntaxUID,
|
omitQuotationForMultipartRequest,
|
||||||
omitQuotationForMultipartRequest
|
acceptHeader
|
||||||
} = dicomWebConfig;
|
} = dicomWebConfig;
|
||||||
|
|
||||||
const dicomWebConfigCopy = JSON.parse(JSON.stringify(dicomWebConfig));
|
const dicomWebConfigCopy = JSON.parse(JSON.stringify(dicomWebConfig));
|
||||||
|
|
||||||
const acceptHeader = ['multipart/related']
|
//If accept header is not specified, set as multipart
|
||||||
|
let formattedAcceptHeader = acceptHeader ?? []
|
||||||
if (requestTransferSyntaxUID) {
|
if (acceptHeader.length === 0) {
|
||||||
|
formattedAcceptHeader = ['multipart/related']
|
||||||
// Request:
|
|
||||||
// JPEG-LS Lossless (1.2.840.10008.1.2.4.80) if available, otherwise accept
|
|
||||||
// whatever transfer-syntax the origin server provides.
|
|
||||||
// For now we use image/jls and image/x-jls because some servers still use the old type
|
|
||||||
// http://dicom.nema.org/medical/dicom/current/output/html/part18.html
|
|
||||||
/*
|
|
||||||
taken from
|
|
||||||
https://hg.orthanc-server.com/orthanc-dicomweb/file/tip/Plugin/WadoRsRetrieveFrames.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Hard coding this prevents adding custom types here such as the single part, or adding priority.
|
|
||||||
Suggest dropping this table.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const typeForTS = {
|
|
||||||
"*": "application/octet-stream",
|
|
||||||
"1.2.840.10008.1.2.1": "application/octet-stream",
|
|
||||||
"1.2.840.10008.1.2": "application/octet-stream",
|
|
||||||
"1.2.840.10008.1.2.2": "application/octet-stream",
|
|
||||||
"1.2.840.10008.1.2.4.70": "image/jpeg",
|
|
||||||
"1.2.840.10008.1.2.4.50": "image/jpeg",
|
|
||||||
"1.2.840.10008.1.2.4.51": "image/dicom+jpeg",
|
|
||||||
"1.2.840.10008.1.2.4.57": "image/jpeg",
|
|
||||||
"1.2.840.10008.1.2.5": "image/dicom-rle",
|
|
||||||
"1.2.840.10008.1.2.4.80": "image/jls",
|
|
||||||
"1.2.840.10008.1.2.4.81": "image/jls",
|
|
||||||
"1.2.840.10008.1.2.4.90": "image/jp2",
|
|
||||||
"1.2.840.10008.1.2.4.91": "image/jp2",
|
|
||||||
"1.2.840.10008.1.2.4.92": "image/jpx",
|
|
||||||
"1.2.840.10008.1.2.4.93": "image/jpx",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
This should be the default TSUID,
|
|
||||||
but the actual request should be able to over-ride the requested TSUID.
|
|
||||||
Why not just allow configuring the default accept header - INCLUDING making it empty?
|
|
||||||
If it were set as an array of strings, then an empty array wouldn't set it, and would allow the default response to be sent.
|
|
||||||
Also, it is permissable to request single part types directly,
|
|
||||||
and it would be nice to allow that to be configured using the same mechanism -
|
|
||||||
for example: dataSource....defaultImageAccept: [] would not pass any accept header
|
|
||||||
(this is required to work on all DICOMweb servers)
|
|
||||||
dataSource...defaultImageAccept: ['multipart/related; type="image/jphc"', 'multipart/related; type="image/jpeg"]
|
|
||||||
would allow for either HTJ2K or JPEG responses - something that can be very important when fetching existing lossy encoded images.
|
|
||||||
Then, dataSource...defaultImageAccept: ['image/jpeg', 'image/jp2'] would return JPEG or JPEG2000 responses.
|
|
||||||
*/
|
|
||||||
//Check TS is valid
|
|
||||||
if (!typeForTS[requestTransferSyntaxUID]) {
|
|
||||||
console.warn(requestTransferSyntaxUID + 'is unexpected')
|
|
||||||
} else {
|
|
||||||
//Fetch type header according to requesting TS
|
|
||||||
let type = typeForTS[requestTransferSyntaxUID]
|
|
||||||
acceptHeader.push('type=' + type)
|
|
||||||
acceptHeader.push('transfer-syntax=' + requestTransferSyntaxUID)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!omitQuotationForMultipartRequest) {
|
if (!omitQuotationForMultipartRequest) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user