Support types module #include "diplib.h"
Types used for image samples (pixels), and related support functionality
Namespaces
- namespace dip::
Option:: CmpProp - Namespace to emulate an enumerator, contains values more...
Classes
-
class dip::
AlignedBuffer - A container used to allocate 32-byte aligned buffers. more...
-
template<typename T>class dip::
DimensionArray - A dynamic array type optimized for few elements. more...
-
struct dip::
QuartilesResult - Represents the quartiles, see
dip::Quartiles. more... -
struct dip::
Range - Used in indexing to indicate a regular subset of pixels along one image dimension. more...
-
struct dip::
RegressionParameters - Represents the result of a 2D regression analysis: . more...
Aliases
-
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::
FloatArray = dip::DimensionArray - An array to hold filter parameters.
-
using dip::
FloatCoordinateArray = std::vector<FloatArray> - An array of subpixel coordinates.
-
using dip::
IntegerArray = dip::DimensionArray - An array to hold strides, filter sizes, etc.
-
using dip::
Option:: CmpPropFlags = dip::detail::Options - Determines which properties to compare. Combines multiple
dip::Option::CmpPropEnumeratorvalues, predefined values are indip::Option::CmpProp. -
using dip::
RangeArray = dip::DimensionArray - An array of ranges
-
using dip::
sint = std::ptrdiff_t - An integer type to be used for strides and similar measures.
-
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::
uint = std::size_t - An integer type to be used for sizes and the like.
-
using dip::
UnsignedArray = dip::DimensionArray - An array to hold dimensions, dimension lists, etc.
Enums
-
enum class dip::
Option:: AcceptDataTypeChange: uint8 - The function
dip::Image::ReForgetakes this option to control how to handle protected images. more... -
enum class dip::
Option:: AllowSingletonExpansion: uint8 - The function
dip::Image::CheckIsMasktakes this option to control how sizes are compared. more... -
enum class dip::
Option:: CmpPropEnumerator: uint8 - Determines which properties to compare. more...
-
enum class dip::
Option:: CropLocation: uint8 - The function
dip::Image::Croptakes this option to control which pixels are taken. more... -
enum class dip::
Option:: ThrowException: uint8 - Some functions that check for a condition optionally throw an exception if that condition is not met. more...
Functions
-
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. more...
-
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.
-
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::
sortIndices(dip::DimensionArray& indices, dip::DimensionArray const& data) - Sorts the
indicesarray with indices into thedataarray, 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.
-
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 if they have different size and/or contain different values.
-
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, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhselements are smaller than allrhselements. -
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}”.
-
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
lhselements are smaller or equal than allrhselements. -
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, 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, 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, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhselements are larger than allrhselements. -
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, dip::DimensionArray const& rhs) -> bool - Compares two arrays, returns true only if they have the same size and all
lhselements are larger or equal than allrhselements. -
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.
Variables
-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: All = Shape+ColorSpace+PixelSize constexpr dip::Option::CmpProp::Shape+dip::Option::CmpProp::ColorSpace+dip::Option::CmpProp::PixelSize.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: AllSizes = Sizes+TensorElements constexpr dip::Option::CmpProp::Sizes+dip::Option::CmpProp::TensorElements.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: ColorSpace = CmpPropEnumerator::ColorSpace constexpr dip::Option::CmpPropEnumerator::ColorSpace.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: DataType = CmpPropEnumerator::DataType constexpr dip::Option::CmpPropEnumerator::DataType.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Dimensionality = CmpPropEnumerator::Dimensionality constexpr dip::Option::CmpPropEnumerator::Dimensionality.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Full = Shape+Strides+TensorStride constexpr dip::Option::CmpProp::Shape+dip::Option::CmpProp::Strides+dip::Option::CmpProp::TensorStride.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: PixelSize = CmpPropEnumerator::PixelSize constexpr dip::Option::CmpPropEnumerator::PixelSize.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Samples = DataType+Sizes+TensorElements constexpr dip::Option::CmpProp::DataType+dip::Option::CmpProp::Sizes+dip::Option::CmpProp::TensorElements.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Shape = DataType+Sizes+TensorShape constexpr dip::Option::CmpProp::DataType+dip::Option::CmpProp::Sizes+dip::Option::CmpProp::TensorShape.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Sizes = CmpPropEnumerator::Sizes constexpr dip::Option::CmpPropEnumerator::Sizes.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: Strides = CmpPropEnumerator::Strides constexpr dip::Option::CmpPropEnumerator::Strides.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorElements = CmpPropEnumerator::TensorElements constexpr dip::Option::CmpPropEnumerator::TensorElements.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorShape = CmpPropEnumerator::TensorShape constexpr dip::Option::CmpPropEnumerator::TensorShape.-
dip::Option::CmpPropFlags const dip::
Option:: CmpProp:: TensorStride = CmpPropEnumerator::TensorStride constexpr dip::Option::CmpPropEnumerator::TensorStride.
Macros
- #define DIP_DECLARE_OPTIONS(EnumType, OptionsType)
- Declare a type used to pass enumerated options to a function or class. more...
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). |
Alias documentation
using dip:: Option:: CmpPropFlags = dip::detail::Options
Determines which properties to compare. Combines multiple dip::Option::CmpPropEnumerator values,
predefined values are in dip::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
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.
bool
dip:: BooleanFromString(
dip::String const& input, dip::String const& trueString, dip::String const& falseString)
Translates a string input parameter that is meant as a boolean value.
bool
dip:: StringCompareCaseInsensitive(
dip::String const& string1, dip::String const& string2)
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!
Variable documentation
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: DataType
= CmpPropEnumerator::DataType constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Dimensionality
= CmpPropEnumerator::Dimensionality constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Sizes
= CmpPropEnumerator::Sizes constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Strides
= CmpPropEnumerator::Strides constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: TensorShape
= CmpPropEnumerator::TensorShape constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: TensorElements
= CmpPropEnumerator::TensorElements constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: TensorStride
= CmpPropEnumerator::TensorStride constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: ColorSpace
= CmpPropEnumerator::ColorSpace constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: PixelSize
= CmpPropEnumerator::PixelSize constexpr
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: AllSizes
= Sizes+TensorElements constexpr
dip::Option::CmpProp::Sizes + dip::Option::CmpProp::TensorElements.
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Samples
= DataType+Sizes+TensorElements constexpr
dip::Option::CmpProp::DataType + dip::Option::CmpProp::Sizes + dip::Option::CmpProp::TensorElements.
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Shape
= DataType+Sizes+TensorShape constexpr
dip::Option::CmpProp::DataType + dip::Option::CmpProp::Sizes + dip::Option::CmpProp::TensorShape.
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: Full
= Shape+Strides+TensorStride constexpr
dip::Option::CmpProp::Shape + dip::Option::CmpProp::Strides + dip::Option::CmpProp::TensorStride.
dip::Option::CmpPropFlags const dip:: Option:: CmpProp:: All
= Shape+ColorSpace+PixelSize constexpr
dip::Option::CmpProp::Shape + dip::Option::CmpProp::ColorSpace + dip::Option::CmpProp::PixelSize.
Macro documentation
#define DIP_DECLARE_OPTIONS (EnumType, OptionsType)
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.