.
This commit is contained in:
+39
-10
@@ -791,6 +791,12 @@ function keyDownHandler(e, element) {
|
||||
}
|
||||
e.preventDefault(); // Needed to stop the default action (scroll)
|
||||
break;
|
||||
case 38: // Up
|
||||
manualScrollDicom(1, element);
|
||||
break;
|
||||
case 40: // down
|
||||
manualScrollDicom(-1, element);
|
||||
break;
|
||||
case 46: // .
|
||||
//toggleFlagged();
|
||||
break;
|
||||
@@ -1125,16 +1131,6 @@ function onImageRendered(e) {
|
||||
$(".thumb").removeClass("thumb-active");
|
||||
$("#thumb-" + stack.currentImageIdIndex).addClass("thumb-active");
|
||||
}
|
||||
//if (stack.imageIds.length > 1) {
|
||||
// $("option[value=scroll").prop("disabled", false);
|
||||
// $("option[value=scroll").prop("hidden", false);
|
||||
// $("option[value=scroll").text(
|
||||
// "scroll (" +
|
||||
// (stack.currentImageIdIndex + 1) +
|
||||
// "/" +
|
||||
// stack.imageIds.length +
|
||||
// ")"
|
||||
// );
|
||||
}
|
||||
|
||||
function stopEvent(evt) {
|
||||
@@ -1276,4 +1272,37 @@ 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);
|
||||
|
||||
let max = c.toolStateManager.toolState.stack.data[0].imageIds.length;
|
||||
|
||||
if (max < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
// 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