Skip to content

Instantly share code, notes, and snippets.

@haehn
Created November 1, 2023 19:49
Show Gist options
  • Save haehn/6770c4dc25cf614d7398a45175b1d568 to your computer and use it in GitHub Desktop.
Save haehn/6770c4dc25cf614d7398a45175b1d568 to your computer and use it in GitHub Desktop.
NiiVue Volume access test!
<html>
<head>
<title>NiiVue!</title>
<style>
body {
background-color:#000;
margin: 0;
padding: 0;
height: 100%;
overflow: hidden !important;
}
</style>
<script type="text/javascript" src="https://niivue.github.io/niivue/features/niivue.umd.js"></script>
<script type="text/javascript">
window.onload = function() {
var nv1 = new niivue.Niivue()
nv1.attachTo('gl1')
nv1.setSliceType(nv1.sliceTypeRender)
nv1.loadVolumes([{url:'https://haehn.github.io/VIZBI/daniel.nii'}]).then(function() {
console.log('Volume dimensions:', nv1.back.dims);
console.log('Full Volume (flattened):', nv1.back.img);
console.log('Full Volume (3D): %c not yet working', 'color:red');
console.log('Volume pixel access:', nv1.back.getValue(10, 10, 10));
console.log('Subvolume access: %c not yet working', 'color:red');
});
};
</script>
</head>
<body>
<canvas id='gl1' style='height:100%;width:100%'></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment