This commit is contained in:
Ross
2021-10-30 23:09:02 +01:00
parent 10ebd4a823
commit 14050c7373
+19 -5
View File
@@ -42,6 +42,7 @@ let normal = false;
}
function input_change(evt) {
file = evt.target.files[0];
$(evt.target).removeClass("image-ident-warning");
$(evt.target).removeClass("image-ident-ok");
updateFileList();
@@ -51,6 +52,18 @@ let normal = false;
// Check if we have selected a examination type
console.log($("#id_examination_from").val())
if (!$("#id_examination_to option")) {
var reader = new FileReader();
reader.onload = function (file) {
var arrayBuffer = reader.result;
// Here we have the file data as an ArrayBuffer. dicomParser requires as input a
// Uint8Array so we create that here
var byteArray = new Uint8Array(arrayBuffer);
extractDicomStudyDescription(byteArray)
}
reader.readAsArrayBuffer(file);
}
}
@@ -190,6 +203,8 @@ let normal = false;
if (!normal) {
if ($('#id_answers-TOTAL_FORMS').val() == "0") {
add_answers_input_form();
alert("Please add an answer")
evt.preventDefault();
}
}
@@ -274,7 +289,7 @@ let normal = false;
image.title = file.name;
image.src = reader.result;
image.className = "temp-thumb";
console.log("read", el);
console.log("read", reader, el);
$(el).parent().parent().prepend(image);
//images.push(reader.result);
loadViewer();
@@ -350,8 +365,7 @@ let normal = false;
}
function extractDicomStudyDescription(byteArray)
{
function extractDicomStudyDescription(byteArray) {
// We need to setup a try/catch block because parseDicom will throw an exception
// if you attempt to parse a non dicom part 10 file (or one that is corrupted)
try {
@@ -367,10 +381,10 @@ let normal = false;
// We will get the sopInstanceUid from the file which is a string and
// has the tag (0020,000D)
var study_description = dataSet.string('x00081030');
console.log("STUDY", study_description)
}
catch(err)
{
catch (err) {
console.log(err);
}
}