From 9dba1493df32738b58adf0ebe66a235bf444e8f9 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 11 Nov 2021 15:04:54 +0000 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 72 +++++++++++++------------ 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 2eee4cda..faca705b 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -276,7 +276,7 @@ for (let elem of current_files) { current_files_tuple.add( `${elem.size}, ${elem.name}, ${elem.lastModified}` - ); + ); } console.log(current_files_tuple) @@ -285,8 +285,8 @@ f = await items[i].handle.getFile() console.log("f", f) if (!current_files_tuple.has( - `${f.size}, ${f.name}, ${f.lastModified}` - )) { + `${f.size}, ${f.name}, ${f.lastModified}` + )) { files_to_add.add(f); } } @@ -306,12 +306,12 @@ .after( $( " [clear]").click((evt) => { - $(evt.target).remove(); - $("#directory-picker-display").text(""); - monitor_directory_handler = false; - clearInterval(monitor_interval_id); - //const files = await listAllFilesAndDirs(directoryHandle); - })); + $(evt.target).remove(); + $("#directory-picker-display").text(""); + monitor_directory_handler = false; + clearInterval(monitor_interval_id); + //const files = await listAllFilesAndDirs(directoryHandle); + })); }); }); @@ -436,7 +436,7 @@ $(`img[data-input-id='${input.id}'`).removeClass("image-ident-loading"); console.log(l); if (l.includes("accesion") || l.includes("number") || l.search( - /(ref|rk9|rh8|ra9|rbz)\d+/g) > -1) { + /(ref|rk9|rh8|ra9|rbz)\d+/g) > -1) { console.log("SHIT", input); $(input).addClass("image-ident-warning"); $(`img[data-input-id='${input.id}'`).addClass("image-ident-warning"); @@ -467,26 +467,32 @@ const readFile = (file, el) => { reader(file).then(reader => { console.log("12345", reader) - var image = new Image(); - image.height = 100; - image.title = file.name; - image.src = reader.result; - image.className = "temp-thumb"; - $(el).parent().parent().find(".temp-thumb").remove(); - $(el).parent().parent().prepend(image); - //images.push(reader.result); + + if (reader.result.startsWith("data:application/octet-stream;base64")) { + const element = $("
").get(0) + const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add( + file + ); + cornerstone.enable(element); + cornerstone.loadAndCacheImage(imageId).then(function (image) { + cornerstone.displayImage(element, image); + cornerstone.resize(element) + + }); + $(el).parent().parent().prepend(element); + + } else { + var image = new Image(); + image.height = 100; + image.title = file.name; + image.src = reader.result; + image.className = "temp-thumb"; + $(el).parent().parent().find(".temp-thumb").remove(); + $(el).parent().parent().prepend(image); + //images.push(reader.result); + } - const element = $("
").get(0) - const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add( - file - ); - cornerstone.enable(element); - cornerstone.loadAndCacheImage(imageId).then(function(image) { - cornerstone.displayImage(element, image); - - }); - $(el).parent().parent().prepend(element); active_file_inputs.delete(el) @@ -613,11 +619,11 @@

Submit Rapid

Edit defaults

-

Instructions

- Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). String - answers that match those added below will be used for automatic marking. Multiple images can be added to a question. - If - the feedback image box is checked they will not be displayed when taking the question. +

Instructions

+Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). String +answers that match those added below will be used for automatic marking. Multiple images can be added to a question. +If +the feedback image box is checked they will not be displayed when taking the question.

To monitor a directory select it here.