feat(transferSyntax): Add customizable Transfer syntax through datasource config (#3406)
This commit is contained in:
commit
52f419d188
@ -166,7 +166,7 @@ export default async function init({
|
|||||||
prefetch: appConfig?.maxNumRequests?.prefetch || 10,
|
prefetch: appConfig?.maxNumRequests?.prefetch || 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
initWADOImageLoader(userAuthenticationService, appConfig);
|
initWADOImageLoader(userAuthenticationService, appConfig, extensionManager);
|
||||||
|
|
||||||
/* Measurement Service */
|
/* Measurement Service */
|
||||||
this.measurementServiceSource = connectToolsToMeasurementService(
|
this.measurementServiceSource = connectToolsToMeasurementService(
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import dicomImageLoader, {
|
|||||||
webWorkerManager,
|
webWorkerManager,
|
||||||
} from '@cornerstonejs/dicom-image-loader';
|
} from '@cornerstonejs/dicom-image-loader';
|
||||||
import dicomParser from 'dicom-parser';
|
import dicomParser from 'dicom-parser';
|
||||||
import { errorHandler } from '@ohif/core';
|
import { errorHandler, utils } from '@ohif/core';
|
||||||
|
|
||||||
const { registerVolumeLoader } = volumeLoader;
|
const { registerVolumeLoader } = volumeLoader;
|
||||||
|
|
||||||
@ -35,7 +35,8 @@ function initWebWorkers(appConfig) {
|
|||||||
|
|
||||||
export default function initWADOImageLoader(
|
export default function initWADOImageLoader(
|
||||||
userAuthenticationService,
|
userAuthenticationService,
|
||||||
appConfig
|
appConfig,
|
||||||
|
extensionManager
|
||||||
) {
|
) {
|
||||||
dicomImageLoader.external.cornerstone = cornerstone;
|
dicomImageLoader.external.cornerstone = cornerstone;
|
||||||
dicomImageLoader.external.dicomParser = dicomParser;
|
dicomImageLoader.external.dicomParser = dicomParser;
|
||||||
@ -55,18 +56,18 @@ export default function initWADOImageLoader(
|
|||||||
convertFloatPixelDataToInt: false,
|
convertFloatPixelDataToInt: false,
|
||||||
},
|
},
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function(xhr) {
|
||||||
|
//TODO should be removed in the future and request emitted by DicomWebDataSource
|
||||||
|
const sourceConfig =
|
||||||
|
extensionManager.getActiveDataSource()?.[0].getConfig() ?? {};
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
const headers = userAuthenticationService.getAuthorizationHeader();
|
||||||
|
const acceptHeader = utils.generateAcceptHeader(
|
||||||
|
sourceConfig.acceptHeader,
|
||||||
|
sourceConfig.requestTransferSyntaxUID,
|
||||||
|
sourceConfig.omitQuotationForMultipartRequest
|
||||||
|
);
|
||||||
|
|
||||||
// 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
|
|
||||||
const xhrRequestHeaders = {
|
const xhrRequestHeaders = {
|
||||||
Accept: appConfig.omitQuotationForMultipartRequest
|
Accept: acceptHeader,
|
||||||
? 'multipart/related; type=application/octet-stream'
|
|
||||||
: 'multipart/related; type="application/octet-stream"',
|
|
||||||
// 'multipart/related; type="image/x-jls", multipart/related; type="image/jls"; transfer-syntax="1.2.840.10008.1.2.4.80", multipart/related; type="image/x-jls", multipart/related; type="application/octet-stream"; transfer-syntax=*',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (headers) {
|
if (headers) {
|
||||||
|
|||||||
@ -60,15 +60,42 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
supportsReject,
|
supportsReject,
|
||||||
staticWado,
|
staticWado,
|
||||||
singlepart,
|
singlepart,
|
||||||
|
omitQuotationForMultipartRequest,
|
||||||
|
acceptHeader,
|
||||||
|
requestTransferSyntaxUID,
|
||||||
} = dicomWebConfig;
|
} = dicomWebConfig;
|
||||||
|
|
||||||
const dicomWebConfigCopy = JSON.parse(JSON.stringify(dicomWebConfig));
|
const dicomWebConfigCopy = JSON.parse(JSON.stringify(dicomWebConfig));
|
||||||
|
|
||||||
|
const getAuthrorizationHeader = () => {
|
||||||
|
const xhrRequestHeaders = {};
|
||||||
|
const authHeaders = userAuthenticationService.getAuthorizationHeader();
|
||||||
|
if (authHeaders && authHeaders.Authorization) {
|
||||||
|
xhrRequestHeaders.Authorization = authHeaders.Authorization;
|
||||||
|
}
|
||||||
|
return xhrRequestHeaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
const generateWadoHeader = () => {
|
||||||
|
let authorizationHeader = getAuthrorizationHeader();
|
||||||
|
//Generate accept header depending on config params
|
||||||
|
let formattedAcceptHeader = utils.generateAcceptHeader(
|
||||||
|
acceptHeader,
|
||||||
|
requestTransferSyntaxUID,
|
||||||
|
omitQuotationForMultipartRequest
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...authorizationHeader,
|
||||||
|
Accept: formattedAcceptHeader,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const qidoConfig = {
|
const qidoConfig = {
|
||||||
url: qidoRoot,
|
url: qidoRoot,
|
||||||
staticWado,
|
staticWado,
|
||||||
singlepart,
|
singlepart,
|
||||||
headers: userAuthenticationService.getAuthorizationHeader(),
|
headers: getAuthrorizationHeader(),
|
||||||
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +103,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
url: wadoRoot,
|
url: wadoRoot,
|
||||||
staticWado,
|
staticWado,
|
||||||
singlepart,
|
singlepart,
|
||||||
headers: userAuthenticationService.getAuthorizationHeader(),
|
headers: generateWadoHeader(),
|
||||||
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,11 +137,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
studies: {
|
studies: {
|
||||||
mapParams: mapParams.bind(),
|
mapParams: mapParams.bind(),
|
||||||
search: async function(origParams) {
|
search: async function(origParams) {
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
qidoDicomWebClient.headers = getAuthrorizationHeader();
|
||||||
if (headers) {
|
|
||||||
qidoDicomWebClient.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { studyInstanceUid, seriesInstanceUid, ...mappedParams } =
|
const { studyInstanceUid, seriesInstanceUid, ...mappedParams } =
|
||||||
mapParams(origParams, {
|
mapParams(origParams, {
|
||||||
supportsFuzzyMatching,
|
supportsFuzzyMatching,
|
||||||
@ -135,11 +158,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
series: {
|
series: {
|
||||||
// mapParams: mapParams.bind(),
|
// mapParams: mapParams.bind(),
|
||||||
search: async function(studyInstanceUid) {
|
search: async function(studyInstanceUid) {
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
qidoDicomWebClient.headers = getAuthrorizationHeader();
|
||||||
if (headers) {
|
|
||||||
qidoDicomWebClient.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = await seriesInStudy(
|
const results = await seriesInStudy(
|
||||||
qidoDicomWebClient,
|
qidoDicomWebClient,
|
||||||
studyInstanceUid
|
studyInstanceUid
|
||||||
@ -151,11 +170,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
},
|
},
|
||||||
instances: {
|
instances: {
|
||||||
search: (studyInstanceUid, queryParameters) => {
|
search: (studyInstanceUid, queryParameters) => {
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
qidoDicomWebClient.headers = getAuthrorizationHeader();
|
||||||
if (headers) {
|
|
||||||
qidoDicomWebClient.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
qidoSearch.call(
|
qidoSearch.call(
|
||||||
undefined,
|
undefined,
|
||||||
qidoDicomWebClient,
|
qidoDicomWebClient,
|
||||||
@ -182,6 +197,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
return getDirectURL({ wadoRoot, singlepart }, params);
|
return getDirectURL({ wadoRoot, singlepart }, params);
|
||||||
},
|
},
|
||||||
bulkDataURI: async ({ StudyInstanceUID, BulkDataURI }) => {
|
bulkDataURI: async ({ StudyInstanceUID, BulkDataURI }) => {
|
||||||
|
qidoDicomWebClient.headers = getAuthrorizationHeader();
|
||||||
const options = {
|
const options = {
|
||||||
multipart: false,
|
multipart: false,
|
||||||
BulkDataURI,
|
BulkDataURI,
|
||||||
@ -200,11 +216,6 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
sortFunction,
|
sortFunction,
|
||||||
madeInClient = false,
|
madeInClient = false,
|
||||||
} = {}) => {
|
} = {}) => {
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
|
||||||
if (headers) {
|
|
||||||
wadoDicomWebClient.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StudyInstanceUID) {
|
if (!StudyInstanceUID) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Unable to query for SeriesMetadata without StudyInstanceUID'
|
'Unable to query for SeriesMetadata without StudyInstanceUID'
|
||||||
@ -234,17 +245,12 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
|
|
||||||
store: {
|
store: {
|
||||||
dicom: async (dataset, request) => {
|
dicom: async (dataset, request) => {
|
||||||
const headers = userAuthenticationService.getAuthorizationHeader();
|
wadoDicomWebClient.headers = generateWadoHeader();
|
||||||
if (headers) {
|
|
||||||
wadoDicomWebClient.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataset instanceof ArrayBuffer) {
|
if (dataset instanceof ArrayBuffer) {
|
||||||
const options = {
|
const options = {
|
||||||
datasets: [dataset],
|
datasets: [dataset],
|
||||||
request,
|
request,
|
||||||
};
|
};
|
||||||
|
|
||||||
await wadoDicomWebClient.storeInstances(options);
|
await wadoDicomWebClient.storeInstances(options);
|
||||||
} else {
|
} else {
|
||||||
const meta = {
|
const meta = {
|
||||||
@ -282,7 +288,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
madeInClient
|
madeInClient
|
||||||
) => {
|
) => {
|
||||||
const enableStudyLazyLoad = false;
|
const enableStudyLazyLoad = false;
|
||||||
|
wadoDicomWebClient.headers = generateWadoHeader();
|
||||||
// data is all SOPInstanceUIDs
|
// data is all SOPInstanceUIDs
|
||||||
const data = await retrieveStudyMetadata(
|
const data = await retrieveStudyMetadata(
|
||||||
wadoDicomWebClient,
|
wadoDicomWebClient,
|
||||||
@ -353,6 +359,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
|
|||||||
madeInClient = false
|
madeInClient = false
|
||||||
) => {
|
) => {
|
||||||
const enableStudyLazyLoad = true;
|
const enableStudyLazyLoad = true;
|
||||||
|
wadoDicomWebClient.headers = generateWadoHeader();
|
||||||
// Get Series
|
// Get Series
|
||||||
const {
|
const {
|
||||||
preLoadData: seriesSummaryMetadata,
|
preLoadData: seriesSummaryMetadata,
|
||||||
|
|||||||
@ -4,7 +4,7 @@ window.config = {
|
|||||||
modes: [],
|
modes: [],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -30,6 +30,7 @@ window.config = {
|
|||||||
supportsFuzzyMatching: false,
|
supportsFuzzyMatching: false,
|
||||||
supportsWildcard: false,
|
supportsWildcard: false,
|
||||||
staticWado: true,
|
staticWado: true,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,6 @@ window.config = {
|
|||||||
// some windows systems have issues with more than 3 web workers
|
// some windows systems have issues with more than 3 web workers
|
||||||
maxNumberOfWebWorkers: 3,
|
maxNumberOfWebWorkers: 3,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -51,7 +50,6 @@ window.config = {
|
|||||||
wadoUriRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
wadoUriRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
||||||
qidoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
qidoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
||||||
wadoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
wadoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
|
||||||
|
|
||||||
qidoSupportsIncludeField: false,
|
qidoSupportsIncludeField: false,
|
||||||
supportsReject: false,
|
supportsReject: false,
|
||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
@ -68,6 +66,7 @@ window.config = {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
relativeResolution: 'studies',
|
relativeResolution: 'studies',
|
||||||
},
|
},
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ window.config = {
|
|||||||
extensions: [],
|
extensions: [],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
strictZSpacingForVolumeViewport: true,
|
strictZSpacingForVolumeViewport: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
@ -25,6 +24,7 @@ window.config = {
|
|||||||
bulkDataURI: {
|
bulkDataURI: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -4,7 +4,6 @@ window.config = {
|
|||||||
modes: [],
|
modes: [],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -28,6 +27,7 @@ window.config = {
|
|||||||
enableStudyLazyLoad: true,
|
enableStudyLazyLoad: true,
|
||||||
supportsFuzzyMatching: false,
|
supportsFuzzyMatching: false,
|
||||||
supportsWildcard: false,
|
supportsWildcard: false,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,6 @@ window.config = {
|
|||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
maxNumberOfWebWorkers: 3,
|
maxNumberOfWebWorkers: 3,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -31,6 +30,7 @@ window.config = {
|
|||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
staticWado: true,
|
staticWado: true,
|
||||||
singlepart: 'bulkdata,video,pdf',
|
singlepart: 'bulkdata,video,pdf',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ window.config = {
|
|||||||
extensions: [],
|
extensions: [],
|
||||||
modes: [],
|
modes: [],
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -23,6 +22,7 @@ window.config = {
|
|||||||
qidoSupportsIncludeField: false,
|
qidoSupportsIncludeField: false,
|
||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
thumbnailRendering: 'wadors',
|
thumbnailRendering: 'wadors',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,6 @@ window.config = {
|
|||||||
routerBasename: '/',
|
routerBasename: '/',
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -18,6 +17,7 @@ window.config = {
|
|||||||
qidoSupportsIncludeField: false,
|
qidoSupportsIncludeField: false,
|
||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
thumbnailRendering: 'wadors',
|
thumbnailRendering: 'wadors',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
// REQUIRED TAG:
|
// REQUIRED TAG:
|
||||||
// TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version
|
// TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version
|
||||||
// requestOptions: {
|
// requestOptions: {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ window.config = {
|
|||||||
extensions: [],
|
extensions: [],
|
||||||
modes: [],
|
modes: [],
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -23,6 +23,7 @@ window.config = {
|
|||||||
qidoSupportsIncludeField: false,
|
qidoSupportsIncludeField: false,
|
||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
thumbnailRendering: 'wadors',
|
thumbnailRendering: 'wadors',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ window.config = {
|
|||||||
modes: ['@ohif/mode-test'],
|
modes: ['@ohif/mode-test'],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
maxNumberOfWebWorkers: 3,
|
maxNumberOfWebWorkers: 3,
|
||||||
showWarningMessageForCrossOrigin: false,
|
showWarningMessageForCrossOrigin: false,
|
||||||
showCPUFallbackMessage: false,
|
showCPUFallbackMessage: false,
|
||||||
@ -31,6 +30,7 @@ window.config = {
|
|||||||
supportsFuzzyMatching: false,
|
supportsFuzzyMatching: false,
|
||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
singlepart: 'video,thumbnail,pdf',
|
singlepart: 'video,thumbnail,pdf',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,6 @@ window.config = {
|
|||||||
},
|
},
|
||||||
enableGoogleCloudAdapter: false,
|
enableGoogleCloudAdapter: false,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -55,6 +54,7 @@ window.config = {
|
|||||||
supportsFuzzyMatching: true,
|
supportsFuzzyMatching: true,
|
||||||
supportsWildcard: false,
|
supportsWildcard: false,
|
||||||
dicomUploadEnabled: true,
|
dicomUploadEnabled: true,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,6 @@ window.config = {
|
|||||||
routerBasename: '/',
|
routerBasename: '/',
|
||||||
enableGoogleCloudAdapter: true,
|
enableGoogleCloudAdapter: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
|
|||||||
@ -8,7 +8,6 @@ window.config = {
|
|||||||
extensions: [],
|
extensions: [],
|
||||||
modes: [],
|
modes: [],
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -39,6 +38,7 @@ window.config = {
|
|||||||
bulkDataURI: {
|
bulkDataURI: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,7 +8,6 @@ window.config = {
|
|||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
maxNumberOfWebWorkers: 4,
|
maxNumberOfWebWorkers: 4,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -33,6 +32,7 @@ window.config = {
|
|||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
staticWado: true,
|
staticWado: true,
|
||||||
singlepart: 'bulkdata,video,pdf',
|
singlepart: 'bulkdata,video,pdf',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,7 +16,6 @@ window.config = {
|
|||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
maxNumberOfWebWorkers: 4,
|
maxNumberOfWebWorkers: 4,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -42,6 +41,7 @@ window.config = {
|
|||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
staticWado: true,
|
staticWado: true,
|
||||||
singlepart: 'bulkdata,video,pdf',
|
singlepart: 'bulkdata,video,pdf',
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ window.config = {
|
|||||||
modes: [],
|
modes: [],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -38,6 +37,7 @@ window.config = {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
relativeResolution: 'studies',
|
relativeResolution: 'studies',
|
||||||
},
|
},
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,6 @@ window.config = {
|
|||||||
routerBasename: '/',
|
routerBasename: '/',
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
omitQuotationForMultipartRequest: true,
|
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
@ -18,6 +17,7 @@ window.config = {
|
|||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
thumbnailRendering: 'wadors',
|
thumbnailRendering: 'wadors',
|
||||||
supportsFuzzyMatching: true,
|
supportsFuzzyMatching: true,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
58
platform/core/src/utils/generateAcceptHeader.ts
Normal file
58
platform/core/src/utils/generateAcceptHeader.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
const generateAcceptHeader = (
|
||||||
|
configAcceptHeader = [],
|
||||||
|
requestTransferSyntaxUID = null,
|
||||||
|
omitQuotationForMultipartRequest = false
|
||||||
|
): string[] => {
|
||||||
|
//if acceptedHeader is passed by config use it as it.
|
||||||
|
if (configAcceptHeader.length > 0) {
|
||||||
|
return configAcceptHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
let acceptHeader = ['multipart/related'];
|
||||||
|
if (requestTransferSyntaxUID && typeForTS[requestTransferSyntaxUID]) {
|
||||||
|
const type = typeForTS[requestTransferSyntaxUID];
|
||||||
|
acceptHeader.push('type=' + type);
|
||||||
|
acceptHeader.push('transfer-syntax=' + requestTransferSyntaxUID);
|
||||||
|
} else {
|
||||||
|
acceptHeader.push('type=application/octet-stream');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!omitQuotationForMultipartRequest) {
|
||||||
|
//need to add quotation for each mime type of each accept entry
|
||||||
|
acceptHeader = acceptHeader.map(mime => {
|
||||||
|
if (mime.startsWith('type=')) {
|
||||||
|
const quotedParam = 'type="' + mime.substring(5, mime.length) + '"';
|
||||||
|
return quotedParam;
|
||||||
|
}
|
||||||
|
if (mime.startsWith('transfer-syntax=')) {
|
||||||
|
const quotedParam =
|
||||||
|
'transfer-syntax="' + mime.substring(16, mime.length) + '"';
|
||||||
|
return quotedParam;
|
||||||
|
} else {
|
||||||
|
return mime;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return [acceptHeader.join('; ')];
|
||||||
|
};
|
||||||
|
|
||||||
|
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',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default generateAcceptHeader;
|
||||||
@ -13,6 +13,7 @@ import Queue from './Queue';
|
|||||||
import isDicomUid from './isDicomUid';
|
import isDicomUid from './isDicomUid';
|
||||||
import formatDate from './formatDate';
|
import formatDate from './formatDate';
|
||||||
import formatPN from './formatPN';
|
import formatPN from './formatPN';
|
||||||
|
import generateAcceptHeader from './generateAcceptHeader';
|
||||||
import resolveObjectPath from './resolveObjectPath';
|
import resolveObjectPath from './resolveObjectPath';
|
||||||
import hierarchicalListUtils from './hierarchicalListUtils';
|
import hierarchicalListUtils from './hierarchicalListUtils';
|
||||||
import progressTrackingUtils from './progressTrackingUtils';
|
import progressTrackingUtils from './progressTrackingUtils';
|
||||||
@ -74,6 +75,7 @@ const utils = {
|
|||||||
subscribeToNextViewportGridChange,
|
subscribeToNextViewportGridChange,
|
||||||
splitComma,
|
splitComma,
|
||||||
getSplitParam,
|
getSplitParam,
|
||||||
|
generateAcceptHeader,
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@ -105,6 +107,7 @@ export {
|
|||||||
downloadCSVReport,
|
downloadCSVReport,
|
||||||
splitComma,
|
splitComma,
|
||||||
getSplitParam,
|
getSplitParam,
|
||||||
|
generateAcceptHeader,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default utils;
|
export default utils;
|
||||||
|
|||||||
@ -24,6 +24,7 @@ describe('Top level exports', () => {
|
|||||||
'b64toBlob',
|
'b64toBlob',
|
||||||
'formatDate',
|
'formatDate',
|
||||||
'formatPN',
|
'formatPN',
|
||||||
|
'generateAcceptHeader',
|
||||||
'isEqualWithin',
|
'isEqualWithin',
|
||||||
//'loadAndCacheDerivedDisplaySets',
|
//'loadAndCacheDerivedDisplaySets',
|
||||||
'isDisplaySetReconstructable',
|
'isDisplaySetReconstructable',
|
||||||
|
|||||||
@ -48,6 +48,7 @@ window.config = {
|
|||||||
enableStudyLazyLoad: true,
|
enableStudyLazyLoad: true,
|
||||||
supportsFuzzyMatching: true,
|
supportsFuzzyMatching: true,
|
||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -97,6 +98,7 @@ window.config = ({ servicesManager } = {}) => {
|
|||||||
enableStudyLazyLoad: true,
|
enableStudyLazyLoad: true,
|
||||||
supportsFuzzyMatching: true,
|
supportsFuzzyMatching: true,
|
||||||
supportsWildcard: true,
|
supportsWildcard: true,
|
||||||
|
omitQuotationForMultipartRequest: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -112,6 +114,8 @@ Here are a list of some options available:
|
|||||||
- `maxNumberOfWebWorkers`: The maximum number of web workers to use for
|
- `maxNumberOfWebWorkers`: The maximum number of web workers to use for
|
||||||
decoding. Defaults to minimum of `navigator.hardwareConcurrency` and
|
decoding. Defaults to minimum of `navigator.hardwareConcurrency` and
|
||||||
what is specified by `maxNumberOfWebWorkers`. Some windows machines require smaller values.
|
what is specified by `maxNumberOfWebWorkers`. Some windows machines require smaller values.
|
||||||
|
- `acceptHeader` : accept header to request specific dicom transfer syntax ex : [ 'multipart/related; type=image/jls; q=1', 'multipart/related; type=application/octet-stream; q=0.1' ]
|
||||||
|
- `requestTransferSyntaxUID` : Request a specific Tansfer syntax from dicom web server ex: 1.2.840.10008.1.2.4.80 (applyed only if acceptHeader is not set)
|
||||||
- `omitQuotationForMultipartRequest`: Some servers (e.g., .NET) require the `multipart/related` request to be sent without quotation marks. Defaults to `false`. If your server doesn't require this, then setting this flag to `true` might improve performance (by removing the need for preflight requests). Also note that
|
- `omitQuotationForMultipartRequest`: Some servers (e.g., .NET) require the `multipart/related` request to be sent without quotation marks. Defaults to `false`. If your server doesn't require this, then setting this flag to `true` might improve performance (by removing the need for preflight requests). Also note that
|
||||||
if auth headers are used, a preflight request is required.
|
if auth headers are used, a preflight request is required.
|
||||||
- `maxNumRequests`: The maximum number of requests to allow in parallel. It is an object with keys of `interaction`, `thumbnail`, and `prefetch`. You can specify a specific number for each type.
|
- `maxNumRequests`: The maximum number of requests to allow in parallel. It is an object with keys of `interaction`, `thumbnail`, and `prefetch`. You can specify a specific number for each type.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user