fix some helper / viewer issues
This commit is contained in:
@@ -19,16 +19,6 @@ export function shuffleArray(array) {
|
||||
return array;
|
||||
}
|
||||
|
||||
export function urltoFile(url, filename, mimeType) {
|
||||
return fetch(url)
|
||||
.then(function (res) {
|
||||
return res.arrayBuffer();
|
||||
})
|
||||
.then(function (buf) {
|
||||
return new File([buf], filename, { type: mimeType });
|
||||
});
|
||||
}
|
||||
|
||||
export function formatBytes(bytes, decimals = 2) {
|
||||
if (bytes === 0) return "0 Bytes";
|
||||
|
||||
|
||||
+9
-3
@@ -88,7 +88,10 @@ async function loadPacketList(data) {
|
||||
}
|
||||
});
|
||||
|
||||
window.packet_list = data.packets;
|
||||
if (data != null) {
|
||||
window.packet_list = data.packets;
|
||||
}
|
||||
$("#packet-list").empty();
|
||||
window.packet_list.forEach(function (packet) {
|
||||
let c = "";
|
||||
if (packets_started.indexOf(packet) > -1) {
|
||||
@@ -469,7 +472,7 @@ function loadQuestion(n, section = 1, force_reload = false) {
|
||||
// otherwise try to load it as a dicom
|
||||
} else {
|
||||
// convert the data url to a file
|
||||
helper
|
||||
viewer
|
||||
.urltoFile(based_img, "dicom", "application/dicom")
|
||||
.then(function (dfile) {
|
||||
// load the file using cornerstoneWADO file loader
|
||||
@@ -956,6 +959,7 @@ $("#review-button").click(function (evt) {
|
||||
});
|
||||
|
||||
$("#options-button").click(function (evt) {
|
||||
loadPacketList(null);
|
||||
$("#options-panel").toggle();
|
||||
});
|
||||
|
||||
@@ -1075,8 +1079,10 @@ function submitAnswers() {
|
||||
* Displays the review question panel with a summary of marks
|
||||
*/
|
||||
function reviewQuestions() {
|
||||
// Stop timer
|
||||
// Stop timer (if it's running)
|
||||
if (window.timer != null) {
|
||||
window.timer.stop();
|
||||
}
|
||||
|
||||
const cid = window.cid;
|
||||
const eid = window.eid;
|
||||
|
||||
+11
-1
@@ -503,7 +503,7 @@ export function openMainImage(current_question, t, source) {
|
||||
} else if (data_url.startsWith("data:application/dicom")) {
|
||||
// stack = stack.split(";")[1];
|
||||
|
||||
const dfile = await helper.urltoFile(
|
||||
const dfile = await urltoFile(
|
||||
data_url,
|
||||
"dicom",
|
||||
"application/dicom"
|
||||
@@ -566,3 +566,13 @@ export function openMainImage(current_question, t, source) {
|
||||
load(images);
|
||||
}
|
||||
}
|
||||
|
||||
export function urltoFile(url, filename, mimeType) {
|
||||
return fetch(url)
|
||||
.then(function (res) {
|
||||
return res.arrayBuffer();
|
||||
})
|
||||
.then(function (buf) {
|
||||
return new File([buf], filename, { type: mimeType });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user