Created
July 10, 2013 15:44
-
-
Save renaud/5967402 to your computer and use it in GitHub Desktop.
XTK demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hellllo</title> | |
<style type="text/css"> | |
html, body { | |
background-color:#000; | |
margin: 0; | |
padding: 0; | |
height: 100%; | |
overflow: hidden !important; | |
} | |
</style> | |
<script type="text/javascript" src="http://get.goXTK.com/xtk.js"></script> | |
<script type="text/javascript"> | |
window.onload = function() { | |
// create and initialize a 3D renderer | |
var r = new X.renderer3D(); | |
r.init(); | |
// create a new X.mesh | |
var skull = new X.mesh(); | |
// .. and associate the .vtk file to it | |
//skull.file = 'skull.vtk'; | |
//skull.file = 'gridAnnotation.nrrd'; | |
skull.file = 'MR-head.nii'; | |
// .. make it transparent | |
//skull.opacity = 0.7; | |
// .. add the mesh | |
r.add(skull); | |
// re-position the camera to face the skull | |
r.camera.position = [0, 400, 0]; | |
// animate.. | |
r.onRender = function() { | |
// rotate the skull around the Z axis | |
// since we moved the camera, it is Z not X | |
skull.transform.rotateZ(1); | |
// we could also rotate the camera instead which is better in case | |
// we have a lot of objects and want to rotate them all: | |
// | |
// r.camera.rotate([1,0]); | |
}; | |
r.render(); | |
}; | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment