From 12c9433800c96ac2ead75427d4485105801cb7b2 Mon Sep 17 00:00:00 2001 From: Ross Date: Fri, 12 Nov 2021 12:27:48 +0000 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 68 +++---------------------- 1 file changed, 6 insertions(+), 62 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 009f48b8..866cd2de 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -396,67 +396,6 @@ } - // function ocr(input) { - // // Tesseract.recognize(f, "eng",{ logger: m => console.log(m) } - // // ).then(({ data: { text } }) => { - // // console.log(text); - // // l = text.toLowerCase(); - // // if (l.includes("accesion") || l.includes("number") || l.search(/(REF|RK9|RH8|RA9)\d+/g)) { - // // console.log("SHIT", this); - // // } - // // }) - - // console.log('{% static "worker.min.js" %}'); - // console.log('{{ STATIC_URL }}/tesseract-core.wasm.js %}'); - - // const worker = Tesseract.createWorker({ - // workerPath: '{% static "worker.min.js" %}', - // langPath: '{% static "" %}', - // //langPath: '{{ STATIC_URL }}', - // corePath: '{% static "tesseract-core.wasm.js" %}', - // }); - - // const url = URL.createObjectURL(input.files[0]); - // let img = new Image; - // img.src = url; - - // img.onload = function () { - - - // width = img.width; - - // // const rectangle = { left: 0, top: 0, width: width, height: 10 } - - - // (async () => { - // await worker.load(); - // await worker.loadLanguage('eng'); - // await worker.initialize('eng'); - // // const { data: { text } } = await worker.recognize(input.files[0], { rectangle }); - // const { - // data: { - // text - // } - // } = await worker.recognize(input.files[0]); - // //console.log(text); - // l = text.toLowerCase(); - // $(`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) { - // console.log("SHIT", input); - // $(input).addClass("image-ident-warning"); - // $(`img[data-input-id='${input.id}'`).addClass("image-ident-warning"); - // } else { - // $(input).addClass("image-ident-ok"); - - // } - - // await worker.terminate(); - // })(); - // } - // } - async function blobToBase64(blob) { return new Promise((resolve, _) => { const reader = new FileReader(); @@ -531,7 +470,12 @@ cornerstone.enable(element2); cornerstone.loadAndCacheImage(imageId).then(function (image) { cornerstone.displayImage(element2, image); - cornerstone.resize(element2) + + element2.requestFullscreen().then(() => { + ocr($(element2).find("canvas").get(0).toDataURL(), el); + document.exitFullscreen(); + }) + //cornerstone.resize(element2) });