The library infrastructure » Image module
#include "diplib.h"

The dip::Image class and types that provide a view into it.

Contents

Classes

class dip::ExternalInterface abstract
Support for external interfaces.
class dip::AlignedAllocInterface
dip::ExternalInterface that allocates aligned data.
class dip::CoordinatesComputer
Computes pixel coordinates based on an index or offset.
class dip::Image
Represents an image with all associated information.
class dip::Tensor
Describes the shape of a tensor, but doesn’t actually contain tensor data.

Aliases

using dip::DataSegment = std::shared_ptr<void>
A dip::Image holds a shared pointer to the data segment using this type.
using dip::ImageArray = std::vector<Image>
An array of images
using dip::ImageRefArray = std::vector<std::reference_wrapper<Image>>
An array of image references
using dip::ImageConstRefArray = std::vector<std::reference_wrapper<const Image>>
An array of const image references

Functions

auto dip::NonOwnedRefToDataSegment(void* ptr) -> dip::DataSegment
This function converts a pointer to a dip::DataSegment that does not own the data pointed to.
auto dip::NonOwnedRefToDataSegment(void const* ptr) -> dip::DataSegment
This function converts a pointer to a dip::DataSegment that does not own the data pointed to.
auto dip::Alias(dip::Image const& img1, dip::Image const& img2) -> bool
Calls img1.Aliases( img2 ). See dip::Image::Aliases.
void dip::DefineROI(dip::Image const& src, dip::Image& dest, dip::UnsignedArray origin = {}, dip::UnsignedArray sizes = {}, dip::UnsignedArray spacing = {})
Makes a new image object pointing to same pixel data as src, but with different origin, strides and size.
void dip::Copy(dip::Image const& src, dip::Image& dest)
Copies samples over from src to dest, identical to the dip::Image::Copy method.
void dip::Copy(dip::Image::View const& src, dip::Image& dest)
Copies samples over from src to dest, identical to the dip::Image::Copy method.
void dip::Copy(dip::Image const& src, dip::Image::View& dest)
Copies samples over from src to dest, identical to the dip::Image::View::Copy method.
void dip::Copy(dip::Image::View const& src, dip::Image::View& dest)
Copies samples over from src to dest, identical to the dip::Image::View::Copy method.
void dip::CopyFrom(dip::Image const& src, dip::Image& dest, dip::Image const& srcMask)
Copies the pixels selected by srcMask in src over to dest. dest will be a 1D image.
void dip::CopyFrom(dip::Image const& src, dip::Image& dest, dip::IntegerArray const& srcOffsets)
Copies the pixels selected by srcOffsets over from src to dest. dest will be a 1D image.
void dip::CopyTo(dip::Image const& src, dip::Image& dest, dip::Image const& destMask)
Copies all pixels from src over to the pixels selected by destMask in dest. dest must be forged.
void dip::CopyTo(dip::Image const& src, dip::Image& dest, dip::IntegerArray const& destOffsets)
Copies all pixels from src over to the pixels selected by destOffsets in dest. dest must be forged.
void dip::ExpandTensor(dip::Image const& src, dip::Image& dest)
Copies samples over from src to dest, expanding the tensor so it’s a standard, column-major matrix.
void dip::Convert(dip::Image const& src, dip::Image& dest, dip::DataType dt)
Copies samples over from src to dest, with data type conversion.
auto dip::CreateImageRefArray(dip::ImageArray& imar) -> dip::ImageRefArray
Creates a dip::ImageRefArray from a dip::ImageArray.
auto dip::CreateImageConstRefArray(dip::ImageArray const& imar) -> dip::ImageConstRefArray
Creates a dip::ImageConstRefArray from a dip::ImageArray.

Operators

auto dip::operator<<(std::ostream& os, dip::Image const& img) -> std::ostream&
You can output a dip::Image to std::cout or any other stream. Some information about the image is printed.
auto dip::operator<<(std::ostream& os, dip::Image::Sample const& sample) -> std::ostream&
You can output a dip::Image::Sample to std::cout or any other stream. It is printed like any numeric value of the same type.
auto dip::operator+(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Arithmetic operator, element-wise.
auto dip::operator-(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Arithmetic operator, element-wise.
auto dip::operator*(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Arithmetic operator, tensor multiplication.
auto dip::operator/(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Arithmetic operator, element-wise.
auto dip::operator%(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Arithmetic operator, element-wise.
auto dip::operator&(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Bit-wise operator, element-wise.
auto dip::operator|(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Bit-wise operator, element-wise.
auto dip::operator^(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> dip::Image::Pixel
Bit-wise operator, element-wise.
auto dip::operator-(dip::Image::Pixel const& in) -> dip::Image::Pixel
Unary operator, element-wise.
auto dip::operator~(dip::Image::Pixel const& in) -> dip::Image::Pixel
Bit-wise unary operator operator.
auto dip::operator!(dip::Image::Pixel const& in) -> dip::Image::Pixel
Boolean unary operator, element-wise.
auto dip::operator==(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> bool
Comparison operator, can only be true if the two pixels have compatible number of tensor elements.
template<typename T, typename <SFINAE>>
auto dip::operator!=(dip::Image::Pixel const& lhs, T const& rhs) -> bool
Comparison operator, equivalent to !(lhs==rhs).
auto dip::operator<(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> bool
Comparison operator, can only be true if the two pixels have compatible number of tensor elements.
auto dip::operator>(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> bool
Comparison operator, can only be true if the two pixels have compatible number of tensor elements.
auto dip::operator<=(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> bool
Comparison operator, can only be true if the two pixels have compatible number of tensor elements.
auto dip::operator>=(dip::Image::Pixel const& lhs, dip::Image::Pixel const& rhs) -> bool
Comparison operator, can only be true if the two pixels have compatible number of tensor elements.
auto dip::operator<<(std::ostream& os, dip::Image::Pixel const& pixel) -> std::ostream&
You can output a dip::Image::Pixel to std::cout or any other stream. It is printed as a sequence of values, prepended with “Pixel with values:”.
auto dip::operator<<(std::ostream& os, dip::Tensor const& tensor) -> std::ostream&
Prints information about the tensor.

Class documentation

class dip::CoordinatesComputer

Computes pixel coordinates based on an index or offset.

Objects of this class are returned by dip::Image::OffsetToCoordinatesComputer and dip::Image::IndexToCoordinatesComputer, and act as functors. Call it with an offset or index (depending on which function created the functor), and it will return the coordinates:

auto coordComp = img.OffsetToCoordinatesComputer();
auto coords1 = coordComp( offset1 );
auto coords2 = coordComp( offset2 );
auto coords3 = coordComp( offset3 );

Note that the coordinates must be inside the image domain, if the offset given does not correspond to one of the image’s pixels, the result is meaningless.