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

Hi,
The X axis spans from 0 to mapper.getWidth().
The Y axis spans from mapper.getHeight() (for the first point of the centerline) to 0 (for the last point of the centerline).
The image is in the Z=0 plane.

So for each point the centerline of index pointIndex going from 0 to centerline.getNumberOfPoints():

  • Z will be 0
  • Y can be computed using mapper.getHeight() - centerline.getDistancesToFirstPoint()[pointIndex]
  • X will be mapper.getWidth() if mapper.getCenterPoint() is null or it will be dot(centerPoint - centerlinePoint, localXDirection) with localXDirection being the local x axis for this point, which is computed either using the uniform orientation or mapper.getOrientationDataArray()

The result will be the point coordinates for the mapper, but the actor (the ImageSlice actor) can have a matrix too.