@@ -541,6 +541,10 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
loadAnnotation(imageId, annotation);
imageIds.push(imageId);
+ } else if (data_url.startsWith("base64://") || data_url.startsWith("wadouri:")) {
+ loadAnnotation(data_url, annotation);
+
+ imageIds.push(data_url);
// Treat application/octet-stream as if they are dicoms
} else if (data_url.startsWith("data:application/dicom") || data_url.startsWith("data:application/octet-stream")) {
@@ -602,6 +606,22 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
});
}
+ function loadCornerstoneThumb(image, id) {
+ let img = $("
").get(0);
+ img.id = "thumb-image-" + id;
+ img.class = "thumbnail";
+ img.title =
+ "Click on the thumbnail to view and manipulate the image.";
+ img.draggable = "false";
+ img.style = "height: 100px; width: 100px";
+ $("#thumb-" + id).append(img);
+
+ const element = document.getElementById("thumb-image-" + id);
+ cornerstone.enable(element);
+ cornerstone.displayImage(element, image);
+ cornerstone.resize(element);
+ }
+
if (images.length > 1 && load_as_stack == false) {
$(".canvas-panel").append("
");
for (let id = 0; id < images.length; id++) {
@@ -622,6 +642,8 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
let img;
+ console.log("load thumb", image_url);
+
if (image_url.startsWith("data")) {
// based (image) data url, just load the image directly
if (image_url.startsWith("data:image/")) {
@@ -647,24 +669,16 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
dfile
);
cornerstone.loadAndCacheImage(imageId).then(function (image) {
- img = $("
").get(0);
- img.id = "thumb-image-" + id;
- img.class = "thumbnail";
- img.title =
- "Click on the thumbnail to view and manipulate the image.";
- img.draggable = "false";
- img.style = "height: 100px; width: 100px";
- $("#thumb-" + id).append(img);
-
- const element = document.getElementById("thumb-image-" + id);
- cornerstone.enable(element);
- cornerstone.displayImage(element, image);
- cornerstone.resize(element);
- }); //.catch( function(error) {
+ loadCornerstoneThumb(image, id);
+ });
});
}
} else {
- if (!image_url.endsWith("dicom") && !image_url.endsWith("dcm")) {
+ if (image_url.startsWith("wadouri") || image_url.startsWith("base64")) {
+ cornerstone.loadAndCacheImage(image_url).then(function (image) {
+ loadCornerstoneThumb(image, id);
+ });
+ } else if ((!image_url.endsWith("dicom") && !image_url.endsWith("dcm"))) {
img = $("
![]()
", {
src: image_url,
id: "thumb-image-" + id,
@@ -680,21 +694,8 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
} else {
let url = "wadouri:" + image_url;
- console.log(url)
cornerstone.loadAndCacheImage(url).then(function (image) {
- img = $("
").get(0);
- img.id = "thumb-image-" + id;
- img.class = "thumbnail";
- img.title =
- "Click on the thumbnail to view and manipulate the image.";
- img.draggable = "false";
- img.style = "height: 100px; width: 100px";
- $("#thumb-" + id).append(img);
-
- const element = document.getElementById("thumb-image-" + id);
- cornerstone.enable(element);
- cornerstone.displayImage(element, image);
- cornerstone.resize(element);
+ loadCornerstoneThumb(image, id);
});
}
}