import NiiVue from '@niivue/niivue'
const gl1 = document.getElementById('gl1')
const checkCutaway = document.getElementById('checkCutaway')
const clipSelect = document.getElementById('clipSelect')
const colorSelect = document.getElementById('colorSelect')
const xrayCheck = document.getElementById('xrayCheck')
checkCutaway.onclick = function () {
nv1.isClipPlaneCutaway = this.checked
xrayCheck.onclick = function () {
nv1.meshXRay = +this.checked * 0.1
colorSelect.onchange = function () {
const index = this.selectedIndex
const clr = nv1.clipPlaneColor
clipSelect.onchange = function () {
const index = parseInt(this.value, 10) // selected option value as integer
let planes = [[2.0, 180, 20]]
planes = [[0.1, 180, 20]]
[0.0, 90, 0], //right center
[0.0, 0, -20], //posterior oblique
[0.1, 0, -90], //inferior
[0.0, 180, 0], //anterior
[0.4, 180, 0], //anterior
[0.1, 0, -90], //inferior
[0.4, 180, 0], //anterior
[0.1, 0, -90], //inferior
nv1.setClipPlanes(planes)
const nv1 = new NiiVue({ meshXRay: 0.1 })
await nv1.attachToCanvas(gl1)
await nv1.loadVolumes([{ url: '/volumes/mni152.nii.gz' }])