Skip to content

Commit

Permalink
Merge pull request #35 from asoronow/development
Browse files Browse the repository at this point in the history
Update to version 10
  • Loading branch information
asoronow authored Sep 5, 2024
2 parents 8cad863 + bb5ca72 commit eaa9f2a
Show file tree
Hide file tree
Showing 21 changed files with 70,083 additions and 1,674 deletions.
40,232 changes: 40,232 additions & 0 deletions app/background.js

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions app/preload.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/belljar_guide.pdf
Binary file not shown.
222 changes: 119 additions & 103 deletions js/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var outdir = document.getElementById("outdir");
var loadbar = document.getElementById("loadbar");
var tile = document.getElementById("tile");
var confidence = document.getElementById("confidence");
var eccentricity = document.getElementById("eccentricity");
var model = document.getElementById("model");
var loadmessage = document.getElementById("loadmessage");
var back = document.getElementById("back");
Expand All @@ -18,140 +19,155 @@ var area = document.getElementById("area");
var detectionMethod = "somata";

somata.addEventListener("click", function () {
methods.textContent = "Somata";
detectionMethod = "somata";
methods.textContent = "Somata";
detectionMethod = "somata";
});

nuclei.addEventListener("click", function () {
methods.textContent = "Nuclei";
detectionMethod = "nuclei";
methods.textContent = "Nuclei";
detectionMethod = "nuclei";
});

advance.addEventListener("click", function () {
arrow.classList.toggle("down");
arrow.classList.toggle("down");
});

function checkNumber(value, message) {
var str = value.toString();
if (!str.match(/^-?\d*\.?\d*$/)) {
alert(`${message}`);
return false;
}
return true;
var str = value.toString();
if (!str.match(/^-?\d*\.?\d*$/)) {
alert(`${message}`);
return false;
}
return true;
}

run.addEventListener("click", function () {
var c = 0.5;
var a = 200;
var t = 640;
var m = "";
var mc = false;

if (indir && outdir && indir.value && outdir.value) {
if (confidence.value && confidence.value < 1 && confidence.value > 0) {
c = checkNumber(
confidence.value,
"Confidence should be a float between 0-1, using default."
)
? confidence.value
: 0.5;
}

if (area.value && area.value > 0) {
a = checkNumber(area.value, "Area should be an integer, using default.")
? area.value
: 200;
}

if (tile.value && tile.value > 0) {
t = checkNumber(tile.value, "Tile should be an integer, using default.")
? tile.value
: 640;
}
if (model.value) {
m = model.value;
}
if (multichannel.checked) {
mc = true;
}

run.classList.add("disabled");
back.classList.remove("btn-warning");
back.classList.add("btn-danger");
back.innerHTML = "Cancel";
run.innerHTML = "<i class='fas fa-spinner fa-spin'></i>";
loadmessage.innerHTML = "Intializing...";

ipc.send("runDetection", [
indir.value,
outdir.value,
c,
t,
m,
mc,
detectionMethod,
a,
]);
}
var c = 0.5;
var e = 0.2;
var a = 200;
var t = 640;
var m = "";
var mc = false;

if (indir && outdir && indir.value && outdir.value) {
if (confidence.value && confidence.value < 1 && confidence.value > 0) {
c = checkNumber(
confidence.value,
"Confidence should be a float between 0-1, using default."
)
? confidence.value
: 0.5;
}

if (
eccentricity.value &&
eccentricity.value < 1 &&
eccentricity.value > 0
) {
e = checkNumber(
eccentricity.value,
"Eccentricity should be a float between 0-1, using default."
)
? eccentricity.value
: 0.5;
}

if (area.value && area.value > 0) {
a = checkNumber(area.value, "Area should be an integer, using default.")
? area.value
: 200;
}

if (tile.value && tile.value > 0) {
t = checkNumber(tile.value, "Tile should be an integer, using default.")
? tile.value
: 640;
}
if (model.value) {
m = model.value;
}
if (multichannel.checked) {
mc = true;
}

run.classList.add("disabled");
back.classList.remove("btn-warning");
back.classList.add("btn-danger");
back.innerHTML = "Cancel";
run.innerHTML = "<i class='fas fa-spinner fa-spin'></i>";
loadmessage.innerHTML = "Intializing...";

ipc.send("runDetection", [
indir.value,
outdir.value,
c,
t,
m,
mc,
detectionMethod,
a,
e,
]);
}
});

back.addEventListener("click", function (event) {
if (back.classList.contains("btn-danger")) {
event.preventDefault();
ipc.send("killDetect", []);
back.classList.add("btn-warning");
back.classList.remove("btn-danger");
back.innerHTML = "Back";
run.innerHTML = "Run";
run.classList.remove("disabled");
loadmessage.innerHTML = "";
loadbar.style.width = "0";
}
if (back.classList.contains("btn-danger")) {
event.preventDefault();
ipc.send("killDetect", []);
back.classList.add("btn-warning");
back.classList.remove("btn-danger");
back.innerHTML = "Back";
run.innerHTML = "Run";
run.classList.remove("disabled");
loadmessage.innerHTML = "";
loadbar.style.width = "0";
}
});

ipc.on("detectResult", function (event, response) {
back.classList.add("btn-warning");
back.classList.remove("btn-danger");
back.innerHTML = "Back";
run.innerHTML = "Run";
run.classList.remove("disabled");
loadmessage.innerHTML = "";
loadbar.style.width = "0";
back.classList.add("btn-warning");
back.classList.remove("btn-danger");
back.innerHTML = "Back";
run.innerHTML = "Run";
run.classList.remove("disabled");
loadmessage.innerHTML = "";
loadbar.style.width = "0";
});

ipc.on("detectError", function (event, response) {
run.innerHTML = "Run";
run.classList.remove("disabled");
run.innerHTML = "Run";
run.classList.remove("disabled");
});

ipc.on("updateLoad", function (event, response) {
loadbar.style.width = String(response[0]) + "%";
loadmessage.innerHTML = response[1];
loadbar.style.width = String(response[0]) + "%";
loadmessage.innerHTML = response[1];
});

indir.addEventListener("click", function () {
ipc.once("returnPath", function (event, response) {
if (response[1] == "indir") {
indir.value = response[0];
}
});
ipc.send("openDialog", "indir");
ipc.once("returnPath", function (event, response) {
if (response[1] == "indir") {
indir.value = response[0];
}
});
ipc.send("openDialog", "indir");
});

outdir.addEventListener("click", function () {
ipc.once("returnPath", function (event, response) {
if (response[1] == "outdir") {
outdir.value = response[0];
}
});
ipc.send("openDialog", "outdir");
ipc.once("returnPath", function (event, response) {
if (response[1] == "outdir") {
outdir.value = response[0];
}
});
ipc.send("openDialog", "outdir");
});

model.addEventListener("click", function () {
ipc.once("returnPath", function (event, response) {
if (response[1] == "model") {
model.value = response[0];
}
});
ipc.send("openFileDialog", "model");
ipc.once("returnPath", function (event, response) {
if (response[1] == "model") {
model.value = response[0];
}
});
ipc.send("openFileDialog", "model");
});
Loading

0 comments on commit eaa9f2a

Please sign in to comment.