Commit ac48e988 authored by Taylor Hanayik's avatar Taylor Hanayik
Browse files

show bet result as overlay

parent 9916b894
......@@ -14,7 +14,7 @@
"@mui/icons-material": "^5.2.4",
"@mui/lab": "^5.0.0-alpha.70",
"@mui/material": "^5.2.4",
"@niivue/niivue": "^0.20.1",
"@niivue/niivue": "^0.22.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"socket.io-client": "^4.4.0"
......@@ -1141,9 +1141,9 @@
}
},
"node_modules/@niivue/niivue": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@niivue/niivue/-/niivue-0.20.1.tgz",
"integrity": "sha512-QBj/XfAE6/1xiwku7QBZtNoYDGTc64ozd8ydZV8OBHCMs6UR8daJpiTVg6AJ5jyqHRcj9ejGJownxfriaUYm5Q==",
"version": "0.22.2",
"resolved": "https://registry.npmjs.org/@niivue/niivue/-/niivue-0.22.2.tgz",
"integrity": "sha512-zEAQYl6KBvL2jk+DyVBLw/fa+vT33Xs6fcDsgo2dMpE8kjaUCFA1HmMn3hoqy0tuKy0cCCplnw5wFjpozawa2w==",
"dependencies": {
"gl-matrix": "^3.4.3",
"nifti-reader-js": "^0.5.4",
......@@ -3076,9 +3076,9 @@
}
},
"@niivue/niivue": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@niivue/niivue/-/niivue-0.20.1.tgz",
"integrity": "sha512-QBj/XfAE6/1xiwku7QBZtNoYDGTc64ozd8ydZV8OBHCMs6UR8daJpiTVg6AJ5jyqHRcj9ejGJownxfriaUYm5Q==",
"version": "0.22.2",
"resolved": "https://registry.npmjs.org/@niivue/niivue/-/niivue-0.22.2.tgz",
"integrity": "sha512-zEAQYl6KBvL2jk+DyVBLw/fa+vT33Xs6fcDsgo2dMpE8kjaUCFA1HmMn3hoqy0tuKy0cCCplnw5wFjpozawa2w==",
"requires": {
"gl-matrix": "^3.4.3",
"nifti-reader-js": "^0.5.4",
......
import { useState, useEffect, useRef, useCallback } from 'react'
import { useState, useEffect, useRef, memo } from 'react'
import Box from '@mui/material/Box'
import LoadingButton from '@mui/lab/LoadingButton';
import { Button, Card, CardContent, Slider, Input, Collapse, Snackbar, FormControlLabel, Checkbox, Switch } from '@mui/material'
import { Container, CssBaseline, TextField, Typography, Grid, Divider } from '@mui/material'
import { Niivue } from '@niivue/niivue'
import { Niivue, NVImage } from '@niivue/niivue'
import { io } from "socket.io-client";
import "./App.css"
......@@ -20,6 +20,12 @@ const runSocket = io(`ws://${host}:${socketServerPort}`)
const nv = new Niivue()
async function addNiiVueImage(url, color='red') {
let img = await NVImage.loadFromUrl(url,'',color,0.8)
console.log(img)
nv.addVolume(img)
}
const NiiVue = ({url}) => {
// use url string (primative) since object equality will not work with effects
const canvas = useRef()
......@@ -39,7 +45,7 @@ function InputField({text, updateBetOptsValue}) {
useEffect(()=>{
inFileSocket.on('files', (data) => {
console.log(data)
updateOptsValue('input', data[0])
updateBetOptsValue('input', data[0])
})
}, [])
......@@ -88,9 +94,6 @@ function OutputField({text, updateBetOptsValue}) {
>
</TextField>
</Grid>
<Grid item xs={3} sx={{justifyContent: 'center'}}>
<Button variant='contained' style={{margin:0, marginLeft: 12}}>Choose</Button>
</Grid>
</Grid>
)
}
......@@ -190,6 +193,7 @@ function OptionsContainer({moreOptions, options, updateBetOptsValue}) {
return (
<Collapse in={moreOptions} timeout="auto" unmountOnExit>
<Grid container item xs={12} m={2} spacing={0} direction='column'>
<GvalueField g={options['-g']} updateBetOptsValue={updateBetOptsValue} />
<BetOptionCheckBox
optionValue={options['-o']}
label={'create brain outline image'}
......@@ -322,9 +326,13 @@ export default function Bet() {
})
runSocket.on('run', (data) => {
console.log('run', data)
console.log('run', data)
let url = `http://${host}:${fileServerPort}/file/?filename=${betOpts['output']}`
//let name = betOpts['output'].split('/').pop()
if (isRunning){
addNiiVueImage(url)
}
setIsRunning(false)
setNiivueImage(`http://${host}:${fileServerPort}/file/?filename=${betOpts['output']}`)
})
function handleSnackBarClose() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment