ML Reference
|
This class defines a rectangular subimage region of standard ML dimensions. More...
#include <mlSubImageBox.h>
Public Types | |
typedef TImageVector< intT > | VectorType |
The vector type used for corner members v1 and v2. More... | |
Public Member Functions | |
Constructors | |
TSubImageBox () | |
Constructor: creates an empty subimage region by setting v1 to (0,...,0) and v2 to (-1,...,-1). More... | |
TSubImageBox (const VectorType &vector1, const VectorType &vector2) | |
Constructor: creates a subimage from two passed vectors vector1 and vector2 . More... | |
TSubImageBox (const VectorType extent) | |
Constructor: creates a subimage from an extent , i.e., v1 is set to (0,...,0) and v2 is set to (extent.x-1,...,extent.u-1). More... | |
Properties and operators | |
bool | operator== (const TSubImageBox< intT > &box) const |
Returns true if box has identical components; otherwise, it returns false . More... | |
bool | operator!= (const TSubImageBox< intT > &box) const |
Returns false if box has identical components; otherwise, it returns true . More... | |
bool | isEmpty () const |
Returns true if subimage region is empty, i.e., if any of the components of v1 is greater than the corresponding component of v2. More... | |
intT | getNumVoxels () const |
Returns number of voxels in the subimage region, i.e., the product of all extents if this is not empty; otherwise, 0 is returned. More... | |
VectorType | getExtent () const |
Returns the extents of the subimage region. More... | |
void | correct () |
Swaps all components where v1. More... | |
Public Attributes | |
VectorType | v1 |
Corner v1 of the subimage region (included in region). More... | |
VectorType | v2 |
Corner v2 of the subimage region (also included in region!). More... | |
Functions and methods on TSubImageBox<intT>. | |
void | makeEmpty () |
Makes box empty by setting v1 to (0,...,0) and v2 to (-1,...,-1), i.e., constructor state is restored. More... | |
TSubImageBox< intT > | intersect (const TSubImageBox< intT > &box) const |
Member function version to intersect this with a given box . More... | |
TSubImageBox< intT > | merge (const TSubImageBox< intT > &box) const |
Member function version to merge this with a given box . More... | |
VectorType | clamp (const VectorType &position) const |
Clamps the position to the nearest position inside the SubImageBox. More... | |
bool | contains (const VectorType &position) const |
Returns true if position is inside the SubImageBox. More... | |
void | translate (const VectorType &offsetVector) |
Shifts the entire box by an offset given by offsetVector . More... | |
static TSubImageBox< intT > | intersect (const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2) |
Returns the overlapping region of subimage regions box1 and box2 . More... | |
static TSubImageBox< intT > | merge (const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2) |
Returns the region containing both subimage regions box1 and box2 . More... | |
static void | get3DCorners (const TSubImageBox< intT > &box, VectorType corners[8]) |
Returns the corners of the 3D box extents of box in corners . More... | |
This class defines a rectangular subimage region of standard ML dimensions.
The subimage region is defined by two corners given by two objects of class TVector.
Thread-safety: This class is reentrant.
Notes:
Examples to initialize a subimage region:
Definition at line 52 of file mlSubImageBox.h.
typedef TImageVector<intT> ml::TSubImageBox< intT >::VectorType |
The vector type used for corner members v1 and v2.
Definition at line 57 of file mlSubImageBox.h.
|
inline |
Constructor: creates an empty subimage region by setting v1 to (0,...,0) and v2 to (-1,...,-1).
Definition at line 77 of file mlSubImageBox.h.
|
inline |
Constructor: creates a subimage from two passed vectors vector1
and vector2
.
ImageVector components are left as they are. This way, the caller is responsible to create a valid/invalid subimage region.
Definition at line 84 of file mlSubImageBox.h.
|
inline |
Constructor: creates a subimage from an extent
, i.e., v1 is set to (0,...,0) and v2 is set to (extent.x-1,...,extent.u-1).
Definition at line 90 of file mlSubImageBox.h.
TImageVector< intT > ml::TSubImageBox< intT >::clamp | ( | const VectorType & | position | ) | const |
Clamps the position
to the nearest position inside the SubImageBox.
If the SubImageBox is empty, the result vector contains undefined values.
Definition at line 310 of file mlSubImageBox.h.
References ml::compMax(), and ml::compMin().
|
inline |
Returns true
if position
is inside the SubImageBox.
Definition at line 200 of file mlSubImageBox.h.
void ml::TSubImageBox< intT >::correct |
Swaps all components where v1.
Definition at line 264 of file mlSubImageBox.h.
|
inlinestatic |
Returns the corners of the 3D box extents of box
in corners
.
All returned corners will be ImageVector(0) if box
is empty. All c,t, and u components are always set to 0.
Definition at line 215 of file mlSubImageBox.h.
References ml::TSubImageBox< intT >::isEmpty(), ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Returns the extents of the subimage region.
If subimage region is empty, then 0 is returned.
Definition at line 137 of file mlSubImageBox.h.
Referenced by ml::SubImage::setBox(), and ml::PagedImage::setImageExtent().
|
inline |
Returns number of voxels in the subimage region, i.e., the product of all extents if this is not empty; otherwise, 0 is returned.
There is no check for integer overflows.
Definition at line 123 of file mlSubImageBox.h.
References ml::compMul().
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax().
|
inline |
Member function version to intersect this with a given box
.
Definition at line 183 of file mlSubImageBox.h.
|
static |
Returns the overlapping region of subimage regions box1
and box2
.
A result with (v1.x>v2.x || ... || v1.z>v1.z) is interpreted as empty. See also isEmpty(). This is especially true if that already holds for box1
or box2
.
Definition at line 282 of file mlSubImageBox.h.
References ml::compMax(), ml::compMin(), ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Returns true
if subimage region is empty, i.e., if any of the components of v1 is greater than the corresponding component of v2.
Otherwise, false
is returned.
Definition at line 116 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< intT >::get3DCorners(), and ml::TSubImageBox< intT >::merge().
|
inline |
Makes box empty by setting v1 to (0,...,0) and v2 to (-1,...,-1), i.e., constructor state is restored.
Definition at line 175 of file mlSubImageBox.h.
References ml::TImageVector< CompIntType >::set().
|
inline |
Member function version to merge this with a given box
.
Definition at line 190 of file mlSubImageBox.h.
|
static |
Returns the region containing both subimage regions box1
and box2
.
Returns the region containing both subimage regions loc1
and loc2
.
Merging two empty regions result in an empty region; if only one of the regions is empty, the other region is returned.
Two empty regions result to an empty region; if only one region is empty, then the other region is returned.
Definition at line 294 of file mlSubImageBox.h.
References ml::compMax(), ml::compMin(), ml::TSubImageBox< intT >::isEmpty(), ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Returns false
if box
has identical components; otherwise, it returns true
.
Definition at line 108 of file mlSubImageBox.h.
References ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Returns true
if box
has identical components; otherwise, it returns false
.
Definition at line 102 of file mlSubImageBox.h.
References ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Shifts the entire box by an offset given by offsetVector
.
Definition at line 206 of file mlSubImageBox.h.
VectorType ml::TSubImageBox< intT >::v1 |
Corner v1 of the subimage region (included in region).
Convention: the vector components are always less than or equal to the corresponding components of v2; otherwise, the subimage region will be interpreted as being empty.
Definition at line 63 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< intT >::get3DCorners(), ml::TSubImageBox< intT >::intersect(), ml::TSubImageBox< intT >::merge(), ml::TSubImageBox< intT >::operator!=(), ml::TSubImageBox< intT >::operator==(), and ml::TSubImageCursorBase< DATATYPE >::TSubImageCursorBase().
VectorType ml::TSubImageBox< intT >::v2 |
Corner v2 of the subimage region (also included in region!).
Convention: the vector components are always greater than or equal to the corresponding components of v1; otherwise, the subimage region will be interpreted as being empty.
Definition at line 69 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< intT >::get3DCorners(), ml::TSubImageBox< intT >::intersect(), ml::TSubImageBox< intT >::merge(), ml::TSubImageBox< intT >::operator!=(), and ml::TSubImageBox< intT >::operator==().