[vtkusers] Set up vtk.js

YONE MORENO JIMÉNEZ yone.moreno101 at alu.ulpgc.es
Wed Feb 21 08:56:26 EST 2018


Hello I would like some help or link to resources, because I have followed the introduction guide: https://kitware.github.io/vtk-js/docs/develop_requirement.html to install vtk, node and git.


I have been trying to integrate into a React aplication, and it outputs:


Failed to compile

./node_modules/vtk.js/Sources/Rendering/OpenGL/Texture/index.js
1126:25-47 "export 'default' (imported as 'ComputeGradientsWorker') was not found in './ComputeGradients.worker'


I just have used the code in: https://kitware.github.io/vtk-js/examples/PolyDataReader.html


In addition if I go to the previous file and deep into ./ComputedGradients.worker, I navigate well to ComputeGradients.worker.js.



Do I need other requirement to execute the aplication? I am using a node server.


In addition I have written the code as React code:


import React from 'react';


import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';
import vtkFullScreenRenderWindow from 'vtk.js/Sources/Rendering/Misc/FullScreenRenderWindow/index';
import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';
import vtkPolyDataReader from 'vtk.js/Sources/IO/Legacy/PolyDataReader';

class LoadVTK extends React.Component() {
    render() {
        const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
        const renderer = fullScreenRenderer.getRenderer();
        const renderWindow = fullScreenRenderer.getRenderWindow();

        const resetCamera = renderer.resetCamera;
        const render = renderWindow.render;

        const reader = vtkPolyDataReader.newInstance();
        reader.setUrl(`C:\Users\YonePC\WebstormProjects\prototipo\src\components\animals\cabezasegmentado02.vtk`).then(() => {
            const polydata = reader.getOutputData(0);
            const mapper = vtkMapper.newInstance();
            const actor = vtkActor.newInstance();

            actor.setMapper(mapper);
            mapper.setInputData(polydata);

            renderer.addActor(actor);

            resetCamera();
            render();

        });

        return (
            <div></div>
        );

    }
}

export default LoadVTK;



And I have used it from the main page as:

<LoadVTK/>


Could you help me please?


Antes de imprimir este correo electrónico, piense bien si es necesario hacerlo: el medio ambiente es una cuestión de todos.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/659df140/attachment.html>


More information about the vtkusers mailing list