Skip to content
Open
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
11 changes: 10 additions & 1 deletion extensions/cornerstone/src/initWADOImageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function initWADOImageLoader(
use16BitDataType:
Boolean(appConfig.useNorm16Texture) || Boolean(appConfig.preferSizeOverAccuracy),
},
beforeSend: function (xhr) {
beforeSend: function (xhr, imageId) {
//TODO should be removed in the future and request emitted by DicomWebDataSource
const sourceConfig = extensionManager.getActiveDataSource()?.[0].getConfig() ?? {};
const headers = userAuthenticationService.getAuthorizationHeader();
Expand All @@ -70,6 +70,15 @@ export default function initWADOImageLoader(
Object.assign(xhrRequestHeaders, headers);
}

const instance = cornerstone.metaData.get('instance', imageId);
const { CustomOffsetTable, CustomOffsetTableLengths, FileOffsets } = instance;
if (FileOffsets && !(CustomOffsetTable && CustomOffsetTableLengths)) {
// A seperate logic is used if offset tables are present in cornerstone3D.
const { startByte, endByte } = instance.FileOffsets;
const rangeHeader = { Range: `bytes=${startByte}-${endByte}` };
Object.assign(xhrRequestHeaders, rangeHeader);
}

return xhrRequestHeaders;
},
errorInterceptor: error => {
Expand Down