module
Arithmetic operatorsMonadic and dyadic image arithmetic operators.
Functions

void dip::
Modulo (dip::Image const& lhs, dip::Image const& rhs, dip::Image& out, dip::DataType dt)  Computes the modulo of two images, samplewise, with singleton expansion.

void dip::
Invert (dip::Image const& in, dip::Image& out)  Inverts each sample of the input image, yielding an image of the same type.

void dip::
Not (dip::Image const& in, dip::Image& out)  Bitwise NOT of an integer image, or logical NOT of a binary image, samplewise.

void dip::
Abs (dip::Image const& in, dip::Image& out)  Computes the absolute value of each sample.

void dip::
Modulus (dip::Image const& in, dip::Image& out)  Computes the modulus (absolute value) of each sample.
dip::Modulus
is an alias fordip::Abs
. 
void dip::
SquareModulus (dip::Image const& in, dip::Image& out)  Computes the square of the modulus of each sample.

void dip::
Phase (dip::Image const& in, dip::Image& out)  Computes the phase (angle on complex plane, through
std::arg
) of each sample. 
void dip::
Real (dip::Image const& in, dip::Image& out)  Returns the real component of a complex image. Returns
dip::Image::Real
if the input is complex. 
void dip::
Imaginary (dip::Image const& in, dip::Image& out)  Returns the imaginary component of a complex image. Returns
dip::Image::Imaginary
if the input is complex 
void dip::
Conjugate (dip::Image const& in, dip::Image& out)  Computes the complex conjugate of each sample.

void dip::
Sign (dip::Image const& in, dip::Image& out)  Computes the sign of each sample. Only defined for signed real data types (signed integers
and floatingpoint types). Output is of type
dip::DT_SINT8
, containing values 1, 0 and 1. 
void dip::
NearestInt (dip::Image const& in, dip::Image& out)  Computes the integer closest to the value of each sample.
Only defined for floatingpoint types, the output is of type
dip::DT_SINT32
. 
void dip::
Supremum (dip::ImageConstRefArray const& in, dip::Image& out)  Computes the samplewise supremum (maximum) over all the input images. For binary images, this is the same as the union.

void dip::
Supremum (dip::Image const& a, dip::Image const& b, dip::Image& out)  Computes the samplewise supremum (maximum) of the two input images. For binary images, this is the same as the union.

void dip::
Infimum (dip::ImageConstRefArray const& in, dip::Image& out)  Computes the samplewise infimum (minimum) over all the input images. For binary images, this is the same as the intersection.

void dip::
Infimum (dip::Image const& a, dip::Image const& b, dip::Image& out)  Computes the samplewise infimum (minimum) of the two input images. For binary images, this is the same as the intersection.

void dip::
SignedInfimum (dip::Image const& a, dip::Image const& b, dip::Image& out)  Computes the samplewise signed infimum (minimum) of the two input images: returns
b
whereb < a
, a otherwise. 
void dip::
LinearCombination (dip::Image const& a, dip::Image const& b, dip::Image& out, dip::dfloat aWeight = 0.5, dip::dfloat bWeight = 0.5)  Computes the linear combination of the two images, samplewise.

void dip::
LinearCombination (dip::Image const& a, dip::Image const& b, dip::Image& out, dip::dcomplex aWeight, dip::dcomplex bWeight)  Computes the linear combination of the two complex images, samplewise, yielding a complex output,
Operators

template<typename T1, typename T2, typename <SFINAE> = T1>auto dip::
operator+ (T1 const& lhs, T2 const& rhs) > dip::Image  Arithmetic operator, calls
dip::Add
. 
template<typename T1, typename T2, typename <SFINAE> = T1>auto dip::
operator (T1 const& lhs, T2 const& rhs) > dip::Image  Arithmetic operator, calls
dip::Subtract
. 
template<typename T1, typename T2, typename <SFINAE> = T1>auto dip::
operator* (T1 const& lhs, T2 const& rhs) > dip::Image  Arithmetic operator, calls
dip::Multiply
. 
template<typename T1, typename T2, typename <SFINAE> = T1>auto dip::
operator/ (T1 const& lhs, T2 const& rhs) > dip::Image  Arithmetic operator, calls
dip::Divide
. 
template<typename T1, typename T2, typename <SFINAE> = T1>auto dip::
operator% (T1 const& lhs, T2 const& rhs) > dip::Image  Arithmetic operator, calls
dip::Modulo
. 
template<typename T>auto dip::
operator& (dip::Image const& lhs, T const& rhs) > dip::Image  Bitwise and logical operator, calls
dip::And
. 
template<typename T>auto dip::
operator (dip::Image const& lhs, T const& rhs) > dip::Image  Bitwise and logical operator, calls
dip::Or
. 
template<typename T>auto dip::
operator^ (dip::Image const& lhs, T const& rhs) > dip::Image  Bitwise and logical operator, calls
dip::Xor
. 
auto dip::
operator (dip::Image const& in) > dip::Image  Unary operator, calls
dip::Invert
. 
auto dip::
operator~ (dip::Image const& in) > dip::Image  Bitwise and logical unary operator, calls
dip::Not
. 
auto dip::
operator! (dip::Image const& in) > dip::Image  Logical unary operator. The input is converted to a binary image, then calls
dip::Invert
. 
template<typename T>auto dip::
operator+= (dip::Image& lhs, T const& rhs) > dip::Image&  Compound assignment operator.

template<typename T>auto dip::
operator= (dip::Image& lhs, T const& rhs) > dip::Image&  Compound assignment operator.

template<typename T>auto dip::
operator*= (dip::Image& lhs, T const& rhs) > dip::Image&  Compound assignment operator.

