diff --git a/js/collate.js b/js/collate.js deleted file mode 100644 index f45c4f7..0000000 --- a/js/collate.js +++ /dev/null @@ -1,81 +0,0 @@ -var ipc = require('electron').ipcRenderer; -var run = document.getElementById('run'); -var indir = document.getElementById('indir'); -var outdir = document.getElementById('outdir'); -var loadbar = document.getElementById('loadbar'); -var loadmessage = document.getElementById('loadmessage'); -var back = document.getElementById('back'); -var regions = document.getElementById('regions'); - -function checkNumber(value, message) { - var str = value.toString(); - if(!str.match(/^-?\d*\.?\d*$/)) { - alert(`${message}`); - return false; - } - return true; -} - -run.addEventListener('click', function(){ - if (indir && outdir && indir.value && outdir.value) { - run.classList.add('disabled'); - back.classList.remove('btn-warning'); - back.classList.add('btn-danger') - back.innerHTML = "Cancel"; - run.innerHTML = ""; - ipc.send('runCollate', [indir.value, outdir.value, regions.innerText]); - loadmessage.innerHTML = "Intializing..."; - } -}); - -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"; - } -}); - -ipc.on('collateResult', 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"; -}); - -ipc.once('detectError', function(event, response){ - run.innerHTML = "Run"; - run.classList.remove('disabled'); -}); - -ipc.on('updateLoad', function (event, response) { - 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('openFileDialog', 'indir'); -}); - -outdir.addEventListener('click', function(){ - ipc.once('returnPath', function(event, response){ - if (response[1] == 'outdir') { - outdir.value = response[0]; - } - }) - ipc.send('openDialog', 'outdir'); -}); \ No newline at end of file diff --git a/js/count.js b/js/count.js deleted file mode 100644 index dd2108c..0000000 --- a/js/count.js +++ /dev/null @@ -1,86 +0,0 @@ -var ipc = require('electron').ipcRenderer; -var run = document.getElementById('run'); -var preddir = document.getElementById('preddir'); -var annodir = document.getElementById('annodir'); -var outdir = document.getElementById('outdir'); -var loadbar = document.getElementById('loadbar'); -var loadmessage = document.getElementById('loadmessage'); -var layerinfo = document.getElementById('layerinfo'); -var back = document.getElementById('back'); - -run.addEventListener('click', function(){ - if (preddir && annodir && outdir && preddir.value && annodir.value && outdir.value) { - run.classList.add('disabled'); - back.classList.remove('btn-warning'); - back.classList.add('btn-danger') - back.innerHTML = "Cancel"; - run.innerHTML = ""; - - var should_layer = layerinfo.checked; - - ipc.send('runCount', [preddir.value, annodir.value, outdir.value, should_layer]); - } -}); - -back.addEventListener('click', function (event){ - if (back.classList.contains('btn-danger')){ - event.preventDefault(); - ipc.send('killCount', []); - 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('countResult', function(event, response){ - run.innerHTML = "Run"; - run.classList.remove('disabled'); - 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('countError', function(event, response){ - run.innerHTML = "Run"; - run.classList.remove('disabled'); -}); - -ipc.on('updateLoad', function (event, response) { - loadbar.style.width = String(response[0]) + "%"; - loadmessage.innerHTML = response[1]; -}); - -preddir.addEventListener('click', function(){ - ipc.once('returnPath', function(event, response){ - if (response[1] == 'preddir') { - preddir.value = response[0]; - } - }) - ipc.send('openDialog', 'preddir'); -}); - -annodir.addEventListener('click', function(){ - ipc.once('returnPath', function(event, response){ - if (response[1] == 'annodir') { - annodir.value = response[0]; - } - }) - ipc.send('openDialog', 'annodir'); -}); - -outdir.addEventListener('click', function(){ - ipc.once('returnPath', function(event, response){ - if (response[1] == 'outdir') { - outdir.value = response[0]; - } - }) - ipc.send('openDialog', 'outdir'); -}); \ No newline at end of file diff --git a/js/detect.js b/js/detect.js deleted file mode 100644 index 3b31e11..0000000 --- a/js/detect.js +++ /dev/null @@ -1,125 +0,0 @@ -var ipc = require("electron").ipcRenderer; -var run = document.getElementById("run"); -var indir = document.getElementById("indir"); -var outdir = document.getElementById("outdir"); -var loadbar = document.getElementById("loadbar"); -var tile = document.getElementById("tile"); -var confidence = document.getElementById("confidence"); -var model = document.getElementById("model"); -var loadmessage = document.getElementById("loadmessage"); -var back = document.getElementById("back"); -var advance = document.getElementById("advance"); -var arrow = document.getElementById("arrow"); -var multichannel = document.getElementById("multichannel"); - -advance.addEventListener("click", function () { - arrow.classList.toggle("down"); -}); - -function checkNumber(value, message) { - var str = value.toString(); - if (!str.match(/^-?\d*\.?\d*$/)) { - alert(`${message}`); - return false; - } - return true; -} - -run.addEventListener("click", function () { - var c = 0.5; - 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 (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 = ""; - loadmessage.innerHTML = "Intializing..."; - - ipc.send("runDetection", [indir.value, outdir.value, c, t, m, mc]); - } -}); - -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"; - } -}); - -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"; -}); - -ipc.on("detectError", function (event, response) { - run.innerHTML = "Run"; - run.classList.remove("disabled"); -}); - -ipc.on("updateLoad", function (event, response) { - 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"); -}); - -outdir.addEventListener("click", function () { - 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"); -}); diff --git a/js/intensity.js b/js/intensity.js deleted file mode 100644 index 56c824e..0000000 --- a/js/intensity.js +++ /dev/null @@ -1,99 +0,0 @@ -var ipc = require("electron").ipcRenderer; -var run = document.getElementById("run"); -var indir = document.getElementById("indir"); -var annodir = document.getElementById("annodir"); -var outdir = document.getElementById("outdir"); -var loadbar = document.getElementById("loadbar"); -var loadmessage = document.getElementById("loadmessage"); -var back = document.getElementById("back"); -var whole = document.getElementById("whole"); -var half = document.getElementById("half"); -var alignmentMethod = "True"; -var methods = document.querySelector("#methods"); - -whole.addEventListener("click", function () { - methods.textContent = "Whole Slice"; - alignmentMethod = "True"; - console.log(alignmentMethod); -}); - -half.addEventListener("click", function () { - methods.textContent = "Hemisphere Only"; - alignmentMethod = "False"; - console.log(alignmentMethod); -}); - -run.addEventListener("click", function () { - if (indir && outdir && indir.value && outdir.value && annodir && annodir.value) { - - run.classList.add("disabled"); - back.classList.remove("btn-warning"); - back.classList.add("btn-danger"); - back.innerHTML = "Cancel"; - run.innerHTML = ""; - ipc.send("runIntensity", [indir.value, outdir.value, annodir.value, alignmentMethod]); - } -}); - -back.addEventListener("click", function (event) { - if (back.classList.contains("btn-danger")) { - event.preventDefault(); - ipc.send("killIntensity", []); - 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("intensityResult", function (event, response) { - run.innerHTML = "Run"; - run.classList.remove("disabled"); - 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("intensityError", function (event, response) { - run.innerHTML = "Run"; - run.classList.remove("disabled"); -}); - -ipc.on("updateLoad", function (event, response) { - 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"); -}); - -outdir.addEventListener("click", function () { - ipc.once("returnPath", function (event, response) { - if (response[1] == "outdir") { - outdir.value = response[0]; - } - }); - ipc.send("openDialog", "outdir"); -}); - -annodir.addEventListener("click", function () { - ipc.once("returnPath", function (event, response) { - if (response[1] == "annodir") { - annodir.value = response[0]; - } - }); - ipc.send("openDialog", "annodir"); -}); \ No newline at end of file diff --git a/main.js b/main.js index 8cec154..3d058ab 100644 --- a/main.js +++ b/main.js @@ -522,13 +522,13 @@ function setupMambaEnv(win) { miniforgePath = path.join(homeDir, 'miniforge'); mambaPath = path.join(miniforgePath, 'condabin', 'mamba'); pipPath = path.join(miniforgePath, 'Scripts', 'pip'); // Adjust for Windows if necessary - imswitchPath = path.join(miniforgePath, 'site-packages', 'imswitch') + imswitchPath = path.join(miniforgePath, 'Lib', 'site-packages', 'imswitch') } else { miniforgePath = path.join(homeDir, 'miniforge'); mambaPath = path.join(miniforgePath, 'bin', 'mamba'); pipPath = path.join(miniforgePath, 'bin', 'pip'); - imswitchPath = path.join(miniforgePath, 'site-packages', 'imswitch') + imswitchPath = path.join(miniforgePath, 'site-packages', 'imswitch') } /* Install UC2-REST and ImSwitch from github master @@ -686,7 +686,7 @@ function setupMambaEnv(win) { } } }); - checkForUpdates(); + //checkForUpdates(); win.webContents.once("did-finish-load", () => { // Make a directory to house enviornment, settings, etc.yarn checkLocalDir();