Display module

Image display

Contents

Modules

module DIPviewer
Interactive image display.

Classes

class dip::ImageDisplay
Encapsulates state of an image in a display window, and provides the functionality for converting the image to a form suitable for display.

Functions

void dip::ApplyColorMap(dip::Image const& in, dip::Image& out, dip::String const& colorMap = "grey")
Applies a color map to an image prepared for display using dip::ImageDisplay.
void dip::Overlay(dip::Image const& in, dip::Image const& overlay, dip::Image& out, Image::Pixel const& color = {255,0,0})
Adds a colored overlay to the image in, yielding an RGB image.
void dip::MarkLabelEdges(dip::Image const& labels, dip::Image& out, dip::uint factor = 2)
Upscales a labeled image and outlines each region with the background label.

Function documentation

void dip::ApplyColorMap(dip::Image const& in, dip::Image& out, dip::String const& colorMap = "grey")

Applies a color map to an image prepared for display using dip::ImageDisplay.

in is a scalar, 8-bit unsigned image. out will be an image of the same size and type but with three tensor components, and in the “sRGB” color space.

colorMap can currently be one of the following color maps:

  • "grey": Each grey level maps to an RGB value that represents the same grey level.
  • "saturation": Each grey level maps to an RGB value that represents the same grey level, except pixels with a value 0 and 255, which are colored blue and red respectively. This can be used to show which pixels were likely saturated during acquisition.
  • "linear": A blue-magenta-yellow highly saturated, perceptually linear color map.
  • "diverging": A blue-grey-red diverging, perceptually linear color map, where the middle value maps to a neutral grey-value, high values map to increasingly bright reds, and low values map to increasingly bright blues. This is meant to be used in combination with the "base" range mode of dip::ImageDisplay.
  • "cyclic": A magenta-yellow-green-blue cyclic, perceptually linear color map, which allows four orientations or angles to be visualised. Use in combination with the "angle" or "orientation" range mode of dip::ImageDisplay.
  • "label": For labeled images, each grey value gets a color that can easily be distinguished from that of nearby grey values. 16 different colors are used. The 0 grey value is considered background and colored black. Use with the "modulo" range mode of dip::ImageDisplay.

For more information regarding the range modes of dip::ImageDisplay, see dip::ImageDisplay::SetRange.

The "linear", "diverging" and "cyclic" are by Peter Kovesi.

void dip::Overlay(dip::Image const& in, dip::Image const& overlay, dip::Image& out, Image::Pixel const& color = {255,0,0})

Adds a colored overlay to the image in, yielding an RGB image.

in must be either scalar (grey-value image) or RGB. overlay can be binary or integer.

In the case of a binary overlay image, the pixels selected by it will be assigned the value color, which defaults to red. If color is a scalar value, it will be interpreted as an intensity value, producing a grey overlay. In this latter case, if in was a scalar image, then the output will be scalar as well.

In the case of an integer overlay image, dip::ApplyColorMap with the "label" option will be used to create a label image overlay. color will be ignored.

void dip::MarkLabelEdges(dip::Image const& labels, dip::Image& out, dip::uint factor = 2)

Upscales a labeled image and outlines each region with the background label.

out will be a labeled image like labels, but factor times as large along each dimension. In the upscaled image, the pixels that form the border of each region are set to 0, the background label.