Create a short video to visualise a transform

Hello,
I have a transform that I apply to an organ segmentation. It would be nice to have a short animation of the segmentation moving from its original position/orientation/shape to the final one to visualize the transform.

This would be very helpfull to communicate with healthcare professional and for outside communication in general.

Is there any module/script that could help me to do that ?

Yes, this would be nice. Not all transforms are easy to interpolate, but for something like a grid transform it’s doable. This could be added to the Animator module with some scripting.

1 Like

Unfortunately, I have a B-spline transform.
Fortunately, I don’t have a computation time limit.
My first idea is to compute the destination position for each voxel and make them move linearly between the starting and ending position, taking a screenshot of the created segmentation at everystep and putting everything together as a video.
This would work with any transform.

Did you try just interpolating the coefficients of the b-spline control points?

I didn’t
I haven’t started coding this (and I don’t think I will soon)
I don’t know how to interpolate the coefficient of the b-spline control point (and I haven’t looked into it).
Also, I think it’s easier to code soething that works with every transform even if it’s more computationnally costly.

Actually, you should be able to do something quick with SetDisplaycementScale so very little coding required (at least for the bspine case).

I just did this with a bspline registration result

>>> 
>>> bs = getNode("BS*")
>>> t = bs.GetTransformFromParent()
>>> t.GetDisplacementScale()
1.0
>>> t.SetDisplacementScale(.5)
>>> t.SetDisplacementScale(.25)
>>> t.SetDisplacementScale(.75)