module #include "diplib/generation.h"
Coordinate generation Generating images with coordinates
Contents
 Reference
Functions

void dip::
FillRamp (dip::Image& out, dip::uint dimension, dip::StringSet const& mode = {})  Fills an image with a ramp function.

void dip::
CreateRamp (dip::Image& out, dip::UnsignedArray const& sizes, dip::uint dimension, dip::StringSet const& mode = {})  Creates a ramp function image.

void dip::
FillXCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with a ramp function that increases along the xaxis.

void dip::
CreateXCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates a ramp function image.

void dip::
FillYCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with a ramp function that increases along the yaxis.

void dip::
CreateYCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates a ramp function image.

void dip::
FillZCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with a ramp function that increases along the zaxis.

void dip::
CreateZCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates a ramp function image.

void dip::
FillRadiusCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with the distance to the origin.

void dip::
CreateRadiusCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates an image filled with the distance to the origin.

void dip::
FillRadiusSquareCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with the square distance to the origin.

void dip::
CreateRadiusSquareCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates an image filled with the square distance to the origin.

void dip::
FillPhiCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with the angle to the xaxis within the xy plane.

void dip::
CreatePhiCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates an image filled with the angle to the xaxis within the xy plane.

void dip::
FillThetaCoordinate (dip::Image& out, dip::StringSet const& mode = {})  Fills an image with the angle to the zaxis.

void dip::
CreateThetaCoordinate (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {})  Creates an image filled with the angle to the zaxis.

void dip::
FillCoordinates (dip::Image& out, dip::StringSet const& mode = {}, dip::String const& system = S::CARTESIAN)  Fills an image with the coordinates of each pixel.

void dip::
CreateCoordinates (dip::Image& out, dip::UnsignedArray const& sizes, dip::StringSet const& mode = {}, dip::String const& system = S::CARTESIAN)  Creates an image filled with the coordinates of each pixel.

void dip::
FillDistanceToPoint (dip::Image& out, dip::FloatArray const& point, dip::String const& distance = S::EUCLIDEAN, dip::FloatArray scaling = {})  Fills an image with the distance to a given point.

void dip::
DistanceToPoint (dip::Image& out, dip::UnsignedArray const& sizes, dip::FloatArray const& point, dip::String const& distance = S::EUCLIDEAN, dip::FloatArray scaling = {})  Creates an image filled with the distance to a given point.

void dip::
EuclideanDistanceToPoint (dip::Image& out, dip::UnsignedArray const& sizes, dip::FloatArray const& point, dip::FloatArray scaling = {})  Creates an image filled with the Euclidean distance to a given point.

