Curved Planar Reformat module results inaccurate

Hello, I am again trying to use the Curved Planar Reformat module and finding that it does not seem to produce a reasonable straightened volume for an airway I am trying to process. Here is an outline of the steps followed to get to this point:

  • Threshold CT to generate Air segment and then cut this down using scissors tool so that it only contains the airway segment of interest
  • Manually place 2 endpoints at either end of the airway using the VMTK ExtractCenterline module
  • Extract centerline curve node using VMTK ExtractCenterline module
  • Generate straightened volume and straighten transform by using CurvedPlanarReformat module with all default settings (1 mm curve resolution, 1 mm slice resolution 30x30mm slice size)

The resulting straightened volume does NOT follow the supplied centerline curve. This is most obvious in the upper portion of the airway, where the center of the straightened volume’s “axial” slice (the one perpendicular to the curve) does not remain in the airway, despite the fact that the centerline curve does remain in the center of the airway in the original volume.

Here is a view of the straightened volume:

The cyan outline is the airway segmentation on the original volume, transformed by the straightening transform, and overlaid on the straightened volume. The yellow outline is an airway segmentation with the straightened volume as the master volume, using the same air threshold. If the reformat and the transform were good, the yellow and cyan segmentations should closely coincide. Instead, in some places, they barely overlap (see the red slice view). In the 3D view it is possible to see that the yellow and cyan segmentations have broadly similar shapes, but the cyan segmentation seems to have been perhaps under-straightened compared to the yellow one.

Here’s how they look back in the original volume space (i.e. the cyan segmentation has no transform applied, and the yellow segmentation has the inverse of the straightening transform applied):

I know CurvedPlanarReformat has been significantly reworked since this time, but just in case it is relevant, this was my post from last time I ran into problems with it: https://discourse.slicer.org/t/curved-planar-reformat-module-reslicing-error/10248

I tried to reproduce this issue with the MRHead volume from SampleData, but I do not see the same deviation. Because it is MR and an adult, the segmentation I could get was different and less curved, but within that constraint, the reformat looked pretty good to me. One difference I noticed was that the MRHead IJK to RAS matrix has only ones and zeros, whereas the volume I was working with had been reoriented and has slightly tilted axes.

If someone is willing to take a look at this, I can create an anonymized dataset I can share. I’m also open to suggestions. Thanks!

I just realized that the original volume node I was using had a linear transform applied to it. When I hardened this transform and tried the CPR again, it worked beautifully. So, I think the CPR module must resample in the VolumeRAS coordinate system rather than the WorldRAS coordinate system. This is somewhat confusing as a user, because the centerline curve node is in the WorldRAS coordinate system, and was derived from the same (linearly transformed) volume. Perhaps, if the CurvedPlanarReformatModule is not going to take parent transforms into account (and maybe there are good reasons it shouldn’t?), it should at least warn the user when there are parent transforms which are being ignored?

Thanks for reporting and investigating this. The module is in Sandbox extension exactly because of this kind of small things. I agree that the parent transform should be taken into account (or at least an error/warning should be reported if there is a non-identity parent transform). I’ve added an issue to track this: Make CurvedPlanarReformat module take into accound parent transform of volume · Issue #9 · PerkLab/SlicerSandbox · GitHub - maybe you could give it a try to fix it.