add the ability to load by imageid

This commit is contained in:
Ross
2024-10-07 08:55:36 +01:00
parent 5ceacc441d
commit 174c7a444f
3 changed files with 12 additions and 2 deletions
+6
View File
@@ -1220,6 +1220,12 @@ export function loadStackIndex(new_index, dicom_element) {
//c = cornerstone.getEnabledElement(dicom_element) //c = cornerstone.getEnabledElement(dicom_element)
} }
export function loadImageById(imageId, dicom_element) {
cornerstone.loadImage(imageId).then(b => {
cornerstone.displayImage(dicom_element, b);
});
}
function urltoFile(url, filename, mimeType) { function urltoFile(url, filename, mimeType) {
return fetch(url) return fetch(url)
.then(function (res) { .then(function (res) {
+3 -1
View File
@@ -24,11 +24,13 @@
<main> <main>
<h1>A dicom viewer</h1> <h1>A dicom viewer</h1>
<div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/1.jpg","test_images/IMG1.dcm"]' data-annotations=""></div></div>
<!-- <div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm","test_images/IMG1.dcm"]' data-annotations='[&quot;{\&quot;ArrowAnnotate\&quot;:{\&quot;data\&quot;:[{\&quot;visible\&quot;:true,\&quot;active\&quot;:false,\&quot;handles\&quot;:{\&quot;start\&quot;:{\&quot;x\&quot;:450.01249999999993,\&quot;y\&quot;:592.8031510416666,\&quot;highlight\&quot;:true,\&quot;active\&quot;:false},\&quot;end\&quot;:{\&quot;x\&quot;:283.38750000000005,\&quot;y\&quot;:343.976484375,\&quot;highlight\&quot;:true,\&quot;active\&quot;:false,\&quot;moving\&quot;:false},\&quot;textBox\&quot;:{\&quot;active\&quot;:false,\&quot;hasMoved\&quot;:false,\&quot;movesIndependently\&quot;:false,\&quot;drawnIndependently\&quot;:true,\&quot;allowedOutsideImage\&quot;:true,\&quot;hasBoundingBox\&quot;:true}},\&quot;uuid\&quot;:\&quot;51ca68b0-734c-4046-b3da-dd2886496fd5\&quot;,\&quot;invalidated\&quot;:true}]}}&quot;, null]'></div></div> --> <!-- <div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm","test_images/IMG1.dcm"]' data-annotations='[&quot;{\&quot;ArrowAnnotate\&quot;:{\&quot;data\&quot;:[{\&quot;visible\&quot;:true,\&quot;active\&quot;:false,\&quot;handles\&quot;:{\&quot;start\&quot;:{\&quot;x\&quot;:450.01249999999993,\&quot;y\&quot;:592.8031510416666,\&quot;highlight\&quot;:true,\&quot;active\&quot;:false},\&quot;end\&quot;:{\&quot;x\&quot;:283.38750000000005,\&quot;y\&quot;:343.976484375,\&quot;highlight\&quot;:true,\&quot;active\&quot;:false,\&quot;moving\&quot;:false},\&quot;textBox\&quot;:{\&quot;active\&quot;:false,\&quot;hasMoved\&quot;:false,\&quot;movesIndependently\&quot;:false,\&quot;drawnIndependently\&quot;:true,\&quot;allowedOutsideImage\&quot;:true,\&quot;hasBoundingBox\&quot;:true}},\&quot;uuid\&quot;:\&quot;51ca68b0-734c-4046-b3da-dd2886496fd5\&quot;,\&quot;invalidated\&quot;:true}]}}&quot;, null]'></div></div> -->
<div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm", "test_images/IMG2.dcm", "test_images/IMG3.dcm", "test_images/IMG4.dcm", "test_images/IMG5.dcm", "test_images/IMG6.dcm"]' data-annotations=''></div> <!-- <div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm", "test_images/IMG2.dcm", "test_images/IMG3.dcm", "test_images/IMG4.dcm", "test_images/IMG5.dcm", "test_images/IMG6.dcm"]' data-annotations=''></div> -->
<!-- <div id="dicom-viewer2" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm", "test_images/IMG2.dcm", "test_images/IMG3.dcm", "test_images/IMG4.dcm", "test_images/IMG5.dcm", "test_images/IMG6.dcm"]' data-annotations=''></div> --> <!-- <div id="dicom-viewer2" class="dicom-viewer" style="height: 600px;" data-images='["test_images/IMG1.dcm", "test_images/IMG2.dcm", "test_images/IMG3.dcm", "test_images/IMG4.dcm", "test_images/IMG5.dcm", "test_images/IMG6.dcm"]' data-annotations=''></div> -->
<!-- <div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/CXR.dcm"]' data-annotations=''></div></div> --> <!-- <div id="dicom-viewer" class="dicom-viewer" style="height: 600px;" data-images='["test_images/CXR.dcm"]' data-annotations=''></div></div> -->
</main> </main>
<footer></footer> <footer></footer>
</body> </body>
+3 -1
View File
@@ -79,4 +79,6 @@ function loadDicomViewer(images_to_load, annotations_to_load) {
dicomViewer.loadCornerstone($(single_dicom2), null, images, annotations, load_as_stack); dicomViewer.loadCornerstone($(single_dicom2), null, images, annotations, load_as_stack);
} }
} }
} }
window.dicomViewer = dicomViewer;