VTKImageReslice: Slow performance

You extract 500 slices, so the computation time should be around a few seconds. If you extract frames at higher-resolution or your computer is very slow then it may be normal that it takes 12 seconds.

I would not recommend using vtkSplineDrivenImageSlicer. Not because it is slow (it would be hard to make this faster without reducing the output resolution), but because all it does that it computes the reslicing parameters along a curve and puts the result in the image. This is not sufficient for any applications, which go beyond just straightening out an image.

Instead, what you need is a transform that you can use to straighten out either an image (using vtkImageReslice) or any other data types, such as surface meshes, curves, etc. (using vtkTransformPolyDataFilter). VTK transformation infrastructure is very smart, so it can dynamicallt invert the transformation for you, so for example, you can mark a point in the original volume and get the position in the straightened volume.

We have implemented this transform generation in the Curved Planar Reformat module in 3D Slicer’s Sandbox extension. You can find the full source code here, or you can just use the module with a convenient GUI (or from your Python scripts) within 3D Slicer. A short description/discussion of how the transform is generated is available here.

This demonstrates how landmark points can be transformed between the original and straightened space: