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

clear canvas when loading new images

parent d1ce1ecc
File added
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>image-rater</title> <title>image-rater</title>
<script src="https://unpkg.com/@niivue/niivue@0.6.0/dist/niivue.js"></script> <script type="text/javascript" src="niivue.js"></script>
</head> </head>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<h1>Image to rate</h1> <h1>Image to rate</h1>
</section> </section>
<section> <section>
<canvas id="gl" height=480 width=640></canvas> <canvas style="background-color: black;" id="gl" height=480 width=640></canvas>
</section> </section>
<section> <section>
<button onclick="nextImage()"> <button onclick="nextImage()">
...@@ -27,10 +27,13 @@ ...@@ -27,10 +27,13 @@
let index = 0 let index = 0
// Niivue will adjust the canvas to 100% of its parent container's size // Niivue will adjust the canvas to 100% of its parent container's size
// the parent element can be any size you want (small or large) // the parent element can be any size you want (small or large)
var nv = new niivue.Niivue() // var nv = new niivue.Niivue()
nv.attachTo('gl') // the canvas element id // nv.attachTo('gl') // the canvas element id
// nv.loadVolumes(volumeList) // nv.loadVolumes(volumeList)
// nv.setSliceType(nv.sliceTypeMultiPlanar) // nv.setSliceType(nv.sliceTypeMultiPlanar)
var nv = null
nv = new niivue.Niivue()
nv.attachTo('gl') // the canvas element id
let nextImage = () => { let nextImage = () => {
fetch('/next') fetch('/next')
...@@ -54,6 +57,9 @@ let nextImage = () => { ...@@ -54,6 +57,9 @@ let nextImage = () => {
} }
] ]
var nv = null
nv = new niivue.Niivue()
nv.attachTo('gl') // the canvas element id
nv.loadVolumes(v) nv.loadVolumes(v)
v[0].cal_min = 0 v[0].cal_min = 0
v[0].cal_max = 100 v[0].cal_max = 100
......
...@@ -28,9 +28,10 @@ getFilesRecursively(dir) ...@@ -28,9 +28,10 @@ getFilesRecursively(dir)
fileIdx = -1 fileIdx = -1
//process.exit() //process.exit()
app.get('/', (req, res) => { app.use('/', express.static(__dirname))
res.sendFile('index.html', {root: '.'}) // app.get('/', (req, res) => {
}) // res.sendFile('index.html', {root: '.'})
// })
app.get('/base/:index', (req, res) => { app.get('/base/:index', (req, res) => {
res.sendFile(files[req.params.index]) res.sendFile(files[req.params.index])
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,5 +10,8 @@ ...@@ -10,5 +10,8 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"express": "^4.17.1" "express": "^4.17.1"
},
"devDependencies": {
"pkg": "^5.3.1"
} }
} }
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