Main Content

Choose Approach to Display 2-D and 3-D Images

Image Processing Toolbox™ offers a variety of functions that display 2-D images, frames of image sequences, 2-D slices of 3-D (volumetric) images, and 3-D renderings of volumetric images. You can display images programmatically using functions or interactively using apps.

Display 2-D Images

You can display 2-D images captured by digital cameras in standard file formats such as JPEG, and you can display the images that result from an image processing pipeline. You can also display multiple 2-D images in the same figure.

2-D image display functions, such as imshow, support RGB, grayscale, and binary images. Nonstandard formats include RAW data, medical DICOM images, high dynamic range (HDR) images, and hyperspectral images. For 2-D images in a nonstandard format, you may need to convert the data to a standard format, depending on the display approach that you choose.

When to UseApproachSample Display
You want to display a single 2-D image

Use the imshow function.

See Display an Image in Figure Window.

Image of a flower displayed in a figure window.

You want to display a single 2-D image and perform some common image processing tasks interactively.

Use the Image Viewer app.

See Get Started with Image Viewer App.

Image Viewer app displays a flower and offers tools for cropping and measuring distance on the app toolstrip.

You want to display multiple 2-D images next to each other. For example, you might want to compare an original image and a processed version of the image.

Use the montage function.

See Display Multiple Images.

A color image displayed next to a binary image representing detected edges in the original image.

You want to display two 2-D images overlaid on each other. For example, you want to check the alignment of two images using falsecolor or alpha blending.

Use the imshowpair function.

See Display Multiple Images.

A color image displayed using alpha blending with a binary image representing detected edges.

You want to display the thumbnails of images in an image datastore or a folder.

Use the Image Browser app.

See View and Edit Collection of Images in Folder or Datastore.

Image Browser app displays thumbnails for images in an image datastore and displays a larger preview of a selected image.

You want to display:

  • A single 2-D image that is too large to fit in memory

  • A multiresolution (or multilevel) 2-D image

Read the image as a blockedImage object, then display the image using bigimageshow.

Multiresolution whole-slide image (WSI) displayed with image dimensions of approximately 220,000-by-98,000 pixels at resolution level 1.

You want to display hyperspectral data, including color or false-color representations of hyperspectral images.

Use the Hyperspectral Viewer app (requires Image Processing Toolbox Hyperspectral Imaging Library.)

See Explore Hyperspectral Data in the Hyperspectral Viewer.

Hyperspectral Viewer app showing a hypercube

Display 2-D Slices and Frames

3-D volumes and image sequences are both collections of related 2-D images. The 2-D images (slices) in a 3-D volume are related along the third spatial dimension, depth. The 2-D images (frames) in an image sequence are related by a nonspatial dimension, such as time.

You can display individual slices of a 3-D volume or frames of an image sequence. To see changes in successive slices or frames, you can display the slices or frames sequentially or alongside each other in a montage. For 3-D volumes, you can also display cross-sections along the three orthogonal spatial planes.

When to UseApproachSample Display

You want to display:

  • A single frame of an image sequence

  • A single slice of a 3-D volumetric image

Index into the numeric array representing the image sequence or 3-D volumetric image, then display the indexed frame or slice by using the imshow function.

See Perform an Operation on a Sequence of Images.

One frame of a grayscale image sequence.

You want to display:

  • Multiple frames of an image sequence next to each other

  • Multiple parallel slices of a 3-D volumetric image next to each other

Use the montage function.

See Display Multiple Images.

Fifteen axial slices of a brain MRI.

You want to display a slice of a 3-D volume and change the selected slice interactively using a slider.

Use the sliceViewer function.

Cross-section of volumetric data displayed in a figure window, with a scrollbar to change the slice

You want to animate an image sequence or successive slices of a 3-D volume as a video.

Use the Video Viewer app.

See View Image Sequences in Video Viewer.

Image sequence displayed as a video in the Video Viewer app.

You want to display orthogonal slices of a 3-D volume along the x, y, and z dimensions.

Use the orthosliceViewer function. You can adjust the slices interactively by dragging the yellow lines that indicate the planes of each cross-section.

Three orthogonal cross-sections of a 3-D volumetric image, with interactive yellow lines on each cross-section that show and control the position of the other planes.

You want to display orthogonal slices of a volumetric image or labeled volumetric image, and adjust the display properties interactively.

Use the Volume Viewer app.

See Explore 3-D Volumetric Data with Volume Viewer App and Explore 3-D Labeled Volumetric Data with Volume Viewer.

Volume Viewer app displays three orthogonal cross-sections and a 3-D rendering of a volumetric image, with controls to adjust aspects of the display.

Display 3-D Renderings of 3-D Volumes

You can display a 3-D volumetric image in 3-D space. To improve the visibility of features within the volume, you can move the camera position within the scene, adjust the transparency of the data, or change rendering styles.

When to UseApproachSample Display
You want to display a volumetric image or labeled volumetric image, and adjust the display properties interactively.

Use the Volume Viewer app.

See Explore 3-D Volumetric Data with Volume Viewer App and Explore 3-D Labeled Volumetric Data with Volume Viewer.

Volume Viewer app displays three orthogonal cross-sections and a 3-D rendering of a volumetric image, with controls to adjust aspects of the display.

You want to display a volumetric image using a 3-D rendering. You can optionally:

  • Include pixel labels.

  • Specify the rendering style of the data and overlays.

  • Interactively crop the volume, or remove background objects using 3-D scissors.

Use the volshow function. Adjust the camera controls, scene lighting, and scene color using the viewer3d function.

See Display Interior Labels by Adjusting Volume Overlay Properties and Display Interior Labels by Clipping Volume Planes.

Volumetric image data displayed with a gradient opacity rendering style to reveal internal label data.

You want to display:

  • A single 3-D image that is too large to fit in memory.

  • A multiresolution (or multilevel) 3-D image.

Read the image as a blockedImage object, then display the image using volshow.

See Display Large 3-D Images Using Blocked Volume Visualization.

Blocked volumetric data displayed in an interactive 3-D figure.

Related Examples

More About