Hi!
I’m trying to hide/turn transparent some specific points from the vtkVolume. How can i achieve this? Actually i’m trying to modify the scalar values of this points to a specific value (for example “-3024”) and the points i want to persist with other one (for example “1000”) then replace the actual scalarOpacity function of the volume (because its actually rendered) and set a new one with the values near 1000 as 1.0 (i mean set visible), i’m missing something, maybe render again the volume?. Heres the code i’m trying:
const scalars = this.volume3D.getMapper().getInputData().getPointData().getScalars().getData();
//I want all points turn black/transparent
for (let i = 0; i < scalars.length; i++) {
scalars[i] = -3024;
}
//The points i know should remain as visible (i have a timeout between this twoo loops)
for (let i = 0; i < STORE_POINTS.length; i++) {
scalars[POINT_INDEX] = 1000; //Example, actually i get the real index of ".getInputData"
}
//I also tried with "setScalars" and create a Float32Array but didn't work.
this.volume3D.getMapper().getInputData().getPointData().getScalars().modified();
//Create the opacity function for only view the desired points and reemplace the "0" old one.
const pieceFun = vtkPiecewiseFunction.newInstance();
pieceFun.addPoint(999, 0.0);
pieceFun.addPoint(1000.0, 1.0);
pieceFun.addPoint(1001.0, 0.0);
this.volume3D.getProperty().setScalarOpacity(0, pieceFun);
I don’t know if i’m doing this right, maybe i don’t understand exactly how the opacity function interpretes the scalars…
Thanks in advance!