improve modal view
This commit is contained in:
@@ -415,21 +415,22 @@
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
modalBody.innerHTML = html; // Load the fetched HTML into the modal body
|
||||
const dicomViewer = document.getElementById('single-dicom-viewer');
|
||||
const images = JSON.parse(dicomViewer.getAttribute('data-images'));
|
||||
const viewer_element = document.getElementById('single-dicom-viewer');
|
||||
const images = JSON.parse(viewer_element.getAttribute('data-images'));
|
||||
window.loadDicomViewer(images);
|
||||
annotationjson = JSON.parse(dicomViewer.dataset.annotationjson);
|
||||
viewport = JSON.parse(dicomViewer.dataset.viewportjson);
|
||||
current_image_id_index = dicomViewer.dataset.currentimageid;
|
||||
annotationjson = JSON.parse(viewer_element.dataset.annotationjson);
|
||||
viewport = JSON.parse(viewer_element.dataset.viewportjson);
|
||||
current_image_id_index = viewer_element.dataset.currentimageid;
|
||||
dicom_element = $(".cornerstone-element").get(0);
|
||||
// We have a slight delay to allow the viewer to load
|
||||
setTimeout(function () {
|
||||
console.log("loading annotation and viewport")
|
||||
// Load the annotation and viewport on the DICOM element
|
||||
// Then we load the annotation and viewport
|
||||
loadAnnotationAndViewportOnElement(annotationjson, viewport, dicom_element, current_image_id_index);
|
||||
}, 200);
|
||||
//loadAnnotationAndViewportOnElement(annotationjson, viewport, dicom_element, current_image_id_index);
|
||||
//const annotations = JSON.parse(dicomViewer.getAttribute('data-annotations'));
|
||||
console.log(images)
|
||||
|
||||
document.getElementById("reload-finding").addEventListener("click", function () {
|
||||
loadAnnotationAndViewportOnElement(annotationjson, viewport, dicom_element, current_image_id_index);
|
||||
});
|
||||
|
||||
// Initialize the DICOM viewer with the images and annotations
|
||||
})
|
||||
@@ -443,11 +444,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Clear the iframe src when the modal is closed
|
||||
document.getElementById("findingModal").addEventListener("hidden.bs.modal", function () {
|
||||
iframe.src = "";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
<div>
|
||||
<h5>Finding: {{ finding.name }}</h5>
|
||||
<p><b>Description:</b> {{ finding.description }}</p>
|
||||
{% if finding.conditions.all %}
|
||||
<p><b>Conditions:</b></p>
|
||||
@@ -18,6 +17,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<button class="btn btn-primary" id="reload-finding">Reload</button>
|
||||
|
||||
{% with image_url_array_and_count=finding.series.get_image_url_array_and_count %}
|
||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images='{{ image_url_array_and_count.0 }}' data-annotations='' data-annotationjson={{finding.annotation_json}}
|
||||
|
||||
@@ -314,26 +314,17 @@
|
||||
cornerstone.getEnabledElement(dicom_element).viewport = viewport
|
||||
cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(
|
||||
annotation);
|
||||
console.log("annotation", annotation)
|
||||
console.log("viewport", viewport)
|
||||
|
||||
//cornerstone.getEnabledElement(dicom_element).toolStateManager.restoreToolState(annotationjson)
|
||||
cornerstone.resize(dicom_element);
|
||||
console.log("current_image_id_index", current_image_id_index)
|
||||
//current_image_id_index = parseInt(current_image_id_index);
|
||||
|
||||
console.log(current_image_id_index, Number.isInteger(current_image_id_index))
|
||||
if (Number.isInteger(current_image_id_index)) {
|
||||
console.log("loading stack index")
|
||||
dicomViewer.loadStackIndex(current_image_id_index, dicom_element);
|
||||
} else {
|
||||
try {
|
||||
console.log("current_image_id_index", current_image_id_index)
|
||||
dicomViewer.loadImageById(current_image_id_index, dicom_element);
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
console.log("loading image by id failed")
|
||||
console.log("loading next annotation image")
|
||||
dicomViewer.getNextAnnotationImage(dicom_element);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user