module #include "diplib.h"
Support types Types used for image samples (pixels), and related support functionality
Namespaces
- namespace dip::
Option:: CmpProp - Namespace to emulate an enumerator, contains values
Classes
-
template<typename T>class dip::
DimensionArray - A dynamic array type optimized for few elements.
-
struct dip::
Range - Used in indexing to indicate a regular subset of pixels along one image dimension.
-
struct dip::
RegressionParameters - Represents the result of a 2D regression analysis: .
-
struct dip::
QuartilesResult - Represents the quartiles, see
dip::Quartiles
. -
class dip::
AlignedBuffer - A container used to allocate 32-byte aligned buffers.
Aliases
-
using dip::
Option:: CmpPropFlags = dip::detail::Options - Determines which properties to compare. Combines multiple
dip::Option::CmpPropEnumerator
values, predefined values are indip::Option::CmpProp
. -
using dip::
sint = std::ptrdiff_t - An integer type to be used for strides and similar measures.
-
using dip::
uint = std::size_t - An integer type to be used for sizes and the like.
-
using dip::
IntegerArray = dip::DimensionArray - An array to hold strides, filter sizes, etc.
-
using dip::
UnsignedArray = dip::DimensionArray - An array to hold dimensions, dimension lists, etc.
-
using dip::
FloatArray = dip::DimensionArray - An array to hold filter parameters.
-
using dip::
BooleanArray = dip::DimensionArray - An array used as a dimension selector.
-
using dip::
CoordinateArray = std::vector<UnsignedArray> - An array of pixel coordinates.
-
using dip::
FloatCoordinateArray = std::vector<FloatArray> - An array of subpixel coordinates.
-
using dip::
String = std::string - A string, used to specify an option
-
using dip::
StringArray = std::vector<String> - An array of strings, used to specify an option per dimension
-
using dip::
StringSet = std::set<String> - A collection of strings, used to specify multiple independent options
-
using dip::
RangeArray = dip::DimensionArray - An array of ranges
Enums
-
enum class dip::
Option:: ThrowException: uint8{ DONT_THROW, DO_THROW } - Some functions that check for a condition optionally throw an exception if that condition is not met.
-
enum class dip::
Option:: AllowSingletonExpansion: uint8{ DONT_ALLOW, DO_ALLOW } - The function
dip::Image::CheckIsMask
takes this option to control how sizes are compared. -
enum class dip::
Option:: AcceptDataTypeChange: uint8{ DONT_ALLOW, DO_ALLOW } - The function
dip::Image::ReForge
takes this option to control how to handle protected images. -
enum class dip::
Option:: CropLocation: uint8{ CENTER, MIRROR_CENTER, TOP_LEFT, BOTTOM_RIGHT } - The function
dip::Image::Crop
takes this option to control which pixels are taken. -
enum class dip::
Option:: CmpPropEnumerator: uint8{ DataType, Dimensionality, Sizes, Strides, TensorShape, TensorElements, TensorStride, ColorSpace, PixelSize } - Determines which properties to compare.
Functions
-
template<typename T>void dip::
sortIndices(dip::DimensionArray& indices, dip::DimensionArray const& data) - Sorts the
indices
array with indices into thedata
array, from smallest to largest. The sort is stable. -
template<typename T>auto dip::
SquareDistance(dip::DimensionArray const& v1, dip::DimensionArray const& v2) -> double - Computes the Square Euclidean distance between two points.
-
template<typename T>auto dip::
Distance(dip::DimensionArray const& v1, dip::DimensionArray const& v2) -> double - Computes the Square Euclidean distance between two points.
-
template<typename T>void dip::
ArrayUseParameter(dip::DimensionArray& array, dip::uint nDims, T defaultValue = {}) - Check the length of an array, and extend it if necessary and possible.
-
auto dip::
BooleanFromString(dip::String const& input, dip::String const& trueString, dip::String const& falseString) -> bool - Translates a string input parameter that is meant as a boolean value.
-
auto dip::
StringCompareCaseInsensitive(dip::String const& string1, dip::String const& string2) -> bool - A case-insensitive string comparison, use only with ASCII characters!
-
void dip::
ToLowerCase(dip::String& string) - Convert a string to lower case, use only with ASCII characters!
-
void dip::
ToUpperCase(dip::String& string) - Convert a string to upper case, use only with ASCII characters!
Operators
-
template<typename T>auto dip::
operator==(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and contain the same values.
-
template<typename T>auto dip::
operator!=(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true if they have different size and/or contain different values.
-
template<typename T>auto dip::
operator>(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhs
elements are larger than allrhs
elements. -
template<typename T>auto dip::
operator<(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhs
elements are smaller than allrhs
elements. -
template<typename T>auto dip::
operator>=(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhs
elements are larger or equal than allrhs
elements. -
template<typename T>auto dip::
operator<=(dip::DimensionArray const& lhs, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhs
elements are smaller or equal than allrhs
elements. -
template<typename T>auto dip::
operator==(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator!=(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator>(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator<(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator>=(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator<=(dip::DimensionArray const& lhs, T const& rhs) -> dip::DimensionArray - Compares an array to a scalar, returns a boolean array.
-
template<typename T>auto dip::
operator<<(std::ostream& os, dip::DimensionArray const& array) -> std::ostream& - Writes the array to a stream
-
auto dip::
operator<<(std::ostream& os, dip::Range const& range) -> std::ostream& - Display a range as “{start, stop, step}”.
Variables
-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: DataType constexpr dip::Option::CmpPropEnumerator::DataType
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Dimensionality constexpr dip::Option::CmpPropEnumerator::Dimensionality
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Sizes constexpr dip::Option::CmpPropEnumerator::Sizes
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Strides constexpr dip::Option::CmpPropEnumerator::Strides
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorShape constexpr dip::Option::CmpPropEnumerator::TensorShape
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorElements constexpr dip::Option::CmpPropEnumerator::TensorElements
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorStride constexpr dip::Option::CmpPropEnumerator::TensorStride
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: ColorSpace constexpr dip::Option::CmpPropEnumerator::ColorSpace
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: PixelSize constexpr dip::Option::CmpPropEnumerator::PixelSize
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: AllSizes constexpr dip::Option::CmpProp::Sizes
+dip::Option::CmpProp::TensorElements
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Samples constexpr dip::Option::CmpProp::DataType
+dip::Option::CmpProp::Sizes
+dip::Option::CmpProp::TensorElements
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Shape constexpr dip::Option::CmpProp::DataType
+dip::Option::CmpProp::Sizes
+dip::Option::CmpProp::TensorShape
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Full constexpr dip::Option::CmpProp::Shape
+dip::Option::CmpProp::Strides
+dip::Option::CmpProp::TensorStride
.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: All constexpr dip::Option::CmpProp::Shape
+dip::Option::CmpProp::ColorSpace
+dip::Option::CmpProp::PixelSize
.
Macros
- #define DIP_DECLARE_OPTIONS
- Declare a type used to pass enumerated options to a function or class.
Class documentation
struct dip:: RegressionParameters
Represents the result of a 2D regression analysis: .
Variables | |
---|---|
dip::dfloat intercept | intercept, . |
dip::dfloat slope | slope, . |
struct dip:: QuartilesResult
Represents the quartiles, see dip::Quartiles
.
Variables | |
---|---|
dip::dfloat minimum | Minimum (0th percentile). |
dip::dfloat lowerQuartile | Lower or first quartile (25th percentile). |
dip::dfloat median | Median or second quartile (50th percentile). |
dip::dfloat upperQuartile | Upper or third quartile (75th percentile). |
dip::dfloat maximum | Maximum (100th percentile). |
Enum documentation
enum class dip:: Option:: ThrowException: uint8
Some functions that check for a condition optionally throw an exception if that condition is not met.
Enumerators | |
---|---|
DONT_THROW = 0 | Do not throw and exception, return false if the condition is not met. |
DO_THROW = 1 | Throw an exception if the condition is not met. |
enum class dip:: Option:: AllowSingletonExpansion: uint8
The function dip::Image::CheckIsMask
takes this option to control how sizes are compared.
Enumerators | |
---|---|
DONT_ALLOW = 0 | Do not allow singleton expansion. |
DO_ALLOW = 1 | Allow singleton expansion. |
enum class dip:: Option:: AcceptDataTypeChange: uint8
The function dip::Image::ReForge
takes this option to control how to handle protected images.
Enumerators | |
---|---|
DONT_ALLOW = 0 | Do not allow data type change, the output image is always of the requested type. |
DO_ALLOW = 1 | Allow data type change, if the output image is protected, it will be used as is. |
enum class dip:: Option:: CropLocation: uint8
The function dip::Image::Crop
takes this option to control which pixels are taken.
Enumerators | |
---|---|
CENTER = 0 | The pixel at the origin of the input image is also at the origin in the output image. |
MIRROR_CENTER = 1 |
Same as CENTER , but for even-sized images, the origin is presumed to be left of center, rather than right of center.
|
TOP_LEFT = 2 | The corner of the image at coordinates {0,0,0…} is kept in the corner. |
BOTTOM_RIGHT = 3 |
The corner of the image opposite that of TOP_LEFT is kept in the corner.
|
enum class dip:: Option:: CmpPropEnumerator: uint8
Determines which properties to compare.
Implicitly casts to dip::Option::CmpPropFlags
. Combine constants together with the +
operator.
Enumerators | |
---|---|
DataType = 0 | Compares data type |
Dimensionality = 1 | Compares number of dimensions |
Sizes = 2 | Compares image size |
Strides = 3 | Compares image strides |
TensorShape = 4 | Compares tensor size and shape |
TensorElements = 5 | Compares number of tensor elements |
TensorStride = 6 | Compares tensor stride |
ColorSpace = 7 | Compares color space |
PixelSize = 8 | Compares pixel size |
Function documentation
template<typename T>
void
dip:: ArrayUseParameter(dip::DimensionArray& array,
dip::uint nDims,
T defaultValue = {})
Check the length of an array, and extend it if necessary and possible.
This function is used where a function’s
input parameter is an array that is supposed to match the image dimensionality nDims
. The user can give an
array of that length, or an array with a single value, which will be used for all dimensions, or an empty array,
in which case the default value defaultValue
will be used for all dimensions.
Macro documentation
#define DIP_DECLARE_OPTIONS
Declare a type used to pass enumerated options to a function or class.
This macro is used as follows:
enum class MyOption { clean, fresh, shine }; DIP_DECLARE_OPTIONS( MyOption, MyOptions )
MyOptions
will be a type that combines one or more values from MyOption.
These values can be combined using the +
operator.
A variable of type MyOptions
can be tested using its Contains
method
which returns a bool
:
MyOptions opts {}; // No options are set opts = MyOption::fresh; // Set only one option opts = MyOption::clean + MyOption::shine; // Set only these two options if( opts.Contains( MyOption::clean )) {...} // Test to see if `MyOption::clean` is set
The Contains
method returns true only of all flags specified in the input are set.
The ==
operator returns true only if the two operands contain exactly the same
set of flags.
Note that there should be no more than 32 options within the enumerator.
This macro will not work within a class definition – You will need to manually declare the type alias and define the operator outside of the class.