Files
dv/loader.js
T
2021-02-24 10:05:10 +00:00

40 lines
960 B
JavaScript

import * as dicomViewer from "./dicomViewer.js"
$(document).ready(function () {
loadDicomViewer();
});
function loadDicomViewer(images_to_load) {
console.log("loadDicomViewer", images_to_load);
let single_dicom = document.getElementById("dicom-viewer");
if (single_dicom) {
let images = single_dicom.dataset.images;
if (images_to_load != undefined) {
images = images_to_load;
console.log("i1", images)
} else if (images.indexOf(",") > 0) {
images = images.split(",");
}
console.log(images);
let annotations = single_dicom.dataset.annotations;
if (annotations != undefined && annotations.indexOf(",") > 0) {
annotations = annotations;
}
let load_as_stack;
if (images.length > 5) {
load_as_stack = true;
} else {
load_as_stack = false;
}
if (images) {
dicomViewer.loadCornerstone($(single_dicom), null, images, annotations, load_as_stack);
}
}
}