1. Matthew Turk
  2. yt.hub

Source

yt.hub / ythub / templates / vertices.html

<!-- 
/*
 * 
 *                  xxxxxxx      xxxxxxx
 *                   x:::::x    x:::::x 
 *                    x:::::x  x:::::x  
 *                     x:::::xx:::::x   
 *                      x::::::::::x    
 *                       x::::::::x     
 *                       x::::::::x     
 *                      x::::::::::x    
 *                     x:::::xx:::::x   
 *                    x:::::x  x:::::x  
 *                   x:::::x    x:::::x 
 *              THE xxxxxxx      xxxxxxx TOOLKIT
 *                    
 *                  http://www.goXTK.com
 *                   
 * Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
 *                   
 *    The X Toolkit (XTK) is licensed under the MIT License:
 *      http://www.opensource.org/licenses/mit-license.php
 *
 * LESSON 05 - Give me galaxy, baby!
 *
 * This is the featured example from the goXTK.com website with a little more pep..
 *
 * The galaxy is part of the SPL-PNL Brain Atlas, available here:
 *   http://www.slicer.org/publications/item/view/1265
 *
 */
-->

<html>
<head>
<title>Vertex View</title>

<script type="text/javascript" src="http://get.goXTK.com/xtk.js"></script>
<script type="text/javascript" src="/static/dat.gui.min.js"></script>

<script type="text/javascript">

  var examine;

  var run = function() {
    
    // create a new renderer
    var r = new X.renderer('r');
    examine = r;
    r.init();
    var gui = new dat.GUI();

    // load a .vtk file
    var galaxy00 = new X.object();
    galaxy00.load('{{ vtk_url }}');
    // .. make it transparent
    galaxy00.setOpacity(0.3);
    galaxy00.setColor(0.4,0.1,0.3);
    examine = {gal: galaxy00, r: r};

    // add the object
    r.add(galaxy00);

    // re-position the camera to face the galaxy00
    r.camera().setPosition(0,100,0);
    
    r.render();

    var galaxy00gui = gui.addFolder('Outer Galaxy');
    var galaxy00VisibleController = galaxy00gui.add(galaxy00,'_visible');
    var galaxy00OpacityController = galaxy00gui.add(galaxy00, '_opacity', 0, 1);
    var galaxy00ColorController = galaxy00gui.addColor(galaxy00, '_color');
    galaxy00gui.open(); 

    galaxy00VisibleController.onChange(function(value) {
      r.render();
    });      
    
    galaxy00OpacityController.onChange(function(value) {
      r.render();
    });    

    galaxy00ColorController.onChange(function(value) {
      r.render();
    });        
    

  };
</script>

<body onload="run()" style="margin:0px;">
  
  <!-- the container for the renderer -->
  <div id="r" style="background-color: #000000; width: 100%; height: 100%;"></div>
    
</body>