Permalink
Browse files

New version with selector for subject and rotation checkbox.

  • Loading branch information...
Daniel Haehn
Daniel Haehn committed Sep 9, 2012
1 parent 964e5e7 commit 3e852db8448a05c45f80bb7957532519a5f90255
Showing with 26 additions and 15 deletions.
  1. +24 −13 mindboggle/code.js
  2. +2 −2 mindboggle/index.html
View
@@ -1,23 +1,22 @@
window.onload = function() {
config = {
'rotate': true,
'subject': 1
};
if (location.href.match(/(\?)(\w*,*\w*)*/)) {
//
var _values = location.href.match(/(\?)(\w*,*.*\w*)*/)[0];
subject = _values;
subject = subject.replace('?', '').replace('/', ''); // replace any ? or /
console.log(subject);
config.subject = _values;
config.subject = config.subject.replace('?', '').replace('/', ''); // replace any ? or /
} else {
subject = 1;
}
rotate = true;
left();
right();
@@ -34,7 +33,7 @@ function left() {
// create a new X.mesh
left_fundi = new X.mesh();
// .. and associate the .vtk file to it
left_fundi.file = 'data/_hemi_' + 'lh' + '_subject_HLN-12-' + subject
left_fundi.file = 'data/_hemi_' + 'lh' + '_subject_HLN-12-' + config.subject
+ '/fundi.vtk';
left_fundi.color = [ 1, 0, 0 ];
@@ -46,6 +45,10 @@ function left() {
var gui = new dat.GUI();
var subjectController = gui.add(config, 'subject', [1,2,3,4,5,6,7,8,9,10,11,12]);
var rotation = gui.add(config, 'rotate');
// now we configure the gui for interacting with the X.mesh
var leftgui = gui.addFolder('Left Hemisphere');
// .. the mesh color
@@ -57,14 +60,22 @@ function left() {
// .. the mesh color
var rightColorController = rightgui.addColor(right_fundi, 'color');
rightgui.open();
subjectController.onChange(function() {
var currentURL = window.location + '';
window.location = currentURL.substring(0,currentURL.indexOf('?')) + '?' + config.subject;
});
};
// animate..
r.onRender = function() {
if ( rotate ) {
if ( config.rotate ) {
r.camera.rotate([ 1, 0 ]);
}
@@ -88,7 +99,7 @@ function right() {
// create a new X.mesh
right_fundi = new X.mesh();
// .. and associate the .vtk file to it
right_fundi.file = 'data/_hemi_' + 'rh' + '_subject_HLN-12-' + subject
right_fundi.file = 'data/_hemi_' + 'rh' + '_subject_HLN-12-' + config.subject
+ '/fundi.vtk';
right_fundi.color = [ 0, 1, 0 ];
@@ -98,7 +109,7 @@ function right() {
// animate..
r.onRender = function() {
if ( rotate ) {
if ( config.rotate ) {
r.camera.rotate([ 1, 0 ]);
}
View
@@ -36,9 +36,9 @@
</head>
<body>
<div id='mindboggle' style='position:absolute;top:10px;left:10px;'><a href='http://mindboggle.info' target=_blank><img src='gfx/logo.png' border=0></a></div>
<div id='mindboggletext' style='position:absolute;top:30px;left:130px;'><a style="color: #FFBF1E; text-decoration: none; font-size: 32px" href="#">Mindboggle</a></div>
<div id='lh'></div>
<div id='rh'></div>
<div id='mindboggle' style='position:absolute;top:10px;left:10px;'><a href='http://mindboggle.info' target=_blank><img src='gfx/logo.png' border=0></a></div>
<div id='mindboggletext' style='position:absolute;top:30px;left:130px;'><a style="color: #FFBF1E; text-decoration: none; font-size: 32px" href="#">Mindboggle</a></div>
</body>
</html>

0 comments on commit 3e852db

Please sign in to comment.