.
This commit is contained in:
@@ -479,14 +479,14 @@
|
|||||||
if (el.files[0].type.startsWith("image")) {
|
if (el.files[0].type.startsWith("image")) {
|
||||||
base = await blobToBase64(el.files[0]);
|
base = await blobToBase64(el.files[0]);
|
||||||
imageId = "base64://" + base.split(",")[1];
|
imageId = "base64://" + base.split(",")[1];
|
||||||
imageId2 = base;
|
//imageId2 = base;
|
||||||
} else {
|
} else {
|
||||||
let url = URL.createObjectURL(el.files[0])
|
let url = URL.createObjectURL(el.files[0])
|
||||||
imageId = `wadouri:${url}`;
|
imageId = `wadouri:${url}`;
|
||||||
imageId2 = url
|
//imageId2 = url
|
||||||
}
|
}
|
||||||
console.log(imageId)
|
console.log(imageId)
|
||||||
const element = $(`<div class='temp-thumb' src=${imageId2}></div>`).get(0)
|
const element = $(`<div class='temp-thumb' src=${imageId}></div>`).get(0)
|
||||||
$(el).parent().parent().prepend(element);
|
$(el).parent().parent().prepend(element);
|
||||||
cornerstone.enable(element);
|
cornerstone.enable(element);
|
||||||
cornerstone.loadAndCacheImage(imageId).then(function (image) {
|
cornerstone.loadAndCacheImage(imageId).then(function (image) {
|
||||||
|
|||||||
+27
-28
@@ -541,6 +541,10 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
|
|||||||
loadAnnotation(imageId, annotation);
|
loadAnnotation(imageId, annotation);
|
||||||
|
|
||||||
imageIds.push(imageId);
|
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
|
// Treat application/octet-stream as if they are dicoms
|
||||||
} else if (data_url.startsWith("data:application/dicom") || data_url.startsWith("data:application/octet-stream")) {
|
} 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) {
|
||||||
|
img = $("<div></div>").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) {
|
if (images.length > 1 && load_as_stack == false) {
|
||||||
$(".canvas-panel").append("<div id='image-thumbs'></div>");
|
$(".canvas-panel").append("<div id='image-thumbs'></div>");
|
||||||
for (let id = 0; id < images.length; id++) {
|
for (let id = 0; id < images.length; id++) {
|
||||||
@@ -647,24 +667,12 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
|
|||||||
dfile
|
dfile
|
||||||
);
|
);
|
||||||
cornerstone.loadAndCacheImage(imageId).then(function (image) {
|
cornerstone.loadAndCacheImage(imageId).then(function (image) {
|
||||||
img = $("<div></div>").get(0);
|
loadCornerstoneThumb();
|
||||||
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) {
|
}); //.catch( function(error) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!image_url.endsWith("dicom") && !image_url.endsWith("dcm")) {
|
if ((!image_url.endsWith("dicom") && !image_url.endsWith("dcm")) || image_url.startsWith("base64")) {
|
||||||
img = $("<img />", {
|
img = $("<img />", {
|
||||||
src: image_url,
|
src: image_url,
|
||||||
id: "thumb-image-" + id,
|
id: "thumb-image-" + id,
|
||||||
@@ -677,24 +685,15 @@ export function loadCornerstone(main_element, db, images, annotations_to_load, l
|
|||||||
$("#thumb-" + id).append(img);
|
$("#thumb-" + id).append(img);
|
||||||
|
|
||||||
// otherwise try to load it as a dicom
|
// otherwise try to load it as a dicom
|
||||||
|
} else if (!image_url.startsWith("wadouri")) {
|
||||||
|
cornerstone.loadAndCacheImage(url).then(function (image) {
|
||||||
|
loadCornerstoneThumb();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let url = "wadouri:" + image_url;
|
let url = "wadouri:" + image_url;
|
||||||
console.log(url)
|
|
||||||
cornerstone.loadAndCacheImage(url).then(function (image) {
|
cornerstone.loadAndCacheImage(url).then(function (image) {
|
||||||
img = $("<div></div>").get(0);
|
loadCornerstoneThumb();
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user