Diplib Reference Guide
Diplib Reference Guide
3
4 Contents
2 Function reference 32
5
6 Chapter 1. Indices of functions by subject
DIPlib function reference 7
1.1.3 Strings
1.1.4 Arrays
1.1.5 Frameworks
1.1.9 Sorting
1.1.10 Indexing
• ImageReadPICInfo - Get information about image in BioRad PIC file (in dipIO)
• Ln - arithmetic function
• Or - logic operation
1.3.2 Statistics
1.3.3 Manipulation
1.3.4 Interpolation
1.3.5 Painting
1.3.12 Transforms
1.4.2 Sharpening
1.4.9 Segmentation
1.4.10 Analysis
1.4.11 Measurement
Function reference
34
DIPlib function reference 35
Abs
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Acos
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
AdaptiveBanana
Performs Gaussian filtering steered by paramter images
SYNOPSIS
DATA TYPES
sfloat
FUNCTION
This function performs Gaussian filtering steerd by the information stored in the paramter
images (local orientation) and in the curvature image. The meaning of the parameter
images depends on the dimensionality of the input image. Up to now only 2 and 3D images
are supported for adaptive filtering. If the input image is not of type float it is converted to
that type.
para images: ImageArray containing orientation images.
2D: angle of the orientation.
3D: polar coordinate phi, theta for intrinsic 1D structures polar coordinates of two
orientations for intrinsic 2D structures.
filterSize: Array containing the sigmas of the derivatives.
For intrinsic 1D structures, the first value is along the contour, the second perpendicular to
it.
For intrinsic 2D structures, the first two are in the plane, whereas the other is perpendicular
to them. If a value is zero no convolution is done is this direction.
38 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
LITERATURE
P. Bakker, “Image structure analysis for seismic interpretation”, PhD Thesis, TU Delft, The
Netherlands, 2001
L. Haglund, Adaptive Mulitdimensional Filtering”, PhD Thesis, Link”oping University,
Sweden, 1992
W.T. Freeman,“ Steerable Filters and Local Analysis of Image Structure”, PhD Thesis,
MIT, USA, 1992
DIPlib function reference 39
AdaptiveGauss
Performs Gaussian filtering steered by paramter images
SYNOPSIS
DATA TYPES
sfloat
FUNCTION
This function performs Gaussian filtering steerd by the information stored in the paramter
images. The meaning of the parameter images depends on the dimensionality of the input
image. Up to now only 2 and 3D images are supported for adaptive filtering. If the input
image is not of type float it is converted to that type.
para images: ImageArray containing orientation images.
2D: angle of the orientation
3D: polar coordinate phi, theta for intrinsic 1D structures polar coordinates of two
orientations for intrinsic 2D structures
filterSize: Array containing the sigmas of the derivatives.
For intrinsic 1D structures, the first value is along the contour, the second perpendicular to
it.
For intrinsic 2D structures, the first two are in the plane, whereas the other is perpendicular
to them. If a value is zero no convolution is done is this direction.
ARGUMENTS
SEE ALSO
LITERATURE
P. Bakker, “Image structure analysis for seismic interpretation”, PhD Thesis, TU Delft, The
Netherlands, 2001
L. Haglund, Adaptive Mulitdimensional Filtering”, PhD Thesis, Link”oping University,
Sweden, 1992
W.T. Freeman,“ Steerable Filters and Local Analysis of Image Structure”, PhD Thesis,
MIT, USA, 1992
DIPlib function reference 41
AdaptivePercentile
Performs Percentile filtering steered by paramter images
SYNOPSIS
DATA TYPES
sfloat
FUNCTION
This function performs percentile filtering steerd by the information stored in the paramter
images (local orientation). The meaning of the parameter images depends on the
dimensionality of the input image. Up to now only 2 and 3D images are supported for
adaptive filtering. If the input image is not of type float it is converted to that type.
para images: ImageArray containing orientation images.
2D: angle of the orientation.
3D: polar coordinate phi, theta for intrinsic 1D structures polar coordinates of two
orientations for intrinsic 2D structures.
ARGUMENTS
SEE ALSO
LITERATURE
P. Bakker, “Image structure analysis for seismic interpretation”, PhD Thesis, TU Delft, The
Netherlands, 2001
L. Haglund, Adaptive Mulitdimensional Filtering”, PhD Thesis, Link”oping University,
Sweden, 1992
W.T. Freeman,“ Steerable Filters and Local Analysis of Image Structure”, PhD Thesis,
MIT, USA, 1992
DIPlib function reference 43
Add
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in1 + in2 on a pixel by pixel basis. The data types of the
in1 and in2 image may be of different types. See Information about dyadic operations for
more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
AddComplex
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in + constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, Sub, SubFloat, SubComplex, Mul, MulFloat, MulComplex, Div, DivFloat,
DivComplex
DIPlib function reference 45
AddFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in + constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddComplex, Sub, SubFloat, SubComplex, Mul, MulFloat, MulComplex, Div, DivFloat,
DivComplex
46 Chapter 2. Function reference
And
logic operation
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
The function And performs the logic AND operation between the corresponding pixels in
in1 and in2, and stores the result in out.
ARGUMENTS
SEE ALSO
AreaOpening
Morphological filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The image grey will be filtered to remove local maxima (closing is DIP FALSE) or local
minima (closing is DIP TRUE) with an area smaller than filtersize (in pixels).
Theoretically, the area opening can be written as the supremum of all the openings with
each of the possible compact structuring elements of filtersize pixels. The connectivity
parameter indicates which shapes are considered compact (i.e. all pixels are connected). See
The connectivity parameter for more information.
ARGUMENTS
SEE ALSO
ArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ArrayNew, ArrayFree
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
DIPlib function reference 49
ArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This functions allocates the size elements of a dip Array and sets the size of the array to
size. The size of each element is determined by elementSize.
ARGUMENTS
SEE ALSO
ArrayNew, ArrayFree
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
50 Chapter 2. Function reference
Asin
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Atan
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Atan2
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = atan2(in1 , in2) on a pixel by pixel basis. The data types of
the in1 and in2 image may be of different types. See Information about dyadic operations
for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
AttenuationCorrection
Attenuation correction algorithm
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP ATTENUATION RAC LT2 Recursive Attenuation Correction algorithm using two Light
Cone convolutions
DIP ATTENUATION RAC LT1 Recursive Attenuation Correction algorithm using one Light
Cone convolution
DIP ATTENUATION RAC DET Recursive Attenuation Correction algorithm using
Directional Extinction Tracking
LITERATURE
K.C. Strasters, H.T.M. van der Voort, J.M. Geusebroek, and A.W.M. Smeulders, Fast
attenuation correction in fluorescence confocal imaging: a recursive approach, BioImaging,
vol. 2, no. 2, 1994, 78-92.
AUTHOR
SEE ALSO
SimulatedAttenuation, ExponentialFitCorrection
DIPlib function reference 55
BesselJ0
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
BesselJ1
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
BesselJN
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the Bessel function J of the order n of the input image values.
ARGUMENTS
SEE ALSO
BesselY0
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
BesselY1
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
BesselYN
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the Bessel function Y of the order n of the input image values.
ARGUMENTS
SEE ALSO
BiasedSigma
Adaptive edge sharpening & contrast enhancing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The Biased Sigma filter is an adaptive edge sharpening and contrast enhancing filter. Its
operation differs from the Sigma filter by separating the averaging the pixels with an
intensities higher than the pixel being filtered, from the pixels with lower intensities. The
absolute difference of these two averages with the value of the pixel being filtered. The value
of this pixel is being replaced by the average with the smallest difference. If outputCount is
DIP TRUE, the output values represent the number of pixel over which the average has been
calculated. When threshold is DIP TRUE, the pixel intensities are being thresholded at +/-
2 sigma, when it is set to DIP FALSE, the intensities are weighted with the Gaussian
difference with the intensity of the central pixel.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
LITERATURE
John-Sen Lee, Digital Image Smoothing and the Sigma Filter, Computer Vision, Graphics
and Image Processing, 24, 255-269, 1983
SEE ALSO
Sigma, GaussianSigma
DIPlib function reference 63
BinaryClosing
Binary morphological closing operation
SYNOPSIS
DATA TYPES
binary
FUNCTION
The connectivity parameter defines the metric, that is, the shape of the structuring
element. 1 indicates city-block metric, or a diamond-shaped structuring element. 2 indicates
chessboard metric, or a square structuring element. -1 and -2 indicate alternating
connectivity and produce an octagonal structuring element. See The connectivity parameter
for more information. The edge parameter specifies whether the border of the image should
be treated as object (DIP TRUE) or as background (DIP FALSE). Additionally, you can set it
to -1 for special handling: DIP FALSE for the dilation, DIP TRUE for the erosion; this avoids
the border effect you can get in the corners of the image in some cases.
See section 9.6, “Morphology-based operations”, in “Fundamentals of Image Processing” for
a description of binary mathematical morphology operations.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryDilation
Binary morphological dilation operation
SYNOPSIS
DATA TYPES
binary
FUNCTION
The connectivity parameter defines the metric, that is, the shape of the structuring
element. 1 indicates city-block metric, or a diamond-shaped structuring element. 2 indicates
chessboard metric, or a square structuring element. -1 and -2 indicate alternating
connectivity and produce an octagonal structuring element. See The connectivity parameter
for more information. The edge parameter specifies whether the border of the image should
be treated as object (DIP TRUE) or as background (DIP FALSE).
See section 9.6, “Morphology-based operations”, in “Fundamentals of Image Processing” for
a description of binary mathematical morphology operations.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryErosion
Binary morphological erosion operation
SYNOPSIS
DATA TYPES
binary
FUNCTION
The connectivity parameter defines the metric, that is, the shape of the structuring
element. 1 indicates city-block metric, or a diamond-shaped structuring element. 2 indicates
chessboard metric, or a square structuring element. -1 and -2 indicate alternating
connectivity and produce an octagonal structuring element. See The connectivity parameter
for more information. The edge parameter specifies whether the border of the image should
be treated as object (DIP TRUE) or as background (DIP FALSE).
See section 9.6, “Morphology-based operations”, in “Fundamentals of Image Processing” for
a description of binary mathematical morphology operations.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryImageToPixelTable
Convert a binary image to a pixel table
SYNOPSIS
DATA TYPES
binary
FUNCTION
This functions converts a binary image to a new allocated pixel table table.
ARGUMENTS
SEE ALSO
BinaryNoise
Generates an image disturbed by binary noise
SYNOPSIS
DATA TYPES
binary
FUNCTION
ARGUMENTS
EXAMPLE
p10 = 0.1;
p01 = 0.2;
DIPXX( dip_BinaryNoise(in, out, p10, p01, &random ));
SEE ALSO
BinaryOpening
Binary morphological opening operation
SYNOPSIS
DATA TYPES
binary
FUNCTION
The connectivity parameter defines the metric, that is, the shape of the structuring
element. 1 indicates city-block metric, or a diamond-shaped structuring element. 2 indicates
chessboard metric, or a square structuring element. -1 and -2 indicate alternating
connectivity and produce an octagonal structuring element. See The connectivity parameter
for more information. The edge parameter specifies whether the border of the image should
be treated as object (DIP TRUE) or as background (DIP FALSE). Additionally, you can set it
to -1 for special handling: DIP TRUE for the erosion, DIP FALSE for the dilation; this avoids
the border effect you can get in the corners of the image in some cases.
See section 9.6, “Morphology-based operations”, in “Fundamentals of Image Processing” for
a description of binary mathematical morphology operations.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryPropagation
Morphological propagation of binary objects
SYNOPSIS
DATA TYPES
binary
FUNCTION
The connectivity parameter defines the metric, that is, the shape of the structuring
element. 1 indicates city-block metric, or a diamond-shaped structuring element. 2 indicates
chessboard metric, or a square structuring element. -1 and -2 indicate alternating
connectivity and produce an octagonal structuring element. See The connectivity parameter
for more information. The edge parameter specifies whether the border of the image should
be treated as object (DIP TRUE) or as background (DIP FALSE).
See section 9.6, “Morphology-based operations”, in “Fundamentals of Image Processing” for
a description of binary mathematical morphology operations, and section 10.3,
“Segmentation”, for applications of binary propagation.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryRandomVariable
Binary random variable generator
SYNOPSIS
FUNCTION
The binary random variable is generated by altering the input value, if the value of a
generated random variable is higher than the p10 probability, if input is DIP TRUE, or
higher than p01 otherwise.
ARGUMENTS
EXAMPLE
dip_Random random;
dip_float p10, p01, value;
p10 = 0.1;
p01 = 0.2;
DIPXX( dip_BinaryRandomVariable( &random, 1, p10, p01, &value));
SEE ALSO
BooleanArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the boolean array src to dest. The array dest is created by this
function as well.
ARGUMENTS
SEE ALSO
BooleanArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
BooleanArrayFind will produce an error if value is not found, otherwise found obtains the
search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
BooleanArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
BooleanArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip BooleanArray and sets the size of the
array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
BoundaryArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
BoundaryArrayNew, BoundaryArrayFree
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
DIPlib function reference 79
BoundaryArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip BoundaryArray and sets the size of the
array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
BoundaryArrayNew, BoundaryArrayFree
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
80 Chapter 2. Function reference
Ceil
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the ceil of the input image values, and outputs a signed integer typed image.
ARGUMENTS
SEE ALSO
ChangeDataType
Change the data type of an image
SYNOPSIS
FUNCTION
Inherit all properties of the input image except the data type. The data type is explicitly
specified through dataType. When dataType is zero, the data type of the output image is
not modified. The example image may be either “raw” or “forged”.
ARGUMENTS
SEE ALSO
ChangeDimensions
Changes the order of the dimensions in an image
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ChangeTo0d
Make an image zero dimensional
SYNOPSIS
FUNCTION
Inherit all properties of the input image except the data type and the dimensionality. The
data type is explicitly specified through dataType. When dataType is zero, the data type of
the output image is not modified. The dimensionality is set to zero. The example image
may be either “raw” or “forged”.
ARGUMENTS
SEE ALSO
ChordLength
Compute the chord lengths of the different phases
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
This function computes the chord lengths of the different phases in object. If object is a
binary image, the image is a regarded as a two phase image. In case object is of the integer
type, the image is regarded as a labeled image, with each integer value encoding a phase.
Optionally a mask image can be provided so select which pixels in object should be used to
compute the chord lengths. The probes variable specifies how many random point pairs
should be drawn to compute the lengths. Length specifies the maximum correlation length.
The chord length can be computed using a random of grid method, as specified by
sampling.
ARGUMENTS
SEE ALSO
PairCorrelation, ProbabilisticPairCorrelation
DIPlib function reference 85
CityBlockDistanceToPoint
Distance generation function
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
Computes the cityblock distance of each pixel in the output image to a point at origin.
The coordinates of origin may lie outside the image. The scale parameter may be used to
specify the relative distance between pixels in each dimension.
ARGUMENTS
SEE ALSO
EllipticDistanceToPoint, EuclideanDistanceToPoint
86 Chapter 2. Function reference
Clip
Point operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Clips in at either the minimum value clipLow of the maximum value clipHigh or both. If
the flag DIP CLIP THRESHOLD AND RANGE is specified, the clip bound are defined by clipLow
+/- clipHigh/2.
ARGUMENTS
SEE ALSO
Closing
Morphological closing operation
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
SEE ALSO
Colour2Gray
Convert ND image with colour information to a (n-1)D grayvalue image (in dipIO)
SYNOPSIS
FUNCTION
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
KNOWN BUGS
Some colourspaces are not converted correctly. R’G’B’ (DIPIO PHM RGB NONLINEAR), is
treated like RGB. From a CIE Lab (DIPIO PHM CIELAB) or Luv (DIPIO PHM CIELUV) the
luminosity channel is extracted, which is also a non-linear conversion away from the
intensity. From HCV (DIPIO PHM HCV) and HSV (DIPIO PHM HSV) the value channel is
extracted, which again is a non-linear conversion away from the intensity. CMYK
(DIPIO PHM CMYK) and CMY (DIPIO PHM CMY) conversion is not implemented. Specifying
these values will result in an error.
SEE ALSO
Compare
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function can perform various pixel-by-pixel comparisons (smaller, smaller- equal, equal,
not equal, greater-equal, greater) between in1 ans in2. out contains the binary result. This
is implemented with a call to Select whose in3 and in4 are set to binary true and false,
respectively.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to the functionality of Threshold, but with more options.
ARGUMENTS
SEE ALSO
ComplexArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the complex array src to dest. The array dest is created by this
function as well.
ARGUMENTS
SEE ALSO
ComplexArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
ComplexArrayFind will produce an error if value is not found, otherwise found obtains the
search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
ComplexArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ComplexArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip ComplexArray and sets the size of the
array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
ContrastStretch
Point operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ContrastStretch stretches the pixel values of the input image. Pixel values higher or equal
to UpperBound are stretched to the OutMaximum value. A similar thing holds for
LowerBound and OutMinimum. Method determines how pixel values are stretched.
SigmoidSlope and SigmoidPoint are used by the DIP CST SIGMOID method. MaxDecade
determines the maximum number of decades the method DIP CST DECADE will stretch
(values lower than MaxDecade will be set to zero).
ARGUMENTS
Name Description
DIP CST LINEAR linear contrast stretch
DIP CST SIGNED LINEAR linear stretch with zero at fixed value
DIP CST LOGARITHMIC logarithmic contrast stretch
DIP CST SIGNED LOGARITHMIC signed logarithmic contrast stretch
DIP CST ERF linear contrast stretch with erf clipping
DIP CST DECADE Decade contrast stretching
DIP CST SIGMOID Contrast stretched by sigmoid function
DIP CST CLIP Simple clipping
DIP CST 01 Stretching of [0,1] input values
DIP CST PI Stretching of [-Pi,Pi] input values
In the explanaition of the different contrast stretch flags, the variables input, output,
inMin, inMax, outMin and outMax are used. With input and output is meant the pixel
being processed of respecitively the input and output image. inMin and inMax are the pixel
values corresponding to the lowerBound and upperBound of the input image. outMin and
outMax are parameters passed to the function dip ContrastStretch.
The DIP CST LINEAR stretches the input in the following way:
The DIP CST SIGNED LINEAR stretches the input in the following way:
The DIP CST LOGARITHMIC stretches the input in the following way:
The DIP CST SIGNED LOGARITHMIC stretches the input in the following way:
The DIP CST ERF stretches the input in the following way:
The DIP CST DECADE stretches the input in the following way:
The DIP CST SIGMOID stretches the input in the following way:
The DIP CST CLIP stretches the input in the following way:
SEE ALSO
ConvertArray
converts the data type of an array
SYNOPSIS
FUNCTION
ARGUMENTS
ConvertDataType
Converts the data type of an image
SYNOPSIS
FUNCTION
Convert the data type of the input data to dataType and stores the result in out.
Conversion from a complex type to another (non-complex) type, is done by taking the real
part.
Conversion to a binary type from another (non-binary) type, is done as follows; any
non-zero number becomes 1, zero becomes zero.
ARGUMENTS
Convolve1d
Perform a 1D convolution
SYNOPSIS
DATA TYPES
integer,float
FUNCTION
This function performs a one-dimensional convolution of the input data with the given filter
kernel. In general your filter will be centered around the origin. The origin is uniquely
defined if the filter size is odd, but if the filter size is even you’ll have to specify whether the
origin of the filter lies to the left or the right. Words cannot possibly suffice here, so here is
a small pictorial representation:
When the filter size is even, one of the flags DIP CNV LEFT or DIP CNV RIGHT must be
specified. When the filter size is odd both flags are ignored. It is also possible to specify the
origin of the filter directly by using the DIP CNV USE ORIGIN flag in combination with the
origin parameter. Again a small pictorial representation:
0 1 2 3 4 5 6 7 8
kernel data : x x x x x x x x x when origin = 2
DIPlib function reference 103
^
0
when DIP CNV USE ORIGIN is NOT specified origin is computed as follows :
The input data is copied to a temporary buffer, after which the input data is extended
according to the boundary condition specified. You can use the flags DIP CNV HAS BORDER to
indicate that the input data already has a border. In this case you must make sure that
there are enough pixels on either size of the array:
If DIP CNV HAS BORDER is specified and in != out no auxiliary storage is used. You must
also specify the symmetry of the filter as follows:
ARGUMENTS
SEE ALSO
SeparableConvolution, SeparableFrameWork
DIPlib function reference 105
ConvolveFT
Fourier transform based convolution filter
SYNOPSIS
DATA TYPES
FUNCTION
This function convolves the input image with the point spread function psf, by multiplying
their Fourier transforms. The inrep, psfrep and outrep specify whether the images are
spatial images (DIP IMAGE REPRESENTATION SPATIAL) or their Fourier transform.
(DIP IMAGE REPRESENTATION SPECTRAL).
ARGUMENTS
SEE ALSO
CoordinateArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
CoordinateArrayNew, CoordinateArrayFree
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
DIPlib function reference 107
CoordinateArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip CoordinateArray and sets the size of
the array to size. Each element has ndims values, to store coordinates of an
ndims-dimensional image. Each array element is initialized to 0.
ARGUMENTS
SEE ALSO
CoordinateArrayNew, CoordinateArrayFree
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
108 Chapter 2. Function reference
CoordinateToIndex
Convert coordinate to pixel index
SYNOPSIS
FUNCTION
This function converts a pixel coordinate to an pixel index which is specific for the image
from which stride was obtained. coordinages and stride must have the same number of
elements.
ARGUMENTS
SEE ALSO
IndexToCoordinate
DIPlib function reference 109
Cos
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh
110 Chapter 2. Function reference
Cosh
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Crop
Remove the outer parts of an image
SYNOPSIS
DATA TYPES
FUNCTION
Crop a part of the image. The requested part is selected by specifying its upper left corner
(origin ), and its size (size ). If in has a different type than out, it will be converted to
the type of out.
ARGUMENTS
SEE ALSO
GetSlice, GetLine
112 Chapter 2. Function reference
CrossCorrelationFT
Normalized cross-correlation using the Fourier Transform
SYNOPSIS
DATA TYPES
FUNCTION
This function calculates the cross-correlation between two images of equal size. The
returned image is the cross-correlation normalized in such a way that only the phase
information is of importance. This results as a very sharp peak in the spatial domain. This
function performs out = (Conj(in1)*in2)/((Abs(in1))^2) in the Fourier domain. It is
used by FindShift. The inrep, psfrep and outrep specify whether the images are spatial
images (DIP IMAGE REPRESENTATION SPATIAL) or their Fourier transform.
(DIP IMAGE REPRESENTATION SPECTRAL).
ARGUMENTS
SEE ALSO
FindShift
DIPlib function reference 113
CumulativeSum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the cumulative sum of the pixel values over all those dimensions which are
specified by ps, i.e.:
out(x,y)=sum i=0:x,j=0:y in(i,j) when ps specifies both x and y out(x,y)=sum j=0:y
in(x,j) when ps specifies only y
ARGUMENTS
SEE ALSO
DanielsonLineDetector
Line detector
SYNOPSIS
DATA TYPES
FUNCTION
The Danielson line dectector uses second derivatives to detect lines in 2D images and to
estimate their orientation. See the literature reference for an in-depth information on this
detector.
ARGUMENTS
LITERATURE
P.E. Danielson, Q. Lin and Q-Z Yes, i“Efficient detection of second degree variations in 2D
and 3D images”, Report LiTH-ISY-R-2155, Linkoping University, Linkoping, Sweden, 1999
SEE ALSO
Derivative, StructureTensor2D
DIPlib function reference 115
DataTypeAllowed
Check whether a data type is allowed
SYNOPSIS
FUNCTION
This function checks whether the dataType is (or is not) in the set of data types specified
by allowedTypes. If allow is DIP TRUE, the data type should be in this set. If allow is
DIP FALSE, the data type should not be in this set. If the allowed parameter is zero, the
routine returns dip errorDataTypeNotSupported if the required condition is not satisfied.
If nonzero, it should point to a boolean variable. This boolean variable will be set to
DIP TRUE if the condition is satisfied, or DIP FALSE if not.
ARGUMENTS
SEE ALSO
DataTypeArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the data type array src to dest. The array dest is created by this
function as well.
ARGUMENTS
SEE ALSO
DataTypeArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
DataTypeArrayFind will produce an error if value is not found, otherwise found obtains
the search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
DataTypeArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
DataTypeArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip DataTypeArray and sets the size of the
array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
DataTypeGetInfo
Get information about a data type
SYNOPSIS
ARGUMENTS
FUNCTION
Get information about a data type. Depending on the whatInfo flag this routine will return
information about the data type through the info parameter. A pointer must be passed to
this routine which must point to a variable of the proper type to contain the information
which will be returned. This pointer is passed as a void pointer through the info
parameter. Below is a table of the flags that determine what information is returned, the
type of the variable that is used to store the information in and a description of the
information that is returned.
dipf DataTypeGetInfo type description
DIP DT INFO PROPS dip DataTypeProperties a set of flags as shown in
the table below
DIP DT INFO SIZEOF dip int sizeof( data type )
DIP DT INFO C2R dip DataType for complex types returns
the corresponding floating
point type (i.e.
dip scomplex ->
dip sfloat) for other data
types returns the data type
itself
The following table shows which dip DataTypeProperties flags are set for which data
types:
DIPlib function reference 121
SEE ALSO
Derivative
Derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Dgg
Second order derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
Computes the second derivative in gradient direction of an image using the Derivative
function.
ARGUMENTS
SEE ALSO
Dilation
Local maximum filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
SEE ALSO
dip PixelGetFloat
Midlevel PixelIO function
SYNOPSIS
dip Error dip PixelGetFloat ( vptr, type, position, stride, plane, val )
FUNCTION
The dip PixelGet/SetInteger and dip PixelGet/SetFloat functions provide midlevel access
to image pixel values. These functions are faster than the highlevel Get and Set functions,
but are easier to use than the lowlevel DIP PIXEL GET and DIP PIXEL SET macros as defined
in dip macros.h.
ARGUMENTS
SEE ALSO
dip PixelGetInteger
Midlevel PixelIO function
SYNOPSIS
FUNCTION
The dip PixelGet/SetInteger and dip PixelGet/SetFloat functions provide midlevel access
to image pixel values. These functions are faster than the highlevel Get and Set functions,
but are easier to use than the lowlevel DIP PIXEL GET and DIP PIXEL SET macros as defined
in dip macros.h.
ARGUMENTS
SEE ALSO
dip PixelSetFloat
Midlevel PixelIO function
SYNOPSIS
dip Error dip PixelSetFloat ( val, vptr, type, position, stride, plane )
FUNCTION
The dip PixelGet/SetInteger and dip PixelGet/SetFloat functions provide midlevel access
to image pixel values. These functions are faster than the highlevel Get and Set functions,
but are easier to use than the lowlevel DIP PIXEL GET and DIP PIXEL SET macros as defined
in dip macros.h.
ARGUMENTS
SEE ALSO
dip PixelSetInteger
Midlevel PixelIO function
SYNOPSIS
dip Error dip PixelSetInteger ( val, vptr, type, position, stride, plane )
FUNCTION
The dip PixelGet/SetInteger and dip PixelGet/SetFloat functions provide midlevel access
to image pixel values. These functions are faster than the highlevel Get and Set functions,
but are easier to use than the lowlevel DIP PIXEL GET and DIP PIXEL SET macros as defined
in dip macros.h.
ARGUMENTS
SEE ALSO
DistributionSort
Sort a block of data
SYNOPSIS
FUNCTION
Sorts a block of data (of size size and data type dataType ) using the distribution sort
algorithm.
ARGUMENTS
SEE ALSO
DistributionSortIndices
Sort indices to block of data
SYNOPSIS
FUNCTION
Sorts a list of indices rather than the data itself using the distribution sort algorithm.
ARGUMENTS
SEE ALSO
DistributionSortIndices16
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of (16 bit) indices rather than the data itself using the distribution sort
algorithm.
ARGUMENTS
SEE ALSO
Div
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in1 / in2 on a pixel by pixel basis. If a pixel in in2 has the
value of zero, the corresponding pixel in out will be set to zero. The data types of the in1
and in2 image may be of different types. See Information about dyadic operations for more
information about what the type of the output will be.
ARGUMENTS
SEE ALSO
DivComplex
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in / constant on a pixel by pixel basis. If constant is zero,
out will be set to zero. The data types of the in1 image and constant may be of different
types. See Information about dyadic operations for more information about what the type
of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubFloat, SubComplex, Mul, MulFloat, MulComplex, Div,
DivFloat
DIPlib function reference 137
DivFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in / constant on a pixel by pixel basis. If constant is zero,
out will be set to zero. The data types of the in1 image and constant may be of different
types. See Information about dyadic operations for more information about what the type
of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubFloat, SubComplex, Mul, MulFloat, MulComplex, Div,
DivComplex
138 Chapter 2. Function reference
EdgeObjectsRemove
Remove binary edge objects
SYNOPSIS
DATA TYPES
binary
FUNCTION
The function EdgeObjectsRemove removes those binary objects from in which are connected
to the edges of the image. The connectivity of the objects is determined by connectivity.
This function is a front-end to BinaryPropagation. It calls BinaryPropagation with no
seed image and the edge pixels turned on. The result of the propagation is xor-ed with the
input image. The connectivity parameter defines the metric, that is, the shape of the
structuring element. 1 indicates city-block metric, or a diamond-shaped structuring element.
2 indicates chessboard metric, or a square structuring element. -1 and -2 indicate
alternating connectivity and produce an octagonal structuring element. See The
connectivity parameter for more information. The edge parameter specifies whether the
border of the image should be treated as object (DIP TRUE) or as background (DIP FALSE).
See section 10.3, “Segmentation”, in “Fundamentals of Image Processing” for a description
of the edge object removal operation.
ARGUMENTS
KNOWN BUGS
SEE ALSO
BinaryPropagation, Xor
140 Chapter 2. Function reference
EllipticDistanceToPoint
Distance generation function
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
Computes the elliptic distance of each pixel in the output image to a point at origin. The
coordinates of origin may lie outside the image. The scale parameter may be used to
specify the relative distance between pixels in each dimension.
ARGUMENTS
SEE ALSO
EuclideanDistanceToPoint, CityBlockDistanceToPoint
DIPlib function reference 141
Equal
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when corresponding pixels in in1 and in2 are
equal. This is the same as Compare with the DIP SELECT EQUAL selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to a functionality similar to SelectValue.
ARGUMENTS
SEE ALSO
Erf
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Erfc
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
ErfClip
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Clips in using the erf function at either or both the values threshold +/- range/2. If the
flag DIP CLIP LOW AND HIGH BOUNDS is specified, threshold and range are used as lower
and upper bounds respectively.
ARGUMENTS
LITERATURE
SEE ALSO
Clip, ContrastStretch
146 Chapter 2. Function reference
Erosion
Local minimum filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
SEE ALSO
error.h
Contains error messages
SYNOPSIS
FUNCTION
Contains a lot of definitions to do with DIPlib’s error mechanism. In particular, this include
file contains definitions for a number of error messages. These are all of the type extern
const char *. A list of the error sorted by category follows below:
Memory allocation
Name Description
dip errorCouldNotAllocateMemory No memory could be allocated
Image creation errors
Name Description
dip errorImageIsLocked Image is locked
dip errorImageNotRaw Image is not in the RAW state
dip errorImageNotValid Image is not in the VALID state
dip errorImagesNotUnique Image is used as an output image more than once
dip errorImageLockInvalidKey Cannot unlock. Wrong key
Image type errors
Name Description
dip errorIllegalImageType Illegal image type
dip errorImageTypeDoesNotExist Image type does not exist
dip errorImageTypeAlreadyExists Adding image type failed. Type already exists
dip errorImageTypeNotSupported Image type not supported
dip errorImageTypeHandlerMissing No type handler for image type
Image data type errors
Name Description
dip errorDataTypeNotSupported Data type not supported
dip errorIllegalDataType Illegal data type
Image dimension(ality) errors
Name Description
dip errorIllegalDimensionality Illegal dimensionality
dip errorDimensionalityNotSupported Dimensionality not supported
dip errorIllegalDimension Illegal dimension
DIPlib function reference 149
ErrorFree
Free a DIPlib call tree
SYNOPSIS
FUNCTION
ARGUMENTS
RETURNS
Nothing
150 Chapter 2. Function reference
EuclideanDistanceToPoint
Distance generation function
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
Computes the Euclidean distance of each pixel in the output image to a point at origin.
The coordinates of origin may lie outside the image.
ARGUMENTS
SEE ALSO
EllipticDistanceToPoint, CityBlockDistanceToPoint
DIPlib function reference 151
EuclideanDistanceTransform
Euclidean distance transform
SYNOPSIS
DATA TYPES
binary
FUNCTION
This function computes the Euclidean distance transform of an input binary image using
the vector-based method as opposed to the chamfer method. This method computes
distances from the objects (binary 1’s) to the nearest background (binary 0’s) of in and
stored the result in out. The out image is a sfloat type image.
The distance parameter can be used to specify anisotropic sampling densities. If it is set to
zero, the sampling density is assumed to be 1.0 along all axes.
The border parameter specifies whether the edge of the image should be treated as objects
(border = DIP TRUE) or as background (border = DIP FALSE).
Individual vector components of the Euclidean distance transform can be obtained with the
VectorDistanceTransform.
ARGUMENTS
Name Description
DIP EDT FAST fastest, but most errors
DIP EDT TIES slower, but fewer errors
DIP EDT TRUE slow, uses lots of memory, but is “error free”
DIP EDT BRUTE FORCE gives a result from which errors are calculated for the other
methods. This method is extremly slow and should only be used
for testing purposes.
LITERATURE
Danielsson, P.E. (1980). “Euclidean distance mapping.“ Computer Graphics and Image
Processing 14: 227-248.
Mullikin, J.C. (1992). “The vector distance transform in two and three dimensions.“
CVGIP: Graphical Models and Image Processing 54(6): 526-535.
Ragnemalm, I. (1990). Generation of Euclidean Distance Maps, Thesis No. 206. Licentiate
thesis. Linkoing University, Sweden.
Ye, Q.Z. (1988). “The signed Euclidean distance transform and its applications.“ in
Proceedings, 9th International Conference on Pattern Recognition, Rome, 495-499.
KNOWN BUGS
The EDT TRUE transform type is prone to produce an internal buffer overflow when applied
to larger (almost) spherical objects. It this cases use EDT TIES or EDT BRUTE FORCE instead.
The option border = DIP FALSE is not supported for EDT BRUTE FORCE.
This function supports 2 and 3-dimensional images.
AUTHOR
SEE ALSO
VectorDistanceTransform, GreyWeightedDistanceTransform
DIPlib function reference 153
EuclideanSkeleton
binary skeleton operation
SYNOPSIS
DATA TYPES
binary
FUNCTION
ARGUMENTS
Name Description
DIP ENDPIXEL CONDITION LOOSE ENDS AWAY Loose ends are eaten away
DIP ENDPIXEL CONDITION NATURAL “natural” endpixel condition of
this algorithm
DIP ENDPIXEL CONDITION KEEP WITH ONE NEIGHBOR Keep endpoint if it has a
neighbor
DIP ENDPIXEL CONDITION KEEP WITH TWO NEIGHBORS Keep endpoint if it has two
neighbors
DIP ENDPIXEL CONDITION KEEP WITH THREE NEIGHBORS Keep endpoint if it has three
neighbors
KNOWN BUGS
LITERATURE
“Improved metrics in image processing applied to the Hilditch skeleton”, B.J.H. Verwer, 9th
ICPR, Rome, November 14-17, 1988.
AUTHOR
SEE ALSO
BinaryPropagation
DIPlib function reference 155
Exit
Clean up before exiting
SYNOPSIS
FUNCTION
Free all memory used internally by DIPlib. Call this function when you stop using DIPlib
(before exiting your program).
SEE ALSO
Initialise
156 Chapter 2. Function reference
Exp
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Exp10
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Exp2
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
ExponentialFitCorrection
Exponential fit based attenuation correction
SYNOPSIS
DATA TYPES
FUNCTION
This routine implements a simple absorption, reflection and bleaching correction based upon
the assumption that the sum of these effects result in a exponential extinction of the signal
as a function of depth. Only pixels that are non-zero are taken into account. Depending
upon the chosen method, the mean or a percentile of all the non-zero pixels are calculated
as a function of the slice number (depth). Then an exponential function is fitted through
these slice-representing values. The starting point of the fit is determined by fromWhere.
The first maximum is found with point[z+1] > hysteresis * point[z]. If the mean variant is
chosen one can chose to apply a variance weighting to the fit.
ARGUMENTS
Name Description
DIP ATTENUATION EXP FIT START FIRST PIXEL Start fit on first pixel
DIP ATTENUATION EXP FIT START GLOBAL MAXIMUM Start fit on global maximum
DIP ATTENUATION EXP FIT START FIRST MAXIMUM Start fit on first maximum
LITERATURE
K.C. Strasters, H.T.M. van der Voort, J.M. Geusebroek, and A.W.M. Smeulders, “Fast
attenuation correction in fluorescence confocal imaging: a recursive approach”, BioImaging,
vol. 2, no. 2, 1994, 78-92.
AUTHOR
SEE ALSO
AttenuationCorrection, SimulatedAttenuation
DIPlib function reference 161
ExtendRegion
Image manipulation functions
SYNOPSIS
FUNCTION
ARGUMENTS
FeatureAnisotropy2D
Measure the anisotropy in a labeled region
SYNOPSIS
FUNCTION
cos^2(phi) cos(phi)sin(phi)
[ ]
cos(phi)sin(phi) sin^2(phi)
The next step is to compute a new tensor, each element computed by averaging the
corresponding elements of all the individual tensors. This average tensor represents the
orientation information of the region as a whole. Eigenvalue analysis of this tensor yields
two eigenvalues, the largest l0, the smallest l1. The anisotropy measure is: ( l0 - l1 ) / ( l0 +
l1 ) which is zero for a fully isotropic regions (i.e. one where there is no prefered
orientation), and one for a fully anisotropic region (i.e. when there is a single orientation).
SEE ALSO
FeatureBendingEnergy
Undocumented measurement function
164 Chapter 2. Function reference
FeatureCenter
Measure the object’s center
SYNOPSIS
FUNCTION
dip FeatureCenterID returns the ID value of this measurement function, that is registered
by Initialise.
This functions measures the centre of an object by calculating the first moments of the
object using the object labels as binary mask. The intensity information is not taken into
account.
SEE ALSO
FeatureChainCodeBendingEnergy
Undocumented measurement function
166 Chapter 2. Function reference
FeatureDescriptionFree
Free a Feature Description
SYNOPSIS
FUNCTION
This function frees a Feature Description data structure. This is not the preferred way of
freeing a Feature Description. Use the resources mechanism instead (Resources tracking
structure. See ResourcesNew).
ARGUMENTS
SEE ALSO
FeatureDescriptionGetDescription
Get the description of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionGetLabels
Get the labels of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionGetName
Get the name of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionGetUnits
Get the Units of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionNew
Allocate a new FeatureDescription
SYNOPSIS
FUNCTION
This function allocates a new dip FeatureDescription data structure. A feature description
contains the name, a short description of a measurement feature, as well as the labels and
units of the data measured by the feature.
ARGUMENTS
SEE ALSO
FeatureDescriptionSetDescription
Set the description of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionSetDimensionLabels
Label set convenience function
SYNOPSIS
FUNCTION
This function set the labels of the feature, described by description, by adding for each
label a dimension indicator to baseLabel. For dimensions 0 to 3, X, Y or Z is added. For
dimensions higher, the numerical value of the dimension is added.
ARGUMENTS
SEE ALSO
FeatureDescriptionSetLabel
Set the name of a particular feature label
SYNOPSIS
FUNCTION
This function sets the name of a particular label of the described feature.
ARGUMENTS
SEE ALSO
FeatureDescriptionSetLabels
Set the labels of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionSetName
Set the name of the described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDescriptionSetUnits
Set the units of a described feature
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FeatureDimension
Measure the object’s dimensions
SYNOPSIS
FUNCTION
SEE ALSO
FeatureExcessKurtosis
Undocumented measurement function
180 Chapter 2. Function reference
FeatureFeret
Measure the object’s Feret diameters
SYNOPSIS
FUNCTION
dip FeatureFeretID returns the ID value of this measurement function, that is registered
by Initialise.
This function measures the Feret maximum and minimum diameters of an object. The
Feret diameter are found by rotating the object chaincode. The default angle stepsize is
defined by DIP MSR FERET ACCURACY (set to 0.5 degrees). This measurement function
supports a measurement parameter (see Measure), which is defined in dip measurement.h.
If a non-zero pointer to a dip FeretParameters structure is supplied, the structure’s
stepsize parameter is used instead of the default angle stepsize. Furthermore the
structure’s angles boolean parameter specifies whether the angles of the Feret diameters
should be measured as well. This function supports 2D images only.
The original code on which the current implementation is based, was donated by Gerie van
der Heijden.
ARGUMENTS
SEE ALSO
FeatureGinertia
Measure the object’s inertia
SYNOPSIS
FUNCTION
ARGUMENTS
LITERATURE
“Pratical Handbook on Image Processing for Scientific Applications, chapter 16”, Bernd
Jahne, CRC Press, 1999.
SEE ALSO
FeatureGmu
Measure the object’s inertia
SYNOPSIS
FUNCTION
dip FeatureGmuID returns the ID value of this measurement function, that is registered by
Initialise.
This function calculates the inertia (weighted by its grey values) of an object by calculating
the object’s second order moments tensor. This measure only supports 2D and 3D objects.
The output tensor is ordered as follows:
2D: xx, xy, yy
3D: xx, xy, xz, yy, yz, zz
LITERATURE
SEE ALSO
FeatureGravity
Measure the object’s gravity
SYNOPSIS
FUNCTION
SEE ALSO
FeatureInertia
Measure the object’s inertia
SYNOPSIS
FUNCTION
ARGUMENTS
LITERATURE
“Pratical Handbook on Image Processing for Scientific Applications, chapter 16”, Bernd
Jahne, CRC Press, 1999.
SEE ALSO
FeatureLongestChaincodeRun
Undocumented measurement function
186 Chapter 2. Function reference
FeatureMass
Measure the mass of the object (sum of grey-values)
SYNOPSIS
FUNCTION
dip FeatureMassID returns the ID value of this measurement function, that is registered by
Initialise. This function is just an alias for dip FeatureSumID.
This function measures the sum of the grey-value in the intensity image (see Measure) of
pixels inside the object, and is equivalent to FeatureSum
SEE ALSO
FeatureMaximum
Measure the object’s maximum coordinate value
SYNOPSIS
FUNCTION
SEE ALSO
FeatureMaxVal
Measure the object’s maximum intensity
SYNOPSIS
FUNCTION
dip FeatureMaxValID returns the ID value of this measurement function, that is registered
by Initialise.
This function measures the maximum intensity in the intensity image (see Measure) of
pixels inside the object.
SEE ALSO
FeatureMean
Measure the object’s mean intensity
SYNOPSIS
FUNCTION
dip FeatureMeanID returns the ID value of this measurement function, that is registered by
Initialise.
This function measures the mean intensity in the intensity image (see Measure) of pixels
inside the object.
SEE ALSO
FeatureMinimum
Measure the object’s minimum coordinate value
SYNOPSIS
FUNCTION
SEE ALSO
FeatureMinVal
Measure the object’s minimum intensity
SYNOPSIS
FUNCTION
dip FeatureMinValID returns the ID value of this measurement function, that is registered
by Initialise.
This function measures the minimum intensity in the intensity image (see Measure) of pixels
inside the object.
SEE ALSO
FeatureMu
Measure the object’s inertia
SYNOPSIS
FUNCTION
dip FeatureMuID returns the ID value of this measurement function, that is registered by
Initialise.
This function calculates the inertia of an object by calculating the object’s second order
moments tensor. This measure only supports 2D and 3D objects. The output tensor is
ordered as follows:
2D: xx, xy, yy
3D: xx, xy, xz, yy, yz, zz
LITERATURE
SEE ALSO
FeatureOrientation2D
Undocumented measurement function
194 Chapter 2. Function reference
FeatureP2A
Measure the circularity of the object
SYNOPSIS
FUNCTION
dip FeatureP2AID returns the ID value of this measurement function, that is registered by
Initialise.
This function is a composite measurement function, that uses FeatureSize,
FeaturePerimeter, and FeatureSurfaceArea to determine the circularity of an object by
calculating: 2D: P2A = perimeterˆ2 / (4Pi * size) 3D: P2A = surface-areaˆ1.5 / (6 Sqrt(Pi)
* size).
SEE ALSO
FeaturePerimeter
Measure the object’s perimeter length
SYNOPSIS
FUNCTION
LITERATURE
A.M. Vossepoel and A.W.M. Smeulders (1982), “Vector Code Probability and Metrication
Error in the Representation of Straight Lines of Finite Length”, Computer Graphics and
Image Processing 20: 347-364
SEE ALSO
FeatureShape
Measure shape parameters of the object
SYNOPSIS
FUNCTION
dip FeatureShapeID returns the ID value of this measurement function, that is registered
by Initialise.
This function is a composite measurement function, that uses FeatureSize,
FeaturePerimeter, and FeaturePerimeter to measures the following shape characteristics
of 2D objects: Squarity = area / ( s * sp ) Circularity = area / ( Pi/4 * spˆ2 ) Triangularity
= area / ( 2 * s * sp ) Ellipsity = area / ( Pi/4 * s * sp ) Elongation = p / l with area the
size, s the shortest Feret diameter, l the longest Feret diameter, sp the Feret diameter
perpendicular to s, and p the perimeter of the object.
When the measured object is either a perfect square, circle, triangle or ellips, the values
obtained by FeatureShape will be 1.0.
SEE ALSO
FeatureSize
Measure the object’s size
SYNOPSIS
FUNCTION
dip FeatureSizeID returns the ID value of this measurement function, that is registered by
Initialise.
This function measures the object’s size by counting the number of pixels having the same
object ID. This measure is the optimal procedure for estimating the area (2D) or volume
(3D) of an object with an arbitrary size. The measurement value’s unit are in pixels
(pixelsˆ2 in 2D, pixelsˆ3 in 3D).
SEE ALSO
FeatureSkewness
Undocumented measurement function
DIPlib function reference 199
FeatureStdDev
Measure the standard deviation of the object’s intensity
SYNOPSIS
FUNCTION
dip FeatureStdDevID returns the ID value of this measurement function, that is registered
by Initialise.
This function measures the standard deviation of the intensity in the intensity image (see
Measure) of pixels inside the object.
SEE ALSO
FeatureSum
Measure the sum of the grey values of the object
SYNOPSIS
FUNCTION
dip FeatureSumID returns the ID value of this measurement function, that is registered by
Initialise.
This function measures the sum of the grey-value in the intensity image (see Measure) of
pixels inside the object.
SEE ALSO
FeatureSurfaceArea
Measure the area of the object’s surface
SYNOPSIS
FUNCTION
LITERATURE
J.C. Mullikin and P.W. Verbeek (1993), “Surface area estimation of digitized planes.“,
bioimaging 1(1): 6-16.
SEE ALSO
FillBoundaryArray
Fill the border of array according to the boundary condition
SYNOPSIS
dip Error DIP TPI FUNC(dip FillBoundaryArray)( in, out, size, border, boundary
)
FUNCTION
Set the values of the border pixels of an array. The pixels of out outside the range of the
array in are set to a value determined by the boundary condition and the pixel values of in.
ARGUMENTS
NOTE
The out array has to be allocated before this function is called, and should at least has the
size of (size + 2 * border). Thus, border specifies the length of the border on both sides
of the in array. Furthermore, the out pointer should point to that element in the out array
that corresponds to the first element in the in array:
Name Description
DIP BC SYM MIRROR Symmetric mirroring
DIP BC ASYM MIRROR Asymmetric mirroring
DIP BC PERIODIC Periodic copying
DIP BC ASYM PERIODIC Asymmetric periodic copying
DIP BC ADD ZEROS Extending the image with zeros
DIP BC ADD MAX VALUE Extending the image with +infinity
DIP BC ADD MIN VALUE Extending the image with -infinity
SEE ALSO
SeparableFrameWork
204 Chapter 2. Function reference
FindShift
Estimate the shift between images
SYNOPSIS
DATA TYPES
FUNCTION
This function estimates the (sub-pixel) global shift between in1 and in2. The numbers
found represent the shift of in1 with respect to in2, or the position of the first pixel of in2
in the coordinate system of in1. There are two methods that can be used: CPF and MTS.
Both methods require that the shift be small. Therefore, first the integer pixel is calculated,
and both images are cropped to the common part.
If method is 0, DIP FSM MTS is used. method can also be DIP FSM INTEGER ONLY. Integer
shifts can be calculated for images of any dimensionality.
CPF
The CPF method (marked as FFTS in the literature below) uses the phase of the
cross-correlation (as calculated by CrossCorrelationFT) to estimate the shift. parameter
sets the amount of frequencies used in this estimation. The maximum value that makes
sense is sqrt(1/2). Any larger value will give the same result. Choose smaller values to
ignore the higher frequencies, which have a smaller SNR and are more affected by aliasing.
If parameter is set to 0, the optimal found for images sub-sampled by a factor four will be
used (parameter = 0.2).
This method only supports 2-D images (until further notice).
MTS
The MTS method (marked as GRS in the literature below) uses a first order Taylor
approximation of the equation in1(t) = in2(t-s) at scale parameter. Setting parameter
to zero, a scale of 1 will be used. This means that the images will be smoothed with a
Gaussian kernel of 1. This is the more accurate one of the two methods, and therefore is the
DIPlib function reference 205
default.
This method supports images with a dimensionality between 1 and 3.
ITER
The ITER method is an iterative version of the MTS method. It is known that a single
gradient based shift estimation have bias due to truncation of the Taylor expansion series
(see Pham et.al.) The bias can be expressed as a polynomial of the subpixel displacements.
As a result, if Taylor method is applied iteratively and the shift is refined after each
iteration, the bias eventually become negligible. By using just 3 iterations, it is possible to
correct bias that results in high precision O(1e-6).
PROJ
The PROJ method compute shift in each dimension from images’ projections. It is fast and
fairly accurate for high SNR. Should not be used for low SNR
ARGUMENTS
LITERATURE
C.L. Luengo Hendriks, Improved Resolution in Infrared Imaging Using Randomly Shifted
Images, M.Sc. Thesis, Delft University of Technology, 1998 T.Q. Pham, M. Bezuijen, L.J.
van Vliet, K. Schutte, C.L. Luengo Hendriks, Performance of Optimal Registration
Estimators, In Proc. of SPIE 5817 - Visual Information Processing XIV, Defense and
Security Symposium, Orlando, 2005
206 Chapter 2. Function reference
SEE ALSO
CrossCorrelationFT
DIPlib function reference 207
FiniteDifference
A linear gradient filter
SYNOPSIS
DATA TYPES
FUNCTION
The FiniteDifference filter implements several basic one dimensional FIR convolution filters.
The dimension in which the operation is to be performed is specified by processDim. The
operation itself is selected with filter. The (1 0 1)/2, (1 -1 0) & (0 1 -1) are difference
filters that approximate a first order derivative, the (1 -2 1) filter approximates a second
order derivative operation. The triangular (1 2 1)/4 filter is a local smoothing filter. All
filters are normalized (sum of filter coeff. is 0 or 1).
ARGUMENTS
SEE ALSO
FiniteDifferenceEx
A linear gradient filter
SYNOPSIS
DATA TYPES
FUNCTION
The FiniteDifferenceEx filter implements several basic one dimensional FIR convolution
filters. The difference between this function and FiniteDifference is that this one has an
interface more similar to Gauss and Derivative: it can process different derivatives along
different dimensions at the same time. The first derivative is a convolution with (1 0 -1)/2,
and the second derivative is a convolution with (1 -2 1). When parOrder is 0 for a
dimension, either the triangular smoothing filter (1 2 1)/4 is applied (smoothflag set to
DIP TRUE), or the dimension is not processed at all (smoothflag set to DIP FALSE).
Setting all process to DIP TRUE, all parOrder to 0 except 1 dimension to 1, and
smoothflag to DIP TRUE yields the SobelGradient.
ARGUMENTS
SEE ALSO
FloatArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the float array src to dest. The array dest is created by this function
as well.
ARGUMENTS
SEE ALSO
FloatArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
FloatArrayFind will produce an error if value is not found, otherwise found obtains the
search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
FloatArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FloatArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip FloatArray and sets the size of the array
to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
Floor
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the floor of the input image values, and outputs a signed integer typed image.
ARGUMENTS
SEE ALSO
FourierTransform
Computes the Fourier transform
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP TR FORWARD Forward transformation
DIP TR INVERSE Inverse transformation
SEE ALSO
HartleyTransform
218 Chapter 2. Function reference
Fraction
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the fraction of the input image values, and outputs a float typed image.
ARGUMENTS
SEE ALSO
FrameWorkProcessArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
FrameWorkProcessArrayNew, FrameWorkProcessArrayFree
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
220 Chapter 2. Function reference
FrameWorkProcessArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip FrameWorkProcessArray and sets the
size of the array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
FrameWorkProcessArrayNew, FrameWorkProcessArrayFree
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
DIPlib function reference 221
FTBox
Generates the Fourier transform of a box
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of a box with the half length of its sides specified by
length and scale.
ARGUMENTS
SEE ALSO
FTCross
Generates the Fourier transform of a cross
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of a cross with the length of its sides specified by length
and radius.
ARGUMENTS
SEE ALSO
FTCube
Generates the Fourier transform of a cube
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of a cube with the length of its sides equal to two times
length.
ARGUMENTS
SEE ALSO
FTEllipsoid
Generates Fourier transform of a ellipsoid
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of an ellipsoid with the length of its axes specified by
radius and scale.
ARGUMENTS
LITERATURE
KNOWN BUGS
SEE ALSO
FTGaussian
Generates the Fourier transform of a Gaussian
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of a Gaussian with sigma’s sigma. (The Fourier transform
of a Gaussian, is a Gaussian.) volume is the integral of the Gaussian in the spatial domain.
The cutoff variable can be used to avoid the calculation of the exponent of large negative
values, which is can be very time consuming. Values of the exponent that are below cutoff
yield a 0 value for the exponent. When cutoff is set to 0 or a positive value,
DIP GENERATION EXP CUTOFF is used (it is defined as -50).
ARGUMENTS
SEE ALSO
FTSphere
Generated Fourier transform of a sphere
SYNOPSIS
DATA TYPES
FUNCTION
Generates the Fourier transform of a sphere with radius radius and an amplitude of
amplitude.
ARGUMENTS
KNOWN BUGS
SEE ALSO
GaborIIR
Infinite impulse response filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
GaussIIR
228 Chapter 2. Function reference
Gauss
Gaussian Filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
LIMITATIONS
The order of the derivative is limited to the interval 0-3. Sigmas considerably smaller than
1.0 will yield nonsensical results.
SEE ALSO
GaussFT
Gaussian Filter through the Fourier Domain
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
GaussianNoise
Generate an image disturbed by Gaussian noise
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
EXAMPLE
variance = 1.0;
DIPXX(dip_GaussianNoise(in, out, variance, &random ));
SEE ALSO
GaussianRandomVariable
Gaussian random variable generator
SYNOPSIS
FUNCTION
dip GaussianRandomVariable uses the algorithm, described by D.E. Knuth as the Polar
Method, to generate two Gaussian distributed random variables.
ARGUMENTS
EXAMPLE
dip_Random random;
dip_float mean, variance, value1, value2;
mean = 0.0;
variance = 1.0;
DIPXX(dip_GaussianRandomVariable( &random, mean, variance, &value1, &value2 ));
LITERATURE
Knuth, D.E., Seminumerical algorithms, The art of computer programming, vol. 2, second
edition Addison-Wesley, Menlo Park, California, 1981.
DIPlib function reference 233
SEE ALSO
GaussianSigma
Adaptive Gaussian smoothing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The GaussianSigma filter is an adaptive Gauss-ian smoothing filter. The value of the pixel
under investigation is replaced by the Gaussian-weighted average of the pixelvalues in the
filter region which lie in the interval +/- 2 sigma from the value of the pixel that is filtered.
The filter region is specified by gaussSigma and truncation. If outputCount is DIP TRUE,
the output values represent the number of pixel over which the average has been calculated.
When threshold is DIP TRUE, the pixel intensities are being thresholded at +/- 2 sigma,
when it is set to DIP FALSE, the intensities are weighted with the Gaussian difference with
the intensity of the central pixel.
ARGUMENTS
LITERATURE
John-Sen Lee, Digital Image Smoothing and the Sigma Filter, Computer Vision, Graphics
and Image Processing, 24, 255-269, 1983
DIPlib function reference 235
SEE ALSO
GaussIIR
Infinite impulse response filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Gauss, Derivative
DIPlib function reference 237
GeneralisedKuwahara
Generalised Kuwahara filter
SYNOPSIS
DATA TYPES
FUNCTION
This function is a generalisation of the Kuwahara filter in the sense that is does not use the
variance criterion to select the smoothed value, but instead accepts an image with the
selection values. The algorithm finds, for every pixel, the minimum or maximum (as
specified with minimum) value of selection within the filter window (its size specified by
filterSize).
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
Kuwahara, VarianceFilter
DIPlib function reference 239
Get
Get a pixel value
SYNOPSIS
FUNCTION
This functions get the value of a pixel in image in at the coordinate cor. If cor is zero, the
first pixel value is retrieved.
ARGUMENTS
SEE ALSO
GetComplex
Get complex pixel value
SYNOPSIS
FUNCTION
This functions get the value of a pixel in image in at the coordinate cor. If cor is zero, the
first pixel value is retrieved.
ARGUMENTS
SEE ALSO
GetFloat
Get float pixel value
SYNOPSIS
FUNCTION
This functions get the value of a pixel in image in at the coordinate cor. If cor is zero, the
first pixel value is retrieved.
ARGUMENTS
SEE ALSO
GetInteger
Get integer pixel value
SYNOPSIS
FUNCTION
This functions get the value of a pixel in image in at the coordinate cor. If cor is zero, the
first pixel value is retrieved.
ARGUMENTS
SEE ALSO
GetLibraryInformation
Support function
SYNOPSIS
FUNCTION
This function fills the given dip LibraryInformation structure with information about the
release version and date, copyright information and author information of the DIPlib library.
ARGUMENTS
GetLine
Get a line from an image
SYNOPSIS
DATA TYPES
FUNCTION
Get a orthogonal line form an image. The position of the line in the image is specified by
the coordinates at which its left most pixel (cor) should be placed and on which dimension
of the image, the dimension of the line maps (dimension). If in has If in has a different
type than out, it will be converted to the type of out.
ARGUMENTS
SEE ALSO
GetMaximumAndMinimum
statistics function
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function gets both the maximum and minimum of all the pixel values in the in image.
Optionally, a mask image can be specified to exclude pixels from this search.
ARGUMENTS
SEE ALSO
Maximum, Minimum
246 Chapter 2. Function reference
GetObjectLabels
Lists object labels in image
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
This function produces an array of object labels present in the image in. Optionally, mask
can mask the regions in in where to search for labels. The boolean nullIsObject specifies
whether or not to treat the value zero as an object label.
ARGUMENTS
SEE ALSO
Label, IntegerArrayFind
DIPlib function reference 247
GetRank
Value selection function
SYNOPSIS
FUNCTION
GetRank gets the value at rank rank in the array array. min should be set to the first
index of array, max to the last. dip GetRank will use array for temporary storage, so the
values in the array will be changed are this function is ready.
ARGUMENTS
EXAMPLE
rank = SIZE/2;
DIPXX( dip_GetRank( array, DIP_DT_FLOAT, 0, (SIZE - 1), rank, &median ));
SEE ALSO
GetSlice
Get a slice from an image
SYNOPSIS
DATA TYPES
FUNCTION
Get a orthogonal slice from a image. The requested slice is selected by specifying its upper
left corner (cor) and on which dimensions of the image, the dimensions of the slice map
(dim1, dim2). If in has a different type than out, it will be converted to the type of out.
ARGUMENTS
SEE ALSO
GetUniqueNumber
Obtain an unique value
SYNOPSIS
FUNCTION
This function gives an unique integer value. The value is unique is the sense that its value
has not yet been returned by this function nor will it be returned by subsequent calls.
ARGUMENTS
GlobalBoundaryConditionGet
Get global Boundary Conditions
SYNOPSIS
FUNCTION
This function allocates the boundary array array of size size with the global default
boundary conditions for each dimension of the image. The initial values of this global array
is DIP BC SYMMETRIC MIRROR.
ARGUMENTS
SEE ALSO
Boundary conditions
GlobalBoundaryConditionSet, GlobalGaussianTruncationGet,
GlobalGaussianTruncationSet, GlobalFilterShapeGet, GlobalFilterShapeSet
252 Chapter 2. Function reference
GlobalBoundaryConditionSet
Set global boundary conditions
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
GlobalBoundaryConditionGet, GlobalGaussianTruncationGet,
GlobalGaussianTruncationSet, GlobalFilterShapeGet, GlobalFilterShapeSet
DIPlib function reference 253
GlobalFilterShapeGet
Get global filter shape value
SYNOPSIS
FUNCTION
This function gets the global default of the filter shape used by DIPlib’s linear and
morphology filters. The initial value of this global is DIP FLT SHAPE RECTANGULAR.
ARGUMENTS
SEE ALSO
GlobalBoundaryConditionGet, GlobalBoundaryConditionSet,
GlobalGaussianTruncationGet, GlobalGaussianTruncationSet, GlobalFilterShapeSet
254 Chapter 2. Function reference
GlobalFilterShapeSet
Set the global filter shape value
SYNOPSIS
FUNCTION
This function sets the global default of the filter shape used by DIPlib’s linear and
morphology filters. The initial value of this global is DIP FLT SHAPE RECTANGULAR.
ARGUMENTS
SEE ALSO
GlobalBoundaryConditionGet, GlobalBoundaryConditionSet,
GlobalGaussianTruncationGet, GlobalGaussianTruncationSet, GlobalFilterShapeGet
DIPlib function reference 255
GlobalGaussianTruncationGet
Get the global gaussian truncation
SYNOPSIS
FUNCTION
This function gets the global default of the truncation used by the finite impluse response
implementation of the Gauss (derivative) filter. The initial value of this global is 3.0.
ARGUMENTS
SEE ALSO
GlobalBoundaryConditionGet, GlobalBoundaryConditionSet,
GlobalGaussianTruncationSet, GlobalFilterShapeGet, GlobalFilterShapeSet
256 Chapter 2. Function reference
GlobalGaussianTruncationSet
Set the global gaussian truncation
SYNOPSIS
FUNCTION
This function sets the global default of the truncation used by the finite impluse response
implementation of the Gauss (derivative) filter. The initial value of this global is 3.0.
ARGUMENTS
SEE ALSO
GlobalBoundaryConditionGet, GlobalBoundaryConditionSet,
GlobalGaussianTruncationGet, GlobalFilterShapeGet, GlobalFilterShapeSet
DIPlib function reference 257
GradientDirection2D
Derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
Computes the gradient direction of an image using the Derivative function. This functions
supports only two dimensional images.
ARGUMENTS
SEE ALSO
GradientMagnitude
Derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Greater
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when for corresponding pixels in1 > in2.
This is the same as Compare with the DIP SELECT GREATER selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to a functionality similar to that of Threshold.
ARGUMENTS
SEE ALSO
GreyWeightedDistanceTransform
Grey weighted distance transform
SYNOPSIS
DATA TYPES
FUNCTION
where imagewidth represents the width of the image in image pixels. If both neighborhood
and metric pointers are NULL, the chamfer variable can be set to either 1 (indicating a 3x3
or 3x3x3 chamfer using only 4 or 6 direct neighbors), 3 (indicating a 3x3 or 3x3x3 chamfer,
using all neighbors) or 5 (indicating a 5x5 or 5x5x5 chamfer). In these cases a preset
neighborhood and metric arrays will be used.
ARGUMENTS
LITERATURE
“An efficient uniform cost algorithm applied to distance transforms”, B.J.H. Verwer, P.W.
Verbeek, and S.T. Dekker, IEEE Transactions on Pattern Analysis and Machine
Intelligence, vol. 11, no. 4, 1989, 425-429.
“Shading from shape, the eikonal equation solved by grey-weighted distance transform”, P.W.
Verbeek and B.J.H. Verwer, Pattern Recognition Letters, vol. 11, no. 10, 1990, 681-690.
“Local distances for distance transformations in two and three dimensions”, B.J.H. Verwer,
Pattern Recognition Letters, vol. 12, no. 11, 1991, 671-682.
“Distance Transforms, Metrics, Algorithms, and Applications”, B.J.H. Verwer, Ph.D. thesis
Delft University of Technology, Delft University Press, Delft, 1991.
“3-D Texture characterized by Accessibility measurements, based on the grey weighted
distance transform”, K.C. Strasters, A.W.M. Smeulders, and H.T.M. van der Voort,
BioImaging, vol 2, no. 1, 1994, p. 1-21.
“Quantitative Analysis in Confocal Image Cytometry”, Karel C. Strasters, Delft University
264 Chapter 2. Function reference
KNOWN BUGS
AUTHOR
SEE ALSO
GrowRegions
Dilate the regions in a labelled image
SYNOPSIS
DATA TYPES
FUNCTION
The regions in the input image in are grown with several options:
If grey is NULL, the regions are dilated iterations steps, according to connectivity (see
The connectivity parameter), and optionally constrained by mask. This is the labelled
equivalent to BinaryPropagation. If iterations is 0, the objects are dilated until no
further change is possible. order is ignored.
If an image grey is given, the labels are grown in order of the grey-values in grey. order
indicates whether pixels with high grey-values are added first or last. iterations is
ignored, and mask is an optional constraint. This is a watershed algorithm with initial
labels. The function Watershed does not accept an initial segmentation, so these two
functions complement each other. Note that GrowRegions does not leave any watershed
pixels in between the regions.
266 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
GrowRegionsWeighted
Grow labelled regions using grey-weighted distances
SYNOPSIS
DATA TYPES
FUNCTION
The regions in the input image in are grown according to a grey-weighted distance metric;
the weights are given by grey. The optional mask image mask limits the growing. out
contains the grown regions, and distance, if not 0, contains the grey-weighted distance of
each pixel in mask to the nearest pixel in in. Non-isotropic sampling is supported through
pixelsize, which can be set to 0 to assume isotropic sampling. chamfer selects the size of
the chamfer metric: 3 or 5. Set chamfer to 0 to use a custom metric given by the image
metric. This image should be odd in size, and each pixel gives the distance to the center
pixel. The pixels set to 0 will not be considered as neighbors.
The chamfer metric used is the following for chamfer==3 (with
ps0=pixelsize->array[0] and ps1=pixelsize->array[1]):
sqrt(ps0*ps0+ps1*ps1) ps1 sqrt(ps0*ps0+ps1*ps1)
ps0 0 ps0
sqrt(ps0*ps0+ps1*ps1) ps1 sqrt(ps0*ps0+ps1*ps1)
and the following for chamfer==5:
268 Chapter 2. Function reference
0 0 0
sqrt(ps0*ps0+4*ps1*ps1) sqrt(ps0*ps0+4*ps1*ps1)
ps1
sqrt(4*ps0*ps0+ps1*ps1)
sqrt(ps0*ps0+ps1*ps1) sqrt(ps0*ps0+ps1*ps1)
sqrt(4*ps0*ps0+ps1*ps1)
0 ps0 0 ps0 0
ps1
sqrt(ps0*ps0+ps1*ps1)
sqrt(4*ps0*ps0+ps1*ps1) sqrt(ps0*ps0+ps1*ps1)
sqrt(4*ps0*ps0+ps1*ps1)
0 0 0
sqrt(ps0*ps0+4*ps1*ps1) sqrt(ps0*ps0+4*ps1*ps1)
Setting chamfer to 0 and metric to an image with these values produces the same results
as setting chamfer to 3 or 5.
The output image distance is comparable to the out image of
GreyWeightedDistanceTransform, except that that function uses optimal chamfer
distances whereas this one uses the (sub-optimal) true distance. In return, this function
works on images of any dimensionality, allows for non-isotropic sampling, does not skip
pixels close to the edge of the image, and can be used with a mask image to constrain the
propagation. Note that the seed image in GreyWeightedDistanceTransform corresponds
to the zero pixels of in for this function.
ARGUMENTS
LITERATURE
SEE ALSO
HartleyTransform
Computes the Hartley transform
SYNOPSIS
DATA TYPES
FUNCTION
This function computes a Hartley transform on in and places the result in out.
Normalisation: 1/sqrt(dimension) for each dimension.
The main advantage of the Hartley transform over the Fourier transform is that is requires
half the storage for real valued images. Note, that is also possible to directly reduce the
storage requirements of the Fourier transform by just storing the right half plane, since for
real valued images the left half plane can be derived from the right half using the symmetry
properties of the Fourier transform.
Unfortunately there seem to be two definitions of the multi-dimensional Hartley transform
(they are identical in the 1-D case). DIPlib implements the Bracewell (see below) variant,
since this one is easy to implement and inherits the storage advantage from the 1-D case.
The following are references which each use a different variant (all scaling factors have been
dropped):
Bracewell, “Discrete Hartley Transform”, J. Opt. Soc. Am, vol. 73, no. 12, December 1983 :
cas(ux)cas(vy) = cos(ux)cos(vy)+cos(ux)sin(vy)+sin(ux)cos(vy)+sin(ux)sin(vy)
270 Chapter 2. Function reference
cas(ux+vy) = cos(ux)cos(vy)+cos(ux)sin(vy)+sin(ux)cos(vy)-sin(ux)sin(vy)
^^^
A subtle difference. The two definitions have very similar properties, for example the
convolution property.
In implementation terms, Bracewell is equivalent to perform the one-dimensional Hartley
transform along each dimension. The Castleman variant is equivalent to the definition:
DHT = re(DFT) - im(DFT). On a final note, I’ve not noticed mention of the difference
between the two variants, so the indications Bracewell’s and Castleman’s variant are not and
should not be accepted “labels” to refer to the variants (For both variants I have selected
the first reference I came across, not chronologically the first reference to use the variant).
Defaults: process may be zero, indicating that all dimensions should be processed.
ARGUMENTS
SEE ALSO
FourierTransform
DIPlib function reference 271
HasNormalStride
Determines whether an image has a normal stride
SYNOPSIS
FUNCTION
Determines whether an image has a normal stride. If answer is not zero, the verdict is
passed in this variable. Otherwise, HasNormalStride returns an error in case image does
not have a normal stride.
ARGUMENTS
SEE ALSO
HysteresisThreshold
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Performs hysteresis thresholding. From the binary image (in>low) only those regions are
selected for which at least one location also has (in>high). The output image will be a
binary image with foreground pixel 1 and background pixel 0;
ARGUMENTS
SEE ALSO
IDivergence
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the I-divergence between each pixel value of in1 and in2. Optionally the mask
image can be used to exclude pixels from the calculation by setting the value of these pixels
in mask to zero.
The I-Divergence is defined as: I(x,y) = x ln(x/y) - (x - y) and is divied by the
number of pixels. It is the -log of a possion distribution p(x,y)=e^(-y)/x!-y^x with the
stirling approximation for ln x!. For x=0, the stirling approximation would fail, y is
returned.
ARGUMENTS
LITERATURE
Why Least Squares and Maximum Entropy? An axiomatic approach to inference for linear
inverse problems , I. Csiszar, The Annals of Statistics, 19, 2032-2066, 1991.
SEE ALSO
ImageArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageArrayNew, ImageArrayFree
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
DIPlib function reference 275
ImageArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip ImageArray and sets the size of the array
to size.
ARGUMENTS
SEE ALSO
ImageArrayNew, ImageArrayFree
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
276 Chapter 2. Function reference
ImageAssimilate
Inherit properties of another image
SYNOPSIS
FUNCTION
Give the target image the same properties ( type, data type, etc... ) as the example image.
The example image may be either “raw” or “forged”. The target image is forged.
If the target was forged before calling this function, and it exactly matches the example,
nothing happens. If it doesn’t match the example, it is stripped before the properties are
copied.
ARGUMENTS
SEE ALSO
ImageCheckBooleanArray
Check a boolean array
SYNOPSIS
FUNCTION
This functions check whether the size of array is equal to the dimensionality of im. If
answer is not zero, it will contain the result of the test, otherwise the
DIP E ARRAY ILLEGAL SIZE will be set when the test has failed.
ARGUMENTS
SEE ALSO
ImageCheckBoundaryArray
Check a boundary array
SYNOPSIS
FUNCTION
This functions check whether the size of array is equal to the dimensionality of im. If
answer is not zero, it will contain the result of the test, otherwise the
DIP E ARRAY ILLEGAL SIZE will be set when the test has failed.
ARGUMENTS
SEE ALSO
ImageCheckComplexArray
Check a complex array
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageCheckFloatArray
Check a float array
SYNOPSIS
FUNCTION
This functions check whether the size of array is equal to the dimensionality of im. If
answer is not zero, it will contain the result of the test, otherwise the
DIP E ARRAY ILLEGAL SIZE will be set when the test has failed.
ARGUMENTS
SEE ALSO
ImageCheckIntegerArray
Check an integer array
SYNOPSIS
FUNCTION
This functions check whether the size of array is equal to the dimensionality of im. If
answer is not zero, it will contain the result of the test, otherwise the
DIP E ARRAY ILLEGAL SIZE will be set when the test has failed.
ARGUMENTS
SEE ALSO
ImageCopyProperties
Copy the properties of an image
SYNOPSIS
FUNCTION
Give the target image the same properties ( type, data type, etc... ) as the example image.
The example image may be either “raw” or “forged”, whereas the target image must be
“raw”. See ImageAssimilate.
ARGUMENTS
SEE ALSO
ImageFileGetInfo
Get information about image in file (in dipIO)
SYNOPSIS
FUNCTION
This function opens an image file and fills a dipio ImageFileInformation structure with
the information from that file. imInfo is allocated by this function. Use
ImageFileInformationFree to free this structure, or set the resources parameter for
automatic deallocation. If format is 0, all different ImageRead functions are called in
sequence until the correct format has been found. If you know the format, get the correct
format ID through the registry functions. See File formats recognized by dipIO for a list of
currently supported formats.
The boolean addExtensions specifies whether ImageFileGetInfo should try to add file
format extensions to filename, if the registered file format reader fails to recognise
filename straight away. The extensions are provided by the registered file readers.
If recognised is not zero, ImageFileGetInfo will set it to DIP TRUE when it has been able to
read filename, and it will set it to DIP FALSE when it is not able to read the file. No error
will be generated in this case.
ARGUMENTS
SEE ALSO
ImageFileInformationFree
Free a Image File Information structure (in dipIO)
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageFileInformationNew, ImageFileGetInfo
286 Chapter 2. Function reference
ImageFileInformationNew
Allocate an Image File Information structure (in dipIO)
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageForge
Allocate pixel data for an image
SYNOPSIS
FUNCTION
Allocates a block of memory to store pixel data for an image. The image must be “raw”,
and will be “forged” afterwards. The routine will fail if the image fields do not contain a
valid combination of values for the image type.
ARGUMENTS
SEE ALSO
ImageFree
Free an image
SYNOPSIS
FUNCTION
Free any pixel data associated with the image and return all fields to their initial (“raw”)
state by calling ImageStrip. Then the image structure itself is freed. Notice that you must
pass a pointer to the image instead of the image itself. This allows ImageFree to set your
image variable to zero, preventing further use of the now freed image.
Because ImageNew accepts a resources structure to keep track of allocated images, direct
calls to ImageFree should be unnecessary.
ARGUMENTS
SEE ALSO
ImageGetData
Get the data pointers of a set of images
SYNOPSIS
dip Error dip ImageGetData( in, idp, iflags, out, odp, oflags, flags,
resources )
FUNCTION
Get the data pointers of a set of images. This function should not be called before the clean
up of the previous invocation (by ResourcesFree) has been performed. Currently no clean
up is required by ImageGetData, but any data pointers obtained by a previous call to this
function should be considered invalid when calling this function. The iflags, oflags, and
flags parameters are not used in the current version. These fields should be set to zero.
The resources parameter is mandatory. Any of the image arrays’ elements may be set to
zero, indicating that it is to be ignored.
No functions that will possibly modify an image should be called after the call to
ImageGetData and before its clean up. The proper time to call ImageGetPlane and
ImageGetStride is right after the call to ImageGetData.
ARGUMENTS
SEE ALSO
ImageGetDataType
Read the data type field
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageGetDimensionality
Read the dimensionality field
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageGetDimensions
Read the dimensions array
SYNOPSIS
FUNCTION
Read the dip Image dimensions Array. The array that is used to return the dimensions in,
is allocated by this routine using IntegerArrayNew.
ARGUMENTS
SEE ALSO
ImageGetPlane
Read the plane number
SYNOPSIS
FUNCTION
Read the dip Image plane number. For binary images this is the number of the bit in which
the data is stored. For other data types it is meaningless. The proper time to call this
function is right after ImageGetData.
ARGUMENTS
SEE ALSO
ImageGetStride
Read the stride array
SYNOPSIS
FUNCTION
Read the dip Image stride array. The array that is used to return the dimensions in, is
allocated by this routine using IntegerArrayNew. The proper time to call this function is
right after ImageGetData.
ARGUMENTS
SEE ALSO
ImageGetType
Read the type field
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageIsGIF
Confirm that a file is a GIF file (in dipIO)
SYNOPSIS
FUNCTION
This function verifies that the file is an GIF file. veredict is set to DIP TRUE if it is, and to
DIP FALSE if it isn’t.
ARGUMENTS
SOFTWARE
This function uses GifLib (version 4.1.0 or later), which supports GIF 87a & 98a.
Copyright (c)1997 Eric S. Raymond
SEE ALSO
ImageWriteGIF, ImageReadGIF
298 Chapter 2. Function reference
ImageIsICS
Confirm that a file is an ICS file (in dipIO)
SYNOPSIS
FUNCTION
This function verifies that the file is an ICS file. veredict is set to DIP TRUE if it is, and to
DIP FALSE if it isn’t.
ARGUMENTS
SOFTWARE
This function uses libics (version 1.3), which supports the ICS specification revision 2.0.
Copyright (c)2000-2002 Cris L. Luengo Hendriks, Dr. Hans T.M. van der Voort and many
others.
SEE ALSO
ImageWriteICS, ImageReadICS
DIPlib function reference 299
ImageIsJPEG
Confirm that a file is a JPEG file (in dipIO)
SYNOPSIS
FUNCTION
This function verifies that the file is a JPEG file. veredict is set to DIP TRUE if it is, and to
DIP FALSE if it isn’t.
ARGUMENTS
SOFTWARE
This function uses libjpeg (version 6b or later). Copyright (c)1994-1998, Thomas G. Lane.
SEE ALSO
ImageIsLSM
Confirm that a file is a Zeiss LSM file (in dipIO)
SYNOPSIS
FUNCTION
This function verifies that the file is a Zeiss LSM file. veredict is set to DIP TRUE if it is,
and to DIP FALSE if it isn’t.
ARGUMENTS
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
SEE ALSO
ImageReadLSM
DIPlib function reference 301
ImageIsTIFF
Confirm that a file is a TIFF file (in dipIO)
SYNOPSIS
FUNCTION
This function verifies that the file is a TIFF file. veredict is set to DIP TRUE if it is, and to
DIP FALSE if it isn’t.
ARGUMENTS
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
SEE ALSO
ImageWriteTIFF, ImageReadTIFF
302 Chapter 2. Function reference
ImageNew
Allocate a structure
SYNOPSIS
FUNCTION
Allocates a dip Image structure and initializes all fields to their default values. The
resulting image is in the “raw” state, see The image structure. By using
ImageCopyProperties and the “ImageSet” access functions, the image fields can be set to
their desired values. Pixel data for the image can be allocated using the ImageForge
function, which will will put the image in the “forged” state.
ARGUMENTS
SEE ALSO
ImageRead
Read grey-value image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from a file and puts it in image. image must be allocated
before calling this function. If format is 0, all different ImageRead functions are called in
sequence until the correct format has been found. If you know the format, get the correct
format ID through the registry functions. See File formats recognized by dipIO for a list of
currently supported formats.
The boolean addExtensions specifies whether ImageRead should try to add file format
extensions to filename, if the registered file format reader fails to recognise filename
straight away. The extensions are provided by the registered file readers.
If recognised is not zero, ImageRead will set it to DIP TRUE when it has been able to read
filename, and it will set it to DIP FALSE when it is not able to read the file. No error will
be generated in this case.
If the file contains a colour image, Colour2Gray is called. That is, this function always
returns a grey-value image.
ARGUMENTS
SEE ALSO
ImageReadColour
Read colour image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from a file and puts it in image. image must be allocated
before calling this function. It works the same as ImageRead, except that, if the file contains
a colour image, Colour2Gray is not called. The returned image has an extra dimension with
colours (always the last dimension), and photometric is set to the colour space.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SEE ALSO
ImageReadCSV
Read comma-separated values from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads the comma-separated values from a file and puts it in image. image
must be allocated before calling this function.
ARGUMENTS
SEE ALSO
ImageRead, ImageWriteCSV
DIPlib function reference 307
ImageReadCSVInfo
Get information about image in comma-separated values file (in dipIO)
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageReadGIF
Read a GIF image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from a GIF file and puts it in image. image must be allocated
before calling this function.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses GifLib (version 4.1.0 or later), which supports GIF 87a & 98a.
Copyright (c)1997 Eric S. Raymond
SEE ALSO
ImageReadGIFInfo
Get information about image in GIF file (in dipIO)
SYNOPSIS
FUNCTION
Opens a GIF file and fills a dipio ImageFileInformation structure with the information
from that file. imInfo must be allocated before calling this function.
ARGUMENTS
SOFTWARE
This function uses GifLib (version 4.1.0 or later), which supports GIF 87a & 98a.
Copyright (c)1997 Eric S. Raymond
SEE ALSO
ImageReadICS
Read ICS image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads the image in the ICS file and puts it in image. image must be allocated
before calling this function. photometric is set to match the photometric interpretation of
the data in the file, if it is recognised. The colour dimension is always the last dimension of
the image (no matter how it was saved in the ICS file). offset, roisize and sampling
define a ROI to read in. See the comments in ImageReadROI for more information on this.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libics (version 1.3 or later), which supports the ICS specification
revision 2.0. Copyright (c)2000-2002 Cris L. Luengo Hendriks, Dr. Hans T.M. van der
Voort and many others.
This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly
and Mark Adler
SEE ALSO
ImageReadICSInfo
Get information about image in ICS file (in dipIO)
SYNOPSIS
FUNCTION
Opens a ICS file and fills a dipio ImageFileInformation structure with the information
from that file. imInfo must be allocated before calling this function.
ARGUMENTS
SOFTWARE
This function uses libics (version 1.3), which supports the ICS specification revision 2.0.
Copyright (c)2000-2002 Cris L. Luengo Hendriks, Dr. Hans T.M. van der Voort and many
others.
SEE ALSO
ImageReadJPEG
Read JPEG image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from the JPEG file and puts it in image. image must be
allocated before calling this function. photometric is set to either DIPIO PHM RGB or
DIPIO PHM GREYVALUE. If photometric is 0, the image will be read in as grey-value, even if
color information is present in the file. Color images are allocated as 3D images, with the
different samples along the 3rd. dimension.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libjpeg (version 6b or later). Copyright (c)1994-1998, Thomas G. Lane.
SEE ALSO
ImageReadJPEGInfo
Get information about image in JPEG file (in dipIO)
SYNOPSIS
FUNCTION
Opens a JPEG file and fills a dipio ImageFileInformation structure with the information
from that file. imInfo must be allocated before calling this function.
ARGUMENTS
SOFTWARE
This function uses libjpeg (version 6b or later). Copyright (c)1994-1998, Thomas G. Lane.
SEE ALSO
ImageReadLSM
Read Zeiss LSM image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads the image in the Zeiss LSM file and puts it in image. image must be
allocated before calling this function. Depending on the recording mode and the number of
channels recorded, an image with 2 to 5 dimensions is returned. If multiple channels were
recorded, they will be put along the last dimension (which can be either the third, fourth or
fifth). The “stack”, “time series plane” ans “time series z-scan” recording modes return a
3D image, the “time series stack” returns a 4D image, all other modes return a 2D image
(including the “line” mode).
imInfo->physDims contains information on the distance between pixels. resources is only
used to allocate the imInfo structure, so if imInfo is 0, resources can be 0 too.
offset, roisize and sampling define a region of interest to read in. See the comments in
ImageReadROI for more information on this. Note that the channel dimension is part of this
ROI.
ARGUMENTS
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
318 Chapter 2. Function reference
Graphics, Inc.
This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly
and Mark Adler
SEE ALSO
ImageReadLSMInfo
Get information about image in LSM file (in dipIO)
SYNOPSIS
FUNCTION
Opens a LSM file and fills a dipio ImageFileInformation structure with the information
from that file. imInfo must be allocated before calling this function.
ARGUMENTS
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
SEE ALSO
ImageReadPIC
Read BioRad PIC image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads the image in the BioRAD PIC file and puts it in image. image must be
allocated before calling this function. The information stored in the file is put in info.
offset and roisize define a region of interest to be read in. The ROI is clipped to the
actual image data, so it is safe to specify a ROI that is too large. sampling can be used to
read in a subset of the pixels of the chosen ROI. Any or all of these three parameters can be
NULL.
ARGUMENTS
SEE ALSO
ImageRead, ImageReadROI
DIPlib function reference 321
ImageReadPICInfo
Get information about image in BioRad PIC file (in dipIO)
SYNOPSIS
FUNCTION
Opens a BioRAD PIC file and fills a dipio ImageFileInformation structure with the
information from that file. imInfo must be allocated before calling this function.
ARGUMENTS
SEE ALSO
ImageReadROI
Read a portion of a grey-value image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from a file and puts it in image. image must be allocated
before calling this function. It works the same as ImageRead, except that the user is allowed
to specify a region of the image to read. This is done through the offset and roisize
parameters. The ROI is clipped to the image size, so it is safe to specify a ROI that is too
large. sampling can be used to read in a subset of the pixels of the chosen ROI. Any or all
of these three parameters can be NULL.
ARGUMENTS
SEE ALSO
ImageReadTIFF
Read TIFF image from file (in dipIO)
SYNOPSIS
FUNCTION
This function reads an image from the TIFF file and puts it in image. image must be
allocated before calling this function. imageNumber indicates which image from the
multi-page TIFF file to read. 0 is the first image. photometric is set to match the
photometric interpretation of the TIFF file. Color images and multi-sample images are
allocated as 3D images, with the different samples along the 3rd. dimension.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly
and Mark Adler
KNOWN BUGS
TIFF is a very flexible file format. We have to limit the types of images that can be read to
the more common ones, and to the ones dipIO writes. These are the most obvious
limitations:
Tiled images are not supported.
Only 1, 4, 8, 16 and 32 bits per pixel integer grayvalues are read, as well as 32-bit and 64-bit
floating point.
Only 4 and 8 bits per pixel colourmapped images are read. Colourmapped images contain
16-bit gray-values: stretching of the display will be necessary.
Class Y images (YCbCr) and Log-compressed images (LogLuv or LogL) are not supported.
DIPlib function reference 325
SEE ALSO
ImageReadTIFFInfo
Get information about image in TIFF file (in dipIO)
SYNOPSIS
FUNCTION
Opens a TIFF file and fills a dipio ImageFileInformation structure with the information
from that file. imInfo must be allocated before calling this function. imageNumber indicates
which image from the multi-page TIFF file to get info on. 0 is the first image.
imInfo->numberOfImages gives the number of pages in the file.
ARGUMENTS
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
SEE ALSO
ImagesCheck
Check properties of several images
SYNOPSIS
FUNCTION
This function checks whether the image type and the data type of the first image in the
array matches with the imageType and dataType variables, and compares the other image
fields of the first image with those of the other images in the array. This comparison is done
by calling ImagesCompareTwo. The checkFlag can be used to compare properties not
supported by ImagesCompare. An error is returned by ImagesCheck if a check or
comparison fails.
ARGUMENTS
dipf ImagesCheck
Name Description
DIP CKIM MAX PRECISION MATCH Check whether data types match or match to the
DIP GTP MAX PRECISION DataType
DIP CKIM CASTING TYPE MATCH Check whether data types match or match to the
DIP GTP CAST R2C or DIP GTP CAST C2R types of
the first image in image
DIP CKIM IGNORE NULL DIM IMAGES Ignore images with a zero dimensionality, this flag
is usefull when 0d images are used as generic data
containers of constants
328 Chapter 2. Function reference
SEE ALSO
ImagesCheckTwo
Check properties of two images
SYNOPSIS
FUNCTION
This function checks whether the image type and the data type of the first DIPlib Image
matches with the imageType and dataType variables, and compares the other Image fields
of the first DIPlib Image with those of the second Image. This comparison is done by calling
ImagesCompareTwo. The checkFlag can be used to compare properties not supported by
ImagesCompare. ImagesCheckTwo returns an error code if a check or comparison fails.
ARGUMENTS
dipf ImagesCheck
Name Description
DIP CKIM MAX PRECISION MATCH Check whether data types match or match to the
DIP GTP MAX PRECISION DataType
DIP CKIM CASTING TYPE MATCH Check whether data types match or match to the
DIP GTP CAST R2C or DIP GTP CAST C2R types
DIP CKIM IGNORE NULL DIM IMAGES Ignore images with a zero dimensionality, this flag
is usefull when 0d images are used as generic data
containers of constants
330 Chapter 2. Function reference
SEE ALSO
ImagesCompare
Compare properties of several images
SYNOPSIS
FUNCTION
This function compares some standard fields of a number of Images or performs a full
comparison. Only if the comparison result is true between each of the Images, will the final
comparison result be true. The condition parameter specifies which properties should be
tested. If 0, a full comparison of the Images is performed. Otherwise it should be a logical
OR of the dipf ImagesCompare flags. DIP CPIM MATCH ALL STANDARD is equivalent to all
the flags OR’ed together. The difference between DIP CPIM MATCH ALL STANDARD and the
full comparison specified by 0, is that the first will compare all the standard fields ( type,
data type, dimensions ), whereas the other compares all fields relevant to a particular
DIPlib Image type. This may exclude some of the standard fields and include some fields
particular to the type of DIPlib Image in question. There are two modes of operation. If the
result parameter is set, it is used to store the result of the comparison, a set of OR’ed
dipf ImagesCompare flags. If the result parameter is 0, an error is returned if the condition
parameter and the resulting set of flags are not the same.
ARGUMENTS
dipf ImagesCompare
Name Description
DIP CPIM DIMENSIONALITIES MATCH Dimensionalities match
DIP CPIM DIMENSIONS MATCH Dimensions match. The comparison is done up to
the lower of the of the two dimensionalities
DIP CPIM SIZE MATCH Combination of
DIP CPIM DIMENSIONALITIES MATCH and
DIP CPIM DIMENSIONS MATCH
DIP CPIM TYPES MATCH Types match
DIP CPIM DATA TYPES MATCH Data types match
DIP CPIM MATCH ALL STANDARD All flags above OR’ed together
DIP CPIM STRIDES MATCH Strides match
DIP CPIM FULL MATCH Full match. Returned in result. To test for a full
match use 0. Note: This is NOT equivalent to the
other flags OR’ed together, and it cannot be used
as condition
SEE ALSO
ImagesCompareTwo
Compare properties of two images
SYNOPSIS
FUNCTION
This function compares some standard fields of two Images or performs a full comparison.
The condition parameter specifies which properties should be tested. See ImagesCompare
for more information. There are two modes of operation. If the result parameter is set, it is
used to store the result of the comparison, a set of OR’ed dipf ImagesCompare flags. If the
result parameter is 0, an error is returned if the condition parameter and the resulting set of
flags are not the same.
ARGUMENTS
SEE ALSO
ImageSetDataType
Set the data type field
SYNOPSIS
FUNCTION
Set the dip Image data type field. The image must be “raw”.
ARGUMENTS
SEE ALSO
ImageSetDimensions
Set the dimensions array
SYNOPSIS
FUNCTION
Set the dip Image dimensions array. The image must be “raw”.
ARGUMENTS
SEE ALSO
ImageSetType
Set the image type field
SYNOPSIS
FUNCTION
Set the dip Image type field. The image must be “raw”.
ARGUMENTS
SEE ALSO
ImageSort
Sort image data
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageSortIndices
Sort indices to image data
SYNOPSIS
FUNCTION
Sorts a list of indices rather than the data itself using the algorithm specified by algorithm.
Unless the DIP ISI USE INDICES, the indices image will be initialised with one index for
each pixel in the image.
ARGUMENTS
SEE ALSO
ImagesSeparate
Take care of in-place operations
SYNOPSIS
FUNCTION
First the list of output images is checked to see if any output image is used more than once.
If this is the case an error is returned. Then the input and output images are examined. If
any of the output images is also used as an input image, the function allocates a new image.
This image is returned through the newOut array. For each output image a corresponding
image is returned in this array. Either the original output image itself, or either a new
image as discussed above. After the call to dip ImagesSeparate, the images in the newOut
array should be used instead of the original output images. After you are done processing
the images, a call to ResourcesFree will perform the necessary post-processing. The
post-processing consists of copying the data from the temporary output images to the
original output images and freeing the temporary images. Because the post-processing is
called through ResourcesFree, the resources parameter is mandatory. Any of the image
arrays’ elements may be set to zero, indicating that it is to be ignored.
The boolean saved array can be used to indicate that an input image has been stored in a
safe place. In this case dip ImagesSeparate will not have to allocate a temporary image if
the input image is also used as an output image. The saved parameter may either be zero,
which indicates that none of the input images has been saved, or it must be an array
containing booleans corresponding each of the input images. DIP TRUE indicates that the
image has been saved.
ARGUMENTS
SEE ALSO
ImageGetData
DIPlib function reference 341
ImageStrip
Restore an image to its initial (“raw”) state
SYNOPSIS
FUNCTION
Free any pixel data associated with the image and return all fields to their initial (“raw”)
state. Essentially the image is returned to the state it was in right after it was allocated
with ImageNew.
ARGUMENTS
SEE ALSO
ImageWrite
Write grey-value image to file (in dipIO)
SYNOPSIS
FUNCTION
This function writes a grey-vlaue image to a file, overwriting any other file with the same
name. physDims gives physical dimensions of the image, and can be set to 0 for default
values. Not all file formats are able to store physical dimensions. Get the format ID through
the registry functions. See File formats recognized by dipIO for a list of currently supported
formats. If format is 0, ICSv2 is used.
ARGUMENTS
SEE ALSO
ImageWriteColour
Write colour image to file (in dipIO)
SYNOPSIS
FUNCTION
This function writes a colour image to a file, overwriting any other file with the same name.
photometric must be set to the correct value. Not all file formats support all photometric
values, and some don’t support colour at all. physDims gives physical dimensions of the
image, and can be set to 0 for default values. Not all file formats are able to store physical
dimensions. Get the format ID through the registry functions. See File formats recognized
by dipIO for a list of currently supported formats. If format is 0, ICSv2 is used.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SEE ALSO
ImageWriteCSV
Write image to a comma-separated-value file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to a comma-separated-values file, overwriting any other file
with the same name. Optionally, an other separator than the comma can be specified using
separator. Sometimes a space, a tab or a colon are used instead. Each line of image data is
ended by a newline.
ARGUMENTS
SEE ALSO
ImageWrite, ImageReadCSV
346 Chapter 2. Function reference
ImageWriteEPS
Write image to Encapsulated PostScript file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to an Encapsulated PostScript file, overwriting any other file
with the same name. Set the image size in xcm and ycm. border sets the size of the border
around the image. If border is 0, no border is drawn. For colour images, set photometric
(supported are RGB and CMYK) and write the colour channels along the third image
dimension.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SEE ALSO
ImageWriteFLD
Write image to AVS field file (in dipIO)
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
ImageWrite
DIPlib function reference 349
ImageWriteGIF
Write image to a GIF file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the gray-value image to a GIF file, overwriting any other file with the
same name. Optionally, an integer-typed image can be identified as a labeled image using
labelImage. In that case a colour GIF image will be saved.
ARGUMENTS
SOFTWARE
This function uses GifLib (version 4.1.0 or later), which supports GIF 87a & 98a.
Copyright (c)1997 Eric S. Raymond
SEE ALSO
ImageWriteICS
Write ICS image to file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to an ICS file, overwriting any other file with the same name.
version can set to 1 to use the ICS v.1.0 file format (the 2-file version), instead of ICS
v.2.0. For colour images, set photometric and write the colour channels along the last
image dimension. Set sigbits only if the number of significant bits is different from the full
range of the data type of image (use 0 otherwise). physDims can be set to 0 to fill out
default values. history can be 0 if you do not want to bother.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libics (version 1.3 or later), which supports the ICS specification
revision 2.0. Copyright (c)2000-2002 Cris L. Luengo Hendriks, Dr. Hans T.M. van der
Voort and many others.
This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly
and Mark Adler
SEE ALSO
ImageWriteJPEG
Write JPEG image to file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to a JPEG file, overwriting any other file with the same
name. photometric can set to let the function know how to write the JPEG image
(supported colour space is RGB).
If photometric is not DIPIO PHM GRAYVALUE, a 3D image is expected, in which the different
planes are stored along the 3rd dimension.
physDims gives physical dimensions of the image, which will be used to set the dots per inch
property of the JPEG file. It can be set to 0 for default values (300 dpi). If the
physDims->dimensionUnits is not given, meters are assumed.
complevel is a number between 1 (worst quality, smallest files) and 100 (best quality,
largest files). Setting complevel to 0 uses the default compression level, which is 90.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libjpeg (version 6b or later). Copyright (c)1994-1998, Thomas G. Lane.
SEE ALSO
ImageWritePS
Write image to PostScript file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to a PostScript file, overwriting any other file with the same
name. Set the image size in xcm and ycm. border sets the size of the border around the
image. If border is 0, no border is drawn. You can give the page a title through caption.
For colour images, set photometric (supported are RGB and CMYK) and write the colour
channels along the third image dimension.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SEE ALSO
ImageWriteTIFF
Write TIFF image to file (in dipIO)
SYNOPSIS
FUNCTION
This function writes the image to a TIFF file, overwriting any other file with the same
name. photometric can set to let the function know how to write the TIFF image
(supported colour spaces are RGB, CIE Lab and CMYK).
If photometric is not DIPIO PHM GRAYVALUE, a 3D image is expected, in which the different
planes are stored along the 3rd dimension.
physDims gives physical dimensions of the image, which will be used to set the dots per inch
property of the TIFF file. It can be set to 0 for default values (300 dpi). If the
physDims->dimensionUnits is not given, meters are assumed.
ARGUMENTS
Name Description
DIPIO PHM GREYVALUE No colour information present; it’s a grey-value image.
DIPIO PHM RGB RGB image (the first three planes are red, green and blue)
DIPIO PHM RGB NONLINEAR Non-linear R’G’B’ image (RGB channels to the power of 0.4)
DIPIO PHM CMY CMY image (the first three planes are cyan, magenta and
yellow)
DIPIO PHM CMYK CMYK image (the first four planes are cyan, magenta,
yellow and black)
DIPIO PHM CIELUV CIE L*u’v’ image (the first three planes are luminosity, u*
and v*)
DIPIO PHM CIELAB CIE L*a*b* image (the first three planes are luminosity, a*
and b*)
DIPIO PHM CIEXYZ CIE XYZ (the first three planes are X, Y and Z)
DIPIO PHM CIEYXY CIE Yxy (the first three planes are Y, x and y)
DIPIO PHM HCV HCV image (the first three planes are hue, chroma and
value)
DIPIO PHM HSV HSV image (the first three planes are hue, saturation and
value)
DIPIO PHM DEFAULT Same as DIPIO PHM GREYVALUE
DIPIO PHM GENERIC Anything can be coded in the channels; the same as
DIPIO PHM CMYK
Most file formats support only some of these.
SOFTWARE
This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification
revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon
Graphics, Inc.
This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly
and Mark Adler
SEE ALSO
Imaginary
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the imaginary part of the input image values, and outputs a float typed image.
ARGUMENTS
SEE ALSO
IncoherentOTF
Generates an incoherent OTF
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
This function implements the formulae for a (defocused) incoherent OTF as described by
Castleman. When defocus is unequal to zero, either the Stokseth approximation or the
Hopkins approximation is used. The defocus is defined a the maximum defocus path length
error divided by the wave length (See Castleman for details). The summation over the
Bessel functions in the Hopkins formluation, is stopped when the change is smaller than
DIP MICROSCOPY HOPKINS OTF CUTOFF.
ARGUMENTS
LITERATURE
K.R. Castleman, “Digital image processing, second edition”, Prentice Hall, Englewood Cliffs,
1996.
360 Chapter 2. Function reference
SEE ALSO
IncoherentPSF
DIPlib function reference 361
IncoherentPSF
Generates an incoherent PSF
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
This function generates an incoherent in-focus point spread function of a diffraction limited
objective.
ARGUMENTS
LITERATURE
K.R. Castleman, “Digital image processing, second edition”, Prentice Hall, Englewood Cliffs,
1996.
SEE ALSO
IncoherentOTF
362 Chapter 2. Function reference
IndexToCoordinate
Convert pixel index to coordinate
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
IndexToCoordinateWithSingletons, CoordinateToIndex
DIPlib function reference 363
IndexToCoordinateWithSingletons
Convert pixel index to coordinate
SYNOPSIS
FUNCTION
This function converts an pixel index of an image to a coordinate array. The conversion is
done by calculating the modulus of the index with the stride and size arrays obtained
from the image. coordinate has to be an allocated integer array with its size equal to the
size of stride and size.
A set of macros can be used instead of this function to avoid some overhead when
repeatedly converting linear indices to coordinates for the same image:
dip_Image image;
dip_int index;
dip_IntegerArray coordinates;
dip_IntegerArray size;
dip_IntegerArray stride;
DIP_FNR_INITIALISE;
/* ... */
/* Now, every time you need to obtain the coordinates for an index, do: */
364 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
IndexToCoordinate, CoordinateToIndex
DIPlib function reference 365
Initialise
Initialise DIPlib
SYNOPSIS
FUNCTION
Initialise the DIPlib library. Must be called before using any of the other DIPlib functions.
This function can be invoked more than once; all but the first invocation are ignored.
SEE ALSO
Exit
366 Chapter 2. Function reference
InsertionSort
Sort a block of data
SYNOPSIS
FUNCTION
Sorts a block of data (of size size and data type dataType ) using the insertion sort
algorithm.
ARGUMENTS
SEE ALSO
InsertionSortIndices
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of indices rather than the data itself using the insertion sort algorithm.
ARGUMENTS
SEE ALSO
InsertionSortIndices16
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of (16 bit) indices rather than the data itself using the insertion sort algorithm.
ARGUMENTS
SEE ALSO
IntegerArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the integer array src to dest. The array dest is created by this
function as well.
ARGUMENTS
SEE ALSO
IntegerArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
IntegerArrayFind will produce an error if value is not found, otherwise found obtains the
search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
IntegerArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
IntegerArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip IntegerArray and sets the size of the
array to size. Each array element is initialized with value.
ARGUMENTS
SEE ALSO
Invert
logic operation
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
The function Invert inverts the pixel value in in1 and stores the result in out.
ARGUMENTS
SEE ALSO
And, Xor, Or
374 Chapter 2. Function reference
IsodataThreshold
Point operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Thresholds in with the isodata method. Several threholds can be supplied, their value is
returned in values. The different regions are label in out with different grey-values. A
maks image mask can be given to compute the isodata only there.
ARGUMENTS
SEE ALSO
IsScalar
Determines whether an image is a scalar
SYNOPSIS
FUNCTION
Determines whether an image is of the DIP IMTP SCALAR type. If answer is not zero, the
verdict is passed in this variable. Otherwise, dip IsScalar returns an error in case image
fails to be a scalar.
ARGUMENTS
Kuwahara
Edge perserving smoothing filter
SYNOPSIS
DATA TYPES
FUNCTION
This function implements the kuwahara edge-preserving smoothing function. See section
9.4, “Smoothing operations”, in “Fundamentals of Image Processing” for a description of the
algorithm. However, this function does not implement the classical kuwahara filter, which
only compares the variance of four regions in the filter window, but compares the variance
of every region specified by the filter shape and size centered withing the filter window.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
GeneralisedKuwahara, VarianceFilter
378 Chapter 2. Function reference
Label
Label a binary image
SYNOPSIS
DATA TYPES
binary
FUNCTION
The output is an integer image. Each object (respecting the connectivity, see The
connectivity parameter) in the input image receives a unique number. This number ranges
from 1 to the number of objects in the image. The pixels in the output image corresponding
to a given object are set to this number (label). The remaining pixels in the output image
are set to 0. The minsize and maxsize set limits on the size of the objects, if the flag
DIP LB THRESHOLD ON SIZE is set: Objects smaller than minsize or larger than maxsize do
not receive a label and the corresponding pixels in the output image are set to zero. Setting
minsize to zero implies that there is no check with respect to the minimum size of the
object, and the same holds for maxsize and the maximum size of the object. If the flag
DIP LB LABEL IS SIZE is set, the objects’ labels are set to the objects’ sizes. The boundary
conditions are generally ignored (labeling stops at the boundary). The exception is
DIP BC PERIODIC, which is the only one that makes sense for this algorithm.
ARGUMENTS
Laplace
Second order derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
LaplaceMinDgg
Second order derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
Computes Laplace - Dgg. For two-dimensional images this is equivalent to the second order
derivative in the direction perpendicular to the gradient direction.
ARGUMENTS
SEE ALSO
LaplacePlusDgg
Second order derivative filter
SYNOPSIS
DATA TYPES
FUNCTION
Computes the laplace and the second derivative in gradient direction of an image using the
Derivative function and adds the results. The zero-crossings of the result correspond to
the edges in the image, just as for the individual Laplace and Dgg operators. The
localization is improved by an order of magnitude with respect to the individual operators.
ARGUMENTS
LITERATURE
SEE ALSO
Lee
Morphological edge detector
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
MorphologicalGradientMagnitude, MorphologicalRange,
MultiScaleMorphologicalGradient, Tophat
386 Chapter 2. Function reference
Lesser
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when for corresponding pixels in1 < in2.
This is the same as Compare with the DIP SELECT LESSER selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to a functionality similar to that of Threshold.
ARGUMENTS
SEE ALSO
Ln
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
LnGamma
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the natural logarithm of the gamma function of the input image values.
ARGUMENTS
SEE ALSO
LnNormError
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the order norm difference between each pixel value of in1 and in2. Optionally
the mask image can be used to exclude pixels from the calculation by setting the value of
these pixels in mask to zero.
ARGUMENTS
SEE ALSO
LocalMinima
Marks local minima (or regional minima)
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The binary output image is true on all pixels belonging to the minima of a region (as
defined by the watershed). To find local maxima, use the inverse of the image as input to
this function (see Invert). If binaryOutput is DIP FALSE, the output is a labelled image
instead of a binary one. In this case, pixels belonging to the same local minimum are
assigned the same value.
The algorithm is based on the watershed transform, see Watershed for information on the
parameters.
Minima is a different algorithm to obtain local minima; Maxima yields the local maxima.
ARGUMENTS
SEE ALSO
Log10
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Log2
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
macros.h
Various macros
DESCRIPTION
get/set the value of the pixel at position pos from data pointer ip with strides stride.
Both pos and stride are dip IntegerArrays.
add/subtract/multlipy/divide the value with the pixel-value at position pos from data
pointer ip with strides stride. Both pos and stride are dip IntegerArrays.
394 Chapter 2. Function reference
Map
Remaps an image
SYNOPSIS
DATA TYPES
FUNCTION
This function maps the dimensions of the output image to (different) dimensions of the
input image. The array index of map specifies the dimension of the output image, the value
of the array element of map specifies to which dimension in the input image it corresponds.
Optionally, the dimensions can be mirrored, when the value of the corrsponding array
element in mirror is set to DIP TRUE.
ARGUMENTS
SEE ALSO
Mirror
DIPlib function reference 395
Max
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = max (in1 , in2) on a pixel by pixel basis. The data types of
the in1 and in2 image may be of different types. See Information about dyadic operations
for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
MaxFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = max(in , constant) on a pixel by pixel basis. The data
types of the in1 image and constant may be of different types. See Information about
dyadic operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Maxima
Detects local maxima
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
NOTE
If you are looking for the old version of Maxima, it is still available through the following
combination of commands:
SEE ALSO
Maximum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the maximum of the pixel values over all those dimensions which are specified by
ps.
ARGUMENTS
SEE ALSO
mBesselJ0
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mBesselJ1
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mBesselJN
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mBesselY0
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mBesselY1
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mBesselYN
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
Mean
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean of the pixel values over all those dimensions which are specified by ps.
ARGUMENTS
SEE ALSO
MeanAbsoluteError
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean absolute error difference between each pixel value of in1 and in2.
Optionally the mask image can be used to exclude pixels from the calculation by setting the
value of these pixels in mask to zero.
ARGUMENTS
SEE ALSO
MeanError
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean error difference between all pixel values of in1 and in2. Optionally the
mask image can be used to exclude pixels from the calculation by setting the value of these
pixels in mask to zero.
ARGUMENTS
SEE ALSO
MeanModulus
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean modulus of the pixel values over all those dimensions which are
specified by ps.
ARGUMENTS
SEE ALSO
MeanSquareError
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean square error difference between all pixel values of in1 and in2.
Optionally the mask image can be used to exclude pixels from the calculation by setting the
value of these pixels in mask to zero.
ARGUMENTS
SEE ALSO
MeanSquareModulus
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the mean square modulus of the pixel values over all those dimensions which are
specified by ps.
ARGUMENTS
SEE ALSO
Measure
Measure object features
SYNOPSIS
DATA TYPES
FUNCTION
The Measure function is the top-level function of DIPlib’s measurement library. This
function performs measurements of the objects in the specified objectIm image. The
measurements to be performed are specified by the featureID array of measurement
function IDs. If the featureParams is non-zero, its size should equal that of featureID.
Although the current implementation of Measure does not make use of this argument,
future versions will pass the data pointers of the featureParams to the corresponding
measurement functions. featureParams should be set to zero for now.
The list of object IDs on which the measurements have to be performed is specified by
objectID. If it is zero, Measure will call GetObjectLabels to obtain a list of all non-zero
values in objectIm. The objectID values should be unequal to zero.
The state of measurement should be raw (see MeasurementNew), since Measure will forge
the measurement data structure by calling MeasurementForge.
The intensityIm image defines the pixel intensity of the objects, whose shape is defined by
objectIm. If none of the measurements specified in featureID require the grey-value image,
it can be set to NULL.
The physDims parameter defines the physical dimensions of the pixel sizes and pixel
intensity. See PhysicalDimensionsNew for more information.
412 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
MeasurementFeatureConvert
Convert the data of a measurement feature
SYNOPSIS
FUNCTION
This function convert the data of object inID in measurement in measured by feature
featureID to object outID in out.
ARGUMENTS
SEE ALSO
MeasurementFeatureDescription
Measurement Description access function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureFormat
Feature data format convenience function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureLabels
Measurement Labels access function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureRegister
Register a measurement function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureRegistryFeatureDescription
Get the feature description of a registered measurement feature
SYNOPSIS
FUNCTION
This function obtains the feature description information of the measurement feature
specified by featureID.
ARGUMENTS
SEE ALSO
MeasurementFeatureRegister, MeasurementFeatureRegistryList,
MeasurementFeatureRegistryGet
DIPlib function reference 419
MeasurementFeatureRegistryGet
Get the registry information of a measurement feature
SYNOPSIS
FUNCTION
This function obtains (a copy of) the registry structure of the measurement feature function
specified by featureID.
ARGUMENTS
SEE ALSO
MeasurementFeatureRegister, MeasurementFeatureRegistryList,
MeasurementFeatureRegistryFeatureDescription
420 Chapter 2. Function reference
MeasurementFeatureRegistryList
Obtain a list of the registered measurement features
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureRegister, MeasurementFeatureRegistryGet
DIPlib function reference 421
MeasurementFeatures
Get the measurement ID array
SYNOPSIS
FUNCTION
This function obtains an array of measurement function IDs in the measurement structure.
See MeasurementForge for a (brief) explination of the measurement data structure.
ARGUMENTS
SEE ALSO
MeasurementFeatureSize
Feature data convenience function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementFeatureValid
Verify a measurement feature ID
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementForge
Allocate the data of a measurement data structure
SYNOPSIS
FUNCTION
This function forges a measurement data structure, that has been created with
MeasurementNew. The featureID array should contain the IDs of the features to be
performed. The vadility of these IDs is checked by comparing them with the IDs of
registered measurement functions (see MeasurementFeatureRegister). The objectID
array contains the IDs (i.e. labels) of the objects on which the features are to be performed.
(For example, the Measure function accepts as one of its arguments a label image, of which
the intensity of each individual pixel represents the ID of the object to which that pixel
belongs. These label values should in that case correspond to the values of objectID.)
The measurement structure can be regarded as a matrix spanned by the number of features
along one axis, and the number of objects along the other. MeasurementForge allocates and
initialises the internal structures to contain this matrix and the data required for each
conbimation of measurement and object ID.
ARGUMENTS
SEE ALSO
MeasurementFree
Free a measurement data structure
SYNOPSIS
FUNCTION
This function frees a Measurement data structure. After the Measurement has been freed,
the pointer measurement is set to zero.
ARGUMENTS
SEE ALSO
MeasurementGetName
Get the name of a Measurement structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementGetPhysicalDimensions
Get the physical dimensions info of a measurement
SYNOPSIS
FUNCTION
This function obtains a copy of the physical dimensions information associated with the
measurement data structure. The physical dimensions data structure informs measurement
features about the physical sizes and position of the pixels of the measured image.
ARGUMENTS
SEE ALSO
MeasurementID
Get the ID of a Measurement structure
SYNOPSIS
FUNCTION
This function obtains the ID of a the measurement structure. The ID is a DIPlib wide
unique number (see GetUniqueNumber).
ARGUMENTS
SEE ALSO
MeasurementIsValid
Checks whether a measurement is valid
SYNOPSIS
FUNCTION
This function determines whether measurement is forged. If verdict is not zero, the result
(DIP TRUE or DIP FALSE) is stored in verdict, otherwise an error is returned in case the
verification fails.
ARGUMENTS
SEE ALSO
MeasurementNew
Create new measurement data structure
SYNOPSIS
FUNCTION
This function creates, by allocating and initialising it, a new Measurement data structure.
After this function has been used to create a new measurement structure, the state of it is
raw. It needs to be passed through MeasurementForge before it can be used to store
measurement results.
ARGUMENTS
SEE ALSO
MeasurementNumberOfFeatures
Get the number of measurement feature IDs
SYNOPSIS
FUNCTION
This function obtains the number of measurement feature IDs in the measurement structure.
See MeasurementForge for a (brief) explination of the measurement data structure.
ARGUMENTS
SEE ALSO
MeasurementNumberOfObjects
Get the number of object IDs
SYNOPSIS
FUNCTION
This function obtains the number of object IDs belonging to the featureID measurement
function ID in the measurement structure. See MeasurementForge for a (brief) explination
of the measurement data structure.
ARGUMENTS
SEE ALSO
MeasurementObjectData
Object data access function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementObjects
Get an object ID array
SYNOPSIS
FUNCTION
This function obtains an array of object IDs belonging to the featureID measurement
function in the measurement structure. See MeasurementForge for a (brief) explination of
the measurement data structure.
ARGUMENTS
SEE ALSO
MeasurementObjectValid
Verify an object ID
SYNOPSIS
FUNCTION
This function determines whether the object ID objectID, belonging to the measurement
function ID featureID, is a valid object ID, by comparing objectID to the object IDs
belonging to the featureID in measurement. If verdict is not zero, the result (DIP TRUE or
DIP FALSE) is stored in verdict, otherwise an error is returned in case the verification fails.
ARGUMENTS
SEE ALSO
MeasurementObjectValue
Object value access function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementRead
Read measurement results from a file
SYNOPSIS
FUNCTION
This function reads measurement data from a file and puts it in measurement. measurement
must be allocated before calling this function. If format is 0, all different MeasurementRead
functions are called in sequence until the correct format has been found. If you know the
format, get the correct format ID through the registry functions.
The boolean addExtensions specifies whether MeasurementRead should try to add file
format extensions to filename, if the registered file format reader fails to recognise
filename straight away. The extensions are provided by the registered file readers.
If recognised is not zero, MeasurementRead will set it to DIP TRUE when it has been able
to read filename, and it will set it to DIP FALSE when it is not able to read the file. No
error will be generated in this case.
NOTE
There are currently no measurement reading functions, so this function will always fail.
ARGUMENTS
SEE ALSO
Measure, MeasurementWrite
DIPlib function reference 439
MeasurementSetName
Set the name of a measurement structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MeasurementSetPhysicalDimensions
Set the physical dimensions info of the measurement
SYNOPSIS
FUNCTION
This function sets the physical dimensions information for the measurement data structure.
The physical dimensions data structure informs measurement features about the physical
sizes and position of the pixels of the measured image.
ARGUMENTS
SEE ALSO
MeasurementWrite
Write measurement results to a file
SYNOPSIS
FUNCTION
This function writes measurement data to a file, overwriting any other file with the same
name. Get the format ID through the registry functions. If format is 0, CSV is used.
ARGUMENTS
SEE ALSO
MeasurementWriteCSV
Write measurement results to a CSV file
SYNOPSIS
FUNCTION
This function writes the measurement results to a comma separated values (CSV) file,
overwriting any other file with the same name.
This function calls MeasurementWriteText with the proper settings.
ARGUMENTS
SEE ALSO
MeasurementWriteHTML
Write measurement results to an HTML file
SYNOPSIS
FUNCTION
This function writes the measurement results to a formatted HTML file, overwriting any
other file with the same name.
ARGUMENTS
SEE ALSO
Measure, MeasurementWrite
444 Chapter 2. Function reference
MeasurementWriteText
Write measurement results as readable text
SYNOPSIS
FUNCTION
This function saves/prints the results of a measurement stored in the measurement data
structure. Since it will save the results to the fp FILE pointer (which has to be opened
before this function is called, and closed afterwards), the results can be printed to a screen
(specify stdout as fp) or to a file.
The results are saved in a matrix, with a column for each measurement, and a row for each
object. The first column contains the object ID. The options structure provides a means to
adjust the formatting of the measurement data. Its separator variable specifies the column
separator character, the rows are separated by a newline. If the labelAlign variable is
DIP TRUE, the separator is repeated such that the columns are aligned. If the labels
variable is DIP TRUE, the first row contains measurement labels, and info specifies whether
or not the short description of each measurement function should be printed before the
result matrix. If results is DIP FALSE, the measurement values are not printed.
ARGUMENTS
SEE ALSO
Measure, MeasurementWrite
446 Chapter 2. Function reference
Median
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the median of the pixel values over all those dimensions which are specified by ps.
ARGUMENTS
SEE ALSO
MedianFilter
Non-linear smoothing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
MemoryCopy
Copy memory blocks
SYNOPSIS
FUNCTION
ARGUMENTS
NOTE
The behaviour of this function is undefined when the in and out blocks overlap.
450 Chapter 2. Function reference
MemoryFree
Free a chunk of memory
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MemoryFunctionsSet
Sets memory allocation functions
SYNOPSIS
FUNCTION
ARGUMENTS
NOTE
SEE ALSO
MemoryNew
Allocate and track memory
SYNOPSIS
FUNCTION
Allocates a chunk of memory, and adds a reference to the chunk to the list of tracked
resources.
ARGUMENTS
SEE ALSO
MemoryReallocate
Reallocate a chunk of memory
SYNOPSIS
FUNCTION
Reallocates a chunk of memory, to change its size. resources must be the dip Resources
structure used in the call to MemoryNew when pointer was allocated.
ARGUMENTS
SEE ALSO
mErf
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mErfc
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mExp10
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mExp2
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mFraction
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mGammaP
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mGammaQ
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
Min
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = min(in1 , in2) on a pixel by pixel basis. The data types of
the in1 and in2 image may be of different types. See Information about dyadic operations
for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
MinFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = min(in , constant) on a pixel by pixel basis. The data types
of the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Minima
Detects local minima
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
NOTE
If you are looking for the old version of Minima, it is still available through the following
combination of commands:
SEE ALSO
Minimum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the minimum of the pixel values over all those dimensions which are specified by
ps.
ARGUMENTS
SEE ALSO
Mirror
Mirrors an image
SYNOPSIS
DATA TYPES
FUNCTION
This function mirrors the pixels in those dimensions of image as specified by mirror.
ARGUMENTS
SEE ALSO
Map
DIPlib function reference 467
mLnGamma
mathematical function
SYNOPSIS
FUNCTION
Computes the natural logarithm of the gamma function of the input value.
ARGUMENTS
SEE ALSO
mLog2
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mNearestInt
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
Modulo
Arithmetic function
SYNOPSIS
DATA TYPES
integer
FUNCTION
Computes the modulo of the input image values, by computing the remainder of the the
division of the input image values with period.
ARGUMENTS
SEE ALSO
Modulus
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the modulus of the input image values, and outputs a float typed image.
ARGUMENTS
SEE ALSO
MonadicFrameWork
FrameWork for monadic operations
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
SeparableFrameWork, SingleOutputFrameWork
DIPlib function reference 473
MorphologicalGradientMagnitude
Morphological edge detector
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
MorphologicalRange
Morphological edge detector
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
MorphologicalReconstruction
Morphological filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Dilation of the image marker, constrained by the image mask. out will be smaller or equal
to mask. The image is grown according to the connectivity parameter. See The
connectivity parameter for more information.
ARGUMENTS
LITERATURE
SEE ALSO
Dilation, BinaryPropagation
DIPlib function reference 477
MorphologicalSmoothing
Morphological smoothing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
MorphologicalThreshold, Tophat
DIPlib function reference 479
MorphologicalThreshold
Morphological smoothing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
MorphologicalSmoothing, Tophat
DIPlib function reference 481
mReciprocal
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
mSign
mathematical function
SYNOPSIS
FUNCTION
Computes the sign of the input value. The sign of zero is defined as zero.
ARGUMENTS
SEE ALSO
mSinc
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MsrComposeFunction
Measurement compose function
SYNOPSIS
FUNCTION
The compose function is called to obtain a list of measurement features. These features are
than measured before the MsrMeasureFunction of this composite feature function is called.
The compose function is called after the MsrCreateFunction.
ARGUMENTS
SEE ALSO
MsrConvertFunction
Measurement convert function
SYNOPSIS
FUNCTION
The convert function converts the data measurement of the feature feaureID for the
object inID in the measurement in to object outID of measurement out. for each
measurement value.
ARGUMENTS
SEE ALSO
MsrCreateFunction
Measurement create function
SYNOPSIS
FUNCTION
The create function is called to initialise the measurement function. It is meant to allocate
and initialise data for the internal use by the measurement function itself.
ARGUMENTS
SEE ALSO
MsrDescriptionFunction
Measurement feature description function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
MsrMeasureFunction
Measurement measure function
SYNOPSIS
FUNCTION
dip_MsrLineMsrFunction line;
dip_MsrImageMsrFunction image;
dip_MsrChainCodeMsrFunction chaincode;
dip_MsrCompositeMsrFunction composite;
The measure function is the function that performs the actual measurement. It The four
different measurement functions line, image, chaincode and composite differ in the way
the object label, shape and intensity information is provided.
The line measure function obtains two arrays (label and intensity) with label and
intensity information of the to be measured objects. The line measurement function is
called for every (X-) line in the image. Since label can contain more than one different
labels, line itself is responsible for storing the measurement results for the appropriate
object (using, for example, MsrObjectData). The object ID array label can contain values
that are not present in objectID. These labels should be ignored.
The image measurement function is meant for measurement operation that need
neighborhood or global object shape information for its operation (e.g. the MsrSurfaceArea
function needs to evaluate the 6 connected neighborhood of each boundary voxel). The
object ID image label can contain values that are not present in objectID. These labels
should be ignored.
DIPlib function reference 489
The chaincode measure function is meant for 2-D measurement functions that only require
information on the shape of the object’s contour, e.g. MsrPerimeter. The chaincode
function is called for each object seperately, with the contour of that object stored in
chaincode.
The composite measure function is meant for measurement function that derive their
measurement function from the results of other measurement functions. The measurement
functions this function is based on is obtained by calling the MsrComposeFunction callback
function. The composite measure function obtains the results of these measurements
through its composite function parameter (type: dip Measurement). The composite
function is therefore able to obtain these measurement results (e.g. by using
dip MeasurementObjectValue).
ARGUMENTS
SEE ALSO
MsrValueFunction
Measurement value function
SYNOPSIS
FUNCTION
The value function give access to the measurement values produced by the measurement
function.
ARGUMENTS
SEE ALSO
mTruncate
mathematical function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
Mul
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in1 * in2 on a pixel by pixel basis. The data types of the
in1 and in2 image may be of different types. See Information about dyadic operations for
more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
MulComplex
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in * constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubFloat, SubComplex, Mul, MulFloat, Div, DivFloat,
DivComplex
DIPlib function reference 495
MulFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in * constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubFloat, SubComplex, Mul, MulComplex, Div, DivFloat,
DivComplex
496 Chapter 2. Function reference
MultiScaleMorphologicalGradient
Morphological edge detector
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function computes the average morphological gradient over a range of scales bounded
by upperSize and lowerSize. The morphological gradient is computed as the difference of
the dilation and erosion of the input image at a particular scale, eroded by an erosion of one
size smaller. At the lowest scale, the size of the structuring element is 2 * upperSize + 1.
The rectangular, elliptic and diamond structuring elements are “flat”, i.e. these structuring
elements have a constant value. For these structuring elements, filterParam determines
the sizes of the structuring elements. When shape is set to DIP FLT SHAPE PARABOLIC,
filterParams specifies the curvature of the parabola. When shape is set to
DIP FLT SHAPE STRUCTURING ELEMENT, se is used as structuring element. It can be either a
binary or a grey-value image, but be careful: it is converted to the same data type as the
input image, and might therefore be clipped or loose precision. It is required (in the current
implementation) that the structuring element be odd in size. Its origin is the center.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
DIPlib function reference 497
ARGUMENTS
LITERATURE
SEE ALSO
NearestInt
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
NeighbourIndicesListMake
Get indices to direct neighbours
SYNOPSIS
FUNCTION
A list indices is created with the relative indices to the direct neighbours of a pixel in an
image whose strides are given by stride. How many direct neighbours are returned is
controlled by connectivity, see The connectivity parameter for the available values and
their meaning.
indices is allocated and tracked in resources.
ARGUMENTS
SEE ALSO
NeighbourListMake
Get list of direct neighbours
SYNOPSIS
FUNCTION
A list coords is created with the relative coordinates to the direct neighbours of a pixel in
an ndims-dimensional image. How many direct neighbours are returned is controlled by
connectivity, see The connectivity parameter for the available values and their meaning.
coords is allocated and tracked in resources.
ARGUMENTS
SEE ALSO
NeighbourListMakeChamfer
Get list of neighbours based on Chamfer metric
SYNOPSIS
FUNCTION
A list coords is created with the relative coordinates to the neighbours of a pixel in an
pixelsize->size-dimensional image. Here, neighbours are all pixels within a maxdistance
distance. pixelsize gives the size of a pixel, and hence controls the size of the
neighbourhood with maxdistance. Anisotropic pixel grids are supported. distance
contains the distance to each of the neighbours in coords.
Distances between two pixels are taken to be the Euclidean distance. There are better
metrics described in the literature for small neighbourhoods, that yield a more isotropic
measure when compounded over longer distances. These are not implemented in this
function.
coords and distance are allocated and tracked in resources.
ARGUMENTS
SEE ALSO
NeighbourListMakeImage
Get list of neighbours based on metric in image
SYNOPSIS
FUNCTION
A list coords is created with the relative coordinates to the neighbours of a pixel in an
image, with dimensionality as in metric. metric is an image that specifies the distance to
each of the neighbours. This image must be odd in size, the centre pixel is the origin of the
neighbourhood. Any pixel with value 0 is not considered part of the neighbourhood.
distance contains the distance to each of the neighbours in coords.
Distances between two pixels are taken to be the Euclidean distance. There are better
metrics described in the literature for small neighbourhoods, that yield a more isotropic
measure when compounded over longer distances. These are not implemented in this
function.
coords and distance are allocated and tracked in resources.
ARGUMENTS
SEE ALSO
NeighbourListToIndices
Get indices to neighbours
SYNOPSIS
FUNCTION
This function translates the relative coordinates in coords into relative indices into an
image with strides given by stride.
indices is allocated and tracked in resources.
ARGUMENTS
SEE ALSO
NormaliseSum
Normalise the sum of the pixel values
SYNOPSIS
DATA TYPES
FUNCTION
This function normalizes the sum of the pixel values in in to newSum, and puts the result in
out.
ARGUMENTS
NotEqual
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when corresponding pixels in in1 and in2 are
different. This is the same as Compare with the DIP SELECT NOT EQUAL selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to the functionality of NotZero, but with more options.
ARGUMENTS
SEE ALSO
NotGreater
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when for corresponding pixels in1 <= in2.
This is the same as Compare with the DIP SELECT LESSER EQUAL selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to a functionality similar to that of Threshold.
ARGUMENTS
SEE ALSO
NotLesser
Compare grey values in two images
SYNOPSIS
DATA TYPES
FUNCTION
This function sets each pixel in out to “true” when for corresponding pixels in1 >= in2.
This is the same as Compare with the DIP SELECT GREATER EQUAL selector flag.
in2 can be a 0D image for comparison of pixel values with a single scalar value. This leads
to a functionality similar to that of Threshold.
ARGUMENTS
SEE ALSO
NotZero
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function returns a binary image with value 1 where in != 0 and value 0 elsewhere.
The opposite can be accomplished with SelectValue: dip SelectValue(in,out,0);.
ARGUMENTS
SEE ALSO
ObjectToMeasurement
Convert object label value to measurement value
SYNOPSIS
DATA TYPES
FUNCTION
This function produces an output image which pixel intensities are equal to the
measurement value that the featureID measurement function measured on the object who
label is defined by the pixel intensity of the corresponding pixel in object. This function is
therefore useful to select (i.e. threshold) objects on basis of a measurement perfomed on the
object. intensity provides pixel intensity information for measurements that require pixel
intensity information of the objects, whose shape is defined by object.
The list of object IDs on which the measurements have to be performed is specified by
objectID. If it is zero, ObjectToMeasurement will call GetObjectLabels to obtain a list of
all non-zero values in objectIm.
If the featureID measurement function produces an array of measurement values,
measurementDim will be used to select the desired array element.
ARGUMENTS
SEE ALSO
OneDimensionalSearch
Numerical algorithm
SYNOPSIS
FUNCTION
This function implements a numerical line-search for either the minimum or zero-crossing of
a function. The obejctive is searched for in the range specified by min and man with a
tolerance of tol. The search methods are based on Brent’s algorithm. The dfunc parameter
is preparation for support of search algorithms using derivative information. This is not
supported in the current implementation, and dfunc should be set to zero.
ARGUMENTS
Opening
Morphological opening operation
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
SEE ALSO
Or
logic operation
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
The function Or performs the logic OR operation between the corresponding pixels in in1
and in2, and stores the result in out.
ARGUMENTS
SEE ALSO
ovl.h
Call an overloaded function
SYNOPSIS
FUNCTION
Call a type specific function based on the data type stored in the ovlDataType variable. The
base name of the function is passed to dip ovl.h by defining DIP OVL FUNC. The argument
list is passed by defining DIP OVL ARGS. By defining DIP OVL ALLOW the list of data types for
which overloading is possible can be controlled. If DIP OVL ALLOW is not defined, all data
types are allowed. The list is specified by a logical OR of identifier and identifier group
flags, see the table at DIPlib’s data types. The code executed by dip ovl.h is the following:
DIP FUNC is described in macros.h. Note that there are no brackets around DIP OVL ARGS,
so they must be included in DIP OVL ARGS itself. If ovlDataType is one of the binary types,
DIP OVL BINARY ARGS can be defined to override DIP OVL ARGS.
If DIP OVL ASSIGN is defined, the following code will be executed by dip ovl.h instead of
the code shown above:
Note that to actually perform an assignment the “=“ operator must be included in the
definition of DIP OVL ASSIGN itself. DIP OVL BINARY ASSIGN overrides DIP OVL ASSIGN if
ovlDataType is one of the binary data types.
SEE ALSO
DataTypeGetInfo, tpi.h
DIPlib function reference 517
PaintBox
Paint a box
SYNOPSIS
DATA TYPES
FUNCTION
Paints an box object in the image by replacing the values of the pixels in im that lie within
the box (as specified by length and origin) with amplitude, and leaving the other pixel
values untouched.
ARGUMENTS
SEE ALSO
PaintEllipsoid, PaintDiamond
518 Chapter 2. Function reference
PaintDiamond
Paint a diamond-shaped object
SYNOPSIS
DATA TYPES
FUNCTION
Paints a diamond-shaped object in the image by replacing the values of the pixels in im that
lie within the diamond (as specified by length and origin) with amplitude, and leaving
the other pixel values untouched.
ARGUMENTS
SEE ALSO
PaintEllipsoid, PaintBox
DIPlib function reference 519
PaintEllipsoid
Paint an ellipsoid
SYNOPSIS
DATA TYPES
FUNCTION
Paints an elliptical object in the image by replacing the values of the pixels in im that lie
within the ellips (as specified by diameter and origin) with amplitude, and leaving the
other pixel values untouched.
ARGUMENTS
SEE ALSO
PaintDiamond, PaintBox
520 Chapter 2. Function reference
PairCorrelation
Compute the pair correlation function
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
This function computes the pair correlation function of the different phases in object. If
object is a binary image, the image is a regarded as a two phase image. In case object is
of the integer type, the image is regarded as a labeled image, with each integer value
encoding a phase. Optionally a mask image can be provided so select which pixels in object
should be used to compute the pair correlation. The probes variable specifies how many
random point pairs should be drawn to compute the function. Length specifies the
maximum correlation length. The correlation function can be computed using a random of
grid method, as specified by sampling. Finally covariance determines whether only the
correlations ( DIP FALSE) or the covarianances (DIP TRUE) has to be computed.
ARGUMENTS
SEE ALSO
ChordLength, ProbabilisticPairCorrelation
DIPlib function reference 521
Percentile
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the perc percentile of the pixel values over all those dimensions which are
specified by ps.
ARGUMENTS
SEE ALSO
PercentileFilter
Rank-order filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
MedianFilter
524 Chapter 2. Function reference
Phase
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the phase of the input image values, and outputs a float typed image.
ARGUMENTS
SEE ALSO
PhysicalDimensionsCopy
Copy a Physical Dimensions
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PhysicalDimensionsFree
Free a Physical Dimensions data structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PhysicalDimensionsIsIsotropic
Checks if the Physical Dimensions are isotropic
SYNOPSIS
FUNCTION
This function checks whether the physical dimensions physDims are isotropic by checking
that all its pixel dimensions and dimension units are equal to each other. If verdict is not
zero, the result (DIP TRUE or DIP FALSE) is stored in verdict, otherwise an error is
returned in case the verification fails.
ARGUMENTS
SEE ALSO
PhysicalDimensionsNew
Allocates a new Physical Dimensions structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PixelHeapFree
Destroy heap structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PixelHeapIsEmpty
Query heap
SYNOPSIS
FUNCTION
Checks to see if there are any items on the heap. See PixelHeapNew for information on the
heap data structure.
ARGUMENTS
SEE ALSO
PixelHeapNew
Create a new heap structure
SYNOPSIS
FUNCTION
This function allocates space for a new dip PixelHeap structure. Memory allocated is
tracked in resources. The heap is dimensioned to hold pixels from an ndims-dimensional
image, and initially enough space is allocated for blocksize elements. The heap will be
expanded as necessary when used.
The heap stores the coordinates, the value and the pointer to a pixel in an image. Note that
the value does not need to equal the data pointed to by the pointer. ndims can be set to
zero, in which case no coordinates are stored; this does not affect the function of the value
and the pointer.
A heap is a priority queue data structure. Just like a queue, items can be added (pushed)
and subtracted (popped). However, in the priority queue the item popped is always the
higherst priority one: either the one with the highest-valued item (order is
DIP GVSO HIGH FIRST) or lowest-valued item (order is DIP GVSO LOW FIRST). However,
identically-valued items are stored on the heap in unpredictable order. If this order is
important (such as for the GrowRegions algorithm with integer-valued pixels, use a
dip StablePixelHeap instead. See StablePixelHeapNew for information on the stable heap
structure.
ARGUMENTS
IMPLEMENTATION
When the heap grows beyond its initial size, its capacity is doubled in size by reallocating
the data blocks. However, when removing pixels from the queue, the heap is not shrunk. It
is assumed that the dip PixelHeap structure will be destroyed as soon as the algorithm
using it terminates. Reducing the memory footprint of the heap therefore has no benefit.
SEE ALSO
PixelHeapPop
Pop item onto heap
SYNOPSIS
FUNCTION
Pops the next pixel from the heap. See PixelHeapNew for information on the heap data
structure. coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
If the stack was created with ndims set to 0, the coords pointer is ignored. coords,
pointer and value can be NULL if you are not interested in either those values.
ARGUMENTS
SEE ALSO
PixelHeapPush
Push item onto heap
SYNOPSIS
FUNCTION
Pushes a pixel onto the heap. See PixelHeapNew for information on the heap data
structure. All 3 values coords, pointer and value are stored, except if the heap was
created with ndims set to 0, in which case the coords pointer is ignored.
coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
pointer is a pointer to any memory location, and value is the value to be used when
sorting.
ARGUMENTS
SEE ALSO
PixelQueueFree
Destroy queue structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PixelQueueIsEmpty
Query queue
SYNOPSIS
FUNCTION
Checks to see if there are any items on the queue. See PixelQueueNew for information on
the queue data structure.
ARGUMENTS
SEE ALSO
PixelQueueNew
Create a new queue structure
SYNOPSIS
FUNCTION
This function allocates space for a new dip PixelQueue structure. Memory allocated is
tracked in resources. The queue is dimensioned to hold pixels from an ndims-dimensional
image, and initially enough space is allocated for blocksize elements. The queue will be
expanded as necessary when used.
The queue stores the coordinates, and the pointer to a pixel in an image. ndims can be set
to zero, in which case no coordinates are stored; this does not affect the function of the
pointer.
A queue is a data structure to which items can be added (pushed) to the back, and
subtracted (popped) from the front (FIFO - First In, First Out).
ARGUMENTS
IMPLEMENTATION
The queue is stored in an array whose size can be incresed at will. This is accomplished by
a linked list of blocks, each one holds blocksize elements. When more space is needed, a
new block is simply allocated. No data needs to be moved as would be necessary when using
realloc to change the size of the array. Blocks on the front of the queue that become
empty are freed.
DIPlib function reference 539
SEE ALSO
PixelQueuePop
Pop item from queue
SYNOPSIS
FUNCTION
Pops the next pixel from the queue. See PixelQueueNew for information on the queue data
structure. coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
If the queue was created with ndims set to 0, the coords pointer is ignored. coords and
pointer can be NULL if you are not interested in either those values.
newiteration, when not NULL, will be set to DIP TRUE if the pixel being popped is the first
one in an iteration, or DIP FALSE otherwise. When a new iteration starts, all pixels pushed
onto the queue afterwards belong to the next iteration. This is useful in routines that use
the queue for propagating boundaries, such as GrowRegions. First all boundary pixels are
pushed onto the queue. The first iteration will need to process only these pixels, while at
the same time push new pixels onto the queue for the second iteration. So after pushing all
the initial boundary pixels onto the queue, the first iteration is started by popping the first
pixel. All pixels pushed while processing this and the rest of the pixels will be pushed
behind the “new iteration” marker. When the first pixel after this marker is popped, the
newiteration boolean is set, so the program knows that the second iteration is starting.
Also, the “new iteration” marker is moved to the end of the queue, so that pixels pushed
subsequently will belong to iteration number 3.
ARGUMENTS
SEE ALSO
PixelQueuePush
Push item onto queue
SYNOPSIS
FUNCTION
Pushes a pixel onto the queue. See PixelQueueNew for information on the queue data
structure. Both coords and pointer are stored, except if the stack was created with ndims
set to 0, in which case the coords values are ignored.
coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
pointer is a pointer to any memory location.
ARGUMENTS
SEE ALSO
PixelTableAddRun
Add a new run to a pixel table
SYNOPSIS
FUNCTION
Adds a new run to a pixel table. The new run is appended to the existing runs in the pixel
table.
ARGUMENTS
SEE ALSO
PixelTableCreateFilter
Create a pixel table from a filter shape
SYNOPSIS
FUNCTION
This function allocates and creates a new pixel table data structure. The shape and
dimensionality of the pixel table is specified by the filterSize, filterShape and se
parameters.
ARGUMENTS
SEE ALSO
PixelTableFrameWork
FrameWork for PixelTable filters
SYNOPSIS
FUNCTION
Thsi function provides a framework for filters that code the shape of their filter in a pixel
table (runlengths). See SeparableFrameWork for details.
ARGUMENTS
SEE ALSO
SeparableFrameWork
546 Chapter 2. Function reference
PixelTableGetDimensionality
Get the dimensionality of a pixel table
SYNOPSIS
FUNCTION
Gets the dimensionality of the binary object that is encoded by the pixel table table.
ARGUMENTS
SEE ALSO
PixelTableGetDimensions
Get the dimemsions of a pixel table
SYNOPSIS
FUNCTION
This functions gets the dimensions of the bounding box of the binary object that is encoded
by the pixel table table.
ARGUMENTS
SEE ALSO
PixelTableGetOffsetAndLength
Converts the pixel table’s runs
SYNOPSIS
FUNCTION
This functions converts the linked-list of runs in the pixel table table to two arrays of
offsets and lengths. The length of these arrays equals the number of runs. The offsets are
calculated by multiplying each coordinate of a run with the stride of that dimension. This
function is useful when an image needs to be filtered with a filter that is encoded by a pixel
table. Before processing the image. See also PixelTableFrameWork.
ARGUMENTS
SEE ALSO
PixelTableGetOrigin
Get the origin of the pixel table
SYNOPSIS
FUNCTION
This function gets the origin of the pixel table table. All coordinates of the pixel table
runs are defined relative to this origin.
ARGUMENTS
SEE ALSO
PixelTableGetPixelCount
Get the number of pixels encoded in the pixel table
SYNOPSIS
FUNCTION
Gets the total number of pixels of the binary object that is encoded by the Pixel table
table.
ARGUMENTS
SEE ALSO
PixelTableGetRun
Get the contents of a pixel table run
SYNOPSIS
FUNCTION
This functions get the the coordinate and length parameters of the runth run of the pixel
table table.
ARGUMENTS
SEE ALSO
PixelTableGetRuns
Get the number of runs in a pixel table
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
PixelTableGetSize
The number of pixels in the pixel table’s bounding box
SYNOPSIS
FUNCTION
Gets the number of pixels in the bounding box of the pixel table table.
ARGUMENTS
SEE ALSO
PixelTableNew
Allocate a new pixel table
SYNOPSIS
FUNCTION
Allocates a new pixel table table. The size array specifies the dimensionality of the
coordinates in each run, and the sizes of the bounding box of the pixel table. The runs
parameter specifies the number of runs in the pixel table.
ARGUMENTS
SEE ALSO
PixelTableSetRun
Initialises a pixel table run
SYNOPSIS
FUNCTION
This function initialises the runth run of the pixel table table, by setting the run’s
coordinate to coordinate and its length to length. The pixel table must at least consist of
run number of runs ans has to be allocated (using PixelTableNew).
ARGUMENTS
SEE ALSO
PixelTableToBinaryImage
Convert a pixel table to a binary image
SYNOPSIS
DATA TYPES
binary
FUNCTION
Converts the pixel table table to a binary image. The size of the image is set to the size of
the bounding box of the pixel table.
ARGUMENTS
SEE ALSO
PoissonNoise
Generate an image disturbed by Poisson noise
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Generate a Poisson noise disturbed image. The intensities of the input image divided by the
conversion variable are used as mean value for the Poisson distribution. The conversion
factor can be used to relate the pixel values with the number of counts. For example, the
simulate a photon limited image acquired by a CCD camera, the conversion factor specifies
the relation between the number of photons recorded and the pixel value it is represented by.
ARGUMENTS
EXAMPLE
conversion = 2.0;
DIPXX( dip_PoissonNoise(in, out, conversion, &random ));
558 Chapter 2. Function reference
SEE ALSO
PoissonRandomVariable
Poisson random variable generator
SYNOPSIS
FUNCTION
ARGUMENTS
EXAMPLE
dip_Random random;
dip_float mean, value;
mean = 23.0;
DIPXX( dip_PoissonRandomVariable( &random, mean, &value));
LITERATURE
Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. Numerical Recipes in C,
2nd edition, Cambridge University Press, Cambridge, 1992.
560 Chapter 2. Function reference
SEE ALSO
ProbabilisticPairCorrelation
Compute the probabilistic pair correlation function
SYNOPSIS
DATA TYPES
float
FUNCTION
This function computes the probabilistic pair correlation function of the different phases in
object. Each image in the image array phases is treated as a separate phase. The function
assumes, but does not check, that the values in these images are with the [0 1] range.
Optionally a mask image can be provided so select which pixels in object should be used to
compute the pair correlation. The probes variable specifies how many random point pairs
should be drawn to compute the function. Length specifies the maximum correlation length.
The correlation function can be computed using a random of grid method, as specified by
sampling. Finally covariance determines whether only the correlations ( DIP FALSE) or
the covarianances (DIP TRUE) has to be computed.
ARGUMENTS
SEE ALSO
PairCorrelation, ChordLength
562 Chapter 2. Function reference
PseudoInverse
Image restoration filter
SYNOPSIS
FUNCTION
This function performs a basic, very noise sensitive image restoration operation by inverse
filtering the image with a clipped point spread function. Each frequency in the output for
which the response of the PSF is smaller than threshold is set to zero.
ARGUMENTS
LITERATURE
G.M.P. van Kempen, Image Restoration in FLuorescence Microscopy, Ph.D. Thesis, Delft
University of Technology, 1999
SEE ALSO
Wiener, TikhonovMiller
DIPlib function reference 563
PutLine
Put a line in an image
SYNOPSIS
DATA TYPES
FUNCTION
Put a line in an image. Put a line orthogonally in an image. The position of the line in the
image is specified by the coordinates at which its left most pixel (cor) is be placed and on
which dimension of the image, the dimension of the line maps (dimension). If in has a
different type than out, it will be converted to the type of out.
ARGUMENTS
SEE ALSO
PutSlice
Put a slice in an image
SYNOPSIS
DATA TYPES
FUNCTION
Put a slice orthogonally in an image. The position of the slice in the image is specified by
the coordinates at which its upper left corner (cor) should be placed and on which
dimensions of the image, the dimensions of the slice map (dim1, dim2). If in has a different
type than out, it will be converted to the type of out.
ARGUMENTS
SEE ALSO
QuickSort
Sort a block of data
SYNOPSIS
FUNCTION
Sorts a block of data (of size size and data type dataType ) using the quick sort algorithm.
ARGUMENTS
SEE ALSO
QuickSortAnything
Sort data of any type
SYNOPSIS
FUNCTION
Sorts a block of data (of size size) using the quick sort algorithm. This routine requires the
user to write two functions in order to fully implement the sorting procedure. These are
SortCompareFunction and SortSwapFunction.
ARGUMENTS
SEE ALSO
QuickSortIndices
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sort a list of indices rather than the data itself using the quick sort algorithm.
ARGUMENTS
SEE ALSO
QuickSortIndices16
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of (16 bit) indices rather than the data itself using the quick sort algorithm.
ARGUMENTS
SEE ALSO
RadialMaximum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes the radial projection of the maximum of the pixel intensities of in.
The radial projection is performed for the dimensions specified by ps. If the radial distance
of a pixel to the center of the image is r, than the maximum of the intensities of all pixels
with n * binSize <= r < (n + 1) * binSize is stored at position n in the radial
dimension of out. The radial dimension is the first dimension to be processed (as specified
by ps). If innerRadius is set to DIP TRUE, the maximum radius that is projected is equal
to the the smallest dimension of the to be projected dimensions. Otherwise, the maximum
radius is set equal to the diagonal length of the dimensions to be processed.
ARGUMENTS
SEE ALSO
RadialMean
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes the radial projection of the mean of the pixel intensities of in.
The radial projection is performed for the dimensions specified by ps. If the radial distance
of a pixel to the center of the image is r, than the mean of the intensities of all pixels with n
* binSize <= r < (n + 1) * binSize is stored at position n in the radial dimension of
out. The radial dimension is the first dimension to be processed (as specified by ps). If
innerRadius is set to DIP TRUE, the maximum radius that is projected is equal to the the
smallest dimension of the to be projected dimensions. Otherwise, the maximum radius is set
equal to the diagonal length of the dimensions to be processed.
ARGUMENTS
SEE ALSO
RadialMinimum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes the radial projection of the sum of the pixel intensities of in.
The radial projection is performed for the dimensions specified by ps. If the radial distance
of a pixel to the center of the image is r, than the minimum of the intensities of all pixels
with n * binSize <= r < (n + 1) * binSize is stored at position n in the radial
dimension of out. The radial dimension is the first dimension to be processed (as specified
by ps). If innerRadius is set to DIP TRUE, the maximum radius that is projected is equal
to the the smallest dimension of the to be projected dimensions. Otherwise, the maximum
radius is set equal to the diagonal length of the dimensions to be processed.
ARGUMENTS
SEE ALSO
RadialSum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes the radial projection of the sum of the pixel intensities of in.
The radial projection is performed for the dimensions specified by ps. If the radial distance
of a pixel to the center of the image is r, than the sum of the intensities of all pixels with n
* binSize <= r < (n + 1) * binSize is stored at position n in the radial dimension of
out. The radial dimension is the first dimension to be processed (as specified by ps). If
innerRadius is set to DIP TRUE, the maximum radius that is projected is equal to the the
smallest dimension of the to be projected dimensions. Otherwise, the maximum radius is set
equal to the diagonal length of the dimensions to be processed.
ARGUMENTS
SEE ALSO
RandomSeed
Random seed function
SYNOPSIS
FUNCTION
ARGUMENTS
EXAMPLE
dip_Random random;
dip_uint32 seed;
seed = 123758;
DIPXX(dip_RandomSeed( &random, seed ));
SEE ALSO
RandomVariable
Random number generator
SYNOPSIS
FUNCTION
ARGUMENTS
EXAMPLE
dip_Random random;
dip_float val;
SEE ALSO
RangeThreshold
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
SEE ALSO
Real
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the real part of the input image values, and outputs a float typed image.
ARGUMENTS
SEE ALSO
Reciprocal
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the reciprocal (1/x) of the input image values. If pixel values of in are zero, the
corresponding pixels in out is set to zero.
ARGUMENTS
SEE ALSO
Register
Generic registry function
SYNOPSIS
FUNCTION
dip_Error dip_MsrRegister
(
dip_MsrRegistry registry
)
{
DIP_FN_DECLARE("dip_MsrRegister");
dip_Registry globalRegistry;
void *data;
dip_MsrRegistry *reg;
switch( registry.type )
{
default:
DIPSJ( DIP_E_REGISTRY_INCOMPLETE_REGISTRY );
break;
DIPlib function reference 579
case DIP_MSR_FUNCTION_LINE_BASED:
DIPTS( ! ( registry.create &&
registry.measure.line &&
registry.value &&
registry.labels &&
registry.description ),
DIP_E_REGISTRY_INCOMPLETE_REGISTRY );
break;
case DIP_MSR_FUNCTION_IMAGE_BASED:
DIPTS( ! ( registry.create &&
registry.measure.image &&
registry.value &&
registry.labels &&
registry.description ),
DIP_E_REGISTRY_INCOMPLETE_REGISTRY );
break;
case DIP_MSR_FUNCTION_CHAINCODE_BASED:
DIPTS( ! ( registry.create &&
registry.measure.chaincode &&
registry.value &&
registry.labels &&
registry.description ),
DIP_E_REGISTRY_INCOMPLETE_REGISTRY );
break;
}
/* copy the Msr specific registry info */
DIPXJ( dip_MemoryNew( &data, sizeof( dip_MsrRegistry ), 0 ));
reg = data;
*reg = registry;
globalRegistry.id = registry.id;
globalRegistry.class = DIP_REGISTRY_CLASS_MEASUREMENT;
globalRegistry.registry = reg;
dip_error:
DIP_FN_EXIT;
}
580 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
RegisterClass
Register a registry class
SYNOPSIS
FUNCTION
This function registers a Registry class. See Register for more information about DIPlib’s
Registry.
ARGUMENTS
SEE ALSO
RegistryArrayNew
Allocate a registry array
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
RegistryGet
Get a registry item
SYNOPSIS
FUNCTION
This function obtains the Registry information of the ID of the Registry class class. See
Register for more information about DIPlib’s Registry.
The following code gives an example of a class-specific register list function:
dip_Error dip_MsrRegistryGet
(
dip_int id,
dip_MsrRegistry *registry
)
{
DIP_FN_DECLARE("dip_MsrRegistryGet");
dip_MsrRegistry *reg;
void *data;
dip_error:
DIP_FN_EXIT;
}
ARGUMENTS
SEE ALSO
RegistryList
Get an array of registry IDs
SYNOPSIS
FUNCTION
This function obtains an array of the registered IDs of the Registry class class. See
Register for more information about DIPlib’s Registry.
The following code gives an example of a class-specific register list function:
dip_Error dip_MsrRegistryList
(
dip_IntegerArray *measurement,
dip_Resources resources
)
{
DIP_FN_DECLARE("dip_MsrRegistryList");
dip_error:
DIP_FN_EXIT;
}
ARGUMENTS
SEE ALSO
RegistryValid
Validate an registry item
SYNOPSIS
FUNCTION
This function checks whether id has been registered in the Registry in the Registry class
class. If verdict is not zero, the validation information (DIP FALSE or DIP TRUE) is copied
to verdict. Otherwise an error is returned in case the validation fails.
See Register for more information about DIPlib’s Registry.
ARGUMENTS
SEE ALSO
Resampling
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
This function resmaples the input image in to out using various interpolation methods.
Both a (subpixel) shift and a zoom factor are supported. The size of the output image is
zoom times the size of in. If shift is zero, a shift of zero is assumed. If zoom is zero, a
zoom of 1.0 is assumed.
ARGUMENTS
SEE ALSO
Subsampling
588 Chapter 2. Function reference
ResourcesFree
Free resources
SYNOPSIS
FUNCTION
Free all resources registers in the resource tracking structure, as well as the resource tracking
structure itself. To prevent errors, the resource tracking structure is set to 0. Passing a null
pointer instead of a pointer to a dip Resources structure is allowed and silently ignored.
ARGUMENTS
SEE ALSO
ResourcesMerge
Add one resource list to another
SYNOPSIS
FUNCTION
Adds one resource list to another. This function is very useful when writing functions that
will support a dip Resources parameter. Typically you want to allocate a number of
resources and only add these to the user-supplied dip Resources when all these allocations
have been successful. This is where ResourcesMerge comes in. Allocate a local
dip Resources structure and register all resources with it. When no errors occured the
local dip Resources structure can be merged with the user-supplied dip Resources
structure. If an error did occur, simply free all local resources by calling ResourcesFree. In
addition it is the convention that functions supporting resource tracking also accept a zero
indicating that no tracking should be performed. When resources in dip ResourcesMerge
is 0, the mergee tracking structure is freed, but the resources it contains are not. In this
way you get support for the “resources = 0 means no tracking” convention for free.
ARGUMENTS
SEE ALSO
ResourcesNew
Allocate a resource tracking structure
SYNOPSIS
FUNCTION
This function allocates a dip Resources structure. The resource structure can be used to
register various resources as they are allocated, provided that the allocating function allows
you to register the resource. All resources allocated in this manner can be freed with a
single call to ResourcesFree. Examples of functions supporting this registration scheme are
ImageNew and special versions of the memory allocation routines.
Some operations consist of an initialization and a cleanup stage. These stages are often
performed by separate routines to allow the user to execute his/her own operations in
between. In DIPlib there usually is no directly callable cleanup function. Instead the
initialization routine registers its cleanup routine with a dip Resources structure provided
by the user. The cleanup operation is invoked through ResourcesFree.
All functions that support the registration leave you the choice not to register the resource.
This is indicated by supplying a zero instead of a resource tracking structure, unless
documented otherwise. The noItems parameters can be used to give the routine a hint
about the number of resources you will register. The structure grows automagically
whenever more resources are registered than indicated by the hint parameter.
ARGUMENTS
SEE ALSO
ResourceSubscribe
Track a resource
SYNOPSIS
FUNCTION
Track a resource. The resource must be represented by a void *. A handler function to free
the resource must be given. This function will be called through dip ResourcesFree with the
resource as its only parameter. If dip ResourceSubscribe fails, the resource is not
registered. It is allowed to pass a zero instead of a dip Resources structure, in which case
dip ResourceSubscribe returns silently.
ARGUMENTS
SEE ALSO
ResourceUnsubscribe
Stop tracking a resource
SYNOPSIS
FUNCTION
Stop tracking a resource. It will be removed from the dip Resources structure. The
resource itself will not be freed. If a zero is passed instead of a resource or the
dip Resources structure, dip ResourceUnsubscribe returns silently.
ARGUMENTS
SEE ALSO
RootMeanSquareError
difference measure
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the root mean square difference between each pixel value of in1 and in2.
Optionally the mask image can be used to exclude pixels from the calculation by setting the
value of these pixels in mask to zero.
ARGUMENTS
SEE ALSO
Rotation
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
This function rotates an 2-D image in over angle to out using three skews. The function
implements the rotation in the mathmetical sense, but note the Y-axis is positive
downwards! The rotation is over the centre of the image.
ARGUMENTS
Name Description
DIP BGV DEFAULT Default: fill with zeros
DIP BGV ZERO Fill with zeros
DIP BGV MAX VALUE Fill with maximum value for data type
DIP BGV MIN VALUE Fill with minimum value for data type
KNOWN BUGS
SEE ALSO
Skewing
596 Chapter 2. Function reference
Rotation3d
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
This function rotates an 3-D image in via the three Euler angles alpha, beta, gamma to out
using nine skews. The first rotation is about alpha around the initial 3-axis. The second
about beta around the intermediate 2-axis and the last about gamma around the final 3-axis.
The function implements the rotation in the mathmetical sense, but note the Y-axis is
positive downwards! The rotation is over the centre of the image.
ARGUMENTS
KNOWN BUGS
SEE ALSO
Skewing, Rotation3dAxis
598 Chapter 2. Function reference
Rotation3d Axis
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
This function rotates an 3-D image in over angle around axis to out using three skews.
The rotation axis is 0 (x), 1 (y) or 2 (z). The function implements the rotation in the
mathmetical sense, but note the Y-axis is positive downwards! The rotation is over the
centre of the image.
For backwards compatability, the macro Rotation3dAxis calls the function
Rotation3d Axis but uses 1, 2 and 3 to select the axis of rotation.
ARGUMENTS
KNOWN BUGS
SEE ALSO
Skewing, Rotation3d
600 Chapter 2. Function reference
ScalarImageNew
Allocate a scalar image
SYNOPSIS
FUNCTION
Allocate and forge a dip Image structure of the DIP IMTP SCALAR type.
ARGUMENTS
SEE ALSO
ImageNew, ImageFree
DIPlib function reference 601
ScanFrameWork
FrameWork for scanning multiple images
SYNOPSIS
FUNCTION
This function provides a framework for scanning nofin input images and nofout output
images in one dimension of the images. The dimension in which the image should be scan
can be specified or left to ScanFrameWork by specifiying the dimension with
DIP MONADIC OPTIMAL DIMENSION. See SeparableFrameWork for details.
ARGUMENTS
SEE ALSO
SeededWatershed
Morphological segmentation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Watershed segmentation with built-in region merging. max depth and max size control the
merging procedure. Any region with max size or less pixels and with max depth grey-value
difference or less will be merged to neighbouring regions when they touch (as opposed to
build a watershed). max size equal to 0 means that the size of the region is not tested when
merging. To avoid merging of seeds with no grey-value difference between them, set
max size to a negative value. The regions are grown according to the connectivity
parameter. See The connectivity parameter for more information. The output is either a
labelled image where the pixels belonging to a catchment basin are labelled, or a binary
image where the watershed pixels are 1 and the rest is 0. This is controlled by
binaryOutput.
As opposed to Watershed, this function takes a seeds input image, and grows the
catchment basins from there. The output image, when binaryOutput is DIP TRUE, will have
label values as given by the seed image.
If mask is not 0, only the pixels within mask will be considered. All the other pixels will be
untouched.
DIPlib function reference 603
ARGUMENTS
SEE ALSO
Select
Configurable selection function
SYNOPSIS
DATA TYPES
FUNCTION
This function can perform various pixel-by-pixel comparisons (smaller, smaller- equal, equal,
not equal, greater-equal, greater) between in1 ans in2. If the result of the comparison is
true, the corresponding pixel value of in3 is copied to out, otherwise it is copied from in4.
In short the following operation is performed for each pixel in the five images:
The images in2, in3 and in4 can be 0-D images acting as constants.
ARGUMENTS
SEE ALSO
SelectValue
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function returns a binary image with value 1 where in == value and value 0 elsewhere.
ARGUMENTS
SEE ALSO
SeparableConvolution
FrameWork for separable convolution filters
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function is a frontend to the lower level Convolve1d function. Each dimension can be
processed by a different filter.
process may be zero, indicating that all dimensions should be processed.
ARGUMENTS
SEE ALSO
SeparableFrameWork
FrameWork for separable filters
SYNOPSIS
FUNCTION
The dip SeparableFrameWork function is a framework for separable filters. This function
takes care of all the “administrative work” involved when processing a n-D dimensional
DIPlib Image n times with a 1-D filter. In short, using this function, one has only to create
an one dimension filter function and dip SeparableFrameWork takes care of the other stuff.
The in DIPlib Image is filtered nrOfProcesses times using the information in each element
of the process array. If nrOfProcesses is zero, only the first element of process is used to
filter in in all its dimensions.
ARGUMENTS
NOTE
SEE ALSO
Set
the value of a pixel
SYNOPSIS
FUNCTION
This function set a value of a pixel at position cor in the image out to the value const.
ARGUMENTS
SEE ALSO
SetComplex
Set a pixel value
SYNOPSIS
FUNCTION
This function set a value of a pixel at position cor in the image out to the value constant.
ARGUMENTS
SEE ALSO
SetFloat
Set a pixel value
SYNOPSIS
FUNCTION
This function set a value of a pixel at position cor in the image out to the value constant.
ARGUMENTS
SEE ALSO
SetInteger
Set a pixel value
SYNOPSIS
FUNCTION
This function set a value of a pixel at position cor in the image out to the value constant.
ARGUMENTS
SEE ALSO
Sharpen
Enhance an image
SYNOPSIS
DATA TYPES
See Laplace
FUNCTION
This function enhances the high frequencies (“sharpens”) of the input image in by
subtracting a Laplace filtered version of in from it. The weight parameter determines by
which amount the laplace information is subtracted from the original: output = input -
weight * laplace( input ) The sigmas are the Gaussian smoothing parameters of the
Laplace operation, and determine how strongly the high-frequency noise in in is suppressed.
ARGUMENTS
SEE ALSO
Laplace
618 Chapter 2. Function reference
Shift
an image manipulation function
SYNOPSIS
DATA TYPES
FUNCTION
This function shifts an image in the Fourier Domain. All frequiencies larger than the
Nyquist frequency are set to zero if killNy is true. It performs:
ARGUMENTS
SEE ALSO
Sigma
Adaptive uniform smoothing filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The Sigma filter is an adaptive Uniform smoothing filter. The value of the pixel
underinvestigation is replaced by the average of the pixelvalues in the filter region (as
specified by filterSize, shape and se) which lie in the interval +/- 2 sigma from the
value of the pixel that is filtered. If outputCount is DIP TRUE, the output values represent
the number of pixel over which the average has been calculated. When threshold is
DIP TRUE, the pixel intensities are being thresholded at +/- 2 sigma, when it is set to
DIP FALSE, the intensities are weighted with the Gaussian difference with the intensity of
the central pixel.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
Name Description
DIP FLT SHAPE DEFAULT default structuring element, same as
DIP FLT SHAPE RECTANGULAR
DIP FLT SHAPE RECTANGULAR rectangular structuring element
DIP FLT SHAPE ELLIPTIC elliptic structuring element
DIP FLT SHAPE DIAMOND diamond shaped structuring element
DIP FLT SHAPE PARABOLIC parabolic structuring element
DIP FLT SHAPE STRUCTURING ELEMENT use se as structuring element
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
LITERATURE
John-Sen Lee, Digital Image Smoothing and the Sigma Filter, Computer Vision, Graphics
and Image Processing, 24, 255-269, 1983
SEE ALSO
Sign
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the sign of the input image values, and outputs a signed integer typed image.
The sign of zero is defined as zero.
ARGUMENTS
SEE ALSO
SimulatedAttenuation
Simulation of the attenuation process
SYNOPSIS
DATA TYPES
FUNCTION
This function simulates an attenuation based on the model of a CSLM, using a ray tracing
method.
ARGUMENTS
LITERATURE
K.C. Strasters, H.T.M. van der Voort, J.M. Geusebroek, and A.W.M. Smeulders, Fast
attenuation correction in fluorescence confocal imaging: a recursive approach, BioImaging,
vol. 2, no. 2, 1994, 78-92.
DIPlib function reference 623
AUTHOR
SEE ALSO
AttenuationCorrection, ExponentialFitCorrection
624 Chapter 2. Function reference
Sin
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Sinc
mathematical function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
SingleOutputFrameWork
FrameWork for generation functions
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
SingularValueDecomposition
Singular value decomposition
SYNOPSIS
DATA TYPES
float, dfloat
FUNCTION
Computes the SVD of the ImageArray in, such that in = u * s * transpose(t), with s being
diagonal. The size of the in matrix is passed to the function via the IntegerArray sz. If the
input is of size m x n, then the outputs must be u: n x m, s: n x n; d: n x n.
ARGUMENTS
Sinh
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Skewing
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
This function skews the axis axis of in over an angle angle to out using the interpolation
method method. The skew is over the centre of the image. If periodicSkew is set to
DIP TRUE, the output image will be of the same size as the input image, and its pixels in the
skew dimension wrapped around the image boundaries. bgval is not used in this case.
ARGUMENTS
SEE ALSO
SmallObjectsRemove
Remove small objects from an image
SYNOPSIS
DATA TYPES
integer
FUNCTION
This function removes from the labeled image in those objects whose size (measured in the
number of pixels) is smaller than threshold.
ARGUMENTS
SEE ALSO
SobelGradient
A linear gradient filter
SYNOPSIS
DATA TYPES
FUNCTION
The SobelGradient filter computes a finite difference gradient (1 0 -1)/2 in the processDim,
and performs a local (1 2 1)/4 smoothing in the other dimensions. Note that in 2D, this
differs by a multiplication factor of 1/8 to the original definition by Sobel.
ARGUMENTS
SEE ALSO
Sort
Sort a block of data
SYNOPSIS
FUNCTION
Sorts a block of data (of size size and data type dataType ) using the algorithm specified
by algorithm.
ARGUMENTS
SEE ALSO
SortAnything
Sort data of any type
SYNOPSIS
FUNCTION
Sorts a block of data (of size size) using the algorithm specified by algorithm. This
routine requires the user to write two functions in order to fully implement the sorting
procedure. These are SortCompareFunction and SortSwapFunction.
ARGUMENTS
SEE ALSO
SortCompareFunction
Typedef for comparison function (sorting)
SYNOPSIS
FUNCTION
A function of this type must be supplied to the sorting algorithms for data of arbitrary
type. It should return DIP TRUE if data1[index1] > data2[index2].
Example:
dip_Boolean MyComplexCompare( void *data1, dip_int index1, void *data2, dip_int index2 )
{
dip_complex *cmplx1, *cmplx2;
dip_float magnitude1, magnitude2;
cmplx1 = data1;
cmplx2 = data2;
cmplx1 += index1;
cmplx2 += index2;
magnitude1 = sqrt( cmplx1->re * cmplx1->re + cmplx1->im * cmplx1->im );
magnitude2 = sqrt( cmplx2->re * cmplx2->re + cmplx2->im * cmplx2->im );
if ( magnitude1 > magnitude2 )
{
return( DIP_TRUE );
}
else
{
return( DIP_FALSE );
}
}
636 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
SortIndices
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of indices rather than the data itself using the algorithm specified by algorithm.
ARGUMENTS
SEE ALSO
SortIndices16
Sort indices to a block of data
SYNOPSIS
FUNCTION
Sorts a list of (16 bit) indices rather than the data itself using the algorithm specified by
algorithm.
ARGUMENTS
SEE ALSO
SortSwapFunction
Typedef for swap and copy function (sorting)
SYNOPSIS
FUNCTION
A function of this type must be supplied to the sorting algorithms for data of arbitrary
type. It should swap data1[index1] and data2[index2] if copy = DIP FALSE, and copy
data1[index1] to data2[index2] if copy = DIP TRUE.
Example:
void dip_MyComplexSwap( void *data1, dip_int index1, void *data2, dip_int index2, dip_Boolean
{
dip_complex *cmplx1, *cmplx2, tmpValue;
cmplx1 = data1;
cmplx2 = data2;
cmplx1 += index1;
cmplx2 += index2;
if ( copy == DIP_TRUE )
{
cmplx2->re = cmplx1->re;
cmplx2->im = cmplx1->im;
}
else
{
tmpValue.re = cmplx2->re;
tmpValue.im = cmplx2->im;
cmplx2->re = cmplx1->re;
cmplx2->im = cmplx1->im;
cmplx1->re = tmpValue.re;
cmplx1->im = tmpValue.im;
}
return;
}
640 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
Sqrt
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
StablePixelHeapFree
Destroy heap structure
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
StablePixelHeapIsEmpty
Query heap
SYNOPSIS
FUNCTION
Checks to see if there are any items on the heap. See StablePixelHeapNew for information
on the heap data structure.
ARGUMENTS
SEE ALSO
StablePixelHeapNew
Create a new heap structure
SYNOPSIS
FUNCTION
This function allocates space for a new dip StablePixelHeap structure. Memory allocated
is tracked in resources. The heap is dimensioned to hold pixels from an ndims-dimensional
image, and initially enough space is allocated for blocksize elements. The heap will be
expanded as necessary when used.
The heap stores the coordinates, the value and the pointer to a pixel in an image. Note that
the value does not need to equal the data pointed to by the pointer. ndims can be set to
zero, in which case no coordinates are stored; this does not affect the function of the value
and the pointer.
A heap is a priority queue data structure. Just like a queue, items can be added (pushed)
and subtracted (popped). However, in the priority queue the item popped is always the
higherst priority one: either the one with the highest-valued item (order is
DIP GVSO HIGH FIRST) or lowest-valued item (order is DIP GVSO LOW FIRST). When various
identically-valued items are stored on the heap, they will be extracted in the same order as
they were insterted (FIFO - first in, first out). If this order is unimportant (such as for the
GrowRegionsWeighted algorithm, use the more efficient dip PixelHeap instead. See
PixelHeapNew for information on the unstable heap structure.
ARGUMENTS
IMPLEMENTATION
SEE ALSO
StablePixelHeapPop
Pop item onto heap
SYNOPSIS
FUNCTION
Pops the next pixel from the heap. See StablePixelHeapNew for information on the heap
data structure. coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
If the stack was created with ndims set to 0, the coords pointer is ignored. coords,
pointer and value can be NULL if you are not interested in either those values.
ARGUMENTS
SEE ALSO
StablePixelHeapPush
Push item onto heap
SYNOPSIS
FUNCTION
Pushes a pixel onto the heap. See StablePixelHeapNew for information on the heap data
structure. All 3 values coords, pointer and value are stored, except if the heap was
created with ndims set to 0, in which case the coords pointer is ignored.
coords is a pointer to an array of dip ints, such as that obtained with
dip IntegerArray->array. It should have as many elements as the image dimensionality.
pointer is a pointer to any memory location, and value is the value to be used when
sorting.
ARGUMENTS
SEE ALSO
StandardDeviation
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the standard deviation of the pixel values over all those dimensions which are
specified by ps.
ARGUMENTS
SEE ALSO
StringAppend
Append a string to another
SYNOPSIS
FUNCTION
Concatenates str1 and str2 and puts the result in str1, which is increased in size if
necessary. If str2 is 0, cstr is used instead.
ARGUMENTS
SEE ALSO
StringArrayCopy
Copy a string array
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
StringArrayNew, StringArrayFree
IntegerArrayCopy, FloatArrayCopy, ComplexArrayCopy, DataTypeArrayCopy,
BooleanArrayCopy, VoidPointerArrayCopy, StringArrayCopy
DIPlib function reference 651
StringArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
StringArrayNew, StringArrayCopy
ArrayFree, IntegerArrayFree, FloatArrayFree, ComplexArrayFree,
BoundaryArrayFree, FrameWorkProcessArrayFree, DataTypeArrayFree, ImageArrayFree,
BooleanArrayFree, VoidPointerArrayFree, StringArrayFree, CoordinateArrayFree
652 Chapter 2. Function reference
StringArrayNew
Allocate an array of strings
SYNOPSIS
FUNCTION
This function allocates an array of strings. size specifies the size of the array, stringSize
the size of the individual strings, which are allocated too. If StringSize is zero, and init
is not, the strings in the array are initialised with init (in size and content). If both
stringSize and init are zero, strings of zero length are created. (see StringNew).
ARGUMENTS
SEE ALSO
StringArrayFree, StringArrayCopy
ArrayNew, IntegerArrayNew, FloatArrayNew, ComplexArrayNew, BoundaryArrayNew,
FrameWorkProcessArrayNew, DataTypeArrayNew, ImageArrayNew, BooleanArrayNew,
VoidPointerArrayNew, StringArrayNew, CoordinateArrayNew
DIPlib function reference 653
StringCat
Concatenate two strings
SYNOPSIS
FUNCTION
Concatenates str1 and str2 and puts the result in newStr, which is allocated. If str2 is 0,
cstr is used instead.
ARGUMENTS
SEE ALSO
StringCompare
Compare two strings
SYNOPSIS
FUNCTION
This function uses the strcmp function to compare orig and copy. If the strings are
different, an error is generated, or verdict obtains the value DIP FALSE, if it is not zero.
ARGUMENTS
SEE ALSO
StringCompareCaseInsensitive
Compare two strings without minding case
SYNOPSIS
FUNCTION
This function uses the strcasecmp (or stricmp) function to compare orig and copy. If the
strings are different, an error is generated, or verdict obtains the value DIP FALSE, if it is
not zero.
ARGUMENTS
SEE ALSO
StringCopy
Copy a String
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
StringCrop
Crop a string
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
StringFree
Free a string
SYNOPSIS
FUNCTION
This function frees a string data structure that has been allocated using StringNew.
ARGUMENTS
SEE ALSO
StringNew
DIPlib function reference 659
StringNew
Allocate a string
SYNOPSIS
FUNCTION
This function allocates a string of size size. If init is not zero, its contents is copied into
the new string. If size is zero, and init is not, the size of string is made equal to init
plus one.
ARGUMENTS
SEE ALSO
StringReplace
Replace the contents of one string with that of another
SYNOPSIS
FUNCTION
Replaces the content of str1 with str2. str1 is increased in size if necessary. If str2 is 0,
cstr is used instead.
ARGUMENTS
SEE ALSO
StructureTensor2D
Two dimensional Structure Tensor
SYNOPSIS
DATA TYPES
integer,float
FUNCTION
This function computes the Structure Tensor (ST) at each point in the image. For a
description of this technique see the references. There are two stages in the computation.
The first stage computes the gradient vector at each point, using Derivative with
parameters gradSpec and gradSigmas. The second stage, the tensor smoothing, is also
performed using Derivative (with order = 0). The parameters used are tensorSpec and
tensorSigmas.
If a mask image is given, a technique called normalised convolution (see references) is used
to “fill in” the missing data.
The routine has a number of output images. Each of these can be set to zero. If set to zero,
the corresponding result will not be computed. The following quantities are computed by
this routine:
orientation Orientation. Lies in the interval
(-pi/2,pi/2).
energy Sum of the two eigenvalues l1 and l2.
l1 The largest eigenvalue.
l2 The smallest eigenvalue.
anisotropy1 Measure for local anisotropy: ( l1 - l2 )
/ ( l1 + l2 ).
anisotropy2 Measure for local anisotropy: 1 - l2 /
l1.
662 Chapter 2. Function reference
ARGUMENTS
LITERATURE
Bernd Jahne, Practical Handbook on Image Processing for Scientific Applications, chapter
13, CRC Press, 1997
L.J. van Vliet and P.W. Verbeek, Estimators for Orientation and Anisotropy in Digitized
Images, in: J. van Katwijk, J.J. Gerbrands, M.R. van Steen, J.F.M. Tonino (eds.), ASCI’95,
Proc. First Annual Conference of the Advanced School for Computing and Imaging (Heijen,
NL, May 16-18), ASCI, Delft, 1995, pp. 442-450.
C.F. Westin, A Tensor Framework for Multidimensional Signal Processing, PhD thesis,
Linkoping University, Sweden, 1994
SEE ALSO
Derivative
DIPlib function reference 663
Sub
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in1 - in2 on a pixel by pixel basis. The data types of the
in1 and in2 image may be of different types. See Information about dyadic operations for
more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
SubComplex
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in - constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubFloat, Mul, MulFloat, MulComplex, Div, DivFloat,
DivComplex
DIPlib function reference 665
SubFloat
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function computes out = in - constant on a pixel by pixel basis. The data types of
the in1 image and constant may be of different types. See Information about dyadic
operations for more information about what the type of the output will be.
ARGUMENTS
SEE ALSO
Add, AddFloat, AddComplex, Sub, SubComplex, Mul, MulFloat, MulComplex, Div, DivFloat,
DivComplex
666 Chapter 2. Function reference
Subsampling
Interpolation function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Resampling
DIPlib function reference 667
Sum
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the sum of the pixel values over all those dimensions which are specified by ps.
ARGUMENTS
SEE ALSO
SumModulus
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the sum of the modulus the pixel values over all those dimensions which are
specified by ps.
ARGUMENTS
SEE ALSO
Tan
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh
670 Chapter 2. Function reference
Tanh
trigonometric function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
TestObjectAddNoise
TestObject generation function
SYNOPSIS
DATA TYPES
FUNCTION
This function adds a mixture of Gaussian and Poisson noise to a testobject at a specified
signal-to-noise ratio. The SNR is defined as the average object energy divided by the
average noise power.
ARGUMENTS
SEE ALSO
TestObjectBlur
TestObject generation function
SYNOPSIS
DATA TYPES
FUNCTION
This function blurs a testobject with a Gaussian psf, with a two dimensional in focus
diffraction limited incoherent PSF or with an user-supplied PSF. The xNyquist parameter
specifies the oversampling factor of the incoherent PSF and Gaussian PSF. The sigma of the
Gaussian PSF is equal to 0.9 * xNyquist.
ARGUMENTS
SEE ALSO
TestObjectCreate
TestObject generation function
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
This function can generate an aliasing free object (ellips, box, ellipsoid shell, box shell) or
uses an user-supplied object. The generated objects have their origin at the center in the
image, but can be generated with a sub-pixel random shift around the center, to average out
dicretization effects over several instances of the same generated object. Optinally the
generated object can be convolved with an isotropic Gaussian with a width specified by
objSigma. Elliptical objects are only supported for images with a dimsnionality equal or
less than three. The position boolean variable specifies whether a subpixel random shift
should be applied to the object. This can be used to average out digitisation error over a
repetition of the generation of the same object.
ARGUMENTS
SEE ALSO
TestObjectModulate
TestObject generation function
SYNOPSIS
DATA TYPES
Output: sfloat
FUNCTION
This function adds a sine modulation to a test object, with modulation the modulation
frequency and modulationDepth the modulation depth.
ARGUMENTS
SEE ALSO
Threshold
Point Operation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
This function thresholds an image at the threshold value. If the boolean binaryOutput is
true, Threshold will produce a binary image. Otherwise an image of the same type as the
input image is produced, with the pixels set to either foreground or background. In other
words: out = ( in >= threshold ? foreground : background)
ARGUMENTS
SEE ALSO
TikhonovMiller
Image restoration filter
SYNOPSIS
FUNCTION
ARGUMENTS
LITERATURE
G.M.P. van Kempen, Image Restoration in FLuorescence Microscopy, Ph.D. Thesis, Delft
University of Technology, 1999
SEE ALSO
Wiener, TikhonovRegularizationParameter
678 Chapter 2. Function reference
TikhonovRegularizationParameter
Determine the value of the regularisation parameter
SYNOPSIS
FUNCTION
This function implements different methods to estimate the value of the regularistion
parameter lambda of the TikhonovMiller restoration filter.
ARGUMENTS
LITERATURE
G.M.P. van Kempen, Image Restoration in FLuorescence Microscopy, Ph.D. Thesis, Delft
University of Technology, 1999
SEE ALSO
TikhonovRegularizationParameter
DIPlib function reference 679
TimerGet
Timing functions
SYNOPSIS
FUNCTION
This function get four Timer values elapsed since the last call to TimerSet. The elapsed
clock time is measured in a low (1 second) resolution, and in a high (microseconds)
resolution. However, this latter timer can only produce reliable results within 36 minutes
after the first (!) call to TimerSet has been made. The other two timer measure the amount
of system and user time used by the program since the last call to TimerSet.
ARGUMENTS
SEE ALSO
TimerSet
680 Chapter 2. Function reference
TimerSet
Timing functions
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
TimerGet
DIPlib function reference 681
Tophat
Morphological high-pass filter
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The top-hat is the difference between a morphological operation and the original image,
comparable to a high-pass filter. Which operation is used can be chosen through the
dip MphEdgeType and dip MphTophatPolarity parameters.
The rectangular, elliptic and diamond structuring elements are “flat”, i.e. these structuring
elements have a constant value. For these structuring elements, filterParam determines
the sizes of the structuring elements. When shape is set to DIP FLT SHAPE PARABOLIC,
filterParams specifies the curvature of the parabola. When shape is set to
DIP FLT SHAPE STRUCTURING ELEMENT, se is used as structuring element. It can be either a
binary or a grey-value image, but be careful: it is converted to the same data type as the
input image, and might therefore be clipped or loose precision. It is required (in the current
implementation) that the structuring element be odd in size. Its origin is the center.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
682 Chapter 2. Function reference
ARGUMENTS
SEE ALSO
tpi.h
Type iterator
SYNOPSIS
FUNCTION
Type iterator. For each data type specified by the define DIP TPI ALLOW, dip tpi.h will
include the file specified by the define DIP TPI FILE. If DIP TPI ALLOW is not defined the file
will be included for all data types. DIP TPI TYPES must be defined as a logical OR of
identifier flags and identifier group flags, as given in DIPlib’s data types and the table
below. During each “iteration” the main symbols defined by dip tpi.h are DIP TPI,
DIP TPI DATA TYPE, DIP TPI IDENTIFIER and DIP TPI EXTENSION. The following table
shows how these are defined for each data type:
DIP TPI DIP TPI DATA TYPE DIP TPI EXTENSION
DIP TPI IDENTIFIER
dip bin8 DIP DT BIN8 DIP DTID BIN8 b8
dip bin16 DIP DT BIN16 DIP DTID BIN16 b16
dip bin32 DIP DT BIN32 DIP DTID BIN32 b32
dip uint8 DIP DT UINT8 DIP DTID UINT8 u8
dip uint16 DIP DT UINT16 DIP DTID UINT16 u16
dip uint32 DIP DT UINT32 DIP DTID UINT32 u32
dip sint8 DIP DT SINT8 DIP DTID SINT8 s8
dip sint16 DIP DT SINT16 DIP DTID SINT16 s16
dip sint32 DIP DT SINT32 DIP DTID SINT32 s32
dip sfloat DIP DT SFLOAT DIP DTID SFLOAT sfl
dip dfloat DIP DT DFLOAT DIP DTID DFLOAT dfl
dip scomplex DIP DT SCOMPLEX DIP DTID SCOMPLEX scx
dip dcomplex DIP DT DCOMPLEX DIP DTID DCOMPLEX dcx
Using this include file it is possible to compile source code for different data types. We
recommend that instead of splitting your code into two files, one for generic code and one
for type specific code, that you use dip tpi.h to let the source file include itself. This also
prevents dependency problems with makefiles. A source file that includes itself through
dip tpi.h should have the following format:
contents of example.c:
#ifndef DIP_TPI
#include "diplib.h"
684 Chapter 2. Function reference
#else
#endif
In addition to the main defines as described above, there are a number of macro’s that are
defined by dip tpi.h:
DIP TPI FUNC ( function name ) attaches the current type suffix to the
function name.
DIP TPI DEFINE ( function name ) equivalent to: dip Error DIP TPI FUNC(
function name ) useful for function
definitions.
DIP TPI DECLARE ( function name ) equivalent to: dip Error DIP TPI FUNC(
function name ) useful for function
declarations. Don’t forget the trailing “;“.
DIP TPI NAME ( function name ) attaches the current type suffix to the
function name and puts double quotes
around the result, thus creating a string.
There are also a couple of defines that are only available for some of the data types:
When DIP TPI is
dip sfloat DIP TPI CAST R2C is defined as
dip scomplex
dip dfloat DIP TPI CAST R2C is defined as
dip dcomplex
dip scomplex DIP TPI CAST C2R is defined as dip sfloat
dip dcomplex DIP TPI CAST C2R is defined as dip dfloat
Other type iterators may be created by making a copy of the dip tpi.h file and replacing
DIP TPI throughout the file by a different name for the new type iterator.
ARGUMENTS
Name Description
DIP TPI ALLOW logical OR of data type identifier and identifier group flags to indicate
for which data types the file should be included
DIP TPI FILE Name of the file to be included by dip tpi.h
DIPlib function reference 685
SEE ALSO
Truncate
Arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
Computes the truncation of the input image values, and outputs a signed integer typed
image.
ARGUMENTS
SEE ALSO
UnderscoreSpaces
Replace spaces with underscores
SYNOPSIS
FUNCTION
This function replaces spaces in string with underscores. This function works in-place.
ARGUMENTS
SEE ALSO
Uniform
Uniform filter
SYNOPSIS
DATA TYPES
FUNCTION
This functions implements an uniform convolution filter with support for various filter
shapes.
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
UniformNoise
Generate an image disturbed by uniform noise
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
ARGUMENTS
EXAMPLE
lower = 1.0;
upper = 10.0;
DIPXX(dip_UniformNoise(in, out, lower, upper, &random ));
DIPlib function reference 691
SEE ALSO
UniformRandomVariable
Uniform random variable generator
SYNOPSIS
FUNCTION
ARGUMENTS
EXAMPLE
dip_Random random;
dip_float lower, upper, value;
lower = -1.0;
upper = 1.0;
DIPXX( dip_UniformRandomVariable( &random, lower, upper, &value));
SEE ALSO
Unregister
Remove a registry item
SYNOPSIS
FUNCTION
This function removes the Registry information of the ID of the Registry class class. See
Register for more information about DIPlib’s Registry.
ARGUMENTS
SEE ALSO
UpperEnvelope
Upper envelope transform (a flooding and an algebraic closing)
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
The Upper envelope transform produces a flooding of the input image (which is an algebraic
closing). See any article by F. Meyer for further explanations.
The Upper envelope is based on the watershed transform, each region being filled up to the
level where it meets a neighbouring region. See Watershed for information on the
parameters.
The bottom image is a second output image that contains the whole watershed region
painted with the lowest value in it. It is useful for stretching the input image: ( out - in ) /
( in - bottom ) . labels returns the label image used during region growing.
ARGUMENTS
SEE ALSO
Watershed, LocalMinima
DIPlib function reference 695
Variance
statistics function
SYNOPSIS
DATA TYPES
FUNCTION
Calculates the variance of the pixel values over all those dimensions which are specified by
ps.
ARGUMENTS
SEE ALSO
VarianceFilter
Sample Variance Filter
SYNOPSIS
DATA TYPES
FUNCTION
This function calculates for every pixel the sample variance of the pixels in the filter window
(it size specifiied by filterSize).
If shape is not equal to DIP FLT SHAPE STRUCTURING ELEMENT, se is allowed to be set to
zero. When shape is set to DIP FLT SHAPE STRUCTURING ELEMENT, filterParam is ignored,
(and can be set to zero).
ARGUMENTS
NOTE
The filter shape DIP FLT SHAPE PARABOLIC, as well as custom grey-value shapes, are not
supported.
SEE ALSO
Kuwahara
698 Chapter 2. Function reference
VectorDistanceTransform
Euclidean vector distance transform
SYNOPSIS
DATA TYPES
binary
FUNCTION
This function produces the vector components of the Euclidean distance transform. These
are stored in the output images, one for each dimension of the input image. See the
EuclideanDistanceTransform for detailed information about the parameters.
To compute the Euclidean distance from the vector compoments produced by this function,
one needs to multiply each componemt with the sampling distance, square the result, sum
the results for all components and take the square root of the sum.
ARGUMENTS
LITERATURE
See EuclideanDistanceTransform
KNOWN BUGS
See EuclideanDistanceTransform
AUTHOR
SEE ALSO
EuclideanDistanceTransform, GreyWeightedDistanceTransform
700 Chapter 2. Function reference
VoidPointerArrayCopy
Copy an array
SYNOPSIS
FUNCTION
This function copies the void pointer array src to dest. The array dest is created by this
function as well.
ARGUMENTS
SEE ALSO
VoidPointerArrayFind
Find value in array
SYNOPSIS
FUNCTION
Finds a value in an array and “returns” its index in the array. If found is zero,
VoidPointerArrayFind will produce an error if value is not found, otherwise found
obtains the search result (DIP FALSE if value is not found).
ARGUMENTS
SEE ALSO
VoidPointerArrayFree
Array free function
SYNOPSIS
FUNCTION
ARGUMENTS
SEE ALSO
VoidPointerArrayNew
Array allocation function
SYNOPSIS
FUNCTION
This function allocates the size elements of a dip VoidPointerArrayNew and sets the size
of the array to size.
ARGUMENTS
SEE ALSO
Watershed
Morphological segmentation
SYNOPSIS
DATA TYPES
integer, float
FUNCTION
Watershed segmentation with built-in region merging. max depth and max size control the
merging procedure. Any region with max size or less pixels and with max depth grey-value
difference or less will be merged to neighbouring regions when they touch (as opposed to
build a watershed). max size equal to 0 means that the size of the region is not tested when
merging. The regions are grown according to the connectivity parameter. See The
connectivity parameter for more information. The output is either a labelled image where
the pixels belonging to a catchment basin are labelled, or a binary image where the
watershed pixels are 1 and the rest is 0. This is controlled by binaryOutput.
If mask is not 0, only the pixels within mask will be considered. All the other pixels will be
marked as watershed pixels.
ARGUMENTS
SEE ALSO
WeightedAdd
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
WeightedDiv
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
This function calculates out = in1 / weight * in2; If (weight * in2) is zero, out will be
set to zero as well.
ARGUMENTS
SEE ALSO
WeightedMul
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
WeightedSub
arithmetic function
SYNOPSIS
DATA TYPES
FUNCTION
ARGUMENTS
SEE ALSO
Wiener
Image Restoration Filter
SYNOPSIS
FUNCTION
This function performs an image restoration using the Wiener filter. The Wiener filter is the
linear restoration filter that is optimal in mean square error sense.
ARGUMENTS
LITERATURE
G.M.P. van Kempen, Image Restoration in FLuorescence Microscopy, Ph.D. Thesis, Delft
University of Technology, 1999
SEE ALSO
PseudoInverse, TikhonovMiller
710 Chapter 2. Function reference
Wrap
Wrap an image
SYNOPSIS
DATA TYPES
FUNCTION
This function wraps the in image around its image borders. wrap specifies the number of
pixels over which the image has to wrapped in each dimension.
ARGUMENTS
SEE ALSO
Xor
logic operation
SYNOPSIS
DATA TYPES
binary, integer
FUNCTION
The function Xor performs the logic XOR operation between the corresponding pixels in
in1 and in2, and stores the result in out.
ARGUMENTS
SEE ALSO
Assorted topics
712
DIPlib function reference 713
SEE ALSO
FillBoundaryArray, SeparableFrameWork
714 Chapter 3. Assorted topics
The structure dipio Compression specifies the compression method to use when writing an
image file, and contains the following elements:
Data type Name Description
dipio CompressionMethod method Compression method
dip int level Compression parameter, dependent on method
dipio CompressionMethod is an enum with the known compression methods. File formats
typically only support one or a few of these, and most of these methods do not have a
parameter to set, in which case level is ignored. If an unsupported compression method is
selected, no compression is done. The dipio CompressionMethod has the following values:
Name Description
DIPIO CMP DEFAULT Default compression method for the file format
DIPIO CMP NONE No compression
DIPIO CMP GZIP ZIP compression, using zlib. The level parameter is between
1 and 10, 1 being the faster, lesser compression and 10 being
the slower, higher compression.
DIPIO CMP DEFLATE Deflate (same as DIPIO CMP GZIP)
DIPIO CMP COMPRESS Using UNIX’s “compress” utility, which uses the LZW
algorithm
DIPIO CMP LZW LZW compression (same as DIPIO CMP COMPRESS)
DIPIO CMP JPEG Lossy JPEG compression. The level parameter is between 1
and 100, higher numbers giving better quality output but
larger files.
DIPIO CMP PACKBITS PackBits
DIPIO CMP THUNDERSCAN ThunderScan
DIPIO CMP NEXT NeXT
DIPIO CMP CCITTRLE CCITT RLE
DIPIO CMP CCITTRLEW CCITT RLE/W
DIPIO CMP CCITTFAX3 CCITT Group 3
DIPIO CMP CCITTFAX4 CCITT Group 4
Thus only DIPIO CMP GZIP and DIPIO CMP JPEG currently have a level to set.
The TIFF file writer understand the methods DIPIO CMP NONE, DIPIO CMP DEFLATE,
DIPIO CMP LZW, DIPIO CMP JPEG, DIPIO CMP PACKBITS, DIPIO CMP THUNDERSCAN,
DIPIO CMP NEXT, DIPIO CMP CCITTRLE, DIPIO CMP CCITTRLEW, DIPIO CMP CCITTFAX3 and
DIPIO CMP CCITTFAX4. It defaults to DIPIO CMP DEFLATE. The level parameter is currently
not used.
DIPlib function reference 715
The ICS file writer understands DIPIO CMP NONE, DIPIO CMP GZIP and DIPIO CMP COMPRESS,
although DIPIO CMP COMPRESS is currently not implemented. It defaults to DIPIO CMP GZIP.
The GIF file writer only understands DIPIO CMP LZW. The compression method selected is
simply ignored.
The JPEG file writer only understands DIPIO CMP JPEG. The compression method selected
is simply ignored.
All other file writers do not compress, and simply ignore the compression method requested.
716 Chapter 3. Assorted topics
STRUCTURE
This structure is an aggregate of common parameters for derivative operators. Its current
definition is:
typedef struct
{
dip_DerivativeFlavour flavour;
dip_float truncation;
} dip_DerivativeSpec;
SEE ALSO
StructureTensor2D, Derivative
DIPlib function reference 717
Pixel values are represented by different types, called data types. DIPlib supports the data
types given in the following table:
data type dip DataType data type suffix
identifier
dip bin8 DIP DT BIN8 DIP DTID BIN8 b8
dip bin16 DIP DT BIN16 DIP DTID BIN16 b16
dip bin32 DIP DT BIN32 DIP DTID BIN32 b32
dip uint8 DIP DT UINT8 DIP DTID UINT8 u8
dip uint16 DIP DT UINT16 DIP DTID UINT16 u16
dip uint32 DIP DT UINT32 DIP DTID UINT32 u32
dip sint8 DIP DT SINT8 DIP DTID SINT8 s8
dip sint16 DIP DT SINT16 DIP DTID SINT16 s16
dip sint32 DIP DT SINT32 DIP DTID SINT32 s32
dip sfloat DIP DT SFLOAT DIP DTID SFLOAT sfl
dip dfloat DIP DT DFLOAT DIP DTID DFLOAT dfl
dip scomplex DIP DT SCOMPLEX DIP DTID SCOMPLEX scx
dip dcomplex DIP DT DCOMPLEX DIP DTID DCOMPLEX dcx
The data types can be divided into five classes: the binary, unsigned integer, signed integer,
floating point and complex classes. Different data types in the same class (e.g. dip uint8
and dip uint16) provide a different range of values they can represent.
The complex data types are defines as follows:
The binary data types are simply aliases for a set of corresponding unsigned integer types.
The reason for having a separate typedef for the binary types is that they are not used like
ordinary integers. Each bit of the integer can store one binary value. When manipulating
binary data, care must be taken not to change any of the other bits of the integer used for
storing it.
The dip DataType enumeration is used to represent data types symbolically. It is used in
dip Image‘s to indicate what the data type of the image is. Data type identifiers are used
by the type iterator (see tpi.h) and overload schemes (see ovl.h and overload.h). Type
suffixes are used to give type specific routines a unique name. Using a standard set of
suffixes enables the type iterator and overload schemes to deal with these type specific
routines. The dip DataType enumeration, data type identifiers and suffixes can be found in
the table above.
718 Chapter 3. Assorted topics
In addition to the data type identifiers for individual data types, there are also defines to
represent an entire group. These are given in the following table:
Data type identifier group data types
DIP DTGID UINT unsigned integer
DIP DTGID UNSIGNED unsigned integer
DIP DTGID SINT signed integer
DIP DTGID INT signed and unsigned integer
DIP DTGID INTEGER signed and unsigned intege
DIP DTGID FLOAT floating-point
DIP DTGID REAL integer and floating-point
DIP DTGID COMPLEX complex floating-point
DIP DTGID SIGNED signed integer, floating-point and complex
DIP DTGID BINARY binary
DIP DTGID ALL all
SEE ALSO
DataTypeGetInfo
DIPlib function reference 719
SEE ALSO
Pixel tables provide an efficient way to encode a multi-dimensional binary object. DIPlib’s
dip PixelTable implements this using runlength encoding (in 2-D this coding scheme is
known as pxy-tables).
A DIPlib pixel table is a structure (defined in dip pixel table.h) that incorporates a
link-list of runlengths. Each run-length consists of a n-D coordinate (integer array) and the
length of the run along the X dimension. All the runlength’s in total encode the binary
object.
LITERATURE
The Registry
A number of file reading and writing functions are included in dipIO. These are registered in
the ImageReadRegistry and the ImageWriteRegistry. Through this registry, ImageRead
and ImageWrite are able to read from and write to any registered file format. You can add
your own functions to these (the interface functions for this are not documented yet),
thereby increasing the possibilities of ImageRead and ImageWrite.
Below you can find a list of currently supported file formats for both reading and writing.
To obtain the format ID from the registry, you need to include the specified file and call the
specified function.
Reading
Writing
Within DIPlib all data, i.e. multi-dimensional data, such as images, and scalar, are all
represented by the same object: the image. Scalars are stored as zero dimensional images.
Examine, for example, the following code to compute the sum over all the grey values:
dip_Image img;
dip_Image value;
...
dip_Sum ( img, 0, value, 0 );
Which stores the sum over all the pixel values of img in the 0-D image value. We often
want to directly manipulate scalars, in which case we need to extract the value. This can be
accomplished easily with the GetInteger, GetFloat or the GetComplex functions:
dip_Image img;
dip_Image valueimg;
dip_float value;
...
dip_Sum ( img, 0, valueimg, 0 );
dip_GetFloat ( valueimg, &value, 0 );
printf ( "The sum is: %f\n", value );
726 Chapter 3. Assorted topics
Convolution can be explained in just a few words: it is a local weighted average (the weights
can be negative). This of course does not explain how to use it or what its properties are.
For this we refer to the following sources:
Ian T. Young, Jan J. Gerbrands and Lucas J. van Vliet, “Fundamentals of Image
Processing”.
Alan V. Oppenheim, Alan S. Willsky and I.T. Young, “Signals and Systems”, Prentice-Hall,
1983.
Anil K. Jain, “Fundamentals of Digital Image Processing”, Prentice-Hall, 1989.
“The Digital Signal Processing Handbook”, Vijay K. Madisetti and Douglas B. Williams
(eds), CRC Press + IEEE Press, 1998.
Kenneth R. Castleman, “Digital Image Processing”, Prentice-Hall, 1996.
DIPlib function reference 727
There are two kinds of sorting routines in DIPlib. The first sorts a one-dimensional array of
data, the second sorts a set of indices to a one-dimensional array of data. The result of the
sort routines can be summarised as follows:
Sort: data[ i ] <= data[ i + 1 ]
Sort indices: data[ indices[ i ] ] <= data[ indices[ i + 1 ] ]
Note that the number of indices does not have to be equal to the amount of pixels in the
image, it may be either smaller or larger. The indices themselves should of course “point” to
a valid pixel.
The sorting algorithms are described in the following reference:
Donald E. Knuth, “The Art of Computer Programming, volume 3: Sorting and Searching”,
second edition, Addison-Wesley, 1998.
728 Chapter 3. Assorted topics
There are two types of dyadic operations. First there are operations such as Add, Sub, etc...
which take two input images. The second category consists of functions such as AddFloat,
AddComplex etc... The data type of the output image given the data types of the input
images is given by the following table:
dcomplex scomplex dfloat sfloat sint32 sint16
dcomplex dcomplex dcomplex dcomplex dcomplex dcomplex dcomplex
scomplex dcomplex scomplex dcomplex scomplex scomplex scomplex
dfloat dcomplex dcomplex dfloat dfloat dfloat dfloat
sfloat dcomplex scomplex dfloat sfloat sfloat sfloat
sint32 dcomplex scomplex dfloat sfloat sint32 sint32
sint16 dcomplex scomplex dfloat sfloat sint32 sint16
sint8 dcomplex scomplex dfloat sfloat sint32 sint16
uint32 dcomplex scomplex dfloat sfloat sint32 sint32
uint16 dcomplex scomplex dfloat sfloat sint32 sint16
uint8 dcomplex scomplex dfloat sfloat sint32 sint16
binary dcomplex scomplex dfloat sfloat sint32 sint16
sint8 uint32 uint16 uint8 binary
dcomplex dcomplex dcomplex dcomplex dcomplex dcomplex
scomplex scomplex scomplex scomplex scomplex scomplex
dfloat dfloat dfloat dfloat dfloat dfloat
sfloat sfloat sfloat sfloat sfloat sfloat
sint32 sint32 sint32 sint32 sint32 sint32
sint16 sint16 sint32 sint16 sint16 sint16
sint8 sint8 sint32 sint16 sint8 sint8
uint32 sint32 uint32 uint32 uint32 uint32
uint16 sint16 uint32 uint16 uint16 uint16
uint8 sint8 uint32 uint16 uint8 uint8
binary sint8 uint32 uint16 uint8 sint8
The output data type of an operation involving an image and a constant of one of the types:
dip complex, dip float, dip int, is given by the following table:
DIPlib function reference 729
DESCRIPTION
dip Image is the structure that is used to store images in DIPlib. It contains a number of
fields that are used to describe an image. The type field stores the type of the image using a
dip ImageType enumeration. Currently scalar images are the only supported type
(DIP IMTP SCALAR). The DIP IMTP ALIEN type is used internally by DIPlib for creating
interfaces to other packages. Whether the other fields in the dip Image are meaningful
depends on the image type. A dip Image may contain fields specific to the current image
type. These will be discussed on the pages pertaining to the type in question. The standard
fields that are always present are:
field type short description access functions
dip ImageType The image type ImageGetType,
ImageSetType
dip ImageState The image state (none)
dip DataType Data type used to store ImageGetDataType,
pixel values ImageSetDataType
dip IntegerArray Dimensions of the image ImageGetDimensions,
ImageGetDimensionality,
ImageSetDimensions
void * Pointer to the pixel data ImageGetData
dip int Plane number, for binary ImageGetPlane
images
dip IntegerArray Stride array (see below) ImageGetStride
Pixel values are stored in the data type specified by the data type field. For a list of possible
data types see DIPlib’s data types.
The dimensionality of the image and the size of each individual dimension is stored in the
dimensions Array.
The data pointer points to the pixel at the origin of the image. For each dimension the
stride array holds the interleave between two neigbouring pixels in memory. The following
equation may be used to compute the address of a pixel at a coordinate specified by an
array called cor[]:
(N-1)
address = origin + Sum cor[i] * stride[i]
i=0
A dip Image structure does not necessarily have pixel data associated with it. When a
dip Image does not contain pixel data, it is said to be in the “raw” state. A dip Image that
does contain data, is said to be “forged”. For binary images the plane field holds the
number of the bit in which the binary data is stored. Access to the fields of a dip Image is
DIPlib function reference 731
restricted to a number of functions, which are given in the table above. The “set” functions
can only be used on “raw” images.
SEE ALSO
DIPlib uses a different name for the various possible connectivites than you might be used
to. This is to generalize this parameter to images of any dimensionality. It is defined as
follows: if connectivity is 1 all pixels for which only one coordinate differs from the pixel’s
coordinates by maximally 1 are considered neighbours; if it is 2, all pixels for which one or
two coordinates differ maximally 1 are considered neighbours. The connectivity can never
be larger than the image dimensionality.
In terms of the obsolete connectivity definitions we have:
In 2-D this connectivity corresponds to and forms this
structuring
element
1 4 connectivity diamond
2 8 connectivity square
-1 4-8 connectivity octagon
-2 8-4 connectivity octagon
In 3-D this connectivity corresponds to and forms this
structuring
element
1 6 connectivity octahedron
2 18 connectivity cuboctahedron
3 26 connectivity cube
-1 6-26 connectivity small rhombicuboc-
tahedron
-3 26-6 connectivity small rhombicuboc-
tahedron
The negative connectivities are only defined for the functions in binary morphology such as
BinaryDilation and BinaryErosion. These alternate steps with different connectivity to
produce a better approximation to an isotropic structuring element.