13#ifndef ML_IMAGE_VECTOR_H
14#define ML_IMAGE_VECTOR_H
38 template <
typename CompIntType>
134 template <
typename CompIntType=ML
int>
165 template <
typename T2IntType>
224 if (xp){ *xp = ParentClass::x; }
225 if (yp){ *yp = ParentClass::y; }
226 if (zp){ *zp = ParentClass::z; }
227 if (cp){ *cp = ParentClass::c; }
228 if (tp){ *tp = ParentClass::t; }
229 if (up){ *up = ParentClass::u; }
242 if (ParentClass::x >= ext.
x){
243 ParentClass::x = 0; ParentClass::y++;
244 if (ParentClass::y >= ext.
y){
245 ParentClass::y = 0; ParentClass::z++;
246 if (ParentClass::z >= ext.
z){
247 ParentClass::z = 0; ParentClass::c++;
248 if (ParentClass::c >= ext.
c){
249 ParentClass::c = 0; ParentClass::t++;
250 if (ParentClass::t >= ext.
t){
251 ParentClass::t = 0; ParentClass::u++;
252 if (ParentClass::u >= ext.
u){
253 ParentClass::u = 0;
return true;
266 return Vector6(
static_cast<double>(ParentClass::x),
267 static_cast<double>(ParentClass::y),
268 static_cast<double>(ParentClass::z),
269 static_cast<double>(ParentClass::c),
270 static_cast<double>(ParentClass::t),
271 static_cast<double>(ParentClass::u));
277 return Vector3(
static_cast<double>(ParentClass::x),
278 static_cast<double>(ParentClass::y),
279 static_cast<double>(ParentClass::z));
static MLint dim()
Returns the dimension the ML calculates with.
bool iterate(const TImageVector< ComponentType > &ext)
TImageVector(const ComponentType xp, const ComponentType yp, const ComponentType zp, const ComponentType cp, const ComponentType tp, const ComponentType up)
Constructor that initializes all components with the values x, y, z, c, t and u.
void set(const ParentClass &v)
Like assignment operator.
ParentClass::ComponentType ComponentType
TImageVector(const TImageVector< T2IntType > &v2)
void set(const ComponentType v=0)
Sets all components to v or - if v is not specified - to 0.
TImageVector(const Vector6 &v6)
TVector< TVector6DBase< intT > > ParentClass
TImageVector(const ComponentType i)
Constructor that initializes all components to i.
TImageVector()
Constructor. All components are initialized to 0.
Vector3 toVector3() const
Returns the x, y, z components as Vector3.
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.
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). Components not passed are set to 0.
TImageVector(const ParentClass &v)
TImageVector(const ComponentType xp, const TImageVector< ComponentType > &p)
Constructor that assigns X to x and copies other elements from p.
Vector6 toVector6() const
Returns the vector contents as Vector6.
TImageVector(const MLint num, const ComponentType *const arr, const ComponentType deflt)
ComponentType c
Color component of the vector.
ComponentType t
Time component of the vector.
ComponentType array[NumberOfDimensions]
ComponentType u
Unit/Modality/User component of the vector.
ComponentType z
Z component of the vector.
ComponentType x
X component of the vector.
CompIntType ComponentType
Integer type used by this vector.
ComponentType y
Y component of the vector.
void set(const ComponentType v=0)
Sets all components to v or - if v is not specified - to 0.
TVectorBase::ComponentType ComponentType
Integer type used by this vector.
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Tvec6< MLdouble > Vector6
A vector with six components of type double.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.