This commit is contained in:
Ross
2021-11-11 15:04:54 +00:00
parent c6909343ab
commit 9dba1493df
+39 -33
View File
@@ -276,7 +276,7 @@
for (let elem of current_files) { for (let elem of current_files) {
current_files_tuple.add( current_files_tuple.add(
`${elem.size}, ${elem.name}, ${elem.lastModified}` `${elem.size}, ${elem.name}, ${elem.lastModified}`
); );
} }
console.log(current_files_tuple) console.log(current_files_tuple)
@@ -285,8 +285,8 @@
f = await items[i].handle.getFile() f = await items[i].handle.getFile()
console.log("f", f) console.log("f", f)
if (!current_files_tuple.has( if (!current_files_tuple.has(
`${f.size}, ${f.name}, ${f.lastModified}` `${f.size}, ${f.name}, ${f.lastModified}`
)) { )) {
files_to_add.add(f); files_to_add.add(f);
} }
} }
@@ -306,12 +306,12 @@
.after( .after(
$( $(
" <span>[clear]</span>").click((evt) => { " <span>[clear]</span>").click((evt) => {
$(evt.target).remove(); $(evt.target).remove();
$("#directory-picker-display").text(""); $("#directory-picker-display").text("");
monitor_directory_handler = false; monitor_directory_handler = false;
clearInterval(monitor_interval_id); clearInterval(monitor_interval_id);
//const files = await listAllFilesAndDirs(directoryHandle); //const files = await listAllFilesAndDirs(directoryHandle);
})); }));
}); });
}); });
@@ -436,7 +436,7 @@
$(`img[data-input-id='${input.id}'`).removeClass("image-ident-loading"); $(`img[data-input-id='${input.id}'`).removeClass("image-ident-loading");
console.log(l); console.log(l);
if (l.includes("accesion") || l.includes("number") || l.search( 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); console.log("SHIT", input);
$(input).addClass("image-ident-warning"); $(input).addClass("image-ident-warning");
$(`img[data-input-id='${input.id}'`).addClass("image-ident-warning"); $(`img[data-input-id='${input.id}'`).addClass("image-ident-warning");
@@ -467,26 +467,32 @@
const readFile = (file, el) => { const readFile = (file, el) => {
reader(file).then(reader => { reader(file).then(reader => {
console.log("12345", reader) console.log("12345", reader)
var image = new Image();
image.height = 100; if (reader.result.startsWith("data:application/octet-stream;base64")) {
image.title = file.name; const element = $("<div class='temp-thumb'></div>").get(0)
image.src = reader.result; const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add(
image.className = "temp-thumb"; file
$(el).parent().parent().find(".temp-thumb").remove(); );
$(el).parent().parent().prepend(image); cornerstone.enable(element);
//images.push(reader.result); 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 = $("<div class='thumb'></div>").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) active_file_inputs.delete(el)
@@ -613,11 +619,11 @@
<h2>Submit Rapid</h2> <h2>Submit Rapid</h2>
<a href="{% url 'rapids:rapid_create_defaults' %}">Edit defaults</a> <a href="{% url 'rapids:rapid_create_defaults' %}">Edit defaults</a>
<p> <p>
<h3>Instructions</h3> <h3>Instructions</h3>
Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). String 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. answers that match those added below will be used for automatic marking. Multiple images can be added to a question.
If If
the feedback image box is checked they will not be displayed when taking the question. the feedback image box is checked they will not be displayed when taking the question.
</p> </p>
<div> <div>
To monitor a directory select it here.<br /> To monitor a directory select it here.<br />