0

I'm adapting Lesson 5 from here, which takes a skull vtk object and displays it rotating in a circle. I want to change it so instead of accessing the .vtk object at http://x.babymri.org/?skull.vtk, it reads from a local file. Is this possible? I downloaded an exact copy of the skull.vtk and tried things like skull.file = file:///C:/Users/myName/Desktop/XTKtest/downloadedSkull.vtk;, but I didn't get anywhere. Is there an alternate way to do this?

Thanks in advance, I am super new to XTK and JavaScript in general...

user3175137
  • 97
  • 1
  • 9

2 Answers2

0

Can you share some code?

I think the easiest is to run a local server on your machine:

Set up Python simpleHTTPserver on Windows

If your project directory contains the following files:

Project
    index.html
    file.vtk

1- Go inside the directory 2- Start the local server from there. 3- Make sure you can access the file through: localhost:/file.vtk 4- In you JS code, change the reference to the model to: localhost:/file.vtk

5- Go to: localhost

Et voila!

make sure to replace by the actual port you are using for the local server, ie. localhost:8000

My 2 cts

Community
  • 1
  • 1
Nicolas
  • 2,191
  • 3
  • 29
  • 49
  • Hi, thanks for your help. I created a localhost on port 8000, and when I go to `http://127.0.0.1:8000/` I can see all my files. However, when I try to access the .vtk file my server crashes. My terminal says `Exception happened during processing of request from ('127.0.0.1',63216)`, then gives several more Tracebacks. The line causing the crash is `skull.file = 'http://127.0.0.1:8000/downloadedSkull.vtk';`. I'm wondering if .vtk files don't like this setup. If I type the address of a jpg in the browser it displays the pic, but if I do it to the .vtk file it tries to download it... – user3175137 Jun 24 '14 at 14:23
  • hmmm... what are the permissions of this file? are they the same for the jpg and for the vtk file? – Nicolas Jun 24 '14 at 15:31
  • They seem to be the same, both file grant full control (Modify, Read & execute, Read, Write) to SYSTEM, MyUser, and Administrators. – user3175137 Jun 24 '14 at 15:36
  • so both have same permissions and are located in the same directory... ? – Nicolas Jun 24 '14 at 15:37
  • That's correct. The only differences I can see are file type and size. – user3175137 Jun 24 '14 at 15:56
-1

The easyest / lazyest way to do that :

1-Copy downloadedSkull.nrrd and downloadedSkull.vtk in the root directory (with index.html)

2- skull.file = 'downloadedSkull.vtk';

3-Use Firefox rather than Chrome : Firefox accept to open local file, chrome need a local server

Bruit
  • 1