dip::viewer::ImageViewer class

Non-interactive 2D RGB image viewer.

Base classes

class Viewer
A Window for viewing a dip::Image

Public functions

auto options() -> ViewingOptions& override
Returns the Viewer's model.
auto image() -> const dip::Image& override
Returns the dip::Image being visualized, converted to real valued.
auto original() -> const dip::Image& override
Returns the dip::Image being visualized.
void setImage(const dip::Image& image) override
Sets the image to be visualized.

Public static functions

static auto Create(const dip::Image& image, std::string name = "ImageViewer", size_t width = 0, size_t height = 0) -> Ptr
Construct a new ImageViewer.

Protected functions

void create() override
Overridable callback that is called when the window is created.
void reshape(int, int) override
Overridable callback that is called when the window shape is changed.
void draw() override
Overridable callback that draws the visualization.

Function documentation

ViewingOptions& dip::viewer::ImageViewer::options() override

Returns the Viewer's model.

Only call or change this under lock.

Example usage:

{
   dip::viewer::Viewer::Guard(*viewer);
   viewer->options().mapping_range_.first = 0;
}

const dip::Image& dip::viewer::ImageViewer::image() override

Returns the dip::Image being visualized, converted to real valued.

Only call this under lock.

Example usage:

{
   dip::viewer::Viewer::Guard(*viewer);
   dip::Image image = viewer->image();
}

const dip::Image& dip::viewer::ImageViewer::original() override

Returns the dip::Image being visualized.

Only call this under lock.

Example usage:

{
   dip::viewer::Viewer::Guard(*viewer);
   dip::Image image = viewer->original();
}

void dip::viewer::ImageViewer::setImage(const dip::Image& image) override

Sets the image to be visualized.

Only call this under lock.

Example usage:

{
   dip::viewer::Viewer::Guard(*viewer);
   viewer->setImage(image);
}

static Ptr dip::viewer::ImageViewer::Create(const dip::Image& image, std::string name = "ImageViewer", size_t width = 0, size_t height = 0)

Construct a new ImageViewer.

As the constructor is protected, this is the only way to create an ImageViewer. Note that the ImageViewer only supports 8-bit 2D RGB images.

If either width or height is 0, it is computed from the other value so as to preserve the image's aspect ratio. If both are zero, the image is displayed in its natural size (one image pixel to one screen pixel) but scaled down if otherwise the window would exceed 512 pixels along either dimension.

Example usage:

manager.createWindow( dip::viewer::ImageViewer::Create( image ));