model data structure in vtk.js, 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!

is there a way to see the actual data structure of imageData within a debuger?

I am trying to understand the magic in macro.js, I am looking at


, and once I step into it with chrome I suddenly get this

export function get(publicAPI, model, fieldNames) {
fieldNames.forEach((field) => {
if (typeof field === ‘object’) {
publicAPI[get${capitalize(}] = () => model[];
} else {
publicAPI[get${capitalize(field)}] = () => model[field];

I cannot find where model[] is defined, although it is used everywhere in macro.js. Why a function without any parameters suddenly becomes a function with three parameters. What technique was employed here, there is no comment in macro.js for its usage, any documentation to understand this huge jump in code logic?

Any tip would be great, thanks!

Anyway to see the actualy data in a vtk object, e.g, imageData? the data must be somewhere stored in ‘model’, but it seems completely hidden from the chrome debugger by the publicAPIs. it is frustrating not being able to check the actual data. The publicAPI properties does not tell you anything about the object. So if I want to printout the data in imageData, what should I do?

Finally found the solution, have to use the get() call to get the actual data (model). it’s cumbersome to check the entire object tree in this way but at least it can be checked in chrome now.

I still don’t understand why you need to have access to the model? If you want something specific get it from the API or a subset via get('a', 'b'). But normally even that should not be allowed. That is the point of having things private/protected.