View 2-D medical image series in Video Viewer app
Medical Imaging Toolbox™ extends the functionality of the
implay (Image Processing Toolbox™) function to display a
medicalImage object. The function uses
medicalImage properties to set the frame rate of the Video
Viewer app. If you do not have Medical Imaging Toolbox installed, see Video Viewer.
Medical Image Object
implay( opens the Video
Viewer app and loads the image series in the
medImage. The app displays the first frame of the image series.
Click the Play button to view the image series as a video. The app
automatically sets the frame rate using the
FrameTime property of
Nonmedical Image Formats
implay( opens the Video
Viewer app and loads the content of the Audio Video Interleaved (AVI) file with
implay( opens the Video Viewer
app and displays the first frame in the multiframe image sequence
specified as a numeric array or MATLAB® movie structure.
implay(___, specifies the
fps in frames per second, in addition to any input
argument from a previous syntax.
Play Medical Image Series as Video
Specify the filename of an echocardiogram ultrasound series. The DICOM file is attached to this example as a supporting file.
filename = "heartUltrasoundSequenceVideo.dcm";
Read the metadata and image data from the file by creating a
medicalImage object. The
FrameTime property indicates that each frame has a duration of 33.333 milliseconds. The
NumFrames property indicates that the series has a total of 116 image frames.
medImg = medicalImage(filename)
medImg = medicalImage with properties: Pixels: [600×800×116×3 uint8] Colormap:  SpatialUnits: "unknown" FrameTime: 33.3330 NumFrames: 116 PixelSpacing: [1 1] Modality: 'US' WindowCenter:  WindowWidth: 
View the ultrasound series as a video by using the Video Viewer app. By default, the app plays the video at the frame rate specified by the
FrameTime property value.
medImage — Medical image
Medical image, specified as a
medicalImage object. The video plays
at the frame rate specified by the
FrameTime property value of
medImage. If the
FrameTime property is
empty, the default frame rate is 20 fps.
filename — Name of Audio Video Interleaved (AVI) file
string scalar | character vector
Name of an Audio Video Interleaved (AVI) file, specified as a string scalar or character vector. The video plays at the frame rate specified by the file metadata. If the file metadata does not specify a frame rate, the default frame rate is 20 fps.
I — Multiframe image sequence
numeric array | structure
Multiframe image sequence, specified as one of these values:
An m-by-n-by-k numeric or logical array representing a grayscale or binary image sequence, respectively, of k frames.
An m-by-n-by-1-by-k numeric or logical array representing a grayscale or binary image sequence, respectively, of k frames.
An m-by-n-by-3-by-k numeric array representing a truecolor (RGB) image sequence of k frames.
A MATLAB movie structure. For more information, see
For numeric data, the preferred data type of
uint8. The actual data type used to display pixels may differ from
the source data type.
The default frame rate is 20 frames per second. To change the frame rate, specify
the second input argument,
fps — Frame rate in frames per second
20 (default) | positive numeric scalar
Frame rate in frames per second, specified as a positive numeric scalar. If the
input is a
medicalImage object or AVI filename, with a frame rate
specified by the
FrameTime property or AVI file metadata,
implay uses the specified frame rate. If the frame
rate is not specified by the
FrameTime property or file metadata,
or if the input is a numeric array, the default value is 20 frames per second.
Introduced in R2023a