question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no.input error when using vtk.js in react

See original GitHub issue

Im just trying to run the polydatareader example with my data in a react project. I am getting an error on load and on button press stating that there is no input.

here is the code I am using:

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

export default class VtkGeometryRenderer extends React.Component {
  constructor (){
    super();
  }
  shouldComponentUpdate(){
    return false;
  }
  componentDidMount(){
//vtk.js try
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(`./Assets/cube_ascii.vtp`).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();
});

global.reader = reader;
global.fullScreenRenderer = fullScreenRenderer;

  }
  render() {

    return (
          <div
              ref={(c) => {
              this.rootContainer = c;
            }}
          />
        );
};

and here is the error message and screen im getting on load: image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
ghostcommented, Jul 31, 2018

Well the data loads now. I think I can work on making the react component valid on my own. I appreciate all the help, thank you very much.

0reactions
jourdaincommented, Jul 31, 2018

I’m not saying react is producing that error, I’m just saying that your react component is not valid. But like I said, you are not there yet… The main issue right now is that the data does not load.

But looking closer at your code, the issue is related to your import. vtk.js/Sources/IO/Legacy/PolyDataReader is meant for vtk files not vtp. You need to use the XML version which is available here: https://github.com/Kitware/vtk-js/tree/master/Sources/IO/XML/XMLPolyDataReader

Read more comments on GitHub >

github_iconTop Results From Across the Web

No input issue and removeActor issue #3 - GitHub
I'm developing a Reactjs front-end using this library. I'm facing some issues and need your help. I got 7 errors (No input!)
Read more >
vtk.js No input error - Web - VTK Discourse
I am trying to do volume rendering which works with fullscreenrendering but I want to place it in a div element rather than...
Read more >
VTK.js, React, JavaScript: Load VTK files - Stack Overflow
I am using a node server. In addition I have written the code as React code: import React from 'react'; ...
Read more >
Starting a vtk.js project from scratch - Kitware, Inc.
This is a quickstart tutorial for using vanilla vtk.js. Initialize your projectLet's start by initializing a new project.
Read more >
Sci-Vis on the Web using VTK.js - YouTube
Presented by Bill Sherman. 2018-2019 Scientific Visualization Workshop at Indiana University. Filmed Nov 28, 2018.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found