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. | |
Public Member Functions | |
Constructors | |
TSubImageBox () | |
Constructor: Creates empty subimage region by setting v1 to (0,...,0) and v2 to (-1,...,-1). | |
TSubImageBox (const VectorType &vector1, const VectorType &vector2) | |
Constructor: Creates subimage from two passed vectors vector1 and vector2 . | |
TSubImageBox (const VectorType extent) | |
Constructor: Creates subimage from an extent , i.e., v1 is set to (0,...,0) and v2 is set to (extent.x-1,...,extent.u-1). | |
Properties and operators | |
bool | operator== (const TSubImageBox< intT > &box) const |
Returns true if box has identical components like this, otherwise returns false . | |
bool | operator!= (const TSubImageBox< intT > &box) const |
Returns false if box has identical components like this, otherwise return true . | |
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. | |
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. | |
VectorType | getExtent () const |
Returns the extents of the subimage region. | |
void | correct () |
Swaps all components where v1. | |
Public Attributes | |
VectorType | v1 |
Corner v1 of the subimage region (included in region). | |
VectorType | v2 |
Corner v2 of the subimage region (also included in region!). | |
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. | |
TSubImageBox< intT > | intersect (const TSubImageBox< intT > &box) const |
Member function version to intersect this with a given box . | |
TSubImageBox< intT > | merge (const TSubImageBox< intT > &box) const |
Member function version to merge this with a given box . | |
VectorType | clamp (const VectorType &position) const |
Clamps the position to the nearest position inside the SubImageBox. | |
bool | contains (const VectorType &position) const |
Returns true if position is inside the SubImageBox. | |
void | translate (const VectorType &offsetVector) |
Shifts the whole box by an offset given by offsetVector . | |
static TSubImageBox< intT > | intersect (const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2) |
Returns the overlapping region of subimage regions box1 and box2 . | |
static TSubImageBox< intT > | merge (const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2) |
Returns the region containing both subimage regions box1 and box2 . | |
static void | get3DCorners (const TSubImageBox< intT > &box, VectorType corners[8]) |
Returns the corners of the 3d box extents of box in corners . | |
This class defines a rectangular subimage region of standard ML dimensions.
The subimage region is defined by two corners given by 2 objects of class TVector.
Thread-safety: This class is reentrant.
Notes:
Example 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 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 subimage from two passed vectors vector1
and vector2
.
ImageVector components are left as they are; So the caller is responsible to create a valid/invalid subimage region.
Definition at line 84 of file mlSubImageBox.h.
|
inline |
Constructor: Creates 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.
|
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 not check for integer overflows.
Definition at line 123 of file mlSubImageBox.h.
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::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.
Two empty regions result to an empty one; if only one is empty, the other one is returned.
Two empty regions result to an empty one, if only one is empty then the other one is returned.
Definition at line 294 of file mlSubImageBox.h.
References ml::TSubImageBox< intT >::isEmpty(), ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Returns false
if box
has identical components like this, otherwise return 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 like this, otherwise returns false
.
Definition at line 102 of file mlSubImageBox.h.
References ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
|
inline |
Shifts the whole 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 smaller than or equal the corresponding components of v2, otherwise the subimage region will be interpreted as 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 bigger than or equal the corresponding components of v1, otherwise the subimage region will be interpreted as 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==().