Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File format of the VTK file to be used as input for XTK

I have a .vtk file at remote server. I am accessing it via http (I verified that the url of the file is correct, in fact I can download it from the browser). I've also tried to remove the blank spaces from the file as suggested in xtk volume rendering with .vtk file created from matlab.

But i get an exception

Unable to get property 'length' of undefined or null reference.

Can you please guide me the .vtk file format that should be used in order to make it work smoothly ? I am following the xtk tutorial http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/05/#run, below is my code

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 = 'http://localhost/startup/bunnycheck.vtk';  //using other .vtk file
    //skull.file = 'http://x.babymri.org/?skull.vtk';     

    // .. make it transparent
    skull.opacity = 0.5;

    // .. add the mesh
    r.add(skull);

    // re-position the camera to face the skull
    r.camera.position = [0, 400, 0];

    // animate..
    r.onRender = function () {
         r.camera.rotate([1,0]);
    };

    r.render();

};
like image 831
AkshayJ Avatar asked Nov 20 '15 10:11

AkshayJ


1 Answers

I just got a similar exception, the problem was that the file was a binary vtk file, and it should have been ASCII .

like image 117
lib Avatar answered Sep 23 '22 00:09

lib