template<typename T>auto dip::
operator/= (dip::Image& lhs, T const& rhs) > dip::Image&  Compound assignment operator.

template<typename T>auto dip::
operator%= (dip::Image& lhs, T const& rhs) > dip::Image&  Compound assignment operator.

template<typename T>auto dip::
operator&= (dip::Image& lhs, T const& rhs) > dip::Image&  Bitwise compound assignment operator.

template<typename T>auto dip::
operator= (dip::Image& lhs, T const& rhs) > dip::Image&  Bitwise compound assignment operator.

template<typename T>auto dip::
operator^= (dip::Image& lhs, T const& rhs) > dip::Image&  Bitwise compound assignment operator.

template<typename T>auto dip::
operator+= (Image::View& lhs, T const& rhs) > Image::View&  Compound assignment operator.

template<typename T>auto dip::
operator= (Image::View& lhs, T const& rhs) > Image::View&  Compound assignment operator.

template<typename T>auto dip::
operator*= (Image::View& lhs, T const& rhs) > Image::View&  Compound assignment operator.

template<typename T>auto dip::
operator/= (Image::View& lhs, T const& rhs) > Image::View&  Compound assignment operator.

template<typename T>auto dip::
operator%= (Image::View& lhs, T const& rhs) > Image::View&  Compound assignment operator.

template<typename T>auto dip::
operator&= (Image::View& lhs, T const& rhs) > Image::View&  Bitwise compound assignment operator.

template<typename T>auto dip::
operator= (Image::View& lhs, T const& rhs) > Image::View&  Bitwise compound assignment operator.

template<typename T>auto dip::
operator^= (Image::View& lhs, T const& rhs) > Image::View&  Bitwise compound assignment operator.
Function documentation
void
dip::Modulo (dip::Image const& lhs,
dip::Image const& rhs,
dip::Image& out,
dip::DataType dt)
#include "diplib.h"
Computes the modulo of two images, samplewise, with singleton expansion.
The image out
will have the type dt
, which defaults to lhs.DataType()
if left out.
Works for all real types (i.e. not complex). For floatingpoint types, uses std::fmod
.
Pixel values from both images will be cast to type dt
(with saturation as usual) before applying the modulo
operation, which might yield surprising results if lhs
is an integer type and rhs
has a fractional component,
or if rhs
saturates in the cast.
Either lhs
or rhs
can be a scalar value of any of the supported pixel types, as long as at
least one input is an image.
void
dip::Invert (dip::Image const& in,
dip::Image& out)
#include "diplib.h"
Inverts each sample of the input image, yielding an image of the same type.
For unsigned images, the output is std::numeric_limits::max()  in
. For
signed and complex types, it is 0  in
. For binary images it is the logical NOT.
void
dip::Not (dip::Image const& in,
dip::Image& out)
#include "diplib.h"
Bitwise NOT of an integer image, or logical NOT of a binary image, samplewise.
Out will have the type of in
.
For binary images, this function calls dip::Invert
.
void
dip::Abs (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the absolute value of each sample.
void
dip::Modulus (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the modulus (absolute value) of each sample. dip::Modulus
is an alias for dip::Abs
.
void
dip::SquareModulus (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the square of the modulus of each sample.
void
dip::Phase (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the phase (angle on complex plane, through std::arg
) of each sample.
void
dip::Real (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Returns the real component of a complex image. Returns dip::Image::Real
if the input is complex.
void
dip::Imaginary (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Returns the imaginary component of a complex image. Returns dip::Image::Imaginary
if the input is complex
void
dip::Conjugate (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the complex conjugate of each sample.
void
dip::Sign (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the sign of each sample. Only defined for signed real data types (signed integers
and floatingpoint types). Output is of type dip::DT_SINT8
, containing values 1, 0 and 1.
void
dip::NearestInt (dip::Image const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the integer closest to the value of each sample.
Only defined for floatingpoint types, the output is of type dip::DT_SINT32
.
void
dip::Supremum (dip::ImageConstRefArray const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the samplewise supremum (maximum) over all the input images. For binary images, this is the same as the union.
void
dip::Supremum (dip::Image const& a,
dip::Image const& b,
dip::Image& out)
#include "diplib/math.h"
Computes the samplewise supremum (maximum) of the two input images. For binary images, this is the same as the union.
void
dip::Infimum (dip::ImageConstRefArray const& in,
dip::Image& out)
#include "diplib/math.h"
Computes the samplewise infimum (minimum) over all the input images. For binary images, this is the same as the intersection.
void
dip::Infimum (dip::Image const& a,
dip::Image const& b,
dip::Image& out)
#include "diplib/math.h"
Computes the samplewise infimum (minimum) of the two input images. For binary images, this is the same as the intersection.
void
dip::SignedInfimum (dip::Image const& a,
dip::Image const& b,
dip::Image& out)
#include "diplib/math.h"
Computes the samplewise signed infimum (minimum) of the two input images: returns b
where b < a
, a otherwise.
void
dip::LinearCombination (dip::Image const& a,
dip::Image const& b,
dip::Image& out,
dip::dfloat aWeight = 0.5,
dip::dfloat bWeight = 0.5)
#include "diplib/math.h"
Computes the linear combination of the two images, samplewise.
The actual operation applied is:
out = a * aWeight + b * bWeight;
With defaults weights of 0.5, the function computes the average of two images.
void
dip::LinearCombination (dip::Image const& a,
dip::Image const& b,
dip::Image& out,
dip::dcomplex aWeight,
dip::dcomplex bWeight)
#include "diplib/math.h"
Computes the linear combination of the two complex images, samplewise, yielding a complex output,
The actual operation applied is:
out = a * aWeight + b * bWeight;
The images a
and b
do not necessarily need to be complex, but the computation will be performed with
complex arithmetic.