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
33 changes: 33 additions & 0 deletions src/imageLoader/wadouri/loadImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@ function addDecache(imageLoadObject, imageId) {
};
}

window.store = {};

function updateTime(imageId, time) {
const SeriesInstanceUID = getSeriesInstanceUIDFromImageId(imageId);

if (!window.store[SeriesInstanceUID]) {
window.store[SeriesInstanceUID] = {};
}

if (!window.store[SeriesInstanceUID][imageId]) {
window.store[SeriesInstanceUID][imageId] = [time];
} else {
window.store[SeriesInstanceUID][imageId].push(time);
}
}

function getSeriesInstanceUIDFromImageId(imageId) {
const [, imageIdWithNoDicomWeb] = imageId.split('dicomweb:');
const url = new URL(imageIdWithNoDicomWeb);
const { pathname } = url;
const [emptyString, userId, SeriesInstanceUID] = pathname.split('/');

return SeriesInstanceUID;
}

function loadImageFromPromise(
dataSetPromise,
imageId,
Expand All @@ -28,6 +53,10 @@ function loadImageFromPromise(
cancelFn: undefined,
};

const startTime = performance.now();

updateTime(imageId, startTime);

imageLoadObject.promise = new Promise((resolve, reject) => {
dataSetPromise.then(
(dataSet /* , xhr*/) => {
Expand Down Expand Up @@ -58,6 +87,10 @@ function loadImageFromPromise(
callbacks.imageDoneCallback(image);
}
resolve(image);

const endTime = performance.now();

updateTime(imageId, endTime);
},
function (error) {
// Reject the error, and the dataSet
Expand Down