New module to create animations

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

New module to create animations

Fernando Pérez-García
Hi slicers,

I have prototyped a Python module to animate transformable nodes using
vtkTransformInterpolator. I'm hoping to use it to create some nice
animations for my projects and I thought it was a good idea to share it.
It's probably not very useful now, but with some development by people who
know better than me it might be usable in Slicer, specially within the
Screen Capture module.

Github: https://github.com/fepegar/SlicerAnimation/

Please let me know what you think about this and feel free to propose and
commit improvements.

I added some tests. Spline interpolation does not seem to work when
rotations are included, and linear interpolation is not very smooth when
multiples transforms are given. I think it would be interesting to apply the
animations to multiple transformable nodes, with a list similar to the one
in the "Apply" section of the Transforms module.


Best,

Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/New-module-to-create-animations-tp4032170.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: New module to create animations

Steve Pieper-2
Hi Fernando - 

That looks very handy - yes, it would be cool to see that as an extension or maybe integrated with the Screen Capture module somehow.

I was able to figure out how to make it work through a little trial and error.  But maybe you can post links to some videos so people have a quick idea what can be done with this module?


Also, when I tried the self test I got a crash with the log below.  This was with a local debug build on linux with the current master.

Thanks!
-Steve


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


ASSERT: "mrmlNode" in file /home/pieper/slicer4/latest/Slicer/Libs/MRML/Widgets/qMRMLSceneModel.cxx, line 1471
error: [/home/pieper/slicer4/latest/Slicer-superbuild/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.


On Mon, Apr 10, 2017 at 10:33 AM, Fernando Pérez-García <[hidden email]> wrote:
Hi slicers,

I have prototyped a Python module to animate transformable nodes using
vtkTransformInterpolator. I'm hoping to use it to create some nice
animations for my projects and I thought it was a good idea to share it.
It's probably not very useful now, but with some development by people who
know better than me it might be usable in Slicer, specially within the
Screen Capture module.

Github: https://github.com/fepegar/SlicerAnimation/

Please let me know what you think about this and feel free to propose and
commit improvements.

I added some tests. Spline interpolation does not seem to work when
rotations are included, and linear interpolation is not very smooth when
multiples transforms are given. I think it would be interesting to apply the
animations to multiple transformable nodes, with a list similar to the one
in the "Apply" section of the Transforms module.


Best,

Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/New-module-to-create-animations-tp4032170.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: New module to create animations

Andras Lasso-2

Hi Fernando,

 

The Sequences extension can already record and replay multiple transforms (and most other node types) and the Screen Capture module can create videos from these sequences of transforms.

 

What we miss is a module that allows you to interpolate smooth transform sequences from key frames. The algorithm part is easy, you can use lonear interpolation for the translation part and SLERP interpolation for the rotation (see for example how transform interpolation is implemented in the PLUS toolkit, www.plustoolkit.org, search for SLEP on the PlusLib repository). What requires more work is to implement a convenient GUI for defining and editing key frames.

 

Andras

 

From: [hidden email]
Sent: Monday, April 10, 2017 2:48 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [slicer-users] New module to create animations

 

Hi Fernando - 

That looks very handy - yes, it would be cool to see that as an extension or maybe integrated with the Screen Capture module somehow.

I was able to figure out how to make it work through a little trial and error.  But maybe you can post links to some videos so people have a quick idea what can be done with this module?


Also, when I tried the self test I got a crash with the log below.  This was with a local debug build on linux with the current master.

Thanks!
-Steve


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


ASSERT: "mrmlNode" in file /home/pieper/slicer4/latest/Slicer/Libs/MRML/Widgets/qMRMLSceneModel.cxx, line 1471
error: [/home/pieper/slicer4/latest/Slicer-superbuild/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.


On Mon, Apr 10, 2017 at 10:33 AM, Fernando Pérez-García <[hidden email]> wrote:
Hi slicers,

I have prototyped a Python module to animate transformable nodes using
vtkTransformInterpolator. I'm hoping to use it to create some nice
animations for my projects and I thought it was a good idea to share it.
It's probably not very useful now, but with some development by people who
know better than me it might be usable in Slicer, specially within the
Screen Capture module.

Github: https://github.com/fepegar/SlicerAnimation/

Please let me know what you think about this and feel free to propose and
commit improvements.

I added some tests. Spline interpolation does not seem to work when
rotations are included, and linear interpolation is not very smooth when
multiples transforms are given. I think it would be interesting to apply the
animations to multiple transformable nodes, with a list similar to the one
in the "Apply" section of the Transforms module.


Best,

Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/New-module-to-create-animations-tp4032170.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: New module to create animations

Fernando Pérez-García
In reply to this post by Steve Pieper-2
Hi Steve and Andras,

Thanks for the feedback. If I'm able to do some useful animation, I'll record and post it.
I haven't been able to reproduce Steve's error on Mac or Linux with the nightly builds, but my local debug build on Linux also crashed. I'll investigate. Maybe I don't need the second of these lines:
self.transformNode = slicer.vtkMRMLTransformNode()
self.transformNode.SetScene(slicer.mrmlScene)
slicer.mrmlScene.AddNode(self.transformNode)


I opened the Sequences extension this morning but I have to read documentation and tutorials to understand it better. If the same animations can be done with the extension, I guess it's pointless to keep working on my module. Maybe my interface can inspire a more refined version for the Sequences extension.
In my code I use vtkTransformInterpolator, which uses vtkQuaternionInterpolator for rotation (SLERP if linear, SQUAD if spline) and vtkTupleInterpolator (linear or spline) for translation and scaling.


Best,
Fernando



2017-04-11 2:19 GMT+02:00 Andras Lasso <[hidden email]>:

Hi Fernando,

 

The Sequences extension can already record and replay multiple transforms (and most other node types) and the Screen Capture module can create videos from these sequences of transforms.

 

What we miss is a module that allows you to interpolate smooth transform sequences from key frames. The algorithm part is easy, you can use lonear interpolation for the translation part and SLERP interpolation for the rotation (see for example how transform interpolation is implemented in the PLUS toolkit, www.plustoolkit.org, search for SLEP on the PlusLib repository). What requires more work is to implement a convenient GUI for defining and editing key frames.

 

Andras

 

From: [hidden email]
Sent: Monday, April 10, 2017 2:48 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [slicer-users] New module to create animations

 

Hi Fernando - 

That looks very handy - yes, it would be cool to see that as an extension or maybe integrated with the Screen Capture module somehow.

I was able to figure out how to make it work through a little trial and error.  But maybe you can post links to some videos so people have a quick idea what can be done with this module?


Also, when I tried the self test I got a crash with the log below.  This was with a local debug build on linux with the current master.

Thanks!
-Steve


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


GetNodeByID: Node is in the scene, but its ID is missing from the NodeIDs cache: vtkMRMLTransformNode6


ASSERT: "mrmlNode" in file /home/pieper/slicer4/latest/Slicer/Libs/MRML/Widgets/qMRMLSceneModel.cxx, line 1471
error: [/home/pieper/slicer4/latest/Slicer-superbuild/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.


On Mon, Apr 10, 2017 at 10:33 AM, Fernando Pérez-García <[hidden email]> wrote:
Hi slicers,

I have prototyped a Python module to animate transformable nodes using
vtkTransformInterpolator. I'm hoping to use it to create some nice
animations for my projects and I thought it was a good idea to share it.
It's probably not very useful now, but with some development by people who
know better than me it might be usable in Slicer, specially within the
Screen Capture module.

Github: https://github.com/fepegar/SlicerAnimation/

Please let me know what you think about this and feel free to propose and
commit improvements.

I added some tests. Spline interpolation does not seem to work when
rotations are included, and linear interpolation is not very smooth when
multiples transforms are given. I think it would be interesting to apply the
animations to multiple transformable nodes, with a list similar to the one
in the "Apply" section of the Transforms module.


Best,

Fernando



--
View this message in context: http://slicer-users.65878.n3.nabble.com/New-module-to-create-animations-tp4032170.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ




--
Fernando Pérez García
Research Engineer
ICM - Institute of the Brain and Spine
CENIR - STIM - Stereotaxy Core Facility (Techniques, Images and Models)
Hôpital de la Pitié-Salpêtrière
<a href="https://www.google.fr/maps/place/ICM&#43;Institute&#43;for&#43;Brain&#43;and&#43;Spinal&#43;Cord/@48.8355044,2.3623824,17z/data=!3m1!4b1!4m12!1m6!3m5!1s0x47e6718ab158a96f:0x946e4c254d43d1b6!2sBiblioth%C3%A8que&#43;J.-M.&#43;Charcot!8m2!3d48.8353737!4d2.364217!3m4!1s0x47e671f4647492ff:0x7700b00040eb24c6!8m2!3d48.8355009!4d2.3645711?hl=en" target="_blank">47, boulevard de l'Hôpital
75013 Paris


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