メインコンテンツ

Generate Animations of Medical Image Volume Data Using Apps

R2026b

This tutorial shows how to export 2-D and 3-D animations of medical image volumes from the Medical Volume Viewer and Medical Image Labeler apps. Both apps provide the same options and capabilities for creating animations, so you can choose the most suitable option for your data. Use Medical Volume Viewer when you already have the data to visualize. Use Medical Image Labeler when you are labeling volumes and want to create animations without switching apps.

You can generate 2-D animations that scroll through transverse, sagittal, or coronal slices, or 3-D animations of the volume rotating about a specified axis. To open the animation generator tool, in the Viewer tab of the Medical Volume Viewer app or the Labeler tab of the Medical Image Labeler app, click Generate Animations.

Create 2-D Animation

To export a 2-D animation, complete these steps.

  1. In the Animation pane, select 2-D slices.

  2. Under Direction, specify the Slice Direction along which you want to view slices.

  3. Under Animation, specify which slices to include in the animation based on slice number or coordinates using the Slice Range or Position option, respectively, and adjust the Step Size. Select Append animation in reverse to make the animation scroll forward and then backward through the slices, rather than forward only.

  4. Under Export, specify the Loop Count and Animation Length. The loop count is the number of times to repeat the animation, equivalent to specifying the LoopCount name-value argument of imwrite. Specify the loop count as a positive integer, for a fixed number of loops, or as Inf to create a continuously looping animation. Specify the animation length in seconds. The editor displays the speed of the animation in frames per second based on your specified slice range and animation length.

  5. Click Preview to preview one loop of the animation with the specified Direction and Animation settings. The preview does not reflect the loop count or animation length of the exported GIF. The preview plays in the slice view of the selected slice direction.

  6. If you are satisfied with the preview, click Export GIF, and, in the dialog box, select the location to save the animation GIF file. You can open and view the GIF file from the saved location and share the animation outside of MATLAB.

For example, specify these values to create an animation that captures every eighth slice along the transverse direction.

  • Specify the Slice Direction as Transverse.

  • Keep the default values for the minimum and maximum of Slice Range, which depend on the number of slices in the volume.

  • Keep the default values for the minimum and maximum of Position, which depend on the spatial metadata for the volume.

  • Specify the step size as 8 frames.

  • Select Append animation in reverse so each loop animates forward and then in reverse through the slice range.

  • Keep the default value for Loop Count as Inf to create an animation that loops infinitely.

  • Keep the default value for Animation Length as 10.0 secs.

Animation pane for generating 2-D slice animations

This animation shows a representative result for a chest CT volume [1] created using the settings above.

GIF animation of transverse 2-D slices

Create 3-D Animation

To export a 3-D animation, follow these steps:

  1. In the Animation pane, select 3-D Volume.

  2. Under Camera, specify the Rotation Axes, which indicates the axis to rotate around, as SI (superior-inferior), LR (left-right), AP (anterior-posterior), or the current up vector in the 3-D Volume pane. When you specify the rotation axis as SI, LR, or AP, by default the app generates the image using the current camera position in the 3-D Volume pane, including any rotations you have applied. In this case, if you want to generate an animation that views the plane orthogonal to the rotation axis, select Snap Camera to Axis. When you specify the rotation axis as Current Up Vector, the Snap Camera to Axis option is unavailable.

  3. Under Animation, use Limits to specify the minimum and maximum angles around the axis, in degrees, between which to rotate the volume. Specify the Step Size in degrees.

For example, specify these values to create an animation of a volume rotating about its superior-inferior axis, with frames acquired every ten degrees of rotation.

  • Specify the Rotation Axes as SI.

  • Keep the default values for the minimum and maximum of Limits as 0 and 360, respectively.

  • Specify the step size as 10 degrees.

  • Clear Append animation in reverse so the animation rotates only one direction around the axis.

  • Keep the default value for Loop Count as Inf to create an animation that loops infinitely.

  • Keep the default value for Animation Length as 3.0 secs.

Animation pane for generating 3-D volume animations

This animation shows a representative result for a chest CT volume [1] created using the settings above.

Animation of the 3-D volume rotating about the SI axis

References

[1] Medical Segmentation Decathlon. "Lung." Tasks. Accessed May 10, 2018. http://medicaldecathlon.com. The Lung data set is provided by the Medical Segmentation Decathlon under the CC-BY-SA 4.0 license. All warranties and representations are disclaimed.

See Also

| | |

Topics