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. | |
Deprecated | |
intT | getSize () const |
VectorType | getExt () const |
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:
SubImageBox loc; loc.v1.x=0; loc.v1.y=0; loc.v1.z=0; loc.v1.c=0; loc.v1.t=0; loc.v1.u=0; loc.v2.x=5; loc.v2.y=5; loc.v2.z=5; loc.v2.c=0; loc.v2.t=0; loc.v2.u=0; // or alternatively loc.v1 = ImageVector(0,0,0,0,0,0); loc.v2 = ImageVector(5,5,5,0,0,0); // or another alternative: loc = SubImageBox( ImageVector(0,0,0,0,0,0),ImageVector(5,5,5,0,0,0) );
Definition at line 51 of file mlSubImageBox.h.
typedef TImageVector<intT> ml::TSubImageBox< intT >::VectorType |
The vector type used for corner members v1 and v2.
Definition at line 56 of file mlSubImageBox.h.
ml::TSubImageBox< intT >::TSubImageBox | ( | ) | [inline] |
Constructor: Creates empty subimage region by setting v1 to (0,...,0) and v2 to (-1,...,-1).
Definition at line 76 of file mlSubImageBox.h.
ml::TSubImageBox< intT >::TSubImageBox | ( | const VectorType & | vector1, |
const VectorType & | vector2 | ||
) | [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.
ml::TSubImageBox< intT >::TSubImageBox | ( | const VectorType | extent | ) | [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 91 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 393 of file mlSubImageBox.h.
References ml::compMax(), ml::compMin(), and ML_TRACE_IN.
bool ml::TSubImageBox< intT >::contains | ( | const VectorType & | position | ) | const [inline] |
Returns true
if position
is inside the SubImageBox.
Definition at line 209 of file mlSubImageBox.h.
void ml::TSubImageBox< intT >::correct | ( | ) |
Swaps all components where v1.
* > v2.*. I.e., an empty vector becomes non empty if corresponding components are not equal.
Definition at line 335 of file mlSubImageBox.h.
References ml::TVector6DBase< CompIntType >::c, ml::TVector6DBase< CompIntType >::t, ml::TVector6DBase< CompIntType >::u, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.
static void ml::TSubImageBox< intT >::get3DCorners | ( | const TSubImageBox< intT > & | box, |
VectorType | corners[8] | ||
) | [inline, static] |
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 228 of file mlSubImageBox.h.
VectorType ml::TSubImageBox< intT >::getExt | ( | ) | const [inline] |
Definition at line 265 of file mlSubImageBox.h.
VectorType ml::TSubImageBox< intT >::getExtent | ( | ) | const [inline] |
Returns the extents of the subimage region.
If subimage region is empty then 0 is returned.
Definition at line 141 of file mlSubImageBox.h.
Referenced by ml::SubImage::setBox().
intT ml::TSubImageBox< intT >::getNumVoxels | ( | ) | const [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 125 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax().
intT ml::TSubImageBox< intT >::getSize | ( | ) | const [inline] |
Definition at line 262 of file mlSubImageBox.h.
TSubImageBox<intT> ml::TSubImageBox< intT >::intersect | ( | const TSubImageBox< intT > & | box | ) | const [inline] |
Member function version to intersect this with a given box
.
Definition at line 189 of file mlSubImageBox.h.
TSubImageBox< intT > ml::TSubImageBox< intT >::intersect | ( | const TSubImageBox< intT > & | box1, |
const TSubImageBox< intT > & | box2 | ||
) | [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 353 of file mlSubImageBox.h.
References ml::compMax(), ml::compMin(), ML_CATCH_RETHROW, ML_TRACE_IN, ML_TRY, ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
bool ml::TSubImageBox< intT >::isEmpty | ( | ) | const [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 118 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< MLint >::get3DCorners(), and ml::TSubImageBox< intT >::merge().
void ml::TSubImageBox< intT >::makeEmpty | ( | ) | [inline] |
Makes box empty by setting v1 to (0,...,0) and v2 to (-1,...,-1), i.e., constructor state is restored.
Definition at line 180 of file mlSubImageBox.h.
TSubImageBox< intT > ml::TSubImageBox< intT >::merge | ( | const TSubImageBox< intT > & | loc1, |
const TSubImageBox< intT > & | loc2 | ||
) | [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 371 of file mlSubImageBox.h.
References ml::compMax(), ml::compMin(), ml::TSubImageBox< intT >::isEmpty(), ML_CATCH_RETHROW, ML_TRACE_IN, ML_TRY, ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.
TSubImageBox<intT> ml::TSubImageBox< intT >::merge | ( | const TSubImageBox< intT > & | box | ) | const [inline] |
Member function version to merge this with a given box
.
Definition at line 197 of file mlSubImageBox.h.
bool ml::TSubImageBox< intT >::operator!= | ( | const TSubImageBox< intT > & | box | ) | const [inline] |
Returns false
if box
has identical components like this, otherwise return true
.
Definition at line 110 of file mlSubImageBox.h.
bool ml::TSubImageBox< intT >::operator== | ( | const TSubImageBox< intT > & | box | ) | const [inline] |
Returns true
if box
has identical components like this, otherwise returns false
.
Definition at line 104 of file mlSubImageBox.h.
void ml::TSubImageBox< intT >::translate | ( | const VectorType & | offsetVector | ) | [inline] |
Shifts the whole box by an offset given by offsetVector
.
Definition at line 217 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 62 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< MLint >::get3DCorners(), ml::TSubImageBox< intT >::intersect(), ml::TSubImageBox< intT >::merge(), ml::TSubImageBox< MLint >::operator!=(), ml::TSubImageBox< MLint >::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 68 of file mlSubImageBox.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImageBox< MLint >::get3DCorners(), ml::TSubImageBox< intT >::intersect(), ml::TSubImageBox< intT >::merge(), ml::TSubImageBox< MLint >::operator!=(), and ml::TSubImageBox< MLint >::operator==().