|
|
@@ -1,142 +1,221 @@
|
|
|
<!DOCTYPE html>
|
|
|
-<html>
|
|
|
+<html lang="en" xml:lang="en">
|
|
|
<head>
|
|
|
-<link rel="icon" href="favicon.ico?v=$COMMIT_HASH" type="image/x-icon">
|
|
|
-<meta charset="utf-8"/>
|
|
|
-<title>Analog ROI's</title>
|
|
|
-
|
|
|
-<style>
|
|
|
-h1 {font-size: 2em;}
|
|
|
-h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
|
|
|
-h3 {font-size: 1.2em;}
|
|
|
-p {font-size: 1em;}
|
|
|
-
|
|
|
-input[type=number] {
|
|
|
- width: 100px;
|
|
|
- margin-right: 10px;
|
|
|
- padding: 3px 5px;
|
|
|
- display: inline-block;
|
|
|
- border: 1px solid #ccc;
|
|
|
- font-size: 16px;
|
|
|
-}
|
|
|
+ <meta charset="UTF-8" />
|
|
|
+ <title>Analog ROI</title>
|
|
|
+
|
|
|
+ <style>
|
|
|
+ h1 {font-size: 2em;}
|
|
|
+ h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
|
|
|
+ h3 {font-size: 1.2em;}
|
|
|
+ p {font-size: 1em;}
|
|
|
+
|
|
|
+ input[type=number] {
|
|
|
+ width: 60px;
|
|
|
+ margin-right: 10px;
|
|
|
+ padding: 3px 5px;
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
|
|
|
-input[type=text] {
|
|
|
- padding: 3px 5px;
|
|
|
- display: inline-block;
|
|
|
- border: 1px solid #ccc;
|
|
|
- font-size: 16px;
|
|
|
-}
|
|
|
+ input[type=text] {
|
|
|
+ padding: 3px 5px;
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
|
|
|
-select {
|
|
|
- padding: 3px 5px;
|
|
|
- display: inline-block;
|
|
|
- border: 1px solid #ccc;
|
|
|
- font-size: 16px;
|
|
|
- margin-right: 10px;
|
|
|
-}
|
|
|
+ input:out-of-range {
|
|
|
+ background-color: rgba(255, 0, 0, 0.25);
|
|
|
+ border: 1px solid red;
|
|
|
+ }
|
|
|
|
|
|
-.button {
|
|
|
- padding: 5px 10px;
|
|
|
- width: 210px;
|
|
|
- font-size: 16px;
|
|
|
-}
|
|
|
+ select {
|
|
|
+ padding: 3px 5px;
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ font-size: 16px;
|
|
|
+ margin-right: 10px;
|
|
|
+ min-width: 100px;
|
|
|
+ max-width: 100%;
|
|
|
+ vertical-align: middle;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
|
|
|
-.move {
|
|
|
- padding: 4px 4px;
|
|
|
- width: 100px;
|
|
|
- font-size: 12px;
|
|
|
-}
|
|
|
+ .button {
|
|
|
+ padding: 5px 10px;
|
|
|
+ width: 160px;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
|
|
|
-th, td {
|
|
|
- padding: 5px 5px 5px 0px;
|
|
|
-}
|
|
|
+ .multiplier {
|
|
|
+ padding: 0px 0px;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ th, td {
|
|
|
+ padding: 5px 5px 5px 0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ #div2{
|
|
|
+ background-color:#777;
|
|
|
+ margin-bottom:20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .disabledDiv {
|
|
|
+ pointer-events: none;
|
|
|
+ opacity: 0.4;
|
|
|
+ }
|
|
|
+
|
|
|
+ table {
|
|
|
+ width: 660px;
|
|
|
+ padding: 5px;
|
|
|
+ table-layout: fixed;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+
|
|
|
+ <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
|
|
|
+ <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
|
|
|
+ <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
|
|
|
|
|
|
-#div2{
|
|
|
- background-color:#777;
|
|
|
- margin-bottom:20px;
|
|
|
-}
|
|
|
-.disabledDiv {
|
|
|
- pointer-events: none;
|
|
|
- opacity: 0.4;
|
|
|
-}
|
|
|
-</style>
|
|
|
-<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
|
|
|
-<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
|
|
|
-<script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
|
|
|
</head>
|
|
|
|
|
|
<body style="font-family: arial; padding: 0px 10px;">
|
|
|
|
|
|
- <h2>Analog ROI's</h2>
|
|
|
- <p>On this page you define ROI's for the analog counters.
|
|
|
- See <a href=https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/ target=_blank>https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/</a> for explanations.</p>
|
|
|
-
|
|
|
- <input type="checkbox" id="Category_Analog_enabled" value="1" onclick = 'EnDisableAnalog()' checked ><label for="Category_Analog_enabled">Enable Analog ROI's</label></p>
|
|
|
-
|
|
|
+ <h2>Analog ROI</h2>
|
|
|
+ <details id="desc_details" style="font-size:16px">
|
|
|
+ <summary><b>CLICK HERE</b> for usage description. More infos in documentation:
|
|
|
+ <a href=https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/ target=_blank>ROI Configuration</a>
|
|
|
+ </summary>
|
|
|
+ <p>
|
|
|
+ <b>R</b>egion <b>O</b>f <b>I</b>nterest (ROI) for analog pointer counter can be defined on this page. If no analog pointer counter need to be
|
|
|
+ processed, disable analog pointer counter processing by deselecting <b>"Analog ROI Processing"</b>.
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ By default one number sequence (a number seqence contains of 1-x digit ROIs + 1-x analog counter ROIs which are processed together) is
|
|
|
+ predefined and already selected in the drop down <b>"Number Sequence"</b>. If you need more than one number sequence additional
|
|
|
+ one's can be added with the buttons next to the drop down. Each number sequence will be processed separately.
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ Using drag and drop by mouse of by manually entering the parameters into the given fields the analog ROIs can be positined to the analog pointer
|
|
|
+ counters on the reference image. To have proper ROI definition please check the documentation:
|
|
|
+ <a href=https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/ target=_blank>ROI Configuration</a>. It's very important to be
|
|
|
+ really precise to have reliable processing. With the drop down <b>"ROI"</b> you can change between the different ROIs in the selected
|
|
|
+ number sequence. To create new ROIs use <b>"New ROI"</b>.
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ The order of the ROIs defines the position (and therefore the multiplication factor) within the reading sequence. The position
|
|
|
+ in the number sequence can be changed with the buttons <b>"Move ROI Lower"</b> and <b>"Move ROI Higher"</b>. The multiplication factor which is
|
|
|
+ shown below the ROI drop down is the multiplication factor of pure position/order in number sequence and the factor right-hand side to this is
|
|
|
+ the additionally corrected by decimal shift setting (configuration, expert parameter, default: 0).
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ After definition of digit ROIs is completed don't forget to save with the <b>"Save Config"</b> button!<br>
|
|
|
+ <b>NOTE:</b> There is no need to perform a reboot after every saving or step. It's sufficient to reboot after all configuration steps
|
|
|
+ (reference image, alignment, ROI configuration) are completed to activate new configuration.
|
|
|
+ </p>
|
|
|
+ </details>
|
|
|
+ <hr />
|
|
|
+
|
|
|
+ <p>
|
|
|
+ <input type="checkbox" id="Category_Analog_enabled" value="1" onclick = 'EnDisableAnalog()' checked >
|
|
|
+ <label style="font-weight: bold; font-size: larger;" for="Category_Analog_enabled">Analog ROI Processing</label>
|
|
|
+ </p>
|
|
|
+
|
|
|
+
|
|
|
<div id="div1">
|
|
|
- <table>
|
|
|
- <tr>
|
|
|
- <td><canvas id="canvas" crossorigin></canvas></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
-
|
|
|
- <p>
|
|
|
- <table>
|
|
|
- <tr>
|
|
|
- <class id="Numbers_text" style="color:black;"><b>Number: </b></class>
|
|
|
+
|
|
|
+ <table>
|
|
|
+ <colgroup>
|
|
|
+ <col span="1" style="width: 22%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <td colspan="4" style="padding: 0px"><class id="Numbers_text" style="color:black;">Number Sequence:</class></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
<select id="Numbers_value1" onchange="numberChanged()">
|
|
|
</select>
|
|
|
- <input class="move" type="submit" id="renameNumber" name="renameNumber" onclick="renameNumber()" value="Rename">
|
|
|
- <input class="move" type="submit" id="newNumber" name="newNumber" onclick="newNumber()" value="New">
|
|
|
- <input class="move" type="submit" id="removeNumber" name="removeNumber" onclick="removeNumber()" value="Remove">
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </p>
|
|
|
+ </td>
|
|
|
+ <td><input class="button" type="submit" id="newNumber" name="newNumber" onclick="newNumber()" value="New Sequence"></td>
|
|
|
+ <td><input class="button" type="submit" id="renameNumber" name="renameNumber" onclick="renameNumber()" value="Rename Sequence"></td>
|
|
|
+ <td><input class="button" type="submit" id="removeNumber" name="removeNumber" onclick="removeNumber()" value="Delete Sequence"></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ <hr />
|
|
|
+
|
|
|
+ <table>
|
|
|
+ <colgroup>
|
|
|
+ <col span="1" style="width: 22%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <td style="padding: 0px">ROI:</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td><select id="index" name="index" onchange="ChangeSelection()" tabindex=1></select></td>
|
|
|
+ <td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI"></td>
|
|
|
+ <td><input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename ROI"></td>
|
|
|
+ <td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td class="multiplier">Multiplier: <output type="text" id="multiplier" name="multiplier"></output><br>
|
|
|
+ (only based on order)
|
|
|
+ </td>
|
|
|
+ <td class="multiplier">Multiplier: <output type="text" id="multiplier_decshift" name="multiplier_decshift"></output><br>
|
|
|
+ (order + decimal shift: <output type="text" id="decimalShift" name="decimalShift"></output>)
|
|
|
+ </td>
|
|
|
+ <td><input class="button" type="submit" id="movePrevious" onclick="movePrevious()" value="Move ROI Higher"></td>
|
|
|
+ <td><input class="button" type="submit" id="moveNext" onclick="moveNext()" value="Move ROI Lower"></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
|
|
|
<table>
|
|
|
- <tr>
|
|
|
- <td><input class="button" type="submit" id= "newROI" name="newROI" onclick="newROI()" value="New ROI (after current)"></td>
|
|
|
- <td><input class="button" type="submit" id= "deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
|
|
|
- <td></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>
|
|
|
- <select id="index" name="index" onchange="ChangeSelection()" tabindex=1>
|
|
|
- </select>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename">
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <input class="move" type="submit" id="moveNext" onclick="moveNext()" value="move Next">
|
|
|
- <input class="move" type="submit" id="movePrevious" onclick="movePrevious()" value="move Previous">
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
|
|
- <td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
|
|
- <td><input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio</label></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
|
|
- <td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
|
|
- <td><input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize Δx and Δy between ROIs</label></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td colspan="2"></td>
|
|
|
- <td><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" unchecked tabindex=8><label for="CCW"> Counter-Clockwise Rotation: </label></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
-</div>
|
|
|
-
|
|
|
- <table>
|
|
|
- <tr>
|
|
|
- <td><input class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save" tabindex=9>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate the changes</button></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
+ <colgroup>
|
|
|
+ <col span="1" style="width: 18%;">
|
|
|
+ <col span="1" style="width: 18%;">
|
|
|
+ <col span="1" style="width: 64%;">
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
|
|
+ <td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
|
|
+ <td><input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
|
|
+ <td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
|
|
+ <td><input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="2"></td>
|
|
|
+ <td><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" unchecked tabindex=8><label for="CCW">Counter clockwise rotation (CCW)</label></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+</div>
|
|
|
+
|
|
|
+ <table>
|
|
|
+ <colgroup>
|
|
|
+ <col span="1" style="width: 22%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ <col span="1" style="width: 26%;">
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <td colspan="3" style="vertical-align: bottom;"><b>Reference Image:</b></td>
|
|
|
+ <!---<td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot device</button></td>-->
|
|
|
+ <td><input style="font-weight:bold;" class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save Config" tabindex=10></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="4"><canvas id="canvas" crossorigin></canvas></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
|
|
@@ -158,16 +237,15 @@ th, td {
|
|
|
lockSizes = false;
|
|
|
domainname = getDomainname();
|
|
|
|
|
|
-
|
|
|
-function doReboot() {
|
|
|
- if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
|
|
|
- var stringota = getDomainname() + "/reboot";
|
|
|
- window.location = stringota;
|
|
|
- window.location.href = stringota;
|
|
|
- window.location.assign(stringota);
|
|
|
- window.location.replace(stringota);
|
|
|
+ function doReboot() {
|
|
|
+ if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
|
|
|
+ var stringota = getDomainname() + "/reboot";
|
|
|
+ window.location = stringota;
|
|
|
+ window.location.href = stringota;
|
|
|
+ window.location.assign(stringota);
|
|
|
+ window.location.replace(stringota);
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
function EnDisableAnalog() {
|
|
|
isEnabled = document.getElementById("Category_Analog_enabled").checked;
|
|
|
@@ -186,9 +264,9 @@ function EnDisableAnalog() {
|
|
|
|
|
|
sah1(document.getElementById("div1"), !isEnabled);
|
|
|
|
|
|
-
|
|
|
cofcat["Analog"]["enabled"] = isEnabled;
|
|
|
-
|
|
|
+ document.getElementById("saveroi").disabled = false;
|
|
|
+
|
|
|
if (isEnabled)
|
|
|
{
|
|
|
UpdateROIs();
|
|
|
@@ -212,6 +290,10 @@ function onNameChange(){
|
|
|
}
|
|
|
|
|
|
function deleteROI(){
|
|
|
+ if (!confirm("Delete the selected ROI?")) {
|
|
|
+ return; //break out of the function early because prompt was aborted
|
|
|
+ }
|
|
|
+
|
|
|
ROIInfo.splice(aktindex, 1);
|
|
|
if (aktindex > ROIInfo.length - 1){
|
|
|
aktindex = ROIInfo.length - 1;
|
|
|
@@ -220,18 +302,21 @@ function deleteROI(){
|
|
|
draw();
|
|
|
}
|
|
|
|
|
|
-function newROI(){
|
|
|
+function newROI() {
|
|
|
var sel = document.getElementById("Numbers_value1");
|
|
|
var _number= sel.options[sel.selectedIndex].text;
|
|
|
sel = document.getElementById("index");
|
|
|
var _roialt= sel.options[sel.selectedIndex].text;
|
|
|
|
|
|
- var _roinew = prompt("Please enter name of new ROI", "name");
|
|
|
+ var _roinew = prompt("Please enter a name for the new ROI", "name");
|
|
|
+ if (_roinew === null) {
|
|
|
+ return; //break out of the function early because prompt was aborted
|
|
|
+ }
|
|
|
|
|
|
if (ROIInfo.length > 0)
|
|
|
- erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], ROIInfo[aktindex]["CCW"]=="true");
|
|
|
+ erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 15, 30, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], ROIInfo[aktindex]["CCW"]=="true");
|
|
|
else
|
|
|
- erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30, false);
|
|
|
+ erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 15, 30, 30, 30, false);
|
|
|
|
|
|
if (erg != "")
|
|
|
firework.launch(erg, 'danger', 30000);
|
|
|
@@ -275,7 +360,9 @@ function changeCCW(){
|
|
|
ROIInfo[aktindex]["CCW"] = "true";
|
|
|
else
|
|
|
ROIInfo[aktindex]["CCW"] = "false";
|
|
|
- UpdateROIs();
|
|
|
+
|
|
|
+ UpdateROIs();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function ChangeSelection(){
|
|
|
@@ -285,11 +372,68 @@ function ChangeSelection(){
|
|
|
}
|
|
|
|
|
|
function SaveToConfig(){
|
|
|
-// _zwcat = getConfigCategory();
|
|
|
- cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
|
|
- WriteConfigININew();
|
|
|
- SaveConfigToServer(domainname);
|
|
|
- firework.launch('Configuration got updated. It will get applied after the next reboot!', 'success', 5000);
|
|
|
+ if (confirm("Are you sure you want to save the new analog ROI configuration?")) {
|
|
|
+ //_zwcat = getConfigCategory();
|
|
|
+ cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
|
|
+ WriteConfigININew();
|
|
|
+ SaveConfigToServer(domainname);
|
|
|
+ UpdateROIs();
|
|
|
+ document.getElementById("saveroi").disabled = true;
|
|
|
+
|
|
|
+ firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function ShowMultiplier()
|
|
|
+{
|
|
|
+ var decimalShift = 0;
|
|
|
+ var multiplier;
|
|
|
+ var multiplier_decshift;
|
|
|
+ var fixedDecimals;
|
|
|
+ var fixedDecimals_decshift;
|
|
|
+ var NumberInfo = getNUMBERInfo();
|
|
|
+ var CategoryInfo = getConfigCategory();
|
|
|
+
|
|
|
+ var sel = document.getElementById("Numbers_value1");
|
|
|
+ var _number= sel.options[sel.selectedIndex].text;
|
|
|
+ document.getElementById("decimalShift").value = 0;
|
|
|
+ for (var i = 0; i < NumberInfo.length; ++i) {
|
|
|
+ if (NumberInfo[i]["name"] == _number) {
|
|
|
+ if (NumberInfo[i]["PostProcessing"]["DecimalShift"]["enabled"]) {
|
|
|
+ decimalShift = NumberInfo[i]["PostProcessing"]["DecimalShift"]["value1"];
|
|
|
+ document.getElementById("decimalShift").value=decimalShift;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CategoryInfo["Analog"]["enabled"] == true && CategoryInfo["Digits"]["enabled"] == true) { // Digit + Analog
|
|
|
+ multiplier = fixedDecimals = aktindex + 1;
|
|
|
+ multiplier_decshift = fixedDecimals_decshift = multiplier - Number(decimalShift);
|
|
|
+
|
|
|
+ if (multiplier < 0)
|
|
|
+ fixedDecimals = 0;
|
|
|
+
|
|
|
+ if (multiplier_decshift < 0)
|
|
|
+ fixedDecimals_decshift = 0;
|
|
|
+
|
|
|
+ document.getElementById("multiplier").value="x" + Number(10 ** (-1*multiplier)).toFixed(fixedDecimals);
|
|
|
+ document.getElementById("multiplier_decshift").value="x" + Number(10 ** (-1*multiplier_decshift)).toFixed(fixedDecimals_decshift);
|
|
|
+ }
|
|
|
+ else if (CategoryInfo["Analog"]["enabled"] == true && CategoryInfo["Digits"]["enabled"] == false) { // Only Analog
|
|
|
+ multiplier = ROIInfo.length - 1 - aktindex;
|
|
|
+ multiplier_decshift = fixedDecimals_decshift = multiplier + Number(decimalShift);
|
|
|
+
|
|
|
+ if (multiplier_decshift > 0)
|
|
|
+ fixedDecimals_decshift = 0;
|
|
|
+
|
|
|
+ if (fixedDecimals_decshift < 0) {
|
|
|
+ fixedDecimals_decshift = -1 * fixedDecimals_decshift;
|
|
|
+ }
|
|
|
+
|
|
|
+ document.getElementById("multiplier").value="x" + Number(10 ** multiplier).toFixed(0);
|
|
|
+ document.getElementById("multiplier_decshift").value="x" + Number(10 ** multiplier_decshift).toFixed(fixedDecimals_decshift);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -305,19 +449,28 @@ function UpdateROIs(_sel){
|
|
|
{
|
|
|
document.getElementById("Category_Analog_enabled").checked = false;
|
|
|
EnDisableAnalog();
|
|
|
- firework.launch('Analog ROIs are disabled - please enable first (Check box top left)', 'warning', 10000);
|
|
|
+ firework.launch('Analog ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (ROIInfo.length == 0){
|
|
|
- firework.launch('There are no ROIs defined. Please first create a new ROI ("New ROIs ...")', 'danger', 10000);
|
|
|
+ firework.launch('No analog ROIs defined in selected number sequence', 'warning', 10000);
|
|
|
document.getElementById("newROI").disabled = false;
|
|
|
document.getElementById("deleteROI").disabled = true;
|
|
|
- document.getElementById("index").disabled = true;
|
|
|
- document.getElementById("saveroi").disabled = true;
|
|
|
document.getElementById("renameROI").disabled = true;
|
|
|
+ document.getElementById("index").disabled = true;
|
|
|
+ document.getElementById("multiplier").style.display = "none";
|
|
|
+ document.getElementById("multiplier_decshift").style.display = "none";
|
|
|
+ document.getElementById("refx").disabled = true;
|
|
|
+ document.getElementById("refdx").disabled = true;
|
|
|
+ document.getElementById("refy").disabled = true;
|
|
|
+ document.getElementById("refdy").disabled = true;
|
|
|
+ document.getElementById("lockSizes").disabled = true;
|
|
|
+ document.getElementById("lockAspectRatio").disabled = true;
|
|
|
+ document.getElementById("CCW").disabled = true;
|
|
|
document.getElementById("moveNext").disabled = true;
|
|
|
document.getElementById("movePrevious").disabled = true;
|
|
|
+ document.getElementById("saveroi").disabled = false;
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
@@ -326,6 +479,15 @@ function UpdateROIs(_sel){
|
|
|
document.getElementById("deleteROI").disabled = false;
|
|
|
document.getElementById("renameROI").disabled = false;
|
|
|
document.getElementById("index").disabled = false;
|
|
|
+ document.getElementById("multiplier").style.display = "";
|
|
|
+ document.getElementById("multiplier_decshift").style.display = "";
|
|
|
+ document.getElementById("refx").disabled = false;
|
|
|
+ document.getElementById("refdx").disabled = false;
|
|
|
+ document.getElementById("refy").disabled = false;
|
|
|
+ document.getElementById("refdy").disabled = false;
|
|
|
+ document.getElementById("lockSizes").disabled = false;
|
|
|
+ document.getElementById("lockAspectRatio").disabled = false;
|
|
|
+ document.getElementById("CCW").disabled = false;
|
|
|
document.getElementById("saveroi").disabled = false;
|
|
|
}
|
|
|
|
|
|
@@ -335,7 +497,7 @@ function UpdateROIs(_sel){
|
|
|
}
|
|
|
|
|
|
if (aktindex > ROIInfo.length)
|
|
|
- aktindex = ROIInfo.length;
|
|
|
+ aktindex = ROIInfo.length-1;
|
|
|
|
|
|
for (var i = 0; i < ROIInfo.length; ++i){
|
|
|
var option = document.createElement("option");
|
|
|
@@ -358,7 +520,9 @@ function UpdateROIs(_sel){
|
|
|
document.getElementById("moveNext").disabled = false;
|
|
|
if (aktindex == (ROIInfo.length-1)){
|
|
|
document.getElementById("moveNext").disabled = true;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ ShowMultiplier();
|
|
|
|
|
|
document.getElementById("lockAspectRatio").checked = lockAspectRatio;
|
|
|
document.getElementById("lockSizes").checked = lockSizes;
|
|
|
@@ -373,8 +537,7 @@ function UpdateROIs(_sel){
|
|
|
rect.startY = ROIInfo[aktindex]["y"];
|
|
|
rect.w = ROIInfo[aktindex]["dx"];
|
|
|
rect.h = ROIInfo[aktindex]["dy"];
|
|
|
- draw();
|
|
|
-
|
|
|
+ draw();
|
|
|
}
|
|
|
|
|
|
function loadCanvas(dataURL) {
|
|
|
@@ -404,10 +567,20 @@ function UpdateROIs(_sel){
|
|
|
var left = box.left + scrollLeft - clientLeft;
|
|
|
return { top: Math.round(top), left: Math.round(left) };
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /* hash #description open the details part of the page */
|
|
|
+ function openDescription() {
|
|
|
+ if(window.location.hash) {
|
|
|
+ var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
|
|
+ if(hash == 'description')
|
|
|
+ document.getElementById("desc_details").open = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
function init() {
|
|
|
+ openDescription();
|
|
|
domainname = getDomainname();
|
|
|
canvas.addEventListener('mousedown', mouseDown, false);
|
|
|
canvas.addEventListener('mouseup', mouseUp, false);
|
|
|
@@ -440,11 +613,12 @@ function UpdateROIs(_sel){
|
|
|
console.log("Not all ROI have the same dX and dY, unticking the sync checkbox!");
|
|
|
}
|
|
|
|
|
|
+ document.getElementById("saveroi").disabled = true;
|
|
|
|
|
|
drawImage();
|
|
|
draw();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function drawImage(){
|
|
|
var canvas = document.getElementById('canvas');
|
|
|
var context = canvas.getContext('2d');
|
|
|
@@ -483,10 +657,13 @@ function UpdateNUMBERS(_sel){
|
|
|
|
|
|
function renameNumber(){
|
|
|
var sel = document.getElementById("Numbers_value1");
|
|
|
- var _delte= sel.options[sel.selectedIndex].text;
|
|
|
- var _numbernew = prompt("Please enter new name", _delte);
|
|
|
+ var _delete= sel.options[sel.selectedIndex].text;
|
|
|
+ var _numbernew = prompt("Please enter a new name for the selected number sequence", _delete);
|
|
|
+ if (_numbernew === null) {
|
|
|
+ return; //break out of the function early because prompt was aborted
|
|
|
+ }
|
|
|
|
|
|
- erg = RenameNUMBER(_delte, _numbernew);
|
|
|
+ erg = RenameNUMBER(_delete, _numbernew);
|
|
|
if (erg != "")
|
|
|
firework.launch(erg, 'danger', 30000);
|
|
|
else
|
|
|
@@ -494,7 +671,10 @@ function renameNumber(){
|
|
|
}
|
|
|
|
|
|
function newNumber(){
|
|
|
- var _numbernew = prompt("Please enter name of new number", "name");
|
|
|
+ var _numbernew = prompt("Please enter a name for the new number sequence", "name");
|
|
|
+ if (_numbernew === null) {
|
|
|
+ return; //break out of the function early because prompt was aborted
|
|
|
+ }
|
|
|
|
|
|
erg = CreateNUMBER(_numbernew);
|
|
|
if (erg != "")
|
|
|
@@ -505,10 +685,13 @@ function newNumber(){
|
|
|
|
|
|
|
|
|
function removeNumber(){
|
|
|
- if (confirm("This will remove the number complete (analog and digital).\nIf you only want to remove the digital ROIs, please use \"Delete ROIs\".\nDo you want to proceed?")) {
|
|
|
+ if (confirm("The entire number sequence will be removed (digit + analog parts). " +
|
|
|
+ "To remove single ROI of the number sequence, use \"Delete ROI\" instead.\n" +
|
|
|
+ "Do you really want to proceed?"))
|
|
|
+ {
|
|
|
var sel = document.getElementById("Numbers_value1");
|
|
|
- var _delte= sel.options[sel.selectedIndex].text;
|
|
|
- erg = DeleteNUMBER(_delte);
|
|
|
+ var _delete= sel.options[sel.selectedIndex].text;
|
|
|
+ erg = DeleteNUMBER(_delete);
|
|
|
if (erg != "")
|
|
|
firework.launch(erg, 'danger', 30000);
|
|
|
UpdateNUMBERS();
|
|
|
@@ -576,8 +759,12 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw);
|
|
|
var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw);
|
|
|
context.strokeRect(x0, y0, dx, dy);
|
|
|
- drawTextBG(context, ROIInfo[_nb]["name"], x0+dx/2-0.5, y0-13, 5);
|
|
|
-
|
|
|
+
|
|
|
+ if (ROIInfo[_nb]["CCW"] != "true")
|
|
|
+ drawTextBG(context, ROIInfo[_nb]["name"], x0+dx/2-0.5, y0-13, 5);
|
|
|
+ else
|
|
|
+ drawTextBG(context, ROIInfo[_nb]["name"]+" (CCW)", x0+dx/2-0.5, y0-13, 5);
|
|
|
+
|
|
|
lw = 1;
|
|
|
var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2);
|
|
|
var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2);
|
|
|
@@ -586,7 +773,8 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
context.strokeRect(x0, y0, dx, dy);
|
|
|
context.lineWidth = lw;
|
|
|
context.beginPath();
|
|
|
- context.arc(x0+dx/2, y0+dy/2, dx/2, 0, 2 * Math.PI);
|
|
|
+// context.arc (x0+dx/2, y0+dy/2, dx/2, 0, 2 * Math.PI);
|
|
|
+ context.ellipse(x0+dx/2, y0+dy/2, dx/2, dy/2, 0, 0, 2 * Math.PI);
|
|
|
context.moveTo(x0+dx/2, y0);
|
|
|
context.lineTo(x0+dx/2, y0+dy);
|
|
|
context.moveTo(x0, y0+dy/2);
|
|
|
@@ -602,11 +790,17 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
var y0 = parseInt(rect.startY) - parseInt(lw/2);
|
|
|
var dx = parseInt(rect.w) + parseInt(lw);
|
|
|
var dy = parseInt(rect.h) + parseInt(lw);
|
|
|
- context.strokeRect(x0, y0, dx, dy);
|
|
|
- drawTextBG(context, ROIInfo[aktindex]["name"], x0+dx/2, y0-11, 5);
|
|
|
+ context.strokeRect(x0, y0, dx, dy);
|
|
|
+
|
|
|
+ if (ROIInfo[aktindex]["CCW"] != "true")
|
|
|
+ drawTextBG(context, ROIInfo[aktindex]["name"], x0+dx/2, y0-11, 5);
|
|
|
+ else
|
|
|
+ drawTextBG(context, ROIInfo[aktindex]["name"] + " (CCW)", x0+dx/2, y0-11, 5);
|
|
|
+
|
|
|
context.lineWidth = 1;
|
|
|
context.beginPath();
|
|
|
- context.arc(x0+dx/2, y0+dy/2, dx/2, 0, 2 * Math.PI);
|
|
|
+// context.arc(x0+dx/2, y0+dy/2, dx/2, 0, 2 * Math.PI);
|
|
|
+ context.ellipse(x0+dx/2, y0+dy/2, dx/2, dy/2, 0, 0, 2 * Math.PI);
|
|
|
context.moveTo(x0+dx/2, y0);
|
|
|
context.lineTo(x0+dx/2, y0+dy);
|
|
|
context.moveTo(x0, y0+dy/2);
|
|
|
@@ -706,6 +900,7 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
rect.startY = document.getElementById("refy").value;
|
|
|
draw();
|
|
|
}
|
|
|
+ document.getElementById("saveroi").disabled = false;
|
|
|
}
|
|
|
|
|
|
function valuemanualchangeddx(){
|
|
|
@@ -721,6 +916,7 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
rect.startY = document.getElementById("refy").value;
|
|
|
draw();
|
|
|
}
|
|
|
+ document.getElementById("saveroi").disabled = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -730,8 +926,10 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
sel = document.getElementById("index");
|
|
|
var _roialt= sel.options[sel.selectedIndex].text;
|
|
|
|
|
|
-
|
|
|
- var _roinew = prompt("Please enter new name", _roialt);
|
|
|
+ var _roinew = prompt("Please enter a new name for the selected ROI", _roialt);
|
|
|
+ if (_roinew === null) {
|
|
|
+ return; //break out of the function early because prompt was aborted
|
|
|
+ }
|
|
|
|
|
|
erg = RenameROI(_number, "analog", _roialt, _roinew);
|
|
|
if (erg != "")
|
|
|
@@ -742,13 +940,15 @@ function drawTextBG(context, txt, x, y, padding) {
|
|
|
|
|
|
function numberChanged()
|
|
|
{
|
|
|
+ aktindex = 0;
|
|
|
UpdateROIs();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
init();
|
|
|
+
|
|
|
</script>
|
|
|
+
|
|
|
</body>
|
|
|
</html>
|