Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make the animation gif file? #23

Open
busyyang opened this issue May 11, 2024 · 2 comments
Open

How to make the animation gif file? #23

busyyang opened this issue May 11, 2024 · 2 comments

Comments

@busyyang
Copy link

Nice registration work and nice visualization for registration process. I would like to make such a visualization file for registration process, but I cann't find the script for this.

I find a animate function in DiffDRR for DRR and x-rays. But in DiffPose, the CT could be fixed in the view and moving x-ray and camera makes the registration very clear. Is there possible to share this script to generate such visualization file? Or can you point out where I can find the scripts?

Thanks in advance.

@eigenvivek
Copy link
Owner

hi @busyyang sorry for the slow reply - that visualization was created with a combination of terminal scripting and ffmpeg, not sure if i have code saved to disk anywhere. i'll dig around, but in case it's helpful, here's an outline of how i generated it

use the 3D plotting code (based on pyvista) implemented in diffdrr - https://vivekg.dev/DiffDRR/tutorials/visualization.html

for each iteration in the test-time optimization run, render the CT, detector plane, camera, and rays intersecting the 3D fiducials. use pyvista to save a screenshot for each frame.

additionally, for each iteration, plot two DRRs (moving and target) and save a screenshot. this is very similar to the animate function, except you can also plot the 2D fiducials in this view.

now you have two animations, one in 3D and one in 2D, with an equal number of frames. using ffmpeg, you can stitch these together into a single GIF/mp4/etc. i don't remember exactly which command i used, but i found it on stackoverflow and it would've been something like this - https://stackoverflow.com/questions/42255139/ffmpeg-merge-two-videos-into-one-with-side-by-side-same-quality-output

@busyyang
Copy link
Author

So kind of you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants