After vtk.js' ImageCPRMapper class example is run, how do I get the image coordinates of the center line on the cpr plane in stretch and straighten mode

For the computation of X, I think that I made a mistake and that there is a constant offset of width / 2 (I guess that width = mapper.getWidth()). When there is a center point, it just adds an other offset. So you can try replacing this:

With this:

newX = width / 2
if (centerPoint) {
  const localXDirection = computeLocalXDirection(pointIndex)
  newX += vec3.dot(vec3.subtract([], centerPoint, point), localXDirection)
}

If you still have issues, you can transpose actor.getUserMatrix() as I don’t remember what the conventions are (column or row major) for this matrix.