how to generate the curved planar reformation image?

I wonder whether there is vtk implement to generate the curved planar reformation (CPR) image?

Any suggestion is appreciated!

1 Like

I find a vtk implement of CPR generation:

https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/CurvedReformation/

However, I don’t know what’s the meaning of direction.

As far as I know, for the generated CPR image, we can rotate it around the center line. Does the direction indicates the angle of rotation? Thus, I think the direction should be [0, 1] rather than [0, 0, 1]. Am I right?

That example is incomplete in the sense that it does not tell you how to generate a centerline with full orientation at each curve point from a centerline.

One answer is using Frenet-Serret frame, as propsoed by Jerome Velut: https://www.vtkjournal.org/browse/publication/838. There used to be a VTK remote module to bring this feature into VTK by a build option, but I’m not sure if this still works with VTK9 (@ben.boeckel - just yet another example where remote modules would make users’ life a bit easier).

Inspired by work of Velut, we went one step further, and implemented invertible CPR in 3D Slicer’s Curved Planar Reformat module. This is a game changer, as it allows transforming not just images but also corresponding points/lines/surfaces, to both directions. For example, landmarks defined in the straightened volume can be transformed back to the original volume, or an implant placed in the original volume can be displayed in the straightened space. The main idea is that we use Frenet-Serret frame not to directly resample the image but to build a bspline transform that VTK can dynamically invert as needed and use for transforming images or other objects. Short demo how it can be used in 3D Slicer’s GUI (of course, you can use it from C++ or Python scripts, too):

Since the implementation is in Python and the core algorithm is only dependent on VTK, you may just take it and use it in your own applications. However, you’ll find that most features that you can imagine that a medical imaging application can have are all available in 3D Slicer. So, instead of developing and maintaining an application from scratch, you can join the large group of companies and research labs who build their products and prototypes by customizing and extending 3D Slicer. It is free in every sense, you can do anything with it, no strings attached.

2 Likes

@lassoan Thank you very much for your suggestion. I want to try the python implementation. Could you please give me a demo code in python? In addition, how to install the SlicerSandbox in python? I have tried: pip install SlicerSandbox, but it failed.

I don’t doubt that it makes it easier, but with VTK 9, just start doing find_package(VTK) if you’re not in VTK’s repository like one does for any other dependency.

The working, fully functional Python code is available here: SlicerSandbox/CurvedPlanarReformat/CurvedPlanarReformat.py at master · PerkLab/SlicerSandbox · GitHub

It is readily usable with GUI or from Slicer’s Python environment as is. If you want to implement your your own viewers, interactive widgets, user interface, etc. then it should not be a problem for you to remove the dependency on a few Slicer-specific classes.