Hello everyone,

I’m using paint filter like in the example; vtk.js

How we can get pixel coordinates of the labels?

i will be appreciated for your help.

Hello everyone,

I’m using paint filter like in the example; vtk.js

How we can get pixel coordinates of the labels?

i will be appreciated for your help.

You can iterate over the pixel arrays to figure out which ones are set.

```
let data = labelImageData.getPointData().getScalars().getData().
let coords = [];
let xyArea = xDim*yDim
for (let i = 0; i < data.length; i++) {
if (data[i] === 0) continue; // not painted
let z = Math.floor(i / xyArea);
let y = Math.floor(i / xDim) % yDim;
let x = i % xDim;
}
```

How do I know, which coordinates belong to which label?

Based on the value of `data[i]`

. Each label is a unique non-zero value.

Thank you!