void dip::
CityBlockDistanceToPoint (dip::Image& out, dip::UnsignedArray const& sizes, dip::FloatArray const& point, dip::FloatArray scaling = {})  Creates an image filled with the city block distance to a given point.
Function documentation
void
dip::FillRamp (dip::Image& out,
dip::uint dimension,
dip::StringSet const& mode = {})
Fills an image with a ramp function.
The ramp function increases along dimension dimension
, and is
equivalent to the cartesian coordinate for dimension dimension
. dimension
must be
one of the dimensions of out
. out
must be forged, scalar, and of a real type.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateRamp (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::uint dimension,
dip::StringSet const& mode = {})
Creates a ramp function image.
The ramp function increases along dimension dimension
, and is equivalent to the cartesian
coordinate for dimension dimension
. dimension
must be smaller than sizes.size()
.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
. All dimensions except
for dimension
will be expanded singleton dimensions. That is, the
output image only stores sizes[dimension]
pixels.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillXCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with a ramp function that increases along the xaxis.
The ramp function is equivalent to the cartesian coordinate for the xaxis.
out
must be forged, scalar, and of a real type.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateXCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates a ramp function image.
The ramp function increases along the xaxis, and is equivalent to the cartesian coordinate for the xaxis.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
. All dimensions except
for dimension
will be expanded singleton dimensions. That is, the
output image only stores sizes[dimension]
pixels.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillYCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with a ramp function that increases along the yaxis.
The ramp function is equivalent to the cartesian coordinate for the yaxis.
out
must be forged, scalar, of a real type, and have at least two dimensions.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateYCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates a ramp function image.
The ramp function increases along the yaxis, and is equivalent to the cartesian coordinate
for the yaxis. size
must have at least two elements.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
. All dimensions except
for dimension
will be expanded singleton dimensions. That is, the
output image only stores sizes[dimension]
pixels.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillZCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with a ramp function that increases along the zaxis.
The ramp function is equivalent to the cartesian coordinate for the zaxis.
out
must be forged, scalar, of a real type, and have at least three dimensions.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateZCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates a ramp function image.
The ramp function increases along the zaxis, and is equivalent to the cartesian coordinate
for the zaxis. sizes
must have at least three elements.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
. All dimensions except
for dimension
will be expanded singleton dimensions. That is, the
output image only stores sizes[dimension]
pixels.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillRadiusCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with the distance to the origin.
The distance function is equivalent to the radius component of the polar or spherical
coordinate system.
out
must be forged, scalar, and of a real type.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateRadiusCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates an image filled with the distance to the origin.
The distance function is equivalent to the radius component of the polar or spherical
coordinate system.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillRadiusSquareCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with the square distance to the origin.
The distance function is equivalent to the radius component of the polar or spherical
coordinate system.
out
must be forged, scalar, and of a real type.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateRadiusSquareCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates an image filled with the square distance to the origin.
The distance function is equivalent to the radius component of the polar or spherical
coordinate system.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillPhiCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with the angle to the xaxis within the xy plane.
The angle function is equivalent to the phi component of the polar or spherical
coordinate system.
out
must be forged, scalar, of a real type, and have two or three dimensions.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreatePhiCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates an image filled with the angle to the xaxis within the xy plane.
The angle function is equivalent to the phi component of the polar or spherical
coordinate system. size
must have two or three elements.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillThetaCoordinate (dip::Image& out,
dip::StringSet const& mode = {})
Fills an image with the angle to the zaxis.
The angle function is equivalent to the theta component of the spherical coordinate system.
out
must be forged, scalar, of a real type, and have three dimensions.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::CreateThetaCoordinate (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {})
Creates an image filled with the angle to the zaxis.
The angle function is equivalent to the theta component of the spherical coordinate
system. size
must have three elements.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillCoordinates
for the meaning of mode
.
void
dip::FillCoordinates (dip::Image& out,
dip::StringSet const& mode = {},
dip::String const& system = S::CARTESIAN)
Fills an image with the coordinates of each pixel.
system
determines the coordinate system, and mode
further defines the origin and
scaling of the coordinate system, as described below.
out
must be forged, of a real type, and have as many tensor elements as spatial
dimensions.
system
determines the coordinate system. It is one of the following strings:
"cartesian"
: Uses cartesian coordinates."spherical"
: Uses polar (2D) or spherical (3D) coordinates. The image must have two or three dimensions.
mode
specifies the origin and scaling of the coordinates. It can contain one of the
following strings:
"right"
: The origin is on the pixel right of the center (at integer division result ofsize/2
). This is the default if no other option is given."left"
: The origin is on the pixel left of the center (at integer division result of(size1)/2
)."true"
: The origin is halfway the first and last pixel, in between pixels if necessary (at floatingpoint division result ofsize/2
)."corner"
: The origin is on the first pixel."frequency"
: The coordinates used are as for the Fourier transform. The origin is as for"right"
, and the coordinates are in the range [0.5,0.5).
Additionally, mode
can contain the following strings:
"math"
: The y axis is inverted, such that it increases upwards."radial"
: In combination with “frequency”, changes the range to [π,π), as with radial frequencies."physical"
: The coordinate system is in physical units rather than providing indices. That is, instead of unit increments between pixels, the pixel size magnitudes are used to scale distances. Units are ignored, so if they differ, polar/spherical coordinates might not make sense. In combination with"frequency"
, yields the same result as in combination with"right"
.
The string "radfreq"
is equivalent to both "frequency"
and "radial"
.
void
dip::CreateCoordinates (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::StringSet const& mode = {},
dip::String const& system = S::CARTESIAN)
Creates an image filled with the coordinates of each pixel.
out
will be of size sizes
, with sizes.size()
vector elements, and of type dip::DT_SFLOAT
.
See dip::FillCoordinates
for the meaning of mode
and system
.
void
dip::FillDistanceToPoint (dip::Image& out,
dip::FloatArray const& point,
dip::String const& distance = S::EUCLIDEAN,
dip::FloatArray scaling = {})
Fills an image with the distance to a given point.
Computes the distance from each pixel in out
to the coordinates specified through point
, which can be
outside of the image. The scaling
parameter may be used to specify the relative distance between pixels
in each dimension (the pixel sizes in out
are ignored). Both point
and scaling
must have the same
number of elements as out.Size()
, but scaling
can also be empty (no scaling) or have a single element
(isotropic scaling).
distance
indicates how the distance is computed, and can be "Euclidean"
, "square"
(for square Euclidean
distance), "city"
(for city block or L1 distance), or "chess"
(for chessboard or Linfinity distance).
out
must be forged, realvalued and scalar.
void
dip::DistanceToPoint (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::FloatArray const& point,
dip::String const& distance = S::EUCLIDEAN,
dip::FloatArray scaling = {})
Creates an image filled with the distance to a given point.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillDistanceToPoint
for the meaning of point
, distance
and scaling
.
void
dip::EuclideanDistanceToPoint (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::FloatArray const& point,
dip::FloatArray scaling = {})
Creates an image filled with the Euclidean distance to a given point.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillDistanceToPoint
for the meaning of point
and scaling
.
void
dip::CityBlockDistanceToPoint (dip::Image& out,
dip::UnsignedArray const& sizes,
dip::FloatArray const& point,
dip::FloatArray scaling = {})
Creates an image filled with the city block distance to a given point.
out
will be of size sizes
, scalar, and of type dip::DT_SFLOAT
.
See dip::FillDistanceToPoint
for the meaning of point
and scaling
.