dip::ImageDisplay class

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

An object is created for a particular image; the image cannot be replaced. Different display options can then be set. When the dip::ImageDisplay::Output method is called, a 1D or 2D, grey-value or RGB, UINT8 image is prepared for display. A const reference to this image is returned. The image is updated every time the Output method is called, not when display options are set. The display options are designed to be settable by a user using the image display window.

For a scalar input image, the output is always scalar (grey-value). For a color image, if it can be converted to sRGB, and RGB output image is produced. For other tensor images, an RGB image is also produced, the user can select which tensor element is shown in each of the three color channels. Note that for color images, the non-linear sRGB color space is used for display, linear RGB images are gamma-corrected in this way to improve display.

See the dipimage/private/imagedisplay.cpp file implementing the MATLAB interface to this class, and the dipimage/dipshow.m function, for an example of how this can be used.

Public types

struct Limits
Intensity mapping limits.
enum class ProjectionMode: unsigned char { SLICE, MAX, MEAN }
Enumerator for the projection mode.
enum class ComplexMode: unsigned char { MAGNITUDE, PHASE, REAL, IMAG }
Enumerator for the complex mapping mode.
enum class MappingMode: unsigned char { MANUAL, MAXMIN, PERCENTILE, BASED, LOGARITHMIC, MODULO }
Enumerator for the intensity mapping mode.

Constructors, destructors, conversion operators

ImageDisplay(Image const& image, ColorSpaceManager* colorSpaceManager = nullptr, ExternalInterface* externalInterface = nullptr) explicit
The constructor takes an image with at least 1 dimension.

Public functions

auto Input() const -> Image const &
Retrieves a reference to the input image.
auto Slice() -> Image const &
Retrieves a reference to the raw slice image.
auto Output() -> Image const &
Retrieves a reference to the output image.
auto MapSinglePixel(Image::Pixel const& input) -> Image::Pixel
Puts a single pixel through the same mapping the image will go through to become Output.
auto OutIsDirty() const -> bool
Returns true if the next call to Output will yield a different result from the previous one. That is, the display needs to be redrawn.
auto SliceIsDirty() const -> bool
Returns true if the next call to Output will yield a different slice.
auto SizeIsDirty() const -> bool
Returns true if the next call to Output will yield an output of a different size. That is, the slicing direction has changed, and this yields a change in sizes.
auto Pixel(dip::uint x, dip::uint y = 0) -> Image::Pixel
Gets input image intensities at a given 2D point (automatically finds corresponding nD location). In case of a 1D Output, y is ignored.
void SetDirection(dip::uint dim1, dip::uint dim2)
Sets the projection/slicing direction, as the two image dimensions to show along the x and y axis of the 2D display. If dim1==dim2, a 1D output is produced.
void SetCoordinates(UnsignedArray coordinates)
Sets the current coordinates. This affects the slice displayed.
void SetTensorElements(dip::sint red, dip::sint green = -1, dip::sint blue = -1)
Sets the tensor element to be shown in each of the three output channels.
void SetProjectionMode(ProjectionMode projectionMode)
Sets the projection mode. Has no effect if image dimensionality is equal to projection dimensionality.
void SetProjectionMode(String const& projectionMode)
Sets the projection mode. Has no effect if image dimensionality is equal to projection dimensionality.
void SetComplexMode(ComplexMode complexMode)
Sets the complex to real mapping mode. Has no effect when projection mode is set to "max", or for non-complex images.
void SetComplexMode(String const& complexMode)
Sets the complex to real mapping mode. Has no effect when projection mode is set to "max", or for non-complex images.
void SetMappingMode(MappingMode mappingMode)
Sets the intensity mapping mode. Has no effect for binary images.
void SetRange(Limits range)
Sets the range of intensities to be mapped to the output range. Forces intensity mapping mode to linear. Has no effect for binary images.
void SetRange(String const& range)
Sets the mapping mode and the range of intensities to be mapped to the output range. Has no effect for binary images.
void SetGlobalStretch(bool globalStretch)
Sets the global stretch mode. Has no effect on 2D images or when the projection mode is not "slice"
void SetGlobalStretch(String const& globalStretch)
Sets the global stretch mode. Has no effect on 2D images or when the projection mode is not "slice"
auto GetDirection() const -> std::pair<dip::uint, dip::uint>
Get the projection/slicing direction. The two values returned are identical when output is 1D.
auto GetOrthogonal() const -> UnsignedArray const &
Returns the array of dimensions orthogonal to those returned by GetDirection. These are the dimensions not displayed.
auto GetCoordinates() const -> UnsignedArray const &
Get the current coordinates.
auto GetSizes() const -> UnsignedArray const &
Get the image sizes.
auto Dimensionality() const -> dip::uint
Get the image dimensionality.
auto GetRedTensorElement() -> dip::sint
Get the tensor element to be shown in the red channel.
auto GetGreenTensorElement() -> dip::sint
Get the tensor element to be shown in the green channel.
auto GetBlueTensorElement() -> dip::sint
Get the tensor element to be shown in the blue channel.
auto GetProjectionMode() const -> String
Get the current projection mode.
auto GetComplexMode() const -> String
Get the current complex to real mapping mode.
auto GetMappingMode() const -> String
Get the current intensity mapping mode.
auto GetRange() const -> Limits
Get the current intensity range.
auto GetLimits(bool compute) -> Limits
Gets the image intensity range (that selected with "lin") for the current slicing and complex mapping modes. If compute is true, it computes them if they're not yet computed.
auto GetGlobalStretch() const -> bool
Get the current global stretch mode.