fix loading in some situations
This commit is contained in:
+37
-32
@@ -585,13 +585,14 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
|
||||
//});
|
||||
} else {
|
||||
let url;
|
||||
// This doesn't seem to have any benefit
|
||||
//if (data_url.startsWith("http")) {
|
||||
// url = data_url;
|
||||
//} else {
|
||||
// url = window.location.href.replace(/\/\#\/?$/, '') + "/" + data_url
|
||||
//}
|
||||
url = data_url;
|
||||
// Cornerstone needs the whole url to load? (not relative)
|
||||
if (data_url.startsWith("http")) {
|
||||
url = data_url;
|
||||
} else {
|
||||
url = window.location.href.replace(/\/\#\/?$/, '').replace("index.html", "") + "/" + data_url
|
||||
}
|
||||
//url = data_url;
|
||||
|
||||
|
||||
if (url.endsWith("dcm")) {
|
||||
url = "wadouri:" + url;
|
||||
@@ -618,7 +619,11 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
|
||||
|
||||
//console.log("LOAD and cache, then", image);
|
||||
loadCornerstoneMainImage(element, image, stack, db, load_as_stack);
|
||||
checkAnonStatus(image.data)
|
||||
|
||||
// We can only check dicom data if it exists (e.g. not on jpegs)
|
||||
if (image.data != undefined) {
|
||||
checkAnonStatus(image.data)
|
||||
}
|
||||
|
||||
let load_annotation_image = true;
|
||||
if (load_annotation_image) {
|
||||
@@ -1277,34 +1282,34 @@ export function getNextAnnotationImage(element) {
|
||||
}
|
||||
|
||||
function manualScrollDicom(n, dicom_element) {
|
||||
// There must be a better way to do this...
|
||||
//dicom_element = document.getElementById("dicom-image");
|
||||
let c = cornerstone.getEnabledElement(dicom_element);
|
||||
// There must be a better way to do this...
|
||||
//dicom_element = document.getElementById("dicom-image");
|
||||
let c = cornerstone.getEnabledElement(dicom_element);
|
||||
|
||||
let max = c.toolStateManager.toolState.stack.data[0].imageIds.length;
|
||||
let max = c.toolStateManager.toolState.stack.data[0].imageIds.length;
|
||||
|
||||
if (max < 2) {
|
||||
return;
|
||||
}
|
||||
if (max < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
let current_index =
|
||||
c.toolStateManager.toolState.stack.data[0].currentImageIdIndex;
|
||||
let current_index =
|
||||
c.toolStateManager.toolState.stack.data[0].currentImageIdIndex;
|
||||
|
||||
let new_index = current_index + n
|
||||
|
||||
let corrected_index = Math.min(Math.max(new_index, 0), max)
|
||||
let new_index = current_index + n
|
||||
|
||||
// TODO: if loop
|
||||
//if (new_index >= max) {
|
||||
// corrected_index = new_index - max;
|
||||
//} else if (new_index < 0) {
|
||||
// corrected_index = new_index + max;
|
||||
//}
|
||||
let corrected_index = Math.min(Math.max(new_index, 0), max)
|
||||
|
||||
c.toolStateManager.toolState.stack.data[0].currentImageIdIndex = corrected_index;
|
||||
let id = c.toolStateManager.toolState.stack.data[0].imageIds[corrected_index];
|
||||
cornerstone.loadImage(id).then((b) => {
|
||||
cornerstone.displayImage(dicom_element, b);
|
||||
});
|
||||
// c = cornerstone.getEnabledElement(dicom_element)
|
||||
// TODO: if loop
|
||||
//if (new_index >= max) {
|
||||
// corrected_index = new_index - max;
|
||||
//} else if (new_index < 0) {
|
||||
// corrected_index = new_index + max;
|
||||
//}
|
||||
|
||||
c.toolStateManager.toolState.stack.data[0].currentImageIdIndex = corrected_index;
|
||||
let id = c.toolStateManager.toolState.stack.data[0].imageIds[corrected_index];
|
||||
cornerstone.loadImage(id).then((b) => {
|
||||
cornerstone.displayImage(dicom_element, b);
|
||||
});
|
||||
// c = cornerstone.getEnabledElement(dicom_element)
|
||||
}
|
||||
Reference in New Issue
Block a user