MeVisLab Toolbox Reference
|
ImageVector is the 6D TVector specialization used by the ML for all image indexing. More...
#include <mlImageVector.h>
Public Types | |
typedef TVector< TVector6DBase< CompIntType > > | ParentClass |
Parent class of this class. | |
typedef ParentClass::ComponentType | ComponentType |
Integer type used by this vector. | |
Public Types inherited from ml::TVector< TVectorBase > | |
enum | { NumberOfDimensions = ParentClass::NumberOfDimensions } |
Enumerator defining the dimension of this class. More... | |
typedef TVectorBase::ComponentType | ComponentType |
Integer type used by this vector. | |
typedef TVectorBase | ParentClass |
Parent class of this class. | |
Public Member Functions | |
TImageVector () | |
Constructor. All components are initialized to 0. | |
TImageVector (const ParentClass &v) | |
Copy constructor from Base class. | |
TImageVector (const ComponentType i) | |
Constructor which initializes all components to i. | |
template<typename T2IntType > | |
TImageVector (const TImageVector< T2IntType > &v2) | |
Copy constructor from another TVector of same or other integer type, values are cast. | |
TImageVector (const ComponentType xp, const TImageVector< ComponentType > &p) | |
Constructor which assigns X to x and copies other elements from p. | |
void | set (const ComponentType v=0) |
Sets all components to v or - if v is not specified - to 0. | |
void | set (const ParentClass &v) |
Like assignment operator. | |
TImageVector (const MLint num, const ComponentType *const arr, const ComponentType deflt) | |
Constructor which initializes the vector components by copying them from arr[0] ,..., arr[num-1]. | |
TImageVector (const ComponentType xp, const ComponentType yp, const ComponentType zp, const ComponentType cp, const ComponentType tp, const ComponentType up) | |
Constructor which initializes all components with the values x, y, z, c, t and u. | |
TImageVector (const Vector6 &v6) | |
Copies the six double components of v6 into x, ..., u, respectively. | |
void | set (const ComponentType vx, const ComponentType vy, const ComponentType vz=0, const ComponentType vc=0, const ComponentType vt=0, const ComponentType vu=0) |
Sets vector to (vx, vy, vz, vc, vt, vu). Not passed components are set to 0. | |
void | get (ComponentType *const xp=nullptr, ComponentType *const yp=nullptr, ComponentType *const zp=nullptr, ComponentType *const cp=nullptr, ComponentType *const tp=nullptr, ComponentType *const up=nullptr) const |
Returns the subset of those Vector components whose corresponding pointers are not NULL. | |
bool | iterate (const TImageVector< ComponentType > &ext) |
Coordinate incrementation/iterator function inside ext. | |
Vector6 | toVector6 () const |
Returns the vector contents as Vector6. | |
Vector3 | toVector3 () const |
Returns the x,y,z components as Vector3. | |
Public Member Functions inherited from ml::TVector< TVectorBase > | |
std::string | print (const std::string &openStr="", const std::string &sepStr=" ", const std::string &termStr="", const MLint16 numDigits=-1) const |
Returns the string openStr + v.array[0] + sepStr + ... + v.array[NumberOfDimensions-2] + sepStr + v.array[NumberOfDimensions-1] + termStr. | |
TVector () | |
Constructor. All components are initialized to 0. | |
TVector (const ComponentType i) | |
Constructor which initializes all components to i. | |
TVector (const TVector< TVectorBase > &v2) | |
TVector< TVectorBase > & | operator= (const TVector< TVectorBase > &v2) |
template<typename TVectorBase2 > | |
TVector (const TVector< TVectorBase2 > &v2) | |
Copy constructor from another TVector of same or other integer type, values are cast. | |
TVector (const ComponentType xp, const TVector &p) | |
Constructor which assigns X to x and copies other elements from p. | |
TVector (const MLint num, const ComponentType *const arr, const ComponentType deflt) | |
Constructor which initializes the vector components by copying them from arr[0] ,..., arr[num-1]. | |
void | copy (const MLint num, ComponentType *const arr) const |
Copy the first num elements from internal array into arr starting with array[0] to arr[0] to array[num-1] to arr[num-1], respectively. | |
void | set (const ComponentType v=0) |
Sets all components to v or - if v is not specified - to 0. | |
void | set (const TVector &v) |
Like assignment operator. | |
TVector< TVectorBase > | operator+ (const TVector &b) const |
Add the corresponding component from b to each component. | |
TVector< TVectorBase > & | operator+= (const TVector< TVectorBase > &b) |
Adds the corresponding component from b to each component. | |
TVector< TVectorBase > | operator- (const TVector< TVectorBase > &b) const |
Calculates and returns *this-b. | |
TVector< TVectorBase > & | operator-= (const TVector< TVectorBase > &b) |
Subtracts the corresponding component from b from each component. | |
TVector< TVectorBase > | operator* (const TVector< TVectorBase > &b) const |
Calculates and returns the multiplication of each component of this with its corresponding component from b. | |
TVector< TVectorBase > & | operator*= (const TVector< TVectorBase > &b) |
Multiplies each component with its corresponding components from b. | |
TVector< TVectorBase > | operator+ (const ComponentType b) const |
Calculates and returns the addition of each component of *this with scalar b. | |
TVector< TVectorBase > | operator- (const ComponentType b) const |
Subtracts the scalar b from all components. | |
TVector< TVectorBase > | operator* (const ComponentType b) const |
Multiplies all components with scalar b. | |
TVector< TVectorBase > | operator/ (const TVector< TVectorBase > &b) const |
Calculates and returns the division of each component of *this by its corresponding component from b. | |
TVector< TVectorBase > & | operator/= (const TVector< TVectorBase > &b) |
Divides each component by its corresponding component from b. | |
bool | operator== (const TVector< TVectorBase > &b) const |
Equality operator: Returns whether each component of a is equal to its corresponding component of b. | |
bool | operator!= (const TVector< TVectorBase > &b) const |
Inequality operator: Returns whether any component differs from its corresponding component of b. | |
bool | operator< (const TVector< TVectorBase > &b) const |
"Smaller" comparison operator, return whether the 'smaller' relation is valid for all components. | |
bool | operator<= (const TVector< TVectorBase > &b) const |
"Smaller Or Equal" comparison operator, return whether the 'smaller or equal' relation is valid for all components. | |
bool | operator> (const TVector< TVectorBase > &b) const |
"Greater" comparison operator, return whether the 'greater' relation is valid for all components. | |
bool | operator>= (const TVector< TVectorBase > &b) const |
"Greater or Equal" comparison operator, return whether the 'greater or equal' relation is valid for all components. | |
TVector< TVectorBase > | operator& (const TVector< TVectorBase > &b) const |
Performs a binary "And" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > | operator| (const TVector< TVectorBase > &b) const |
Performs a binary "Or" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > | operator^ (const TVector< TVectorBase > &b) const |
Performs a binary "Xor" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > & | operator&= (const TVector< TVectorBase > &b) |
Performs a binary "And" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > & | operator|= (const TVector< TVectorBase > &b) |
Performs a binary "Or" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > & | operator^= (const TVector< TVectorBase > &b) |
Performs a binary "Xor" of all components with the corresponding components of another Vector. | |
TVector< TVectorBase > | operator& (const ComponentType b) const |
Performs a binary "And" of all components with an integer. | |
TVector< TVectorBase > | operator| (const ComponentType b) const |
Performs a binary "Or" of all components with an integer. | |
TVector< TVectorBase > | operator^ (const ComponentType b) const |
Performs a binary "Xor" of all components with an integer. | |
TVector< TVectorBase > & | operator&= (const ComponentType b) |
Performs a binary "And" of all components with an integer. | |
TVector< TVectorBase > & | operator|= (const ComponentType b) |
Performs a binary "Or" of all components with an integer. | |
TVector< TVectorBase > & | operator^= (const ComponentType b) |
Performs a binary "Xor" of all components with an integer. | |
TVector< TVectorBase > | operator>> (const int b) const |
Performs a binary right shift ">>" on each vector component. | |
TVector< TVectorBase > | operator<< (const int b) const |
Performs a binary left shift "<<" on each vector component. | |
TVector< TVectorBase > & | operator>>= (const int b) |
Performs a binary right shift unary ">>=" on each vector component. | |
TVector< TVectorBase > & | operator<<= (const int b) |
Performs a binary left shift unary "<<=" on each vector component. | |
TVector< TVectorBase > | operator- () const |
Performs an unary "-" on each vector component. | |
ComponentType | operator[] (const size_t i) const |
Constant indexing operator permits read access to array[0], ..., array[NumberOfDimensions-1] via indexes 0,1, ..., NumberOfDimensions-1, respectively. | |
ComponentType & | operator[] (const size_t i) |
Indexing operator permits read and write access to array[0], ..., array[NumberOfDimensions-1] via indexes 0,1, ..., NumberOfDimensions-1, respectively. | |
MLint | getMaxIdx () const |
Searches the maximum component and returns the index of its first occurrence. | |
ComponentType | getMax () const |
Returns the maximum component value. | |
MLint | getMinIdx () const |
Searches the minimum component and returns the index of its first occurrence. | |
ComponentType | getMin () const |
Returns the minimum component value. | |
TVector< TVectorBase > | getStrides (const ComponentType offset=1) const |
Interprets the vector as image extension and returns a stride vector. | |
TVector< TVectorBase > | getVectorPosition (ComponentType offsetPos) const |
Interprets the vector as a stride vector of an image and returns the offset position offsetPos from the image origin to the coordinate specified by the vector. | |
MLint | getExtDimension () const |
Returns the index to the highest vector component which is not 1 which is useful to get the real dimensional extent of an image. | |
bool | hasNegativeComp () const |
Returns whether any component is negative. | |
bool | allBiggerZero () const |
Returns whether all components > 0. | |
bool | sanityCheckNumberOfVoxels () const |
Returns whether product of all components is in range of integer type. | |
TVector< TVectorBase > | divCeil (const TVector< TVectorBase > &b) const |
Returns the component wise division of the vector this by vector b with rounding up. | |
TVector< TVectorBase > | compMin (const TVector< TVectorBase > &b) const |
Returns the component wise minimum of components of this and b. | |
TVector< TVectorBase > | compMax (const TVector< TVectorBase > &b) const |
Returns the component wise maximum of components of this and b. | |
TVector< TVectorBase > | compMod (const TVector< TVectorBase > &b) const |
Returns the rest of the division of this by b component wise. | |
TVector< TVectorBase > | compAbs () const |
Returns a vector with all components of this replaced by their absolute values. | |
ComponentType | compMul () const |
Returns the product of all components. There is no check for integer overflow. | |
ComponentType | compSum () const |
Returns the sum of all components. There is no check for integer overflow. | |
ComponentType | dot (const TVector< TVectorBase > &b) const |
Returns the scalar product of vectors this and b. There is no check for integer overflow. | |
void | fillSmallerComps (const ComponentType threshold=0, const ComponentType fillVal=0) |
Sets the components which are smaller than threshold to fillVal. | |
void | fillGreaterComps (const ComponentType threshold=0, const ComponentType fillVal=0) |
Sets the components which are greater than threshold to fillVal. | |
void | fillEqualComps (const ComponentType threshold=0, const ComponentType fillVal=0) |
Sets the components which are equal to threshold to fillVal. | |
Static Public Member Functions | |
Properties of an image of the ML. | |
static MLint | dim () |
Returns the dimension the ML calculates with. | |
Static Public Member Functions inherited from ml::TVector< TVectorBase > | |
static TVector< TVectorBase > | divCeil (const TVector< TVectorBase > &a, const TVector< TVectorBase > &b) |
Static version: Returns the component wise division of the vector a by vector b with rounding up. | |
static TVector< TVectorBase > | compMin (const TVector< TVectorBase > &a, const TVector< TVectorBase > &b) |
Static version: Returns the component wise minimum of vectors a and b. | |
static TVector< TVectorBase > | compMax (const TVector< TVectorBase > &a, const TVector< TVectorBase > &b) |
Static version: Returns the component wise maximum of vectors a and b. | |
static TVector< TVectorBase > | compMod (const TVector< TVectorBase > &a, const TVector< TVectorBase > &b) |
Static version: Returns the rest dividing vector a by b component wise. | |
static TVector< TVectorBase > | compAbs (const TVector< TVectorBase > &a) |
Static version: Returns a vector with all components of a replaced by their absolute values. | |
static ComponentType | compMul (const TVector< TVectorBase > &a) |
Static version: Returns the product of all components without check for integer overflow. | |
static ComponentType | compSum (const TVector< TVectorBase > &a) |
Static version: Returns the sum of all components without check for integer overflow. | |
static ComponentType | dot (const TVector< TVectorBase > &a, const TVector< TVectorBase > &b) |
Static version: Returns the scalar product of vectors a and b without check for integer overflow. | |
ImageVector is the 6D TVector specialization used by the ML for all image indexing.
It uses MLint as default for CompIntType and TVector6DBase<CompIntType> as container type for specialized access to array member with x,y,z,c,t, and u.
In contrast to the base class TVector the members are specialized to MLMaxImageDimension dimensions to implement dedicated functionality for ML images. This class can also be instantiated with arguments or other CompIntType arguments to compile with an arbitrary integer base type.
Example for vector initialization:
Notes:
Definition at line 135 of file mlImageVector.h.
typedef ParentClass::ComponentType ml::TImageVector< CompIntType >::ComponentType |
Integer type used by this vector.
Definition at line 142 of file mlImageVector.h.
typedef TVector<TVector6DBase<CompIntType> > ml::TImageVector< CompIntType >::ParentClass |
Parent class of this class.
Definition at line 139 of file mlImageVector.h.
|
inline |
Constructor. All components are initialized to 0.
Definition at line 154 of file mlImageVector.h.
|
inline |
Copy constructor from Base class.
This allows the usage of the ParentClass objects of the same ComponentType in operators using the TImageVector.
Definition at line 158 of file mlImageVector.h.
|
inlineexplicit |
Constructor which initializes all components to i.
Definition at line 161 of file mlImageVector.h.
|
inlineexplicit |
Copy constructor from another TVector of same or other integer type, values are cast.
Only valid elements are copied if vectors have different lengths.
Definition at line 166 of file mlImageVector.h.
|
inline |
Constructor which assigns X to x and copies other elements from p.
Definition at line 169 of file mlImageVector.h.
|
inline |
Constructor which initializes the vector components by copying them from arr[0] ,..., arr[num-1].
All other elements are initialized to the value deflt. arr must have at least num elements.
Definition at line 180 of file mlImageVector.h.
|
inline |
Constructor which initializes all components with the values x, y, z, c, t and u.
Definition at line 185 of file mlImageVector.h.
References mlrange_cast().
|
inlineexplicit |
Copies the six double components of v6 into x, ..., u, respectively.
A simple cast is performed to convert the doubles to the ComponentType type.
Definition at line 198 of file mlImageVector.h.
References mlrange_cast().
|
inlinestatic |
Returns the dimension the ML calculates with.
Definition at line 149 of file mlImageVector.h.
References ml::MLMaxImageDimension.
Referenced by ml::ITKIndexFromMLVector(), ml::ITKSizeFromMLVector(), ml::MLVectorFromITKIndex(), and ml::MLVectorFromITKSize().
|
inline |
Returns the subset of those Vector components whose corresponding pointers are not NULL.
Definition at line 221 of file mlImageVector.h.
References mlrange_cast().
|
inline |
Coordinate incrementation/iterator function inside ext.
Increments x by 1 until it overflows in x (limited by ext). On overflow x is set to 0 and y is incremented by 1 etc. If *this == ext is reached after incrementation then the vector is reset to (0,0,0,0,0,0) and true is returned, otherwise false. Note: Function works sensible only if *this is inside [(0,0,0,0,0,0), (ext.x, ... ,ext.u)[ and if &ext if != this.
Definition at line 239 of file mlImageVector.h.
References mlrange_cast().
|
inline |
Sets all components to v or - if v is not specified - to 0.
Definition at line 172 of file mlImageVector.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImageBox< intT >::makeEmpty(), and ml::MLKernelToolsApplyFiltering().
|
inline |
Sets vector to (vx, vy, vz, vc, vt, vu). Not passed components are set to 0.
Definition at line 209 of file mlImageVector.h.
References mlrange_cast().
|
inline |
Like assignment operator.
Definition at line 175 of file mlImageVector.h.
|
inline |
Returns the x,y,z components as Vector3.
Definition at line 275 of file mlImageVector.h.
|
inline |
Returns the vector contents as Vector6.
Definition at line 264 of file mlImageVector.h.