diff --git a/anatomy/models.py b/anatomy/models.py index c6290a4d..3dd13c60 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -196,6 +196,10 @@ class AnatomyQuestion(models.Model): marked_answers = correct_answers | half_mark_answers | incorrect_answers return marked_answers + def get_annotations(self): + return self.image_annotations + + class Answer(models.Model): question = models.ForeignKey( diff --git a/anatomy/static/js/anatomy.js b/anatomy/static/js/anatomy.js index 043271c6..4337b5f8 100644 --- a/anatomy/static/js/anatomy.js +++ b/anatomy/static/js/anatomy.js @@ -53,8 +53,17 @@ $(document).ready(function () { let single_dicom = document.getElementById("single-dicom-viewer"); if (single_dicom) { - let images = single_dicom.dataset.images.split(","); - let annotations = single_dicom.dataset.annotations.split(","); + + let images = single_dicom.dataset.images; + if (images.indexOf(",") > 0) { + images = images.split(","); + } + + let annotations = single_dicom.dataset.annotations; + if (annotations != undefined && annotations.indexOf(",") > 0) { + annotations = annotations; + } + dicomViewer.loadCornerstone($(single_dicom), null, images, annotations); } @@ -112,24 +121,6 @@ function prepAnswerData() { $("#id_marked_answers").val(JSON.stringify(window.marked_answers)); } -function getJsonToolStateNoId() { - const el = document.getElementById("dicom-image"); - - const c = cornerstone.getEnabledElement(el); - - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - - const image_id = c.image.imageId; - - const state_with_id = toolStateManager.saveToolState() - - const json_tool_state = JSON.stringify(state_with_id[image_id]); - - return json_tool_state; - -} - - function loadJsonToolStateOnCurrentImage(json) { let el = document.getElementById("dicom-image"); diff --git a/anatomy/templates/anatomy/mark.html b/anatomy/templates/anatomy/mark.html index 6aecbf83..943718ff 100644 --- a/anatomy/templates/anatomy/mark.html +++ b/anatomy/templates/anatomy/mark.html @@ -5,7 +5,7 @@ Edit Admin Edit