Skip to content

Commit

Permalink
Merge pull request #6 from neurolabusc/main
Browse files Browse the repository at this point in the history
Bump dependencies
  • Loading branch information
neurolabusc authored May 3, 2024
2 parents 506ed5b + ff733f6 commit 85a8ffe
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 47 deletions.
2 changes: 1 addition & 1 deletion brainchop-mainthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ async function enableProductionMode(textureF16Flag = true) {

async function runInference(opts, modelEntry, niftiHeader, niftiImage, callbackImg, callbackUI) {
const statData = []
statData.startTime = performance.now()
statData.startTime = Date.now() // for common webworker/mainthread do not use performance.now()
callbackUI('Segmentation started', 0)
const startTime = performance.now()
const batchSize = opts.batchSize
Expand Down
5 changes: 2 additions & 3 deletions brainchop-telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ async function isChrome() {
}

async function localSystemDetails(statData, gl = null) {
const Preprocess_t = ((performance.now() - statData.startTime) / 1000).toFixed(4)
// -- Timing data to collect
const today = new Date()
if (statData.isModelFullVol) {
Expand All @@ -168,9 +167,9 @@ async function localSystemDetails(statData, gl = null) {
statData["State"] = ""
statData["City"] = ""
} */

statData.Total_t = (Date.now() - statData.startTime) / 1000.0
delete statData.startTime
statData.Date = parseInt(today.getMonth() + 1) + '/' + today.getDate() + '/' + today.getFullYear()
statData.Time_Elapsed = Preprocess_t
statData.Browser = await detectBrowser()
statData.Browser_Ver = await detectBrowserVersion()
statData.OS = await detectOperatingSys()
Expand Down
2 changes: 1 addition & 1 deletion brainchop-webworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,7 @@ async function enableProductionMode(textureF16Flag = true) {

async function runInferenceWW(opts, modelEntry, niftiHeader, niftiImage, callbackImg, callbackUI) {
const statData = []
statData.startTime = performance.now()
statData.startTime = Date.now() // for common webworker/mainthread do not use performance.now()
callbackUI('Segmentation started', 0)
const batchSize = opts.batchSize
const numOfChan = opts.numOfChan
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<body>
<header>
<label for="smoothCheck">Interpolate</label>
<input type="checkbox" id="smoothCheck" unchecked />
&nbsp;
<label for="clipCheck">Clip Plane</label>
<input type="checkbox" id="clipCheck" unchecked />
Expand Down
8 changes: 6 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { isChrome, localSystemDetails } from "./brainchop-telemetry.js"
import MyWorker from "./brainchop-webworker.js?worker"

async function main() {
smoothCheck.onchange = function () {
nv1.setInterpolation(!smoothCheck.checked)
}
aboutBtn.onclick = function () {
window.alert("BrainChop models https://github.com/neuroneural/brainchop")
}
Expand Down Expand Up @@ -99,8 +102,6 @@ async function main() {
nv1.setClipPlane([2, 0, 90])
}
}


async function fetchJSON(fnm) {
const response = await fetch(fnm)
const js = await response.json()
Expand All @@ -116,6 +117,8 @@ async function main() {
if (modelEntry.colormapPath) {
let cmap = await fetchJSON(modelEntry.colormapPath)
overlayVolume.setColormapLabel(cmap)
// n.b. most models create indexed labels, but those without colormap mask scalar input
overlayVolume.hdr.intent_code = 1002 // NIFTI_INTENT_LABEL
} else {
let colormap = opts.atlasSelectedColorTable.toLowerCase()
const cmaps = nv1.colormaps()
Expand Down Expand Up @@ -179,6 +182,7 @@ async function main() {
nv1.opts.multiplanarForceRender = true
nv1.opts.yoke3Dto2DZoom = true
nv1.opts.crosshairGap = 11
smoothCheck.onchange()
await nv1.loadVolumes([{ url: "./t1_crop.nii.gz" }])
for (let i = 0; i < inferenceModelsList.length; i++) {
var option = document.createElement("option")
Expand Down
76 changes: 38 additions & 38 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
"@niivue/niivue":"^0.42.0",
"@tensorflow/tfjs": "^4.18.0",
"@niivue/niivue":"^0.43.0",
"@tensorflow/tfjs": "^4.19.0",
"gl-matrix": "^3.4.3"
},
"devDependencies": {
Expand Down

0 comments on commit 85a8ffe

Please sign in to comment.