You need to make sure the third image axis parallel to the planar curve’s plane normals.
I’m not sure if vtkPolyDataToImageStencil is aware of image axis directions yet.
- If it is: you can set the image direction matrix to make the third image axis parallel to the curve plane normals.
- If it is not: you can transform your contours using transform polydata filter to make their normal point to Z axis direction.