Hi all,
I’m trying to use vtkImageCPRMapper
to construct a panoramic projection for teeth, but I can’t get it to work.
I have a spline running through the volume. I’m visualizing it on the axial (transversal) plane:
I take points from that spline and their normals, and create a centerline
polydata from them using this code:
const centerline = vtkPolyData.newInstance();
centerline.getPoints().setData(Float32Array.from(points), 3);
const nPoints = points.length / 3;
const lines = new Uint16Array(nPoints + 1);
lines[0] = nPoints;
for (let i = 0; i < nPoints; i++) lines[i + 1] = i;
centerline.getLines().setData(lines);
centerline.getPointData().setTensors(
vtkDataArray.newInstance({
name: 'Orientation',
numberOfComponents: 3, // vectors instead of matrices
values: Float32Array.from(normals),
})
);
centerline.modified();
I then feed this centerline
to a vtkImageCPRMapper
like so:
const cprMapper = vtkImageCPRMapper.newInstance();
cprMapper.setImageData(volume);
cprMapper.setCenterlineData(centerline);
cprMapper.setWidth(width);
cprMapper.useStraightenedMode();
cprMapper.setBackgroundColor(255, 255, 0, 255);
I get this (yellow is the background):
And this if I use tangents as point orientations:
I’m not sure what I should give exactly as the orientation for the points in centerline
. I saw in another post that they use mapper.setDirectionMatrix(...)
, but I’m not sure what to give it as value.
What should I put as orientations for the points in centerline
? Or is there some settings that I should give to the mapper that I’m missing?
Any help would be greatly appreciated!