vtk.js data structure please explain please help

Please explain the vtk.js data structure, expecially how ‘model’ is used. For example, const range = imageData.getPointData().getScalars().getRange();
if you go through debugger, you can see imageData is a bunch of useless public APIs with no data provided,
if you step into getPointData() function, you will get this line
publicAPI[get${capitalize(field)}] = () => model[field];
, I tried and tried but couldn’t understand where model[] is defined, and how does macro.js thing work, please help! Please give some tips, thank you!

What is exactly the question?

  • What is the VTK API ? You can learn about VTK via the free pdf book
  • How to create VTK code yourself? Guide
  • The usage of closures to provide protected/private members via model and a separate public API container that we freeze to prevent any alteration?
  • The fact that we generate methods to prevent developer mistakes?

Hi Sebastien,
The link to download pdf book (https://www.kitware.com/products/books/VTKTextbook.pdf) seems not working. Can you please help to resend it here ?

Check out the examples: https://kitware.github.io/vtk-examples/site/

These include a link to the LaTeX/pdf version of the textbook: https://gitlab.kitware.com/vtk/textbook/raw/master/VTKBook/VTKTextBook.pdf

The link you provided is working for me when clicked in the US. Not sure I know how to solve the problem you are running into.