IOLink
IOL_v1.1.0_release
|
A multi-dimensional region defined by its origin and its size. More...
#include <iolink/Region.h>
Public Types | |
using | VectorType = Vector< T, N > |
using | SizeType = Vector< T, N > |
Public Member Functions | |
Region () | |
Create an empty region. | |
Region (const VectorType &origin, const SizeType &size) | |
Create a region with given origin and size. More... | |
template<typename U , size_t P> | |
Region (const Region< U, P > &other) | |
Build a region from another of different dimension and different type. More... | |
size_t | dimensionCount () const |
Return number of dimension of this region. | |
const VectorType & | origin () const |
Return region's origin. | |
const SizeType & | size () const |
return size of region More... | |
size_t | elementCount () const |
Return number of elements (pixel, voxel, samples) contained in the region. More... | |
VectorType | min () const |
return min region coordinates More... | |
VectorType | max () const |
return max region coordinates More... | |
bool | isEmpty () const |
Indicates if region is empty. More... | |
bool | contains (const Region &other) const |
Returns if the current region contains the given one. More... | |
bool | contains (const VectorType &position) const |
Returns if the given region contains the given position vector. More... | |
bool | intersect (const Region &other) const |
Returns if the given region intersects the given position vector. More... | |
Region | intersection (const Region &other) const |
Returns the intersection region between current and given one. More... | |
Region | extractSliceFromAxis (size_t dimension, T origin) const |
Returns a region of size one along one axis. More... | |
bool | operator== (const Region &other) const |
Returns the intersection region between current and given one. More... | |
Region (const RegionX< T > &other) | |
operator RegionX< T > () const | |
std::string | toString () const |
Return a string representation. | |
A multi-dimensional region defined by its origin and its size.
Origin is always the left-bottom corner of the region.
T | The type of region indexers |
N | The dimension of the region. |
Region definition is different according to its indexer type. Float-indexed-regions are defined from origin point (Org) to Max = Org + region size. Integer-indexed-regions are defined from Org to Max = Org + region size - 1
Up-boundaries are not included for integer-indexers-regions (except when size is 0 and region is a point).
Up-boundaries are included for float-indexers-regions.
Aliases can be used to made this class more practical to use. They use the following convention: RegionNX
Where N is the dimension and X the type. The types currently available are:
Examples:
iolink::Region< T, N >::Region | ( | const VectorType & | origin, |
const SizeType & | size | ||
) |
Create a region with given origin and size.
origin | vector containing region origin |
size | vector containing region size |
|
inlineexplicit |
Build a region from another of different dimension and different type.
If dimension of other is smaller than dimension of region (ex. creating a 3D region from a 2D region) behavior is as follow:
bool iolink::Region< T, N >::contains | ( | const Region< T, N > & | other | ) | const |
Returns if the current region contains the given one.
other | region to test if it is contained into current one |
bool iolink::Region< T, N >::contains | ( | const VectorType & | position | ) | const |
Returns if the given region contains the given position vector.
position | point to test if it is contained into current one |
size_t iolink::Region< T, N >::elementCount | ( | ) | const |
Return number of elements (pixel, voxel, samples) contained in the region.
For Integer-indexed-regions, it return product of each dimensions. This method has no sense for Float-indexed-regions and thus return 0
Region iolink::Region< T, N >::extractSliceFromAxis | ( | size_t | dimension, |
T | origin | ||
) | const |
Returns a region of size one along one axis.
dimension | axis on which the slice must be selected |
origin | position of slice in given dimension |
InvalidArgument | if dimension or origin are out of range |
e.g. a 3D region {{0, 0, 0}, {5, 6, 7}}
e.g. a 3D region with non-null origin { {2, 3, 4}, {5, 6, 7}}
extractSliceFromAxis(0, 3) returns 3D region {{5, 3, 4}, {1, 6, 7}}
bool iolink::Region< T, N >::intersect | ( | const Region< T, N > & | other | ) | const |
Returns if the given region intersects the given position vector.
other | region to test if it intersects with current one |
Region iolink::Region< T, N >::intersection | ( | const Region< T, N > & | other | ) | const |
Returns the intersection region between current and given one.
other | region |
bool iolink::Region< T, N >::isEmpty | ( | ) | const |
Indicates if region is empty.
VectorType iolink::Region< T, N >::max | ( | ) | const |
return max region coordinates
|
inline |
return min region coordinates
bool iolink::Region< T, N >::operator== | ( | const Region< T, N > & | other | ) | const |
Returns the intersection region between current and given one.
other | region |
|
inline |
return size of region