Image module
#include "diplib.h"
dip::ExternalInterface class

Support for external interfaces.

Contents

Software using DIPlib might want to control how the image data is allocated. Such software should derive a class from this one, and assign a pointer to it into each of the images that it creates, through dip::Image::SetExternalInterface. The caller will maintain ownership of the interface.

See Define an image’s allocator for details on how to use the external interfaces.

Derived classes

class dml::MatlabInterface
This class is the dip::ExternalInterface for the MATLAB interface.
class dip_opencv::ExternalInterface
This class is the dip::ExternalInterface for the OpenCV interface.
class dip::AlignedAllocInterface
dip::ExternalInterface that allocates aligned data.

Functions

auto AllocateData(void*& origin, dip::DataType dataType, dip::UnsignedArray const& sizes, dip::IntegerArray& strides, dip::Tensor const& tensor, dip::sint& tensorStride) -> dip::DataSegment pure virtual
Allocates the data for an image. The function is required to set strides,

Function documentation

dip::DataSegment AllocateData(void*& origin, dip::DataType dataType, dip::UnsignedArray const& sizes, dip::IntegerArray& strides, dip::Tensor const& tensor, dip::sint& tensorStride) pure virtual

Allocates the data for an image. The function is required to set strides,

tensorStride and origin, and return a dip::DataSegment that owns the allocated data segment. origin does not need to be the same pointer as stored in the returned dip::DataSegment. For example, the latter can point to a container object (e.g. std::vector), and origin can point to data owned by the container object (e.g. std::vector::data()).

Note that strides and tensorStride might have been set by the user before calling dip::Image::Forge, and should be honored if possible.