From 9fd1fc61a872e97e5dd0575eea0513f949aeba78 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 17 Feb 2021 15:36:25 +0000 Subject: [PATCH] . --- anatomy/static/js/anatomy.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/anatomy/static/js/anatomy.js b/anatomy/static/js/anatomy.js index 03126ba2..6b8a2b44 100644 --- a/anatomy/static/js/anatomy.js +++ b/anatomy/static/js/anatomy.js @@ -75,15 +75,16 @@ $(document).ready(function () { }); window.loadDicomViewerEvent = new Event('loadDicomViewer'); -window.addEventListener('loadDicomViewer', function (e) { - console.log("listen", e.detail) +window.addEventListener('loadDicomViewer', function (e) { + //console.log("listen", e.detail) let images = []; - console.log($("#image_form_set img")); - $("#image_form_set img").each((n, el) => { + //console.log($("#image_form_set img")); + $(e.detail).each((n, el) => { images.push($(el).attr("src")); - } ); - console.log("listen2", images) - loadDicomViewer(images); }, false); + }); + //console.log("listen2", images) + loadDicomViewer(images); +}, false); function loadDicomViewer(images_to_load) { console.log("loadDicomViewer", images_to_load); @@ -105,9 +106,15 @@ function loadDicomViewer(images_to_load) { 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, true); + dicomViewer.loadCornerstone($(single_dicom), null, images, annotations, load_as_stack); } } } @@ -365,9 +372,9 @@ function keyDownHandler(e) { function create_popup_window(url, title) { - newwindow=window.open(url,title,'height=800,width=600'); - if (window.focus) {newwindow.focus()} - return false; + newwindow = window.open(url, title, 'height=800,width=600'); + if (window.focus) { newwindow.focus() } + return false; } window.create_popup_window = create_popup_window \ No newline at end of file