index.html 1.54 KB
Newer Older
Taylor Hanayik's avatar
Taylor Hanayik committed
1
2
3
4
5
6
7
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>image-rater</title>
8
  <script type="text/javascript" src="niivue.js"></script>
Taylor Hanayik's avatar
Taylor Hanayik committed
9
10
11
12
13
14
15
16


</head>
<body>
  <section>
    <h1>Image to rate</h1>
  </section>
  <section>
17
    <canvas style="background-color: black;" id="gl" height=480 width=640></canvas>
Taylor Hanayik's avatar
Taylor Hanayik committed
18
19
20
21
22
23
24
25
26
  </section>
  <section>
    <button onclick="nextImage()">
      Next
    </button>
  </section>
</body>
<script>

Taylor Hanayik's avatar
Taylor Hanayik committed
27
let index = 0
Taylor Hanayik's avatar
Taylor Hanayik committed
28
29
 // 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)
30
31
//  var nv = new niivue.Niivue()
//  nv.attachTo('gl') // the canvas element id
Taylor Hanayik's avatar
Taylor Hanayik committed
32
33
//  nv.loadVolumes(volumeList)
//  nv.setSliceType(nv.sliceTypeMultiPlanar)
34
35
36
var nv = null
    nv = new niivue.Niivue()
    nv.attachTo('gl') // the canvas element id
Taylor Hanayik's avatar
Taylor Hanayik committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

let nextImage = () => {
  fetch('/next')
  .then(res => res.json())
  .then((data) => {
    v = [
      {
        url: '/base/' + data.index,
        volume: {hdr:null, img:null},
        colorMap: "gray",
        opacity: 100, 
        visible:true

      },
      {
        url: '/overlay/' + data.index,
        volume: {hdr:null, img:null},
        colorMap: "red",
        opacity: 80, 
        visible:true

      }
    ]
60
61
62
    var nv = null
    nv = new niivue.Niivue()
    nv.attachTo('gl') // the canvas element id
Taylor Hanayik's avatar
Taylor Hanayik committed
63
64
65
66
67
68
69
    nv.loadVolumes(v)
    v[0].cal_min = 0
    v[0].cal_max = 100
  })
}
</script>
</html>