import * as dicomViewer from "./dicomViewer.js" $(document).ready(function () { loadDicomViewer(); }); function loadDicomViewer(images_to_load, annotations_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; } else { images = JSON.parse(images); } console.log(images); let annotations = single_dicom.dataset.annotations; if (annotations_to_load != undefined) { annotations = annotations_to_load; } else if (annotations && annotations.indexOf(",") > 0) { console.log("annon2", annotations) annotations = JSON.parse(annotations); } else { annotations = undefined; } console.log("annon1", 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); } } let single_dicom2 = document.getElementById("dicom-viewer2"); if (single_dicom2) { let images = single_dicom2.dataset.images; if (images_to_load != undefined) { images = images_to_load; } else { images = JSON.parse(images); } console.log(images); let annotations = single_dicom2.dataset.annotations; if (annotations_to_load != undefined) { annotations = annotations_to_load; } else if (annotations && annotations.indexOf(",") > 0) { console.log("annon2", annotations) annotations = JSON.parse(annotations); } else { annotations = undefined; } console.log("annon1", annotations) let load_as_stack; if (images.length > 5) { load_as_stack = true; } else { load_as_stack = false; } if (images) { dicomViewer.loadCornerstone($(single_dicom2), null, images, annotations, load_as_stack); } } }