diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 058a4af5..ecab6c99 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -452,54 +452,6 @@ } async function readFileAndProcess2(callback) { - //$("#single-dicom-viewer").empty() - //images = [] - //Function that returns a promise to read the file - const reader = (file) => { - return new Promise((resolve, reject) => { - const fileReader = new FileReader(); - fileReader.onload = () => resolve(fileReader); - fileReader.readAsDataURL(file); - }); - } - - // Add file to the process list - active_file_inputs.add(el) - const readFile = (file, el) => { - reader(file).then(reader => { - console.log("12345", reader) - $(el).parent().parent().find(".temp-thumb").remove(); - - if (reader.result.startsWith("data:application/octet-stream;base64")) { - const element = $(`
`).get(0) - $(el).parent().parent().prepend(element); - const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add( - file - ); - cornerstone.enable(element); - cornerstone.loadAndCacheImage(imageId).then(function (image) { - cornerstone.displayImage(element, image); - cornerstone.resize(element) - - }); - - } else { - var image = new Image(); - image.title = file.name; - image.src = reader.result; - image.className = "temp-thumb"; - $(el).parent().parent().prepend(image); - //images.push(reader.result); - } - - active_file_inputs.delete(el) - console.log("active", active_file_inputs) - // Only load once all queued files have been processed - if (active_file_inputs.size < 1) { - loadViewer(); - } - }); - } file_set = $("#image_form_set input[type=file]"); @@ -513,7 +465,11 @@ $(el).parent().parent().find(".temp-thumb").remove(); - const imageId = `wadouri:${url}`; + if (el.files[0].type.startsWith("image")) { + const imageId = `${url}`; + } else { + const imageId = `wadouri:${url}`; + } const element = $(``).get(0) $(el).parent().parent().prepend(element); cornerstone.enable(element);