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