Hi!
I want to make a “scalpel” tool for a vtkVolume where the user can select a specific zone of it, get all of points (from .getPointData) and remove/hide them from the visualization.
Actually, i’m trying to aproaching with two ways:
A: Using clipping planes, but i have the default limit of 6 and i need more than these, exists any way of
create more clipping planes for the vtkVolumeMapper?.
B: Get the scalars of this points and set its values to black or transparent. How can i achieve this?
Actually i’m setting all points i want to be black/not visible for example to a specific value (for example “-3024”) and the other ones with other value (“1000” for example), then i create a new scalarOpacity function with points in this values and add it to the actual volume (remplacing the old one). I need to render other time the volume or do anything more? I don’t if i’m missing something, i let you the code i’m trying here:
//Here set all values i want to be transparent/black
const scalars = this.volume3D.getMapper().getInputData().getPointData().getScalars().getData();
for (let i = 0; i < scalars.length; i++) {
scalars[i] = -3024;
}
//Then set all the values i want to remain as it with other value as 1000 (I use a timeout of 1s
//between this two loops)
for(let i = 0; i < points[0].length; i++) {
scalars[POINT_INDEX] = 1000;
}
//I also try it with "setScalars" and new array of Float3d but didn't work
this.volume3D.getMapper().getInputData().getPointData().getScalars().modified();
//Then add the opacityFunction on the site of the old one: "0". With points as 1.0 in my desired
//scalars
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 understandly properly the opacity with the scalars or something…
Thanks in advance!