I have been trying to debug this issue to no avail and I’m hoping someone could help me out or point me in some direction. Please refer to my stackoverflow post, feel free to answer here or there. If solution or discussion occurs here I can post it in stackoverflow.
Determining a smoothly changing curve normal direction is not a trivial task. In recent Slicer versions, we introduced curve node, which can provide curve tangent and normal using Frenet-Serret frame.
Here is a complete example of computing a panoramic X-ray from a cone-beam dental CT. Just a demonstration of how an image can be resampled along a curve - the code is not optimized for performance or quality and distance along curve is not scaled (we simply used all point indices instead of retrieving point indices based on desired distance along curve).
Really cool algorithm. I am trying to implement it but I am running into this error
Traceback (most recent call last):
File “C:/Users/talmazovg/SlicerDev/SlicerPano/SlicerPano/SlicerPano/SlicerPano.py”, line 234, in onCreatePathButtonClicked
File “C:/Users/talmazovg/SlicerDev/SlicerPano/SlicerPano/SlicerPano/SlicerPano.py”, line 604, in construct_pano
AttributeError: ‘NoneType’ object has no attribute ‘CreateDefaultDisplayNodes’
Based on my original question, how is it that the 3D world view retains proper orientation of the plane while the node view is flipped? Please refer to screenshot.
Is there some way I can anchor the plane to be parallel in the axial direction?
You can arbitrarily rotate the slice view content in the image plane or flip it along any axis, the physical position of the slice will still remain the same.
In your script, you computed the normal direction of the curve inconsistently along the curve (you flipped the normal direction along the curve), that’s why you see a flip in the slice view. If the curve is quasi planar then you can use the curve normal computation method implemented that is implemented in endoscopy module as is (that uses the normal of the plane fit to the curve; a reslicing transform is written to the scene that you can use in Volume reslice driver - see this video for step-by-step instructions). For arbitrary curve shapes, you can use Frenet-Serret frame (that is implemented in recent Slicer preview versions in curves, see my script above for a complete working example).