Automating 3D Model Animations

Hi all, I am looking to create an automated animation (video) that includes rotating a model around a tumor at a 45-degree angle, adjusting the opacity of various volumes in the scene, inserting titles during the video, and performing other similar tasks. What tools or methods would you recommend to achieve this?

Generally speaking you can write a python script to implement exactly what you have in mind.

You can look at the Animator module to get ideas about how to control various visualization options and generate a sequence that can be exported using the ScreenCapture module to make movies.

A lot of the complexity comes from variability in the input data making it hard to create consistently nice movies automatically.

Thank you for your response.

Could you clarify what you mean? I’m new to animation.

Could SlicerMorph be of help as well?

The Animator module is part of SlicerMorph, if you are just making Animations you probably don’t need any of the other features it provides so you can just ignore them.

The Animator already provides some of what you describe, but it may not be expressive enough to cover everything. It’s based on key frame values so there’s an interpolation of the parameters so that things like opacity change frame by frame. But it’s set up to be used interactively and it’s a bit limited. So that’s why I suggest you look at the python code so you can see how to manipulate the view and export the exact animation you have in mind.

The latest code for Animator is in: SlicerMorph/Animator at master · SlicerMorph/SlicerMorph · GitHub

The other repo Steve linked, is an earlier prototype.

Animator can do the opacity/volume rendering changes, cliipping as well as rotation. but it doesn’t do the inserting the text (though it will render markup labels, if you keep them on).

It is a bit complex to use, perhaps first try the tutorial, with tutorial example, and decide it if it is going to help you: Tutorials/Animator at main · SlicerMorph/Tutorials · GitHub

Tutorial is a few years old, since then Annotation ROIs were replaced by MarkupROIs. You can use MarkupROI where it says annotationROIs.

The free 3d blender editor is completely suitable for performing such a task. Do you have time to teach him? Excuse my English…

Thank you so much for all your responses. Apologies for being a bit of a bother, but I have a really exciting idea that I’d love to bring to life. Let me clarify what I mean: Here’s a link to a screen recording I made using MITK. I’m wondering if it’s possible to automate parts of this process completely (by simply inserting an image and a model, then pressing a button to generate the video). I’m open to using another tool you might suggest, as long as it requires minimal effort. What do you think?

There is no such button to make it “fast and beautiful”. I’ll wait for other answers.
The blender is difficult for a beginner.Blender: Converting the model to a 3D grid, simplifying the grid, installing cameras and lights, rendering. You can watch my YouTube, there we just count the teeth of a 7-year-old child. Falling from a height, dizziness, nausea. link

Dear @AlexBaev , your video looks fantastic! I was wondering if you could work with NIfTI images (MRI) in Blender?

This path is not quite easy. First, we get a 3D mesh from Slicer.



Then we open it in a Blender.


We make textures, transparency, set up a camera and light, bones for animation.
This is how this cartoon was created. (My first one, I’m a bad cartoonist, but I’m working on it). You can’t just spin the view - Blender will make a cartoon that you can watch, but not spin. If you want, send me your research, we’ll try to do something together.
a46779935b@mail.ru

Dear @pieper
I’m sorry, but I’m not quite sure what you mean. Could you please explain the pipeline in more detail?

What I mean is that you would approach the animation as a programming project, where you would have use loops to control the transitions from one visual state to the next and record frames at steps in the process. You would use the Slicer API to access the data and set the visual properties incrementally. If you are doing something simple, like rotating an object or fading a structure in/out this can be pretty straightforward. If you want to do multiple things at the same time you need to worry a bit about how those get combined, and you probably end up with a code structure something like what is in the Animator where actions are evaluated at each timepoint and set the visual properties accordingly.

1 Like

Thanks for the links @muratmaga and @pieper ! I think I can make this work. Just to clarify, should the video be generated by running the script in TransformAction.py? Here’s the introduction in that file: “This is a placeholder for Animator plugins for transforms. For testing:”. Could you guide me on how to create a basic video using a script, so I can modify it according to my needs?

I don’t think we can spell it out in more detail than we have - the Animator is a python scripted module so you can learn from it, but you’ll need to know enough python and slicer scripting to understand how to work with it.

To your specific question, no you would not run TransformAction.py. The Action classes are specific scene modifications that take place over a set time frame (start and end time) in the context of an overall animation. Most of the examples are in the main Animator.py script, but the idea is that additional types of actions could be added to the AnimatorLib package.

You could look at the modules SelfTest for an example of how these are used to make an animation:

1 Like

I offered you to learn a 3d program, here you are offered to learn the python programming language. It’s easier to ask developers to make a transparency level for each layer. Maybe I didn’t search well, but the transparency level is set for the entire 3d view at once. Slicer is a great program, but the buttons are not where they are expected, it’s annoying…