How can I rotate a volshow image programatically?

20 visualizaciones (últimos 30 días)
Carsten
Carsten el 22 de Mayo de 2024
Editada: Matt J el 26 de Jul. de 2024
Hi!
I have a volshow image of a brain and I want to rotate it programatically (and then use getframe to write a video with writeVideo).
I tried using CameraPosition and CameraDirection of the Viewer3D parent object, but I have no clue how these work (and whether I need to move LightPosition with the camera). It seems highly complicated to move the camera around the brain like this. Is there an easier way to do that? Can I rotate the volume instead of the camera?
  2 comentarios
Image Analyst
Image Analyst el 23 de Mayo de 2024
Did you want to just rotate the data and axes together, like with view, or did you (for some reason) want to rotate the volume within the fixed axes (keep axes and viewing angle fixed)?
Carsten
Carsten el 23 de Mayo de 2024
Like with "view" would be fine but that does not seem to work for volshow, only for normal figures. Matt J's answer below (Transformation property) seems to work.

Iniciar sesión para comentar.

Respuesta aceptada

Tim Jackman
Tim Jackman el 26 de Jul. de 2024
Editada: Matt J el 26 de Jul. de 2024
You can set the CameraTarget property to the location about which you want to rotate around, and then update the CameraPosition at each frame to form a circle around the camera target. See this example in the volshow documentation for more information:
Regarding your question about light position, if you want the light to move with the camera, you can just leave the default LightPositionMode with the light always staying up and to the right of the camera. If you would prefer that the light stay fixed in 3D space and not move with the camera, flip the LightPositionMode to “manual”. This would give an effect similar to orbiting the light/dark side of the moon.
Hope this helps.

Más respuestas (1)

Matt J
Matt J el 23 de Mayo de 2024
Editada: Matt J el 26 de Jul. de 2024
Can I rotate the volume instead of the camera?
Yes, you can use the Transformation property.
  2 comentarios
Carsten
Carsten el 23 de Mayo de 2024
Thanks, that works. Rotation with rigidtform3d wobbles a bit back and forth, but I think I'll manage with that. I probably need to move the origin (rotation center) of the volume, which I have not found, yet.
Matt J
Matt J el 23 de Mayo de 2024
You're quite welcome, but please Accept-click the answer to indicate that it addressed your problem.

Iniciar sesión para comentar.

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by