This commit is contained in:
Ross
2025-06-09 13:53:01 +01:00
parent e922a93a25
commit d66783b2b8
4 changed files with 125 additions and 96 deletions
@@ -419,15 +419,40 @@
annotationjson = JSON.parse(viewer_element.dataset.annotationjson);
viewport = JSON.parse(viewer_element.dataset.viewportjson);
current_image_id_index = viewer_element.dataset.currentimageid;
console.log(viewer_element.dataset.annotationjson3d)
console.log(viewer_element.dataset.viewerstate3d)
load_3d = false;
viewer_element_3d = document.getElementById('root');
if (viewer_element_3d.dataset.viewerstate3d != undefined) {
load_3d = true;
viewerState = JSON.parse(viewer_element_3d.dataset.viewerstate3d || {});
annotationjson3d = JSON.parse(viewer_element_3d.dataset.annotationjson3d || {});
} else {
viewer_element_3d = null;
}
dicom_element = $(".cornerstone-element").get(0);
// We have a slight delay to allow the viewer to load
setTimeout(function () {
// Then we load the annotation and viewport
loadAnnotationAndViewportOnElement(annotationjson, viewport, dicom_element, current_image_id_index);
window.mountDicomViewers();
if (load_3d) {
console.log("loading 3d")
//setTimeout(function () {
// console.log("loading 3d annotation")
// importAnnotations_root(annotationjson3d)
// importViewerState_root(viewerState);
//}, 1000);
} else {
console.log("not loading 3d")
}
}, 200);
document.getElementById("reload-finding").addEventListener("click", function () {
loadAnnotationAndViewportOnElement(annotationjson, viewport, dicom_element, current_image_id_index);
importAnnotations_root(annotationjson3d)
importViewerState_root(viewerState);
});
// Initialize the DICOM viewer with the images and annotations
@@ -23,5 +23,9 @@
<div id="single-dicom-viewer" class="dicom-viewer" data-images='{{ image_url_array_and_count.0 }}' data-annotations='' data-annotationjson={{finding.annotation_json}}
data-viewportjson={{finding.viewport_json}} data-findingid={{finding.id}} data-currentimageid={{finding.current_image_id_index}}>
</div>
<div id="root" class="dicom-viewer-root" data-images="{{ image_url_array_and_count.0 }}"
style="height: 600px; box-sizing: border-box; background: #222;"
data-annotationjson='{{ finding.annotation_json_3d }}' data-viewerstate='{{ finding.viewer_state_3d }}'
></div>
{% endwith %}
</div>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -70,7 +70,7 @@
<script src="{% static 'js/cornerstone/cornerstoneWADOImageLoader.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone-base64-image-loader.umd.js' %}"></script>
<script src="{% static 'js/anatomy.js' %}" defer="defer" type="module"></script>
<script src="{% static 'dv3d/index-DwrZLsZY.js' %}" type="module" defer="defer" type="module"></script>
<script src="{% static 'dv3d/index-Drikhvya.js' %}" type="module" defer="defer" type="module"></script>
{% block js %}
{% endblock %}